Skip to content

Inkling 2 Mini: refuse mismatched head widths and block splits at load, out-of-vocabulary ids and expired token handles at serve - #4990

Open
plotarmordev wants to merge 5 commits into
ashhart:mainfrom
plotarmordev:feat/265-upstream-pr-inkling-2-mini-fork-main-cud
Open

plotarmordev wants to merge 5 commits into
ashhart:mainfrom
plotarmordev:feat/265-upstream-pr-inkling-2-mini-fork-main-cud

Conversation

@plotarmordev

@plotarmordev plotarmordev commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Inkling 2 Mini's config and serving now refuse three bad states by name instead of reaching device work: a config.json whose head_dim, swa_head_dim or d_rel the attention kernels do not run, or whose n_layers_per_attn_res_block splits the layers into more than the residual mixes' eight finished blocks; a served token id at or past the vocabulary, refused in loop_engine.forward before any launch rather than reading the embedding table out of bounds; and a Metal token handle the 4,096-draw ring has wrapped past, refused rather than returning whichever newer token sits in its slot.

What is deliberately not here

The fork work this was audited against also carried, and this PR omits:

Checks on this head

  • Head commit: 8f85e2f4a293704b421433326e59993a8e559ddb (the checks below were recorded on 91b5e21d4874f1f9de503860d327e56b12c4ba15; the final commit changes only the Inkling 2 Mini: refuse mismatched head widths and block splits at load, out-of-vocabulary ids and expired token handles at serve #4990 entry in CHANGELOG.md).
  • Lean checker, python3 tools/zig/lean_check.py: 165 on the base, 165 on this head, 0 new findings.
  • Tests run, with the command and pass, fail and skip counts:
    • zig build test-inkling2-host: pass (adds the config refusal table entry).
    • zig build test-inkling2-cuda-host: pass (adds the vocabulary refusal test; stream_bytes and registration tests unaffected).
    • zig fmt --check on the touched files and git diff --check: clean.
    • zig build test test-golden on this head: 17,473 pass, 5 fail, 131 skip. The five failures are outside this diff and reproduce on the base on this machine: net.test.stage (this network answers no-such-host.invalid lookups), benchmark_server_log_test (a 4 s wall-clock bound under a loaded shared GPU), info.test (Qwen3.8 start pricing), compile test safe native (qwen27 bf16_topk module wiring on main) and compile test fast native (6 std.mem errors on main).
  • CI: upstream CI on this head was in progress at 2026-11-25 05:14 UTC: 8 pass, 2 pending, 2 skipped, no failures yet.
  • Not run: test-inkling2-metal-host and device checks — this host's libturbojpeg differs from the pinned 3.1.4.1 and the step fails the same on the base; no NVIDIA GPU on this machine, so no CUDA device run.

Receipt

n/a for speed: every change is a refusal added before work the engine already did, or a refusal where a wrong answer was returned. No kernel, arithmetic, scheduling or admission line changes, so there is no faster or slower path to measure; a served checkpoint's admitted tokens are unchanged.

  • Gates the change adds, by the requested categories:
    • GPU: the Metal ring expiry is enforced in metal/backend.zig's read; the CUDA side reads its token ids only inside loop_backend, which feeds forward.
    • Quantization: none; no precision or format changes.
    • Context: unchanged; the config checks run at parse, before context is budgeted.
    • Stream: unchanged; the new checks fire per call, before any lane state is touched.
    • Checkpoint: the three new parse refusals fire at config.json admission, before weights load; the vocabulary refusal fires per forward.
  • Licence of any new weights or drafter, or "n/a": n/a.

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. (Each new host test exercises a refusal added in this PR; without the check the config parses / the read returns a slot / the forward proceeds.)
  • 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.

No visible change: nothing this PR changes shows on screen.

How to check

  • Base commit (main): 94e0f2dc274f1cbd63bde7cc343e47babb87cff3
  • Head commit: 8f85e2f4a293704b421433326e59993a8e559ddb
  • Machine: a Mac on Apple Silicon (arm64) · macOS 27.0 · Zig 0.17.0, Xcode 27.2, nvcc n/a (no NVIDIA GPU on this host)

Test results:

  • zig build test-inkling2-host at 91b5e21d4874 (older head): 1 passed, 0 failed, 0 skipped
  • zig build test-inkling2-cuda-host at 91b5e21d4874 (older head): 1 passed, 0 failed, 0 skipped
  • zig build test test-golden at 91b5e21d4874 (older head): 17473 passed, 5 failed, 131 skipped

… widths the attention kernels do not run, before loading

Moves the fixed kernel widths (head_dim 128, d_rel 16) and the mixes' eight
finished-block cap into config.zig, where parse refuses a checkpoint that
names any other value; kernels.zig, ops.zig and the Metal attention plan
read the same constants.
… past

read() masked handle % ring and returned whatever newer token sat in that
slot once the ring wrapped; an expired handle now fails with
InvalidInklingTokenHandle like a future one.
…launch

A corrupt or off-checkpoint id used to index the embedding table out of
bounds; the forward now fails with InvalidToken in the same host-side
loop that already casts the ids.
@AIFlowML

Copy link
Copy Markdown
Contributor

I test-merged 8f85e2f4a293704b421433326e59993a8e559ddb into main 4c79cfe346d3c239ff7dfd7aa694df799755bafa. On Apple silicon with Zig 0.17.0, zig build test-inkling2-host test-inkling2-metal-host -Dfixed-cpu --summary all exited 0 with 148 passes and 10 skips. The Metal host step ran 102 passes and six skips. It emitted a JPEG-library version warning, but the step completed successfully. The host targets import the new config and Metal ring-handle tests.

I then applied #4724 (b918bc4b6126abbba9531166573a8b403775c428) to that tree because it also touches loop_engine.zig. The trial merge stayed clean. The same host command passed 154 with 10 skips, including the six additional host cases. This checks the interaction of the two heads in that order. CUDA and live checkpoint serving were outside this run.

Igor Lessio - AIFLOW LABS

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