Skip to content

Edge Deployment of the Qwen3 Series

Introduction

Qwen3 is the latest generation of the Qwen series of large language models, providing a complete suite of dense models and Mixture-of-Experts (MoE) models. Built on large-scale training, Qwen3 achieves breakthrough progress in reasoning, instruction following, agent capabilities, and multilingual support.

This chapter demonstrates how to complete the deployment, loading, and conversation process of the Qwen3 series models on edge devices. The following two deployment methods are provided:

  • AidGen C++ API
  • AidGenSE OpenAI API

In this case, the large language model inference runs on the device side, and the relevant interfaces are called through code to receive user input and return conversation results in real time.

  • Device: IQ9075
  • System: Ubuntu 24.04
  • Model: Qwen3-1.7B

Supported Platforms

PlatformRunning Method
IQ9075Ubuntu 24.04

Prerequisites

  1. IQ9075 hardware

  2. Ubuntu 24.04 system

System Dependency Configuration

Configure the AidLux Repository

bash
# Download the correct public key
sudo wget -O- https://archive.aidlux.com/ubuntu24/public.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/private-aidlux.gpg > /dev/null

# Edit the source file
sudo vim /etc/apt/sources.list.d/private-aidlux.list

# Add the private key provided by AidLux to the source file
deb [arch=arm64 signed-by=/etc/apt/trusted.gpg.d/private-aidlux.gpg] https://archive.aidlux.com/ubuntu24 noble main

# Update the cache
sudo apt update

After the update, you can obtain the official AidLux SDK dependencies with the following command:

bash
sudo apt list | grep aid | grep unknown
bash
# Install software
# Must be installed first; not included with the system
sudo apt install python3 python3-pip libopencv-dev python3-opencv  net-tools
# Required before installing aidlite
sudo apt install aidlux-aistack-base aidrtcm

# Install aidlite and its dependencies
sudo apt install aid-lms aidlms-sdk aidlite-sdk cmake
sudo apt-get install libfmt-dev nlohmann-json3-dev
sudo apt install aidlite-*

# Enable DSP support
sudo apt-get install qcom-fastrpc1
sudo apt-get install qcom-fastrpc-dev

# Install the aidgen SDK
sudo apt install aidgen-sdk
sudo apt install aidgen-qnn*

# Install the mms service
sudo apt install aid-mms

# Enable GPU support
sudo apt-add-repository -s ppa:ubuntu-qcom-iot/qcom-ppa
sudo apt install qcom-adreno-cl1
sudo ln -s /usr/lib/aarch64-linux-gnu/libOpenCL.so.1 /usr/lib/aarch64-linux-gnu/libOpenCL.so

After installation, check that the aidlite and aidgen directories have been added under /usr/local/share.

Device Authorization

Obtain the Device SN Code

bash
cat  /sys/devices/soc0/serial_number

Obtain the License File

Provide the SN code to the Aplux technical staff to generate a device-specific License file, and place it under /etc/opt/aidlux/license/AidLuxLics.

Activate Authorization

bash
sudo /opt/aidlux/cpf/aid-lms/manager.sh restart

AidGen Case Deployment

Step 1: Copy the AidGen SDK Code Examples

bash
# Copy the test code
cd /home/ubuntu/aidllm

cp -r /usr/local/share/aidgen/examples/ ./

Step 2: Download Model Resources

Since Qwen3-1.7B is currently in the Model Farm preview section, it must be retrieved via the mms command.

Using mms requires logging in with a Model Farm account. Please visit Model Farm account registration

bash
# Log in
mms login

# Search for the model
mms list qwen3

# Download the model
mms get -m Qwen3-1.7B -p w4a16 -c qcs9075 -b qnn2.36 -d /home/ubuntu/aidllm/

cd /home/ubuntu/aidllm/
unzip qnn236_qcs9075_cl4096.zip

Step 3: Confirm Resource Files

The file distribution is as follows:

bash
/home/ubuntu/aidllm/qnn236_qcs9075_cl4096
├── tokenizer.json
├── qwen3-1.7b_qnn236_qcs9075_cl4096_3_of_3.serialized.bin
├── qwen3-1.7b_qnn236_qcs9075_cl4096_2_of_3.serialized.bin
├── qwen3-1.7b_qnn236_qcs9075_cl4096_1_of_3.serialized.bin
├── qwen3-1.7b-tokenizer.json
├── qwen3-1.7b-htp.json
├── prompt.conf
├── htp_backend_ext_config.json
├── config_linux.json
├── chat-think.txt
├── chat-nothink.txt
├── aidgen_config.json
├── prefix-kvcache

Step 4: Compile and Run

bash
cd /home/ubuntu/aidllm/examples

# Compile
mkdir build && cd build
cmake .. && make

cp test_t2t ../../qnn236_qcs9075_cl4096

cd /home/ubuntu/aidllm/qnn236_qcs9075_cl4096
./test_t2t aidgen_config.json 'Introduce large language models' qnn240
  • After the model runs successfully, the following log output is displayed:
bash
---

### **Summary**
Large language models are an important breakthrough in natural language processing. They not only enhance language understanding capabilities but also drive the application of AI in many fields. Despite their limitations, with the development of technology, LLMs will play a role in more scenarios and become a bridge connecting humans and AI.<|im_end|>[EOS]

--- Turn 1 Performance (Generator::get_profiler) ---
  Init Time (us):           3780139
  Prompt Token Count:       33
  Time-to-First-Token (us): 60278
  Prompt TPS (tok/s):       2123.49
  Generated Token Count:    1040
  Generate Time (us):       25410621
  Generate TPS (tok/s):     40.9278

============================================================