Repository navigation
test(inkling): P1 tiny parity against a golden from mlx-lm #2086 (#650) - #754
Merged
Merged
Conversation
…gmax at 40 positions, logits within 1e-3, 16 greedy tokens through the caches (#650) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012cicguZMN3jhNGmf5327oh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the P1 "Tiny parity (#228)" gate from #650: basalt's Inkling 2 against the reference implementation in ml-explore/mlx-lm#2086, on the same weights.
How the golden was made
TinyModel.make(.inkling2Loop)(seed 650) was saved withMLX.saveasconfig.json+model.safetensors.strict=Trueinto mlx-lm #2086, pinned atjundot/mlx-lm@e2b5bbd3bd. All 173 parameter names match. Two adjustments were needed:*.queryvectors were reshaped from(1, d)to(d,);swa_num_attention_heads,swa_num_key_value_headsandswa_head_dim, equal to the global values. #2086 requires them; basalt ignores them, and the real config sets them equal anyway.Fixtures/Inkling2/mlxlm2086_tiny_golden.jsonfrom 40 fixed tokens:Before writing the golden, the full logits were compared directly: max |Δ| 5.4e-6, mean 5.6e-7, argmax equal at 40/40.
Test
InklingReferenceParityTests:2/2 pass. Strict build, comment and size gates are clean.
Not covered
Expert indices are not compared. #2086 does not expose them without patching its model.
The P1 real-model gate (top-1 ≥ 99% on
oQ3e, 5 × 512 teacher-forced tokens) and the P2 "≥ 1.0x mlx-lm" decode comparison are blocked:model.layers.N.attn.in_proj, packed loop controllers);global_scale([P2] quant(loader): MLX config traps, nvfp4 per-expert global_scale, ModelOpt NVFP4 import — #670 gaps 1–3 #677 gap 2, feat(quant): nvfp4 per-expert global_scale on QuantizedSwitchLinear, streaming, Inkling sanitize, X-ray, and converter (#677 Gap 2) #739).Either side landing unblocks the comparison.
Part of #650.
🤖 Generated with Claude Code
https://claude.ai/code/session_012cicguZMN3jhNGmf5327oh