Skip to content

fix(models): bound Inkling 2 Small load memory and validate it - #3397

Merged
inureyes merged 2 commits into
mainfrom
test/issue-3373-inkling2-small-validation
Nov 24, 2026
Merged

inureyes merged 2 commits into
mainfrom
test/issue-3373-inkling2-small-validation

Conversation

@inureyes

Copy link
Copy Markdown
Member

Summary

First real-checkpoint run of Inkling 2 Small (thinkingmachines/Inkling-2-Small 885d78bf) on a 512 GB M3 Ultra, against mlx-vlm 466069f5, with the one Small-specific bug it exposed fixed.

  • Load memory: the first token built the contiguous gate and up copies of every layer's expert w13 in one graph, taking the process footprint to 459 GiB (10% free on the host). load_inkling2_vlm now evaluates the sanitized weights one decoder layer at a time with the MLX cache limit at 0 and restores it, as mlx-vlm's README does for Small. MLX peak 367 GiB, first prefill 8.2 s to 0.34 s, output unchanged. mlxcel inspect estimates 364.8 GiB for weights, KV and activations (0.6% under the peak), so memory_estimate.rs is unchanged.
  • Kernel gate evidence: each model logs its kernel gates at load and the first dispatch of each kernel at debug level, so Small shows the short convolution on and both loop kernels off.
  • scripts/mlx_vlm_image_logit_trace.py --bounded-load and a zero cache limit in mlx_lm_logit_trace.py --mlx-vlm let mlx-vlm hold Small.
  • Docs: Small results in docs/supported-models.md (model entry and DSpark row), plus the fact that Small's index has no audio tensor (1348 model.llm.*, 422 model.visual.*), so the fix(vlm): refuse audio input for Inkling 2 with a clear error #3376 refusal holds for it.

Results

Check Result
Greedy, 128 tokens text identical to mlx-vlm
Text trace, 1024 positions 30 top-1 differences, 0/409 decided, perplexity -0.68%
Image trace 600 prompt ids identical, 4/126, 0/88 decided
Server text, image_url, get_weather all succeed, streamed equals non-streamed, {"city":"Warsaw"}
Decode, kernels off / on (ABAB) 18.91 / 19.45 tok/s (mlx-vlm 20.5)
Prefill, 2274-token prompt 361 / 362 tok/s
Server C4 aggregate 36.8 tok/s
DSpark (MLXCEL_MTP_ALLOW_INEXACT=1; probe declines, 503855/800232 bytes) 19.3 to 19.3 tok/s (prose), 19.3 to 33.0 tok/s (code), acceptance 0.20 / 0.46

Details: docs/benchmark_results/inkling2-small-m3ultra-2026-11-24.md.

Test plan

  • cargo test --profile test-fast --features metal,accelerate --lib inkling (172 passed) and --lib coverage_tests (18), under the GPU lock
  • cargo clippy --lib --tests --features metal,accelerate -- -D warnings, cargo fmt --all -- --check, the CI contract scripts and the header check
  • Mini 128-token greedy output identical with the new per-layer load and with MLXCEL_WEIGHT_MATERIALIZATION=lazy (the unbounded path)
  • Broad gate (make verify) left to the orchestrator

Closes #3373

@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 labels Nov 24, 2026
inureyes added a commit that referenced this pull request Nov 24, 2026
@inureyes inureyes added status:done Completed and removed status:review Under review labels Nov 24, 2026
Inkling 2 Small loaded and generated on a 512 GB M3 Ultra, but its first token built the contiguous gate and up copies of every layer's expert w13 in one graph, taking the process footprint to 459 GiB and the host to 10% free memory. The loader now evaluates the sanitized weights one decoder layer at a time with the MLX buffer cache off and restores the limit afterwards, as mlx-vlm's README does for Small. The MLX peak is now 367 GiB, the first prefill drops from 8.2 s to 0.34 s, and greedy output is unchanged (Mini output is identical to the unbounded path).

The Inkling 2 kernels log each model's gate decision at load and the first dispatch of each kernel at debug level, which shows Small takes only the short convolution. The two reference trace scripts gain the bounded load so mlx-vlm can hold Small.

Small results (greedy match, 0/409 and 0/88 decided disagreements, server, ABAB kernels, batch 4, DSpark) are in docs/benchmark_results/inkling2-small-m3ultra-2026-11-24.md. Tests: --lib inkling (172), --lib coverage_tests (18), clippy and the CI contract scripts.

Closes #3373
@inureyes
inureyes force-pushed the test/issue-3373-inkling2-small-validation branch from 883fe8b to c3b5c32 Compare November 24, 2026 07:43
@inureyes
inureyes marked this pull request as ready for review November 24, 2026 07:45
@inureyes
inureyes merged commit 164420e into main Nov 24, 2026
33 checks passed
@inureyes
inureyes deleted the test/issue-3373-inkling2-small-validation branch November 24, 2026 07:46
@inureyes inureyes added this to the 0.9 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

test(models): validate Inkling 2 Small on the real checkpoint

1 participant