# Qwen3.5-0.8B NPU ![Alt text](https://github.com/user-attachments/assets/6d297a34-c516-4cb1-be4a-bca471d40fa6)

**User**:\Describe the image.

**Answer**: This is a surreal, cinematic-style photograph taken from an astronaut’s perspective on the Moon. The scene captures a moment of quiet contemplation or perhaps a lighthearted celebration — possibly a beer toast — set against the vastness of space and Earth. **Foreground:** A person in a white, quilted astronaut suit with a fur-lined hood is seated on the lunar surface. They are holding a green glass bottle (likely beer) in one hand and resting their other arm on a small, dark green cooler or box labeled “Beer” — suggesting they’re enjoying a drink while relaxing. The texture of the suit shows stitching details, emphasizing realism despite the cosmic backdrop. **Midground:** The lunar regolith is gray and dusty, dotted with rocks and debris. To the right, a metal ladder leans against the ground, hinting at human presence or exploration history. In the distance, faint outlines of buildings suggest Earth looms behind them — its blue oceans and green land visible through the atmosphere’s haze. **Background:** The sky is filled with stars and swirling nebulae, creating a dreamlike, starry expanse. The curvature of Earth dominates the horizon, appearing as a large, glowing orb against the dark cosmos. Its surface shows continents and clouds, adding depth and scale to the image. **Lighting & Atmosphere:** The lighting is dramatic — strong highlights on the astronaut’s suit and bottle contrast with deep shadows in the cratered terrain. The overall mood is serene yet slightly melancholic, blending human presence with alien isolation. There’s a sense of solitude and wonder, as if humanity has finally found peace beyond Earth. **Style:** The image has a high-contrast, saturated look — reminiscent of digital art or post-processing — giving it a polished, almost staged feel. It evokes themes of exploration, friendship, and the beauty of space travel. In short: This is not just an astronaut on the Moon — it’s a moment frozen in time, filled with emotion, isolation, and the quiet magic of being alone in the universe. ------------ ## Qwen3.5-0.8B VLM for RK3588 NPU (Rock 5, Orange Pi 5).
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

