Repository navigation
update(inkling): make Inkling-Small MTP exact at every width - #3419
Merged
Merged
Conversation
On Inkling-Small-mlx-4bit the block-versus-chain probe passed at widths 2 to 8 but declined at 10, the MTP default, from layer 0 on: past 8 queries MLX's fused SDPA leaves the per-query kernel a decode step runs. Inside a verify block the attention now runs in groups of at most 8 queries; the probe passes at widths 2, 3, 4, 8, 10 and 16, also after 600 and 2100 tokens. A partial accept no longer restores a snapshot and replays the kept prefix. That replay ran outside the verify scope (conv1d and batched experts), so it did not rebuild the state classic decode holds, and it cost a second target forward per round. The verify block now records each short convolution's input window; finalize trims the KV tail and takes the convolution states from those windows. The replay path remains for blocks outside the row-invariant scope. InklingShortConv moves to its own module. Measured on M3 Ultra (128 greedy tokens, ABAB): width 2 goes from 25.9 to 39.7 tok/s (prose) and 27.0 to 41.6 (code), output now equals classic at widths 2, 3 and 10, but classic decode (45.1, 44.4) is still faster at every width. MTP stays opt-in; docs record the result. Tests: the tiny-model probe covers widths 10 and 16, and a new test checks that a partial accept leaves the single-token chain state; both fail on the previous code. Refs #3280
inureyes
marked this pull request as ready for review
November 25, 2026 00:57
This was referenced Nov 25, 2026
inureyes
added a commit
that referenced
this pull request
Nov 25, 2026
…3423) ## Summary First-generation Inkling now takes prompt-lookup verify rounds (`mlxcel generate --prompt-lookup`, the server's `--draft-kind prompt-lookup`, and the full-model drafter), reusing the exact rewind PR #3419 built for MTP. - A token-only speculative append of 2 to 16 rows enters the MTP verify scope in `forward_with_sequence_id`, so it is row-invariant and records each convolution's input window in `block_tails`. - `supports_speculative_verify_rewind` returns the row-kernel setting (`MLXCEL_INKLING_ROW_INVARIANT`, on by default). With it off the gate still refuses. - `rewind_decode_appends` goes through the new `inkling_layer::drop_newest_verify_rows`. It derives the block length from the windows (window rows minus state rows), accepts `kept == 0` (a failed round, or the width warm-up), and checks every layer before it changes any. A layer with no windows, layers that disagree, or `n` past the block are all refused. - A speculative append wider than 16 rows also records its windows, so `--prompt-lookup-max-draft` above 15 still rewinds. Those rows are not byte-identical to the chain. - `supports_padded_prefill` stays `false`, and `trim_state` behavior is unchanged. Its comment and line 66 of the #3419 reports (en, ko) now say it serves padded prefill only. - The Inkling VL wrapper delegates both hooks. The survey's engine probe now runs on this family; Inkling 2 is still excluded, so its verdicts do not change. - Docs: the Inkling row in `docs/supported-models.md`, a paragraph in `docs/speculative-acceptance.md`, and the `MLXCEL_INKLING_ROW_INVARIANT` entry. ## Results (M3 Ultra) - `survey_block_vs_chain`, engine path: equal in every cell. That is widths 2/4/8 × prompts 8/600/2100 on `inkling-0.6b-a0.6b`, and widths 2/4/8/16 on `inkling-small-mlx-4bit`. Before this change the engine path reported `NotRun`. - `--prompt-lookup` text at temperature 0 equals classic decode on every run on both checkpoints (copy, prose and repeat prompts). - ABAB, 4 cycles, on copy-heavy replies. Inkling-Small: 42.12 tok/s classic against 48.00 with prompt lookup (1.14x, 2.26 tokens per forward). 0.6B: 235.52 against 500.41 (2.12x). On replies that give it nothing to draft, prompt lookup runs at 0.81x (0.6B) and 0.87x (Small, one run). Full tables are in `docs/benchmark_results/inkling-prompt-lookup-m3ultra-2026-11-25.md`. ## Test plan - [x] `models::inkling` and `inkling` lib tests under the GPU lock (182 passed; `models::inkling` rerun after the gate test was shortened, 86 passed). These include the new gate test in `tiny_tests.rs`, and `prompt_lookup_tests.rs`: byte equality against the single-token chain after a rewind at every reject position for widths 4 and 10 (full reject included), refusal without mutation, and a width-20 tolerance check. - [x] `--lib coverage_tests` and `prompt_lookup` filters. - [x] fmt, both clippy invocations, the used-by, kernel-dtype, env-var, crate-version, kernel-port, binary-asset and license checks. - [ ] The broad `cargo test --release --lib inkling` gate is left to the orchestrator. The server path shares `Engine::verify_rounds_unsupported` and `verify_round` with the CLI but was not exercised end to end. Closes #3422
10 tasks
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.
Summary
inkling-small-mlx-4bitpassed at widths 2 to 8 but declined at 10 (the MTP default) from layer 0: past 8 queries MLX's fused SDPA leaves the per-query kernel a decode step runs. A verify block now attends in groups of at most 8 queries. The probe passes at widths 2, 3, 4, 8, 10 and 16, after short, 600- and 2100-token prompts.Measured (M3 Ultra, 128 greedy tokens, ABAB)
Mean accepted length is 1.43 to 1.63, nearly all from the first draft. The drafter matches mlx-vlm 466069f5 in chain indexing, hidden-state source and logit path (upstream: 1.59). An experiment starting post-seed drafts at block 1 left acceptance unchanged. No width beats classic, so MTP stays opt-in (
--draft-model). The #3417 adaptive width belongs to the DFlash loop and does not apply to the MTP loop. Details:docs/benchmark_results/inkling-small-mtp-m3ultra-2026-11-25.md.Test plan
mtp_partial_accept_keeps_the_single_token_chain_state_on_metaland widths 10, 16 inthe_verify_block_matches_the_chain_on_metal: both fail on the previous code, pass nowsurvey_block_vs_chainoninkling-small-mlx-4bit, widths 2, 3, 4, 8, 10, 16; ignored real-checkpoint probe test (now with width 10) on the bf16 0.6B and the 4-bit Small checkpointsmodels::inkling(coversinkling2),coverage_tests,inkling_mtp,speculative_exactness,speculative_burst, mlxcel-coreinklingandrow_invariantCloses #3280