Skip to content

forward-serve: a route parity run against llama.cpp cannot be given token ids, so it measures the prompt (not the forward) #937

Closed

Description

@bong-water-water-bong

Measured on Zyphra/ZR1-1.5B (2026-11-03), the same Q4NX container weights on both sides: 1bit forward-serve with NPU_INFER_HOST_GEMM=1 on :18110, llama.cpp on the container's own GGUF (tools/q4nx_to_gguf.py write) on :18112, five raw prompts, greedy 64 tokens.

forward llama.cpp
prompt tokens 10, 5, 7, 24, 13 11, 6, 8, 25, 14
identical continuations 0/5 (first divergence at token 0,0,3,0,1)

The forward's counts are exactly llama.cpp's /tokenize with add_special:false on every prompt, so the gap is one BOS token: app/forward_serve.cpp prepends BOS on the chat route only (if (chat && e.add_bos …)), while llama.cpp's /completion prepends it by default. The reference's token at each divergence point is near-certain (-0.0 to -0.0017 logprob), so this is not a quantization effect — the two engines were fed two different prompts.

The chat route cannot stand in either: it hardcodes ChatML (app/npu_chatml.h) and a non-ChatML checkpoint (ZR1 is DeepSeek-style) is prompted with the wrong text. So with text prompts only, no Zyphra model has a measurable route row.

llama.cpp's /completion accepts prompt as text or as an array of token ids. /v1/completions refuses the id form today (type must be string, but is array). Accepting it makes both engines evaluate identical positions, which is the only way a parity number describes the forward rather than the tokenizer plus the BOS policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions