Skip to content

Fix gated delta recurrence precision - #488

Merged
davidkoski merged 1 commit into
ml-explore:mainfrom
aleroot:fix-gated-delta-precision
Jul 31, 2026
Merged

davidkoski merged 1 commit into
ml-explore:mainfrom
aleroot:fix-gated-delta-precision

Conversation

@aleroot

@aleroot aleroot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

Use Kahan compensated summation for the recurrent k-state dot product so low-order terms do not drift at long context. Disable Metal reassociation and contraction only inside this reduction to preserve the algorithm under default fast math.

Add an adversarial BF16-path regression that checks the FP32 recurrent state against the correctly rounded reference result.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

Use Kahan compensated summation for the recurrent k-state dot product so low-order terms do not drift at long context. Disable Metal reassociation and contraction only inside this reduction to preserve the algorithm under default fast math.

Add an adversarial BF16-path regression that checks the FP32 recurrent state against the correctly rounded reference result.

@davidkoski davidkoski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

@davidkoski
davidkoski merged commit d5d8b29 into ml-explore:main Jul 31, 2026
2 checks passed
div0-space pushed a commit to LibraxisAI/mlx-swift-lm that referenced this pull request Nov 29, 2026
div0-space pushed a commit to LibraxisAI/mlx-swift-lm that referenced this pull request Nov 29, 2026
…stack (ml-explore#503)

Joins feat/inkling2-mini-snapshot-213 at 3880551 (the top of the
ml-explore#488 to ml-explore#503 stack) with fix/cbv2-exponential-sampling at 559306d
(ml-explore#505). Both start from 8803d31. SamplerV2.swift is the only file
that both change: ml-explore#490 adds greedyRows and pendingNoise(vocab:), and
pendingNoise calls the exponentialNoise path that ml-explore#505 fixes. Git
merges the file without conflicts; nothing was edited by hand. The
tree is eedf778, the combined tree compared for provider 0.10.18.

Claude Opus 5.5 drafted this merge and message for the author to read,
review and own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
div0-space pushed a commit to LibraxisAI/mlx-swift-lm that referenced this pull request Nov 29, 2026
…kling-sampler

Land Inkling 2 Mini (ml-explore#488–ml-explore#503) and the CBv2 sampling fix (ml-explore#505) for provider 0.10.18
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.

2 participants