Paper: [Qwen3 Technical Report](https://arxiv.org/pdf/2505.09388)

------------ ## Introduction LLMs (Large Language Models) are neural networks trained on large text datasets to understand and generate language.
VLMs (Vision-Language Models) add a visual encoder so the model can process images and text together.
A combined VLM+LLM system is often referred to as a multimodal model. These models can be large—hundreds of millions to billions of parameters—which impacts accuracy, memory use, and runtime speed.
On edge devices like the RK3588, available RAM and compute are limited, and even the NPU has strict constraints on supported operations.
Because of this, models typically need to be quantised or simplified to fit. Performance is usually expressed in tokens (words) per second.
Once converted to RKNN, parts of the model can run on the NPU, improving speed.
Despite these limits, models like Qwen3-2B run well on the RK3588 because the NPU efficiently accelerates the heavy math, and the vision encoder can be optimised. This makes advanced multimodal AI feasible on small, power-efficient devices. ------------ ## Model performance benchmark (FPS) All models, with C++ examples, can be found on the Q-engineering GitHub.

All LLM models are quantized to **w8a8**, while the VLM vision encoders use **fp16**.
| model | RAM (GB)1 | llm cold sec2 | llm warm sec3 | vlm cold sec2 | vlm warm sec3 | Resolution | Tokens/s | | --------------| :--: | :-----: | :-----: | :--------: | :-----: | :--------: | :--------: | | [Qwen3.5-9B](https://github.com/Qengineering/Qwen3.5-9B-NPU) | 9.2 | 97.1 | 97.1 | 11.5 | 11.5 | 448 x 448 | 3.2 | | [Qwen3.5-4B](https://github.com/Qengineering/Qwen3.5-4B-NPU) | 5.4 | 52.8 | 6.2 | 8.5 | 0.9 | 448 x 448 | 5.2 | | [Qwen3.5-2B](https://github.com/Qengineering/Qwen3.5-2B-NPU) | 2.9 | 23.9 | 3.2 | 8.5 | 0.8 | 448 x 448 | 11.0 | | [Qwen3.5-0.8B](https://github.com/Qengineering/Qwen3.5-0.8B-NPU) | 1.3 | 10.6 | 1.9 | 2.7 | 0.2 | 448 x 448 | 21.6 | | [Qwen3-2B](https://github.com/Qengineering/Qwen3-VL-2B-NPU) | 3.1 | 21.9 | 2.6 | 10.0 | 0.9 | 448 x 448 | 11.5 | | [Qwen3-4B](https://github.com/Qengineering/Qwen3-VL-4B-NPU) | 8.7 | 49.6 | 5.6 | 10.6 | 1.1 | 448 x 448 | 5.7 | | [InternVL3.5-1B](https://github.com/Qengineering/InternVL3.5-1B-NPU) | 1.9 | 8.3 | 8.0 | 1.5 | 0.8 | 448 x 448 | 24 | | [InternVL3.5-2B](https://github.com/Qengineering/InternVL3.5-2B-NPU) | 3.0 | 22 | 8.0 | 2.7 | 0.8 | 448 x 448 | 11.2 | | [InternVL3.5-4B](https://github.com/Qengineering/InternVL3.5-4B-NPU) | 5.4 | 50 | 8.0 | 5.9 | 0.8 | 448 x 448 | 5 | | [InternVL3.5-8B](https://github.com/Qengineering/InternVL3.5-8B-NPU) | 8.8 | 92 | 8.0 | 50.5 | 5.8 | 448 x 448 | 3.5 | | [Qwen2.5-3B](https://github.com/Qengineering/Qwen2.5-VL-3B-NPU) | 4.8 | 48.3 | 4.0 | 17.9 | 1.8 | 392 x 392 | 7.0 | | [Qwen2-7B](https://github.com/Qengineering/Qwen2-VL-7B-NPU) | 8.7 | 86.6 | 34.5 | 37.1 | 20.7 | 392 x 392 | 3.7 | | [Qwen2-2.2B](https://github.com/Qengineering/Qwen2-VL-2B-NPU) | 3.3 | 29.1 | 2.5 | 17.1 | 1.7 | 392 x 392 | 12.5 | | [InternVL3-1B](https://github.com/Qengineering/InternVL3-NPU) | 1.3 | 6.8 | 1.1 | 7.8 | 0.75 | 448 x 448 | 30 | | [SmolVLM2-2.2B](https://github.com/Qengineering/SmolVLM2-2B-NPU) | 3.4 | 21.2 | 2.6 | 10.5 | 0.9 | 384 x 384 | 11 | | [SmolVLM2-500M](https://github.com/Qengineering/SmolVLM2-500M-NPU) | 0.8 | 4.8 | 0.7 | 2.5 | 0.25 | 384 x 384 | 31 | | [SmolVLM2-256M](https://github.com/Qengineering/SmolVLM2-256M-NPU) | 0.5 | 1.1 | 0.4 | 2.5 | 0.25 | 384 x 384 | 54 | 1 The total used memory; LLM plus the VLM.
2 When an llm/vlm model is loaded for the first time from your disk to RAM or NPU, it is called a cold start.
The duration depends on your OS, I/O transfer rate, and memory mapping.
3 Subsequent loading (warm start) takes advantage of the already mapped data in RAM. Mostly, only a few pointers need to be restored.

Plot_Tokens
PlotMemory ------------ ## Dependencies. To run the application, you have to: - OpenCV 64-bit installed. - rkllm library. - rknn library. - Optional: Code::Blocks. (```$ sudo apt-get install codeblocks```) ### Installing the dependencies. Start with the usual ``` $ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install cmake wget curl ``` #### OpenCV To install OpenCV on your SBC, follow the Raspberry Pi 4 [guide](https://qengineering.eu/install-opencv-on-raspberry-64-os.html).

Or, when you have no intentions to program code: ``` $ sudo apt-get install libopencv-dev ``` ------------ ## Installing the app. ``` $ git clone https://github.com/Qengineering/Qwen3-VL-2B-NPU ``` #### RKLLM, RKNN To run InternVL3, you need to have the **rkllm-runtime** library version **1.3.0** installed, as well as the **rknpu driver** version **0.9.8**.
If you don't have these on your machine, or if you have a lower version, you need to install them.
We have provided the correct versions in the repo.
```bash $ cd ./Qwen3-VL-2B-NPU/aarch64/library $ sudo cp ./*.so /usr/local/lib $ cd ../include $ sudo cp ./*.h /usr/local/include ``` Your rkllm model must match the library.

RK_OK2

If you use a model synthesized with the previous 1.2.3 rkllm library and run it with the latest 1.3.0, you will get a malfunction. The internal Byte-Pair Encoding (BPE) dictionary parsing gets misaligned.

RK_ERROR2
### Download the LLM and VLM model. The next step is downloading the models.
Both can be downloaded from our [Hugging Face page](https://huggingface.co/Qengineering/Qwen3.5-0.8B-rk3588).
- qwen3.5-0.8b_w8a8_rk3588.rkllm - qwen3.5-0.8b-vision_rk3588.rknn Copy both into this folder. ## Building the app. Once you have the two models, it is time to build your application.
You can use **Code::Blocks**. - Load the project file *.cbp in Code::Blocks. - Select _Release_, not Debug. - Compile and run with F9. - You can alter command line arguments with _Project -> Set programs arguments..._ Or use **Cmake**. ``` $ mkdir build $ cd build $ cmake .. $ make -j4 ``` ## Running the app The application switches dynamically between Single Image Mode and Video Sequence Mode based on how many image files you pass into the arguments. ```bash ./VLM_VIDEO_NPU RKNN_model RKLLM_model file1.jpg [file2.jpg file3.jpg ...] ``` | Argument | Comment | | --- | --- | | RKNN_model | The visual encoder model (VLM) compiled for the NPU. | | RKLLM_model | The large language model (LLM) compiled for the NPU. | | file1.jpg ... | The images you want to process.
Passing 1 file triggers **Image Mode**.
Passing multiple files triggers **Video Sequence Mode**. | In the context of the Rockchip RK3588 LLM (Large Language Model) library, `NewTokens` and `ContextLength` control the boundaries for text generation and memory allocation.

In `main.cpp` you will find the line:
```cpp RKLLM.LoadModel(vlm_model, llm_model, NewTokens, ContextLength); ``` Here you set you context based on available memory.

**NewTokens** This sets the maximum number of tokens (pieces of text, typically sub-word units) that the model is allowed to generate in response to a prompt during a single inference round. For example, if set to 300, the model will not return more than 300 tokens as output, regardless of the prompt length. It is important for controlling generation length to avoid run-on responses and manage resource use.

**ContextLength (Dynamic KV Cache)** This specifies the maximum total number of tokens the model can hold in its memory at once, which includes the system prompt, the massive image/video embeddings, your text questions, and all previous generated answers.
We have synthesized the models with a larger KV Cache than normally. Ours can hold up to **16384** tokens! * **For 32GB Boards (e.g., Rock 5C 32GB):** You can safely push the KV Cache to `8192` or `16384` to support processing long video sequences and maintaining deep, multi-turn conversations without the model forgetting the image. `RKLLM.LoadModel(vlm_model, llm_model, 2048, 16384);` * **For 8GB/16GB Boards:** The KV cache is highly memory-intensive. You should keep this at `2048` or `4096`. If you set this higher than your physical RAM can handle, the Linux Out-Of-Memory (OOM) killer will crash the application. `RKLLM.LoadModel(vlm_model, llm_model, 2048, 4096);` **Typical Command Line Examples:** Single Image Mode: ```bash ./VLM_VIDEO_NPU ./models/qwen3.5-0.8b-vision_rk3588.rknn ./models/qwen3.5-0.8b_w8a8_rk3588.rkllm ./frame1.jpg ``` Video Sequence Mode (Passing multiple frames): ```bash ./VLM_VIDEO_NPU ./models/qwen3.5-0.8b-vision_rk3588.rknn ./models/qwen3.5-0.8b_w8a8_rk3588.rkllm ./frame1.jpg ./frame2.jpg ./frame3.jpg ``` ##### ❗Showstopper❗ To process video input, individual frames are first extracted. The VLM converts each frame into embeddings, which are then transformed into vision tokens.
Even on a desktop PC, this process places a heavy load on memory and CUDA resources. It’s therefore no surprise that the Rock 5C, with its more limited hardware, struggles even more.
Each vision token corresponds to about 200 tokens, strongly limiting the number of frames processed per video. Therefore, the video is subsampled, and evenly spaced frames are extracted for processing by Qwen3.5.
For reference, each vision token occupies around 20 MB of RAM — a detail worth keeping in mind when working on systems with limited memory.
Keep also in mind that after loading the models, each frame has to be tokenised, which takes about 0.9 seconds per frame. ## Using the app Using the application is simple. Once you provide the model and the media files, you can ask anything you want.
Remember, we are on a bare Rock 5C, so don't expect the same speed or quality as massive server-grade models like ChatGPT. On the other hand, as you will see in the examples below, the app performs amazingly well on the edge! **Interacting with Media:** * If you passed a **single image** and want to talk about it, you must include the `` tag in your prompt. (e.g., `"Describe this in detail."`) * If you passed **multiple images (video sequence)**, you must use the `