Qwen3-Embedding-8B on AX8860 (llama.cpp + ggml-axera, 2026-11-15)
在爱芯 AX8860 的 4 核 NPU 上运行 Qwen3-Embedding-8B(36 层、hidden 4096、4096 维文本向量)。 Qwen3-Embedding-8B text embeddings on the four-core AX8860 NPU with llama.cpp.
文件 / Files
| 文件 / File | 说明 / Description |
|---|---|
gguf/qwen3-emb-8b-bf16.gguf | 模型权重(GGUF BF16,15.1 GB)/ model weights |
bin/ | llama.cpp 板端程序 llama-embedding、llama-server(静态链接)/ the board programs (static) |
kernels/ | NPU kernel:整个模型一个 + manifest.json / one kernel for the whole model + manifest.json |
run.sh | 运行脚本 / launcher |
bench.sh | 性能脚本;下表数字由它生成 / benchmark script that produces the table below |
权重只来自 GGUF;BF16 权重 bank 在加载期转换并整块拷入 CMM,KV cache 为 BF16。 Weights come only from the GGUF; BF16 weight banks are converted at load time and copied to CMM as whole banks, with a BF16 KV cache.
运行 / Run
要求 / Requirements:AX8860,SDK V0.5.0 或更新 / AX8860 with SDK V0.5.0 or newer.
./run.sh "今天天气很好" # 单条文本向量(JSON,L2 归一化)/ one normalized embedding
./run.sh -f texts.txt # 每行一条 / one embedding per input line
./run.sh -s 8080 # OpenAI 兼容服务 / OpenAI-compatible server
curl http://<board>:8080/v1/embeddings -H 'Content-Type: application/json' \
-d '{"input":["今天天气很好","a sunny day"]}'
服务端使用 --embedding --pooling last -np 1。直接调用程序时设置
LD_LIBRARY_PATH=/opt/lib GGML_AXERA_KERNEL_DIR=<repo>/kernels 和 -ngl 99。
检索时 query 按模型卡加指令前缀 / prefix retrieval queries as specified by the model card.
性能 / Performance
数字只来自本包 bench.sh,AX8860 NPU 4 核,每次 3 轮:
Numbers below come only from this package's bench.sh on the four-core AX8860 NPU, three runs each:
| 输入长度 / Input | 中位延迟 / Median | 最小 / Min | 最大 / Max |
|---|---|---|---|
| 256 token | 232.4 ms | 230.4 ms | 438.7 ms |
| 1024 token | 838.3 ms | 836.4 ms | 891.9 ms |
| 4096 token(实测输入 4095) | 3421.5 ms | 3420.0 ms | 3554.0 ms |
4096 上下文已满载,benchmark 文本按 4095 token 发送以容纳服务端可能附加的 1 个 token。 The 4096-token context is full; the benchmark text carries 4095 tokens so the server can add its one extra token.
正确性 / Correctness
20 条中英文句子对 transformers CPU 参考向量:余弦最小值 0.999595、均值 0.999746; 4 组检索查询的文档排序和 top-1 与参考完全一致。 For 20 Chinese/English sentences against the transformers CPU reference: minimum cosine 0.999595, mean 0.999746; all four retrieval queries match the reference ordering and top-1.
已知限制 / Known limits
- 运行时独占 NPU 4 核 / takes all four NPU cores.
- 上下文固定 4096 token / fixed 4096-token context.
源码 / Sources
- llama.cpp:ZHEQIUSHUI/llama.cpp @
6613735ce
更新 / Changelog
- 2026-11-15:首次发布 / first release.