Skip to content

Edge Deployment of the Qwen3 Series

Introduction

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

This chapter demonstrates how to complete the deployment, loading, and conversation process of Qwen3 series models on an edge device. Two deployment methods are provided:

  • AidGen C++ API
  • AidGenSE OpenAI API

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

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

Supported Platforms

PlatformExecution Method
IQ8275Ubuntu 24.04

Prerequisites

  1. IQ8275 hardware

  2. Ubuntu 24.04 system

System Dependency Configuration

Configure the AidLux Package Source

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 list file
sudo vim /etc/apt/sources.list.d/private-aidlux.list

# Add the repository 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 package cache
sudo apt update

After the update is complete, you can use the following command to list the SDK dependencies officially provided by AidLux:

bash
sudo apt list | grep aid | grep unknown
bash
# Install software
# Must be installed first because they are not included in the system by default
sudo apt install python3 python3-pip libopencv-dev python3-opencv  net-tools
# Must be installed before 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 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 the installation is complete, check that the aidlite and aidgen directories have been added under /usr/local/share.

Device Authorization

Get the Device SN

bash
cat  /sys/devices/soc0/serial_number

Get the License File

Provide the SN to APLUX technical support so that they can generate the device-specific license file. Place the generated file under /etc/opt/aidlux/license/AidLuxLics.

Activate the License

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

AidGen Case Deployment

Step 1: Copy the AidGen SDK Code Example

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

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

Step 2: Download the 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 a Model Farm account. Please visit Model Farm account registration

bash
# Login
mms login

# Search for the model
mms list qwen3

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

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

Step 3: Confirm the Resource Files

The files are distributed as follows:

bash
/home/ubuntu/aidllm/qnn236_qcs8275_cl4096
├── tokenizer.json
├── qwen3-1.7b_qnn236_qcs8275_cl4096_3_of_3.serialized.bin
├── qwen3-1.7b_qnn236_qcs8275_cl4096_2_of_3.serialized.bin
├── qwen3-1.7b_qnn236_qcs8275_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_qcs8275_cl4096

cd /home/ubuntu/aidllm/qnn236_qcs8275_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):           5072980
  Prompt Token Count:       33
  Time-to-First-Token (us): 62129
  Prompt TPS (tok/s):       2060.23
  Generated Token Count:    1040
  Generate Time (us):       29451394
  Generate TPS (tok/s):     35.3124

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