Repository navigation
Inkling 2: image input, the checkpoint's vision tower (5/5, split from #405) - #418
Merged
AzeezIsh merged 6 commits intoNov 25, 2026
Merged
Conversation
q, k, v, the relative-bias and gate projections, the sinks and the dynamic convs' taps ran as six to eight GEMV launches a visit, each small (24 to 3,072 outputs over K = 2,304). inkling2_proj_gemv runs them as one: each segment of a per-visit device table (written once the shared buffers attach, one a row count up to 8) is one projection's input rows, weight and output, and every output row is the chain dense_gemv_bf16_batchm computes for it (the common body now takes its block index). A visit with a quantized projection (Spark weights) keeps one launch each. Observed on one GB10, plain Strict decode (no drafter), saver size, greedy text and the six-prompt concurrency hashes identical to engine d1b138e: C1 code/prose 35.84/35.87 -> 36.37/36.37 tok/s (server rate, 3 runs), aggregate C2 51-53 -> 52-55, C4 79-80 -> 80-82, C8 115-118 -> 118-120 (2 rounds of 2 runs). Co-Authored-By: Claude Opus 5.5 <[email protected]>
`--tool-guard stream` screens the same calls as `on`, at the same point (each call's end, and the aggregate size bound as bytes arrive), but sends a call's header and arguments as they are written instead of holding them until the call passes. A call it blocks, or one the response cuts off, ends the response `content_filter` (not `tool_calls`) with STREAMED_REFUSAL, which says part of the call streamed and that it must not be run. Poolside v1 calls stay held: its detector buffers them anyway. `off` and `on` are unchanged, and `off` stays the default. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Under `--tool-guard stream` every request got its tool calls as they were written. A client that does not read `content_filter` would run a call the guard blocked at its end, or an unclosed one. A request now gets streamed tool calls only with the body field `stream_tool_arguments: true` (an Atlas extension on /v1/chat/completions); without it the call is held, and the response is the same as under `--tool-guard on`. This covers the generic stream path and the Poolside v1 string-argument path. Under `on` and `off` the field is accepted and ignored. A working-directory hint, ATLAS_BUFFER_TOOL_ARGS and tool retry still hold a call as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`pc_plan_branch` returned early for a model with no SSM layers, so `ATLAS_GLM_PC_BRANCH` never planted a checkpoint for Inkling 2, whose prefix hits resume from its short-conv state on the same snapshots. Gate on `snapshot_prefix_state()` instead, the gate the prefix lookup already uses (identical for SSM models). For a client that rebuilds its last few messages every turn (a voice rig: system, history, then three trailing user blocks re-rendered each turn), every user turn diverged ~500-700 tokens before the previous prompt's end and restored from the cold prefill's chunk boundary, replaying a growing 4.1-5.1K tokens. With the switch on (min 512), the first such turn plants a checkpoint at the divergence and later turns restore there. Observed, single run, one GB10, Strict, saver flags (prefix caching, 64 slots, chunk 4096), 16.4-17.4K-token prompts, 8 turns: user-turn TTFT 1.33-1.73 s -> 0.61-0.82 s (the planting turn 1.33 -> 1.49 s); follow-ups unchanged at 0.29-0.32 s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`tool_choice` required (or a named function) constrains the output to the Hermes grammar, so the model writes `<tool_call>` text with no Inkling block header. The rewrite passed that through without the think end, so a streamed request with thinking on read the call as reasoning and the in-think leak guard cut the response (finish `length`, guard `in_think_tool_leak`); effort none and the blocking path were unaffected. Text between blocks now closes the reasoning first, as a text block does. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Inkling 2 Mini takes images; the target served text only. This adds its tower (`model.visual.*`, transformers `Inkling2VisionModel`) as a third `VisionTower`: - config: `vision_config` (`inkling2_vision`) parses to a `VisionConfig` with the new `is_inkling2` marker; the image token is the processor's `<|unused_200054|>` (200054), which `config.json` does not carry. - preprocessing (`vision_preprocess/inkling2.rs`): no resize. The image is padded to 40x40 pixel tiles (padding -1 on the 0-255 scale, alpha on the reference checkerboard), one token per tile, patches emitted tile by tile. An image of more tiles than the encoder holds is scaled down first (the reference has no such bound). Video is refused. - tower (`inkling2_vision.rs`): Linear patch embed, CLS token, a learned 32x32 position table resampled bilinearly per image, pre-LayerNorm, 23 blocks with axial 2D RoPE on Q/K and layer scale, then a bias-free projector over each 2x2 block. It runs on the shared `vision_encoder` kernels (the nemotron file, symlinked): q/k rows are permuted per head at load from the reference's interleaved rotation pairs to the kernels' halves, and layer scale is folded into out_proj / c_proj. - prompt: the template writes one image token per image; `expand_vision_pads` repeats it per tile (no start/end markers). - embedding norm: the reference norms token embeddings inside the embedding and scatters image features in afterwards. The first visit normed its whole input, which also normed image rows (coarse content survived, text in an image did not). The table is now normed once at load, in place, with the same kernel and epsilon, and no visit norms; the drafter's anchor row skips its own copy of that norm (`embed_norm` NULL). Checked on one GB10 (Strict, development build): tower output against the transformers implementation on a 760x300 text image (152 tokens): mean row norm 5.437 vs 5.432 (float32), sampled values within 0.003; an invoice image transcribed exactly, a 3x3 labelled colour grid read 9/9. Greedy text of three text prompts byte-identical to d1b138e after the norm moved. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This was referenced Nov 24, 2026
Closed
Contributor
|
Queued in train #421 ( 🤖 Generated with Claude Code |
This was referenced Nov 25, 2026
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.
Change 5 of 5 split from #405, stacked on #417 (review the top commit). The tree at this branch's head is identical
to #405's last head (
1a3675294; treea9945facd).What
The checkpoint's vision tower (
model.visual.*, transformersInkling2VisionModel) as a thirdVisionTower(
spark-model/src/inkling2_vision.rs), on the sharedvision_encoderkernels (the nemotron file, symlinked):vision_config(inkling2_vision) parses to aVisionConfigwith a newis_inkling2marker. The image token isthe processor's
<|unused_200054|>; the template writes one per image andexpand_vision_padsrepeats it.vision_preprocess/inkling2.rs) followsInkling2ImageProcessor: no resize, the image padded to40x40 pixel tiles (padding -1 on the 0-255 scale, alpha on the 204/153 checkerboard), one token per tile. One
deviation: an image of more tiles than the encoder holds (
derive_max_patches) is scaled down first. Video isrefused.
pre-LayerNorm, 23 blocks with axial 2D RoPE on Q/K and layer scale, then a bias-free projector over each 2x2
block of patch states. The kernels rotate channel pairs
(d, d + D/2)and know no layer scale, so at load theq/k rows are permuted per head from the reference's interleaved pairs and layer scale is folded into
out_projand
c_proj.it. The first visit normed its whole input, image rows included. The table is now normed once at load, in place,
with the same kernel and epsilon, and no visit norms; the drafter's anchor row skips its copy of that norm.
Outside the Inkling files:
VisionConfig::is_inkling2(false in every existing literal);VisionTower::Inkling2;image_pad_token_id()also resolves Inkling's image token; a video part is refused for this tower. This setsvision = trueinkernels/gb10/inkling-2-mini/MODEL.tomland adds thevision_encodersymlink under gb10 only; Ihave not touched
kernels/strix-hip/inkling-2-mini.No GPU run on this rebased branch; the GPU observations above were made on #405's old base.
Benchmarks
RigMark protocol 1.1.0 on one GB10, the whole stack before the tool-guard opt-in (#405's
6cf40a5a0) built intothe SparkInkling 0.4.1 image (default profile, DSpark with
ATLAS_DFLASH_BATCH_DEPTH=1:7,1000000:0andATLAS_DFLASH_ADAPTIVE=1, branch checkpoints on), medians, tok/s; receipts inEnntity/sparkinkling results/2026-11-23-release-0.4.1.
Strict structured decode is lower than at #401's head: its two runs read 72.7 and 87.1, and in the slower one half
the steps decoded without drafts (
serial=0.51). Not fixed here.Test plan
inkling2_visionhost tests (patch order, bilinear taps, RoPE table layout, head-row permutation, layer-scalefolding),
vision_preprocess::inkling2tests (tiling, padding value, the capacity fit, the checkerboard), thevision_configparser testimage (152 tokens): mean row norm 5.437 vs 5.432 (float32), sampled values within 0.003; an invoice image
transcribed exactly; a labelled grid; greedy text of three text prompts byte-identical to before the norm moved
probe 30/30 and 10/10
cargo fmt --all -- --check,cargo clippy --workspace --tests, the file-size cap script;spark-model --lib2,503 passed;spark-server --bin spark3,248 passed and 5 failed only for my container (no.gitcheckout or real disk: thebench_selfstartserve pin, twotui::bench_variants, twomodel_download::free_bytes);atlas-tool-guard19 passedspark benchmark run <gate> --pull-request-gategates and the strix-hip build: left to the maintainersAuthorship
AI-authored: Claude (Opus 5.5 and Fable 5.2) in Claude Code, directed and reviewed by a human; no hand-written code.
CLA
🤖 Generated with Claude Code