Qwen3-Embedding-0.6B on AX8860 (llama.cpp + ggml-axera, 2026-10-31)
在爱芯 AX8860 的 NPU(4 核)上用 llama.cpp 运行 Qwen3-Embedding-0.6B(文本向量,1024 维)。 Qwen3-Embedding-0.6B (text embeddings, 1024 dims) on the 4-core NPU of the Axera AX8860, with llama.cpp.
文件 / Files
| 文件 / File | 说明 / Description |
|---|---|
qwen3-emb-0.6b-bf16.gguf | 模型权重(GGUF BF16,1.1 GB,md5 896a1a1dd90d26cb1800c0e1c7bbe12c)/ weights |
bin/ | llama.cpp 板端程序 llama-embedding、llama-server(静态链接,只依赖系统 /opt/lib 与 libc)/ the board programs (static; need only the system /opt/lib and libc) |
kernels/ | NPU kernel:整个模型一个(28 层在 kernel 内循环)+ manifest.json / one kernel for the whole model + manifest.json |
run.sh | 运行脚本 / run script |
权重只来自 GGUF:kernel 不含权重,加载时从 GGUF 转成 MXFP8。 The weights come only from the GGUF: the kernel holds none; they are converted to MXFP8 at load.
运行 / Run
环境 / Requirements:AX8860,SDK V0.5.0 或更新(cat /proc/ax_proc/version)/ SDK V0.5.0 or newer.
./run.sh "今天天气很好" # 一条文本的向量(JSON,已归一化)/ one text (JSON, normalized)
./run.sh -f texts.txt # 每行一条 / one embedding per line
./run.sh -s 8080 # OpenAI 兼容服务 / OpenAI-compatible server
curl http://<board>:8080/v1/embeddings -H 'Content-Type: application/json' -d '{"input":"今天天气很好"}'
直接调用程序时设置 / When calling the programs directly: LD_LIBRARY_PATH=/opt/lib GGML_AXERA_KERNEL_DIR=<repo>/kernels,
-ngl 99,-c 最大 4096;服务端 --embedding --pooling last -np 1。检索时 query 按模型卡加指令前缀
(Instruct: <task>\nQuery: <query>) / for retrieval, prefix queries as the model card says.
性能 / Performance
AX8860,SDK V0.5.1,NPU 4 核 / 4 cores:
| 项 / Item | 结果 / Result |
|---|---|
| 服务模式单条 query(9 token)/ one query on the server | 22 ms |
| 服务模式单条 229 token / one 229-token text on the server | 36 ms |
| 884 token(2 条)/ 884 tokens (2 texts) | 69 ms |
正确性 / Correctness
与上一版 NPU 实现(已验证与 CPU 检索结果一致)的向量余弦 0.9991–0.9997。 Cosine 0.9991-0.9997 to the vectors of the previous NPU implementation (whose retrieval results matched the CPU's).
已知限制 / Known limits
- 运行时独占 NPU 4 核 / takes all 4 NPU cores; do not run other NPU programs alongside.
- 上下文最大 4096 token / context up to 4096 tokens.
源码 / Sources
- llama.cpp:ZHEQIUSHUI/llama.cpp
axera-dev@6613735ce(ggml/src/ggml-axera/models/qwen3)
更新 / Changelog
- 2026-11-24:更新板端 bin(llama.cpp
6613735ce);未设置GGML_AXERA_KERNEL_DIR时直接报错退出;kernels 与 GGUF 不变 / new board binaries (llama.cpp6613735ce): exits with an error whenGGML_AXERA_KERNEL_DIRis not set; kernels and GGUF unchanged - 2026-11-09:更新板端 bin(llama.cpp
2f81e2416);kernels 与 GGUF 不变 / new board binaries; kernels and GGUF unchanged.