Skip to content

Inkling 2 Mini on Metal: with a drafter, the window fit prices a token at a token's bytes (a 64 GB limit holds the whole window for eight streams) - #4622

Draft
sethforprivacy wants to merge 1 commit into
ashhart:mainfrom
sethforprivacy:inkling2-mini-metal-window
Draft

sethforprivacy wants to merge 1 commit into
ashhart:mainfrom
sethforprivacy:inkling2-mini-metal-window

Conversation

@sethforprivacy

Copy link
Copy Markdown
Contributor

What this changes

Before: with --drafter, the Metal opener allows a context window about a hundred times shorter than the memory holds. With a 64 GB load limit it offers 18,878 tokens to four streams and 9,442 to eight, and refuses --context 262144. After: the same limit holds the model's whole window for eight drafted streams.

This is a proposal on top of #4387, opened as a draft.

The cause. open prices a drafted stream's token as Drafter.streamBytes(1) - Drafter.streamBytes(0). A stream's global rings come 128 rows at a time (globalRing rounds the window up to 128), so that difference is 128 tokens' bytes, 524,288, where a token costs 4,096. The fixed part then adds 127 of those for the rounding, and the test beside it checks the bound from the same difference, so it holds.

The fix. Drafter.tokenBytes() is the lane's bytes a token and Drafter.ring_slack the 127 rows the rounding can add; the opener's fixed part is streamBytes(0) plus the slack's bytes. The reservation itself (streams * streamBytes(window)) was already exact and is unchanged.

Measured on this stack, INKLING2_LOAD_LIMIT_GB=64, --drafter, no --context (the opener then reports the longest window it allows, which is over the 262,144 the model takes):

--parallel 2 --parallel 4 --parallel 8
#4446 37,312 tokens 18,878 9,442
This head not run 811,072 610,048

With --context 262144 --parallel 8 under that limit the server starts, answers eight requests at once and takes a 72,826-token prompt; its footprint peaks at 31 GB.

Checks on this head

  • Head commit: ea92d3b40.
  • Lean checker, on the base and on this head: 167 and 167, 0 new.
  • Tests run:
    • "Inkling native longest context accounts target, streams and shared draft scores" now checks the bound against streamBytes at six windows from 1 to 262,144, that it is never more than the slack above it, and that 36 GiB of state hold 262,144 tokens for eight drafted streams. With that last expectation changed by one the Inkling host steps fail, so the test runs there; as written they pass.
    • zig build native -Dcpu=apple_m1: compiles.
    • The six Inkling host steps (test-inkling2-metal-host, test-inkling2-host, test-inkling2-controls-host, test-inkling2-launch-map-host, test-inkling2-metal-capabilities, compile-inkling2-native-host): exit 0.
    • tf-kernel-contract --only inkling2 (-Doptimize=safe): SUMMARY 41 kernels: 41 pass gates 1-4, 0 fail, 0 known findings; 41 controls: 41 red as planted, 0 missed; 0 limit problems, exit 0.
    • zig fmt --check build.zig zig and git diff --check: clean.
  • CI: not yet reported when this was written.
  • Not run, and why: the whole zig build test test-golden on this head (the stack's inherited failures are listed in Inkling 2 Mini on Metal: #4387's native build compiles, its norms write their output, and concurrent streams equal solo #4446). CUDA and HIP are not touched.

Receipt

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. (The test's new expectations fail on Inkling 2 Mini on Metal: #4387's native build compiles, its norms write their output, and concurrent streams equal solo #4446's arithmetic, where a token is priced at 524,288 bytes.)
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Not touched.)
  • No precision traded for speed. If the bits change, the description says which sums change and why. (No arithmetic of the model is touched.)
  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it. (Not touched.)

@ashhart
ashhart force-pushed the lead/inkling2-mini branch 4 times, most recently from aefb063 to c41911e Compare November 24, 2026 09:43
@ashhart
ashhart deleted the branch ashhart:lead/inkling2-mini November 24, 2026 09:43
@ashhart ashhart closed this Nov 24, 2026
@ashhart ashhart reopened this Nov 24, 2026
@ashhart
ashhart changed the base branch from lead/inkling2-mini to main November 24, 2026 09:49
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Sorry for the noise: this was closed automatically when #4387 landed on main and its base branch was removed. It is reopened and now targets main. We will follow up here on what it needs next; nothing is needed from you yet.

  • Synthena

@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you @sethforprivacy. The token price is now 4,096 bytes, and the ring-rounding allowance stays conservative. The actual reservation and per-request target-state checks remain in place. I favor this focused fix over changing the startup count and pressure policy. The remaining qualification is the larger admitted windows on current main; opening with eight streams does not reserve eight maximum-size target caches.

  • Synthena

@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you, @sethforprivacy. The current fix prices a DSpark token at 4,096 bytes and keeps a conservative allowance for ring alignment. It merges cleanly with main and preserves the landed demand breakdown, pressure policy and per-request state checks.

This is ready for controlled comparisons of the larger admitted windows on the final tree. Eight drafted streams at startup still rely on the existing request-size budget checks for their target caches. The earlier qualification results are useful, and the remaining checks belong to final integration.

  • Synthena

This branch has not been deployed

No deployments
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