Files

gpt-oss-20b teacher-forced logit comparison (quality gate B)

Greedy token equality is a weak test: two correct implementations flip near-ties. This gate feeds the same 383 tokens (text.txt, a Harmony-formatted exchange written for this purpose; ids.txt) to the Leleka decoder and to llama.cpp and compares the next-token distribution after every position.

Files

  • text.txt, ids.txt: the text and its token ids (made with gguf_tokenize --special --json).
  • llama-reference.jsonl: llama.cpp 2.55.0 (CPU AVX2 build, -ngl 0 -fa off, f16 KV cache, model SHA-256 65d06d31…cde53ab) top-20 log-probabilities after each position, from /completion with the prompt as token ids, n_predict 1, n_probs 20, temperature 0, cache_prompt true.

Procedure

cargo run --release -p leleka-gptoss --example dump_logprobs -- <model.gguf> ids.txt ours.jsonl 10 20
cargo run --release -p leleka-gptoss --example compare_logprobs -- ours.jsonl llama-reference.jsonl

Result (2026-10-14, Core Ultra 7 265U, 10 threads, kernels AVX-VNNI; no other load control)

Pair best token agrees mean abs difference of the best token's log-prob mean KL (shared top-20) next-token NLL
Leleka (AVX-VNNI) vs llama.cpp 97.1% (372/383) 0.032 0.0080 1.2859 vs 1.2798
Leleka (scalar kernels) vs llama.cpp 97.1% 0.029 0.0068 1.3029 vs 1.2920
Leleka (AVX-VNNI) vs Leleka (scalar kernels) 98.2% (376/383) 0.022 0.0048 1.2859 vs 1.2905

The third row is the noise floor: the scalar and SIMD levels compute the same integer products and differ only in float summation order, yet they differ from each other about as much as Leleka differs from llama.cpp. The differences are large in the first ~100 positions (KL about 0.02-0.04 there) and small after 200 (KL about 0.001): the model amplifies rounding differences through its 8-bit activation quantization in early context. Conclusion: no systematic error is visible; the earlier first-step log-probability discrepancy (top token 0.40 vs 0.45) is of this size. This is one text and one machine, so it is a gate, not a proof.

Pass criteria used for later changes (non-lossy changes)

Against the committed reference: best-token agreement at least 95%, mean KL at most 0.012, and mean next-token NLL within 0.02 of llama.cpp's. A change that makes the third row of its own A/B (new vs old build) much larger than 0.005 mean KL is suspect.

GPU prefill (experimental, 2026-10-15)

cargo run --release -p leleka-gptoss-igpu --example dump_logprobs_gpu -- <model.gguf> ids.txt gpu.jsonl 20 prefills the ids on the integrated GPU (every position's hidden state), projects each on the CPU and writes the same format. Against llama-reference.jsonl (two kernel variants, see the table in spec node igpu-prefill.md): 97.1% / mean KL 0.0100 and 95.3% / 0.0121; first variant: best token agrees 97.1% (372/383), mean KL 0.0100, NLL 1.2976 vs 1.2828. Against the CPU decoder's own dump: 97.4% (373/383), mean KL 0.0067, NLL 1.2976 vs 1.2979. Details and caveats in spec node igpu-prefill.md.

Longer reference set (set2/, 2026-10-15)

Four texts of 770-957 tokens (excerpts of this repository's design notes and one Rust source file, wrapped in the Harmony format; *.txt, ids in *.ids) with llama.cpp 2.55.0 top-20 log-probabilities (*.llama.jsonl; same server settings as above, ids from the server's /tokenize with special tokens parsed). 3,395 positions in total.

Mean KL against llama.cpp (best-token agreement in brackets):

Text CPU AVX-VNNI iGPU prefill NPU prefill
code-rust (957) 0.037 (93.3%) 0.042 (92.1%) 0.051 (92.3%)
docs-cpu (864) 0.023 (92.7%) 0.031 (91.6%) 0.034 (92.1%)
docs-npu (804) 0.042 (91.3%) 0.036 (92.9%) 0.043 (90.9%)
table-igpu (770) 0.016 (93.4%) 0.020 (91.6%) 0.023 (90.8%)

Noise floor on table-igpu (the CPU build against itself): scalar kernels vs AVX-VNNI give KL 0.016 and 92.5% agreement, the same as the CPU against llama.cpp (0.016, 93.4%); AVX2 and AVX-VNNI are bit-identical (KL 0). So on texts of this length the 95% / 0.012 criteria above are tighter than the rounding noise between two correct builds, and they must not be applied to these texts. Use the set2 table as a relative comparison: the iGPU and NPU prefill paths sit 0.004-0.015 KL above the CPU path, about one noise-floor step, with next-token NLL differences within +-0.03 of llama.cpp's. The criteria still need a recalibration (for example against the noise floor of each text); that has not been done.