Skip to content

CPU reference: GGUF reader, dequant, Qwen3 fp32 forward, golden test - #1

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cpu-reference
Sep 22, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cpu-reference

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

The fp32 correctness oracle. Every NPU and GPU backend will be gated against it.

What

  • engine/core: mmap GGUF v2/v3 reader, F32/F16/BF16/Q8_0 dequant, model config from GGUF metadata (refuses unverified architectures), thread pool.
  • engine/backends/cpu: Qwen3 decoder in fp32. Loading fails on any missing, misshaped or unused tensor.
  • tests/: GGUF and dequant unit tests on synthetic data (run in CI); golden_cpu against HF transformers fp32 logits.
  • tools/golden/make_golden.py, docs/cpu-reference.md.

Results (Strix Halo, Qwen3-0.6B BF16 GGUF vs transformers fp32 eager)

result gate
argmax agreement 36/36 all
worst per-position KL 1.3e-10 ≤ 1e-6
worst max |Δlogit| 1.0e-4 reported

Negative controls: RoPE Normal instead of Neox → 17/36 mismatches, KL 7.9; k-norm skipped → 34/36, KL 24.9. Both fail.

Test plan

  • ctest locally (unit tests) and on strixhalo with -DENGINE_GOLDEN_MODEL/DIR (3/3 pass)
  • builds with -Wall -Wextra -Wpedantic, zero warnings (g++ 15.2)
  • mutation check above

Not in this PR: tokenizer, K-quants, a longer-context golden.

🤖 Generated with Claude Code

The fp32 oracle the NPU and GPU backends will be tested against.

- engine/core: mmap GGUF v2/v3 reader, F32/F16/BF16/Q8_0 dequant, model
  config from GGUF metadata (only verified archs accepted), thread pool.
- engine/backends/cpu: Qwen3 decoder in fp32. Load fails on any missing,
  misshaped or unused tensor.
- tests: GGUF and dequant unit tests on synthetic data (run in CI);
  golden_cpu compares against HF transformers fp32 logits.
- tools/golden/make_golden.py writes the golden logits.

Qwen3-0.6B, 36 positions teacher-forced: argmax 36/36, worst KL 1.3e-10
(gate 1e-6). Deliberately broken RoPE and k-norm builds both fail the gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bong-water-water-bong
bong-water-water-bong merged commit c14a5ea into main Sep 22, 2026
1 check passed
bong-water-water-bong pushed a commit that referenced this pull request Sep 28, 2026
…bases our commits

third_party/ds4 moves to 1bit-MONSTER/ds4 1bit/main (a7f2e1e): upstream antirez/ds4
main plus our 1BP v5 reader, converter and checker (ds4 #1). bump-ds4.yml now
rebases the commits we carry onto upstream main, tags the old tip and opens the pin
PR, as bump-llama-vulkan does. 1bit serve recognises a 1BP package by its magic and
serves it on ds4, --device auto included. docs/dwarfstar.md and NOTICE follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bong-water-water-bong pushed a commit that referenced this pull request Sep 28, 2026
…bases our commits

third_party/ds4 moves to 1bit-MONSTER/ds4 1bit/main (a7f2e1e): upstream antirez/ds4
main plus our 1BP v5 reader, converter and checker (ds4 #1). bump-ds4.yml now
rebases the commits we carry onto upstream main, tags the old tip and opens the pin
PR, as bump-llama-vulkan does. 1bit serve recognises a 1BP package by its magic and
serves it on ds4, --device auto included. docs/dwarfstar.md and NOTICE follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bong-water-water-bong added a commit that referenced this pull request Sep 28, 2026
…bases our commits (#196)

third_party/ds4 moves to 1bit-MONSTER/ds4 1bit/main (a7f2e1e): upstream antirez/ds4
main plus our 1BP v5 reader, converter and checker (ds4 #1). bump-ds4.yml now
rebases the commits we carry onto upstream main, tags the old tip and opens the pin
PR, as bump-llama-vulkan does. 1bit serve recognises a 1BP package by its magic and
serves it on ds4, --device auto included. docs/dwarfstar.md and NOTICE follow.

Co-authored-by: bong-water-water-bong <bong-water-water-bong@1bit.gg>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant