Skip to main content
You can run a wide range of Large Language Models (LLMs) and Vision Language Models (VLMs) on your Dragonwing development boards using llama.cpp. Models running under llama.cpp run on the GPU, not on the NPU. You can run a subset of models on the NPU via GENIE.

Building llama.cpp

You’ll need to build some dependencies for llama.cpp. Open the terminal on your development board, or an ssh session to your development board, and run:
1

Install build dependencies

2

Install the OpenCL headers and ICD loader library

3

Build llama.cpp with the OpenCL backend

4

Add the llama.cpp paths to your PATH

5

Verify llama.cpp is installed

Downloading and quantizing a model

To run GPU-accelerated models you’ll want pure 4-bit quantized (Q4_0) models in GGUF format (the llama.cpp format, conversion guide). You can either find pre-quantized models, or quantize a model yourself using llama-quantize. For example, for Qwen2-1.5B-Instruct:

Running your first LLM using llama-cli

You’re now ready to run the LLM via llama-cli. It’ll automatically offload layers to the GPU:
🚀 You now have an LLM running on the GPU of your device!

Serving LLMs using llama-server

Next, you can use llama-server to start a web server with a chat interface, and an OpenAI compatible chat completions API.
1

Find the IP address of your development board

2

Start the server

3

Open the chat interface in a browser

On your computer, open a web browser and navigate to http://192.168.1.253:9876 (replace the IP address with the one you found in step 1):

Serving LLMs using llama-server

4

Access the server programmatically via the OpenAI Chat Completions API

For example, from Python:
1

Create a new venv and install requests

2

Create a new file chat.py

3

Run chat.py

Serving multi-modal LLMs

You can also use multi-modal LLMs. For example SmolVLM-500M-Instruct-GGUF. Download both the Q4_0 quantized weights (or quantize them yourself), and download the CLIP encoder mmproj-*.gguf file. For example:

Serving multi-modal LLMs using llama-server

CLIP model is still fp16: The mmproj model is still fp16; and thus processing images will be slow. There is code to quantize the CLIP encoder in older versions of llama.cpp, that you can explore.

Tips & tricks

Comparing CPU performance

Add -ngl 0 to the llama-* commands to skip offloading layers to the GPU. Models will run on CPU, and you can compare performance to that of the GPU. For example, the Qwen2-1.5B-Instruct Q4_0: GPU:
CPU:
Here the CPU evaluates tokens about twice as fast as the GPU.