Repository navigation
Inkling 2 and Inkling 2 Mini, with DSpark speculative decoding - #65
Merged
Merged
Conversation
Backports the inkling2 package from the upstream draft PRs (ml-explore#2061, ml-explore#2086) together with the pieces of the new upstream layout it needs (mlx_lm/layers, kernels/bitlinear), without the full models-layout refactor. Prefill/forward tests pass; cached decoding and batching still mismatch against our cache.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- sanitize: unquantized (bf16) w13/w2 experts load as they are; only uint8 tensors are packed NVFP4 / MXFP8. - save_config keeps vision_config for inkling2 / inkling2_loop. - load_processor(config) as upstream, by model package; inkling2 added. Nothing called the old load_processor(model, config). The cache, batch and loop tests failed only under TF32 (M5 default); with MLX_ENABLE_TF32=0 all eight pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The draft as vLLM's reference: an anchor + mask block through three dense layers over per-layer mixed target features as context K/V, then the recurrent Markov head chaining the drafts. The model returns the features of the target layer visits; dspark_generate_step verifies a block, keeps the longest matching prefix and rolls the caches back exactly (key/value caches as for Gemma 4, convolution states from the windows the verify forward recorded). stream_generate uses it when the model has the draft. Tests: greedy output equal to plain decoding (fp32), partial acceptance with oracle drafts, the cache after an early stop, sanitize. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hand-written list missed mlx_lm.kernels, mlx_lm.processors,
mlx_lm.layers and mlx_lm.models.inkling2: a pip install from git had no
inkling2 model ("Model type inkling2 not supported") and no kernels. Now
find_packages, plus mlx_lm.quant (no __init__.py).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
mlx_lm.models.inkling2: Inkling 2 (inkling2) and Inkling 2 Mini (inkling2_loop), from the upstream draft PRs Add Inkling 2 model ml-explore/mlx-lm#2061 and Add Inkling 2 Mini model ml-explore/mlx-lm#2086, with the parts of the new upstream layout they import (mlx_lm/layers,kernels/bitlinear.py), not the whole layout refactor.save_configkeepsvision_configfor inkling2;load_processor(config)as upstream (nothing called the old signature).mtp.safetensors(inkling2/dspark.py,generate.dspark_generate_step, picked bystream_generate), as vLLM's reference. Rejected drafts roll back exactly: key/value caches as for Gemma 4's drafter, convolution states from windows the verify forward records.setup.py:find_packages. The hand-written list missedmlx_lm.kernels,mlx_lm.processorsand the new packages, so a pip install from git had no inkling2.Published models that need this: roman220220/Inkling-2-Mini-gptq-mlx-jang and -small.
Test plan
tests/models/test_inkling2.py(8) andtest_inkling2_dspark.py(5) pass withMLX_ENABLE_TF32=0; the cache / batch / loop tests fail only under TF32 (M5 default, 1e-4 tolerance).tests/test_models.py,tests/test_utils.py: 191 pass.🤖 Generated with Claude Code