Skip to content

test(inkling): real-model parity against mlx-lm #2086 on oQ3e — top-1 97.8% at the mlx-lm bf16/fp32 noise floor, always in top-5 (#650) - #755

Merged
goodmai merged 1 commit into
mainfrom
test/inkling-real-parity
Nov 24, 2026
Merged

goodmai merged 1 commit into
mainfrom
test/inkling-real-parity

Conversation

@goodmai

@goodmai goodmai commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Closes the real-model parity part of #650 P1, which was waiting on #739. It does not wait any more: the mlx-lm side now reads the oQ3e pack directly, with the same key mapping that Inkling2Checkpoint.fromOQ uses.

What is added

  • realModelTop1MatchesReference in InklingReferenceParityTests, env-gated on BASALT_E2E=1 and BASALT_E2E_INKLING_MODEL_PATH.
    • It runs basalt teacher-forced over 5 × 512 token ids and compares its argmax with mlx-lm's top-5 at every position.
  • Fixture Fixtures/Inkling2/mlxlm2086_oq3e_top5.json (87 KB): token ids and mlx-lm top-5 per position.
    • The texts are CONTRIBUTING, the RU and ZH READMEs, a Swift file and a Compose doc.

How the reference was made

  • mlx-lm #2086 (jundot/mlx-lm@e2b5bbd3bd) in a venv, loading mlx-community/Inkling-2-Mini-oQ3e-mtp at 5552e32.
  • Its sanitize was replaced by a Python port of fromOQ: the same renames, row splits of in_proj/q_proj/k_proj/v_proj, conv reshapes, loop gates and message queries.
    • load_weights(strict=True) passes, so every key and shape matches.
    • The installed MLX has no global_scale argument on gather_qmm, so a shim drops it. The value is always None for affine weights.

Results (Apple M-series 24 GB, commit 244eef6 + this test)

Comparison Top-1 agreement over 2,560 positions In reference top-5
basalt (bf16) vs mlx-lm (bf16) 97.81% 2560/2560
basalt (bf16) vs mlx-lm (fp32 activations) 97.93% 2560/2560
mlx-lm bf16 vs mlx-lm fp32, the noise floor 97.97% —

Decode, same prompt, 256 tokens, greedy

Model Runner Decode tok/s
Inkling-2-Mini-oQ3e mlx-lm #2086 (kernels on), 1 run 29.5
Inkling-2-Mini-oQ3e basalt plain, 3 runs 27.0 (σ 0.08), 0.92×
Inkling-2-Mini-oQ3e basalt --mtp, 3 runs 38.0 (σ 0.65), 1.29×
Gemma 4 not measured not relevant to this test-only change. No Gemma or Flint regression on 0c3e247 (#650 comment)

🤖 Generated with Claude Code

https://claude.ai/code/session_012cicguZMN3jhNGmf5327oh

… teacher-forced positions, top-1 97.8% (mlx-lm bf16 vs its own fp32 97.97%), always in top-5 (#650)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012cicguZMN3jhNGmf5327oh
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