Summary
On AMD Strix Point (gfx1150) Vulkan with llama.cpp b10724, Qwen3.8-27B + z-lab DFlash2 (or ggml MTP draft) fails decode with:
init: invalid token[1] = 248320
decode: failed to initialize batch
248320 equals tokenizer.ggml.tokens array length — valid token ids are 0..248319. This looks like a classic off-by-one in draft sampling / logits indexing.
Environment
- GPU: AMD Strix Point
gfx1150, Vulkan/RADV
- Runtime: llama.cpp b10724 (also reproduced earlier on b10666)
- Target:
Qwen3.8-27B-UD-Q4_K_XL.gguf (architecture qwen35)
- Draft A:
z-lab/Qwen3.8-27B-DFlash2-GGUF → Qwen3.8-27B-DFlash2-Q4_K_M.gguf (dflash)
- Draft B: Unsloth
mtp-Qwen3.8-27B-Q4_0.gguf (qwen35) — same 248320 with ggml MTP
- Flags:
--spec-type draft-dflash --spec-draft-n-max 2 (or draft-mtp)
Note: Muse-Glimmer + DFlash on the same binary/hardware works (different vocab/arch ~200k). Vanilla Qwen3.8 without speculation is fine (~4.3 t/s).
GGUF metadata (streaming count of tokenizer.ggml.tokens)
| Field |
Value |
n_vocab (tokenizer.ggml.tokens len) |
248320 |
| bos_token_id |
248044 |
| eos_token_id |
248046 |
Same n_vocab / bos / eos on target, DFlash draft, and MTP draft.
Expected
Draft sampling never emits token id >= n_vocab.
Actual
First decode step emits token 248320 (exactly n_vocab). Server returns HTTP 500 / "Invalid input batch."
Suggested fix
- Clamp draft token ids to
[0, n_vocab - 1] after sampling in the DFlash/MTP verify path.
- Audit
qwen35 / dflash draft-head logits indexing for < n_vocab vs <= last index (or argmax over n_vocab+1 slots).
Repro
llama-server \
--model Qwen3.8-27B-UD-Q4_K_XL.gguf \
--model-draft Qwen3.8-27B-DFlash2-Q4_K_M.gguf \
--spec-type draft-dflash --spec-draft-n-max 2 \
--device Vulkan0 -ngl 999 --ctx-size 8192 \
--cache-type-k f16 --cache-type-v f16 --flash-attn on \
--host 127.0.0.1 --port 8080 --no-webui
# POST /v1/chat/completions → 500; log shows invalid token 248320
Related
Happy to provide full server logs / GGUF SHA if useful.
Summary
On AMD Strix Point (
gfx1150) Vulkan with llama.cpp b10724, Qwen3.8-27B + z-lab DFlash2 (or ggml MTP draft) fails decode with:248320 equals
tokenizer.ggml.tokensarray length — valid token ids are0..248319. This looks like a classic off-by-one in draft sampling / logits indexing.Environment
gfx1150, Vulkan/RADVQwen3.8-27B-UD-Q4_K_XL.gguf(architectureqwen35)z-lab/Qwen3.8-27B-DFlash2-GGUF→Qwen3.8-27B-DFlash2-Q4_K_M.gguf(dflash)mtp-Qwen3.8-27B-Q4_0.gguf(qwen35) — same248320with ggml MTP--spec-type draft-dflash --spec-draft-n-max 2(ordraft-mtp)Note: Muse-Glimmer + DFlash on the same binary/hardware works (different vocab/arch ~200k). Vanilla Qwen3.8 without speculation is fine (~4.3 t/s).
GGUF metadata (streaming count of
tokenizer.ggml.tokens)tokenizer.ggml.tokenslen)Same n_vocab / bos / eos on target, DFlash draft, and MTP draft.
Expected
Draft sampling never emits token id
>= n_vocab.Actual
First decode step emits token 248320 (exactly
n_vocab). Server returns HTTP 500 / "Invalid input batch."Suggested fix
[0, n_vocab - 1]after sampling in the DFlash/MTP verify path.qwen35/dflashdraft-head logits indexing for< n_vocabvs<= last index(orargmaxovern_vocab+1slots).Repro
llama-server \ --model Qwen3.8-27B-UD-Q4_K_XL.gguf \ --model-draft Qwen3.8-27B-DFlash2-Q4_K_M.gguf \ --spec-type draft-dflash --spec-draft-n-max 2 \ --device Vulkan0 -ngl 999 --ctx-size 8192 \ --cache-type-k f16 --cache-type-v f16 --flash-attn on \ --host 127.0.0.1 --port 8080 --no-webui # POST /v1/chat/completions → 500; log shows invalid token 248320Related
248320in one layout but reports accept rate 0.0 (possible related draft-head issue; see also qwen4exp: support draft-head-only GGUFs (unsloth layout) + fix draft-load regression #28097).Happy to provide full server logs / GGUF SHA if useful.