Skip to content

fix: opt Kimi Linear out of chunked prefill - #2293

Merged
inureyes merged 3 commits into
mainfrom
fix/issue-1749-kimi-chunked-prefill
Oct 13, 2026
Merged

inureyes merged 3 commits into
mainfrom
fix/issue-1749-kimi-chunked-prefill

Conversation

@inureyes

Copy link
Copy Markdown
Member

Summary

Validation

  • The focused loaded-model CUDA test passes through the compiled test executable; the matching mlxcel and mlxcel-surgery CUDA test graph builds successfully.
  • Formatting, diff checks, implementation review, and security/performance review pass.
  • The pinned Kimi Linear checkpoint was tested with a 3,411-token prompt under the default setting and MLXCEL_PREFILL_CHUNK=0, plus a 21-token chunk-disabled prompt. Baseline and candidate both emitted token ID 0, so these runs do not establish accuracy or numerical parity. The separate runtime defect is tracked in fix(kimi_linear): diagnose CUDA token-zero degeneration #2292 with exact build and checkpoint revisions.

This conservative policy can increase long-prompt transient memory by using one prefill graph. Current DirectEngine carries a stable sequence ID across pieces, while legacy cache-less callers remain protected from silently resetting earlier no-ID pieces.

Closes #1749

Kimi Linear resets model-owned Delta and MLA state when a multi-token forward carries no sequence ID. Advertise the conservative single-pass policy so cache-less trait callers cannot silently discard earlier prompt pieces while preserving the independent-prompt reset contract.

Add a tiny model loaded through `KimiLinearModel::from_weights` and assert the capability through `LanguageModel`. The focused CUDA test, formatting, and diff checks pass. Real checkpoint runs remain degenerate with token ID 0 and are tracked separately in #2292.

Refs #1749
@inureyes inureyes added status:review Under review type:bug Bug fixes, error corrections, or issue resolutions priority:medium Medium priority area:models Model architectures, weights, loading, metadata area:inference Generation, sampling, decoding (incl. speculative, DRY) labels Oct 13, 2026
@inureyes
inureyes merged commit 398f9ba into main Oct 13, 2026
27 checks passed
@inureyes
inureyes deleted the fix/issue-1749-kimi-chunked-prefill branch October 13, 2026 14:44
@inureyes inureyes added status:done Completed and removed status:review Under review labels Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:inference Generation, sampling, decoding (incl. speculative, DRY) area:models Model architectures, weights, loading, metadata priority:medium Medium priority status:done Completed type:bug Bug fixes, error corrections, or issue resolutions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(kimi_linear): chunked prefill discards the recurrent state

1 participant