Skip to content

Inkling 2 Mini (inkling2_loop) on GB10: Strict and Spark modes, DSpark drafter - #401

Merged
AzeezIsh merged 49 commits into
Atlas-Inf:mainfrom
Enntity:inkling2/mini-20261121
Nov 23, 2026
Merged

AzeezIsh merged 49 commits into
Atlas-Inf:mainfrom
Enntity:inkling2/mini-20261121

Conversation

@data-angel

@data-angel data-angel commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Thinking Machines' Inkling 2 Mini on one DGX Spark, from the checkpoint as shipped (thinkingmachines/Inkling-2-Mini),
kernel target inkling-2-mini (overlay over laguna-s-2.1 / common). References: huggingface/transformers#51050
(models/inkling2_loop), ggml-org/llama.cpp#32694, vllm-project/vllm#69028 (DSpark), all Apache-2.0 / MIT.

What

The model

24 physical layers run as 48 visits (core layers 6-17 loop three times), so Atlas sees 48 layers, each visit with its
own KV pool. New layer layers/inkling2/ (one TransformerLayer per visit, layer-major with per-row state in shared
buffers): SWA-1024 and full attention without RoPE, a relative-position bias and per-token sinks in the logits
(decode kernel, and INKLING2_PREFILL_BIAS / INKLING2_ROW_SINKS hooks in prefill_paged_compute.cuh, off for every
other target), q/k L2 clip and log-length scaling, short convolutions with per-sequence fp32 state (static and dynamic
taps), block attention residuals, loop message gates, softcapped SwiGLU experts (NVFP4 layers 0-19 and MXFP8 layers
20-23 read straight from the stacked checkpoint tensors), logit softcap 30.

Config: parsers/inkling2.rs unrolls the loop into the visit schedule; the loader checks the checkpoint layout at load.
Server: reasoning parser for <|content_thinking|> blocks, Inkling's JSON tool blocks mapped to Hermes tool calls
(inkling_turn.rs), tool prompts through the template's tojson, MODEL.toml behavior (thinking default,
no tool grammar, loop guards off).

Modes

  • Strict: the checkpoint as shipped (BF16 attention, lm_head and router; NVFP4/MXFP8 experts).
  • Spark: the same plus a calibrated NVFP4 overlay (GPTQ) of the attention projections, lm_head and the layer 20-23
    experts, loaded from ModelOpt names when the model dir's index maps them (weights.rs). The overlay is published
    separately: Enntity/Inkling-2-Mini-Spark-NVFP4 (KL 0.0081 to the checkpoint as shipped, 224 held-out documents).

Decode, batching, speculation

  • CUDA graphs for single- and multi-sequence decode. New trait hooks: multi_seq_prestage (refresh a layer's
    per-sequence state table before capture/replay), multi_seq_decode_graph_unsupported, padding_state (a padding
    row's state; Inkling's share one pad buffer instead of allocating per padded step), batched_decode_graph_unsupported
    (verify graphs stay off for Inkling).
  • Verify rows journal the conv state and inputs; rollback_aux_verify restores and replays the accepted rows
    (inkling2_sconv_rewind). decode_multi_seq_rows handles one or several sequences' verify rows.
  • DSpark drafter (mtp.safetensors) as a variant of the DFlash head (dflash_head/inkling.rs): per-layer 4-tap mix +
    dflare_norm context, own context K/V projections, anchor/mask block input, the recurrent (rnn_hidden) Markov tail
    with hidden_out folded into the target head at load. parse_dflash_config reads the checkpoint's mtp_config
    (+ vocab_size) as a bidirectional DFlash drafter; the taps name visit inputs, so the capture indices are visit - 1.
    Drafter dir = mtp.safetensors as model.safetensors beside that config; serve with
    --dflash --draft-model <dir> --dflash-gamma 8 --num-drafts 7. One sequence proposes at a time
    (propose_batch_max 1); ATLAS_DFLASH_BATCH_DEPTH=1:7,1000000:0 keeps it to lone requests.

Prefill

  • Experts at the checkpoint's declared numerics. hf_quant_config.json requires the experts' inputs quantized:
    NVFP4 rows for the NVFP4 experts ("fouroversix_mae": per-row outer scale amax / 1536, per-16 E4M3 block scale
    taking the block maximum to 6 or to 4, whichever reconstructs it with the smaller absolute error) and MXFP8 rows for
    the MXFP8 ones, as vLLM's Inkling 2 kernels run them. Prefill does the same: quantizers
    (inkling2_quant_fp4, inkling2_situ_quant_fp4, inkling2_quant_mxfp8, inkling2_situ_quant_mxfp8), grouped
    inkling2_moe_gemm_w4a4 / _w8a8 on mma.sync kind::mxf4nvf4 / kind::mxf8f6f4 over the experts as stored, and
    a compact (expert, row-tile) schedule (inkling2_moe_tiles). Decode and verify rows (< 16) keep BF16 inputs; the
    Spark overlay's experts too.
  • Attention. inkling2_flash_prefill: GQA flash attention for chunks of >= 64 rows (one CTA per KV head and
    64 queries), the relative-position bias computed where it is added (bit for bit the per-head kernel's table, which
    was q_len x heads x 1024 BF16 written and read every visit), and an unmasked path for tiles that need neither masks
    nor bias.
  • Loop gates and residuals. inkling2_msg_gate_fused (the message gates on the tensor cores, 16 rows a CTA) and
    inkling2_block_res_row (both block-residual passes in one CTA a row).

Decode

  • Expert GEMVs read each weight row's block scales in one request (shared memory) instead of a 2-byte load per
    16-byte code chunk, decode E2M1 with cvt.rn.f16x2.e2m1x2, and read the activation row from cache; decode
    attention and the block residuals bound their per-head loops at compile time (ptxas had put the arrays in a
    176-byte local frame); the short conv rolls its own state on decode rows; the row RMSNorm holds its row and
    weights in registers (its runtime-bounded stride loop paid one memory latency per step, 153 times a token).
    All bit-identical.
  • Spark mode: prefill rows (>= 16) read the checkpoint's own BF16 projections and experts; the NVFP4 overlay serves
    decode and verify. The BF16-dequant prefill GEMM paths are removed.
  • pdl.rs: an inkling-2-mini PDL target, always on (pdl::ALWAYS_ON, no env switch), listing exactly the
    target's waiting kernels plus the common decode GEMVs, routing and KV write (the pdl_tests.rs contract holds).
  • Decode batches and verifies of up to 8 rows run BF16 projections on dense_gemv_bf16_batchm (each row the one-row
    GEMV's chain) and router logits on its FP32 twin (inkling2_router_gemv.cu, in this target): Strict RigMark
    C2 / C4 / C8 49.5 / 79.2 / 120.2 -> 52.7 / 81.9 / 122.7.
  • Tool calls at thinking effort 0: the checkpoint can open a call as <|content_text|>NAME<|content_invoke_tool_json|>;
    inkling_turn.rs holds a text block's opening while it reads as a name and turns it into a call at the marker.

Prefix caching

A visit's only per-sequence state besides its KV is its short-conv state (fp32, about 100 KB a visit), so the radix
prefix cache carries it on the Marconi snapshots as each layer's aux blob, with no SSM layers:

  • ModelConfig::aux_prefix_state() (inkling2_loop only) and snapshot_prefix_state() (SSM layers or aux state);
    the snapshot gates in dispatch (tail split), prefix_lookup, prefill_a, reserve and pc_inflight use the
    latter, and build.rs keeps the prefix cache on for an aux-state model.
  • SsmSnapshotPool::new(.., aux_only): Marconi on with no SSM blobs (hidden states and aux only).
  • Inkling's layer implements has_aux_state / snapshot_aux_into / restore_aux over its conv state (pad rows
    excluded); the readback can go through the pinned stage (ATLAS_QWEN4EXP_AUX_PINNED=1).
  • ModelConfig::tail_split_min_tokens() (512 for inkling2_loop, 0 otherwise): a shorter prompt runs its last
    chunk as one pass. The tail split's extra pass of up to 32 rows still reads nearly every expert (about 0.1 s);
    recomputing so short a prompt next turn costs less. Length-only, so cold and warm keep the same pass shapes.

Changes outside the Inkling files

  • The 128 x 128 W4A4 tile of qwen3.8-flash-next/nvfp4/moe_prefill_w4a4.cu moves to
    kernels/gb10/common/nvfp4_w4a4_tile.cuh, unchanged for Qwen (the qwen3.8-flash-next target builds), and gains an
    MXFP8 mode (w4_tile<true>) for Inkling's W8A8 experts.
  • lm_head_project_batched (batched decode head) now applies the logit softcap like the single-row and verify heads.
    Before, a softcapped model sampled its C>=2 rows from uncapped logits (greedy unaffected).
  • dflash_width::spec_width_ok: an ATLAS_DFLASH_BATCH_DEPTH table may also stop speculation at two sequences
    (the default table still speculates there).
  • Batched BF16 head: batch GEMV for <= 8 rows on Inkling only (batched_head_gemv); the scalar dense_gemm took
    11.4 ms at 2 rows on its 201K x 2304 head.
  • DFlash head: the small-M GEMV arm on for the Inkling drafter; store_has_dflash_weights also recognizes
    fuse_weight.
  • kv_only_prefix_cache_is_safe() stays false for inkling2_loop: its prefix hits go through the snapshots.
  • No new ATLAS_* names: check_env_budget.py reports 1,139, main's count (main is over its 1,091 on its own).

Why

Inkling 2 Mini (Apache-2.0, 26.4B total / 3.4B active, looped MoE, 1M context) fits one GB10 with room for KV, and
its checkpoint ships in formats GB10 reads natively (NVFP4 and MXFP8 experts) plus a trained DSpark drafter. This
brings it to Atlas as shipped (Strict), with a Spark mode for speed. Product wrapper: Enntity/sparkinkling.

Benchmarks

RigMark protocol 1.1.0 (--runs 2 --prefill-runs 2, reasoning low, temp 0) on one GB10, this branch at f0f0a2c
built into the SparkInkling 0.4.0 image (default profile: 8 sequences, BF16 KV, 0.80 memory, 4,096-token prefill
chunks, programmatic dependent launch, prefix caching with 128 snapshots), DSpark with ATLAS_DFLASH_BATCH_DEPTH=1:7,1000000:0 and ATLAS_DFLASH_ADAPTIVE=1.
vLLM: vllm/vllm-openai:inkling-2-mini (sha256:c2dc759f5984) on the same Spark, the checkpoint as shipped.
Medians, tok/s; receipts in
Enntity/sparkinkling results/2026-11-21-release-0.4.0.

32K prefill code decode prose decode structured C1 / C2 / C4 / C8 short code
Atlas Strict + DSpark 3,277 49.2 33.6 86.4 35.9 / 49.1 / 78.1 / 119.6
Atlas Spark + DSpark 3,275 66.8 51.6 96.4 50.9 / 72.0 / 101.3 / 134.9
Atlas Strict, 035de22 (first version of this PR) 1,455 52.0 22.2 79.2 31.7 / 44.4 / 71.4 / 108.7
vLLM, no speculation 2,722 35.1 35.6 35.6 35.1 / 54.0 / 86.6 / 122.4
vLLM, DSpark (7 drafts, probabilistic) 2,723 69.8 31.2 104.3 43.4 / 60.9 / 94.7 / 144.0

The 32K prompt sent again answers in 0.16 s (Strict) against 10.0 s cold. Cold prefill is about 2% (32K) to 5-6%
(8K) below the version without prefix caching: the tail split's extra pass.

Known gaps against vLLM: Strict at two to eight requests and on prose (0.90-0.98x), the 8-row DSpark verify step,
batched drafter proposes, and decode expert inputs still BF16.

Not in this PR (follow-ups)

Batched DSpark propose, probabilistic draft acceptance, vision.

Two follow-up PRs carry the work that came after the verified head e6a8a0420: budget forcing and streamed
tool-call arguments (inkling2/budget-forcing-20261122), then image input, the streaming tool guard, branch
checkpoints for aux-state models and fused Strict projections (inkling2/images-and-serving-20261123).

Authorship

AI-authored: Claude (Opus 5.5) in Claude Code, directed and reviewed by a human; no hand-written code.

Test plan

  • cargo fmt --all -- --check
  • clippy --tests on spark-model / spark-server: clean for every touched file (the Mac toolchain flags four
    pre-existing sites in untouched files)
  • SPDX headers, kernel shadow structure, typos on the new files
  • GB10: targeted tests inkling2, dflash_loader, lm_head_batched, dflash_width, prefix_cache
  • GB10 serving: greedy parity against transformers (29/29 tokens, top-5 |dlogp| 0.14 Strict / 0.33 Spark,
    before the prefill expert quantization), multi-sequence graph vs eager outputs, speculative vs drafter
    variants, RigMark (above)
  • GB10 prefill rework: per-visit state dumps of a 3,825-token prompt bit-identical step to step for the bias
    move, block-residual fusion, tile schedule and unmasked attention path; fused gates within 1e-4 of the
    two-kernel path at the first gated visit; W8A8 experts equal to the BF16 path over fake-quantized rows at
    their first visit; task probe 30/30 math, 10/10 tool calls in both modes
  • qwen3.8-flash-next kernel target builds with the shared W4A4 tile
  • GB10 decode rework: greedy text of three probe prompts bit-identical across every step; pdl_tests.rs with
    the new target; task probe on the 0.3.0 image 30/30, 10/10 in both modes
  • GB10 prefix caching: replayed, extended and two-turn prompts (greedy text identical to cold), the disk tier
    under forced eviction (identical to the tier off); methods_tests for the new config gates
  • spark benchmark run <gate> --pull-request-gate gates: left to the maintainers

Notes for reviewers

  • The verify rollback is exact by construction (state restore + replay of the accepted inputs); greedy text with
    speculation can still part from plain decode at near ties because a verify runs the 8-row kernels.
  • ATLAS_DFLASH_BATCH_DEPTH=1:7,1000000:0 is a recommendation for this model, not a default: the drafter proposes
    one sequence at a time.
  • Padding rows of batched decode now get padding_state instead of alloc_state; the default is unchanged for
    every other layer.

CLA

  • I have read and agree to the Contributor License Agreement.

🤖 Generated with Claude Code

data-angel and others added 30 commits November 20, 2026 17:54
The loop core runs three passes with shared weights, so the engine sees
prelude, core x3 and coda as 48 layers (each its own KV and conv state)
and Inkling2Config maps every visit back to its physical layer. NoPE,
gated attention, sigmoid-routed 128x top-8 MoE with bias and route scale,
final softcap 30, and the DSpark drafter fields. Variable loops, shared
experts and a sliding window that differs from the relative-bias extent
are refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Registers `inkling2_loop` with a loader that validates every
`model.llm.` tensor (name, dtype, shape, per-layer NVFP4 or MXFP8
experts, loop controllers) against the config and refuses unknown
tensors, then declines to build layers until the Inkling attention,
block-residual, conv and loop kernels exist. Tested against the
release's safetensors header (text tensors only).

Also fixes the parser's weight prefix: Atlas joins it as
`{prefix}.layers.N`, so the trailing dot produced `model.llm..layers.N`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sinks

paged_decode_attn's single-token kernel (BF16 paged KV, 8 warps, online
softmax) plus Inkling's logit terms: each CTA builds its head's
rel . P bias row for backward distances < rel_extent in shared memory,
and a per-token sink logit with a zero value joins the normaliser.
Sliding window as a mask, as in paged_decode_attn.

Not compiled into any target yet (no MODEL.toml). A ctypes microtest
against transformers' eager Inkling attention math (fp32) passes at
<= 7.7e-3 max abs error (BF16 output rounding): windows 1024 and full,
lengths 1 to 5000, shuffled pages.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…state

One thread per (row, channel) over flat decode/verify/prefill rows:
earlier inputs of the row's own sequence come from x, older ones from
the per-slot fp32 state; a second kernel rolls each sequence's state
forward afterwards, so no row reads a state being replaced. Static:
(depthwise k-tap conv + x) / sqrt(k+1); dynamic (full-layer k/v):
per-token taps static[lag] + projected[head, lag], (sum + x) / sqrt(2k+1).
No activation, unlike causal_conv1d.

Not in a target yet. Microtest against transformers' conv math: <= 1.4e-2
max abs error (BF16 output rounding) at 1024 and 2304 channels, decode,
continued and fresh prefill; rolled states bit-identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One CTA per row: softmax over the token's saved BF16 block states and
its fp32 or BF16 partial sum, each gamma-free RMS-normed, against 1-4
learned fp32 queries (attention/MLP input, the full layers' q/k/v
inputs, the loop's four messages); outputs the weighted sum of the
normed states in fp32. One pass gathers sums of squares and raw query
dots for every state, a second builds the outputs.

Not in a target yet. Microtest against transformers' block residual
math: <= 9.5e-7 max abs error for 0-8 blocks and 1-4 queries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… gate

inkling2_head_norm (one warp per row x head): q/rel L2 clip after a
learned per-head scale, k clip, optional log-length scaling for full
layers (rounded to BF16 before and after, as the reference does), and
the gamma-free v RMSNorm. inkling2_msg_gate: the loop's cross-pass
mix (1 - tanh(F z)) h + tanh(G z) m with z = D [rms0(h); rms0(m)].

Not in a target yet. Microtests against transformers' op order:
head_norm within one BF16 ulp; msg_gate 1.6e-4 of max |out| (z is
rounded to BF16, so a different sum order can flip a z by one ulp).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…oint tensors

gate_up, down and combine for decode/verify rows, NVFP4 (E2M1 codes,
E4M3 per-16 scales, per-expert amax / denominator) and MXFP8 (E4M3
values, E8M0 per-32 scales), addressed by expert offset into the
release's [E, N, K] tensors. w13 rows interleave gate and up, so one
warp produces both halves of an activation and applies the softcapped
SwiGLU (tanh caps 4 and 25) with the reference's BF16 roundings;
combine sums the BF16 expert outputs times the routing weights in fp32.

Not in a target yet. Microtest on the release's own experts (layer 0
NVFP4, layer 20 MXFP8) against transformers' dequant + Inkling2Experts
math with fp32 weights: outputs within 2.0e-3 / 8.9e-4 of max |out|.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Typed argument structs and checked launches for the decode attention,
short convs (+ state roll), block residual, head epilogue, loop message
gate and routed-expert decode kernels, plus one struct resolving every
handle at load. Unused until the per-visit Inkling2Layer lands.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Per visit: physical layer, pass, loop layer, block-boundary push, blocks
on the stack, the prelude save, the later passes' restart and the
previous-pass blocks their messages read, first and last visit. Derived
from Inkling2LoopTextModel.forward; tested on the Mini config (48 visits,
stack sizes 0-4, restarts at visits 18 and 30 reading one message block).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One Copy struct per physical layer (input norms, q/k/v/r projections,
clip scales, gate, output, sinks, static or dynamic k/v convs, post
convs, router + bias, stacked experts, loop message gates, block
residual queries) and the model-level embedding norm, final output
query and cross-pass message queries. NVFP4 experts get their per-expert
amax / denominator globals computed once at load; everything else points
into the store as stored, so all visits of a layer share it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inkling2Layer runs one visit of a physical layer for one token in the
reference's order and dtypes: block-residual attention inputs, the loop's
message gates on later passes, input norms, BF16 projections, k/v short
convs, head clip/norm epilogues, BF16 KV write, decode attention with
relative bias and sinks, sigmoid output gate, post-attention conv, block
push and fp32 residual, MLP block residual, fp32 sigmoid routing, stacked
NVFP4/MXFP8 experts with the softcapped SwiGLU, post-MLP conv. Visit 0
applies the embedding norm and uploads the token's metadata for all
visits (so decode is graph-ineligible for now); restart visits stash the
previous pass and restore the prelude; the last visit applies the final
block residual. Conv state is per sequence and visit; block stack and
scratch are shared via attach_layer_buffers.

The loader builds each physical layer's handles once and 48 visit layers
over them; kernels/gb10/inkling-2-mini compiles Laguna-S-2.1's set plus
the Inkling overlay (and the logit softcap, copied from gemma-4-26b-a4b).

Untested on GPU end to end; prefill falls back to per-token decode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The model runs prefill layer-major, so the per-visit layer now carries
`rows` tokens of one sequence end to end (a decode step is one row): the
block stack (block-major), prelude save and loop messages are per row,
visit 0 uploads every row's position, slot and length, the KV of all rows
is written before attention, and attention runs each row as its own
query over the sequence's shared block table. Multi-row projections use
the BF16 GEMMs (fp32 output for the router) and the batched fp32
sigmoid top-k; one-row decode keeps the GEMVs.

Also: pre-flight accepts `*.embed.weight` and counts the loop's physical
layers; the plan accepts the release's padded vocabulary rows when the
server caps vocab_size at the tokenizer's; the target declares the
model-build probe it never dispatches; chat templates' transformers-only
`{% generation %}` blocks compile as always-true ifs (same whitespace
control; hf_tags.rs, with tests); env-gated per-visit hidden and
intermediate dumps (ATLAS_INKLING2_DUMP, ATLAS_INKLING2_TAP) for
comparison with the transformers reference.

On one Spark (single sequence, BF16 KV, eager): visits 0-46 track the
reference's per-visit hidden states (short prompt, 25 tokens) within
0.3-12% relative L2; greedy chat output matches the reference's first
~35 tokens, then drifts by a word. Observed ~12 tok/s decode with no
graphs, no fusion, no drafter; not a benchmark.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… default

thinking_default = false made the server pass reasoning_effort "none", which
the template renders as 'Thinking effort level: 0'. With thinking on and
verbatim_prompt the effort stays undefined, so an effort-silent chat renders
the template's own 0.9, token-identical to transformers (25 tokens on the
short reference prompt, was 23).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inkling 2 writes a turn as message blocks: <|message_model|>, an optional
name and a content-type token open each one, <|end_message|> closes every
one, and all of them are special tokens. inkling_turn.rs rewrites the
generated ids before the chat paths see them: headers go, the first
block's close stays as the think end (a synthetic one ahead of an answer
the model did not think before; none with thinking off, whose body is
dropped), and each JSON tool block becomes a Hermes <tool_call> with
"arguments", re-encoded once its close arrives. Streaming and blocking
share it, so /v1/chat/completions, /v1/responses and /v1/messages agree.

The reasoning parser `inkling2` reports that its end tag closes more than
reasoning, so the scheduler gets no think-end token: its post-close and
mid-word masks and the reasoning floor would forbid the closes the answer
needs. The model's own effort token in the prompt remains the only
thinking control, as on the reference.

Prompts: templates that call tojson with sort_keys or separators now get
a json.dumps-compatible filter (transformers' semantics); a bare tojson
keeps minijinja's builtin. Inkling's tool results are named through
their tool_call_id, which now reaches its template. MODEL.toml turns the
Hermes tool grammar off for this target.

Checked on one Spark against transformers: rendered prompts token-identical
for plain, system plus effort, tool declarations and a tool-call history
with results; greedy chat returns reasoning, answer and a get_weather call
the same way streamed and blocking. Known gaps: usage.reasoning_tokens is
0, streamed return_token_ids carry the rewritten ids.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
decode_multi_seq now runs one forward over one token each of the batch's
sequences instead of the default per-sequence loop, which ran the model
layer-major across sequences and let one sequence's block stack and
prelude save overwrite another's between visits. Every per-row state was
already per row; what changes is the metadata and the conv states:

- batch.rs: a forward's sequences (one sequence's consecutive rows, or
  one row each of several), uploaded by visit 0 as positions, KV slots,
  lengths, a row-to-sequence map and block tables (one shared table for
  a single sequence, one per row otherwise, strided by the longest).
- The short-conv kernels take a table of per-sequence state pointers
  plus the conv's offset, so each sequence keeps its own allocation.
  Each visit owns a row of the table and re-uploads it only when the
  batch's sequences change.
- attach_layer_buffers also receives the server's decode batch size,
  which sizes the block-table and state-table buffers.
- decode_batched runs as one forward; decode_multi_seq_rows (verify
  rows of several sequences) refuses rather than run with throwaway
  conv states.
- layer.rs splits into layer/forward/calls/batch/debug under the
  500-line cap.

Checked on one Spark (preliminary, single run): with --max-num-seqs 8,
a lone request gives the same greedy text as before; six different
prompts sent together each stay on their own prompt, including after one
finishes early, and track their solo text until a near tie (the first
split checked is an exact logprob tie in the solo run). Aggregate decode
rose from 11.6 to 20.5 tok/s on the unfused eager path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The loop's message gate ran one CTA per row, so a decode step's gate (a
rank-64 projection of the [h; m] norms and two [H, 64] up-projections,
~1.2 MB of weights) ran on one SM: 343 us a call, 97 calls a step, 42%
of decode GPU time in an nsys capture of steady C1 decode.

Two kernels replace it: _z, one warp per (row, gate, rank element) with
16-byte loads, and _out, one thread per (row, channel), which takes up to
three gates of a visit at once and reads every gate's inputs before it
writes (an SWA layer fans one input out to the q, k and v gates; out may
alias h). A visit's q/k/v gates are one launch pair; the MLP gate another.
Same roundings as before (BF16 inputs to the projection, BF16 z); only
fp32 sum order changes.

Checked on one Spark: per-visit hidden rows on the short reference prompt
stay within 0.3-12% of transformers (as before), greedy text unchanged.
Preliminary single run: C1 decode 12.3 -> 20.2 tok/s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…in shared

The routed-expert GEMVs decoded E2M1 through a __constant__ table that
every lane indexes independently, which constant memory serializes (the
note in common/w4a16_gemv.cu: ~14 transactions a read). A byte-indexed
pair table (256 float2) now sits in shared memory, as Atlas's w4a16 GEMV
stages its own. The kernels also read weight rows in 16-byte chunks
against the activation row staged in shared memory: gate_up runs a warp
per activation with half-warps on the interleaved gate and up rows, down
runs 8 lanes per output row. The launcher checks the expert tensors'
alignment for those loads.

Restructuring alone moved nothing (gate_up stayed ~376 us for 21 MB, ~56
GB/s); the shared table is what moved it. Checked on one Spark: per-visit
hidden rows within 7% of transformers (visits 0-46), greedy opening now
matches the reference's punctuation too. Preliminary single run: C1 decode
19.8 -> 29.9 tok/s, TTFT on 25 tokens 0.79 -> 0.32 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The visits stop uploading decode metadata themselves: a decode forward
reads the positions, KV slots and block tables the model stages before
each step (stable buffers refreshed ahead of replay), sequence lengths
come from the positions, and the short convs locate a sequence's rows by
a rows-per-sequence count instead of offset tables. Visit 0 still uploads
for prefill and verify runs, which the model stages without a device
block table. decode_prestage binds the decode sequence's conv state into
each visit's table before capture or replay; a table change under capture
is an error, so a bad capture falls back to eager.

Batched decode and verify graphs stay off for this model through a new
TransformerLayer::batched_decode_graph_unsupported (defaults to
decode_graph_unsupported, so other models keep their behaviour): for a
model without SSM layers their graph key is the padded batch size, so a
replay would keep one batch's state tables after the sequences change.

Checked on one Spark: per-visit hidden rows within 7% of transformers;
C1 greedy text unchanged under graph replay; six concurrent prompts stay
coherent. Preliminary single runs: C1 decode 29.9 -> 33.7 tok/s; six
concurrent 795 tokens in 15.6 s (51 tok/s aggregate, was 20.5).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kernels: the block attention residual ran one CTA per row (a decode step
on one SM, latency-bound at ~20 us a call, 120 calls a step). It now
splits the hidden dimension into 256-channel chunks over two launches:
_sums writes each chunk's per-state sums of squares and query dots, _out
adds them up, takes the softmax and writes its chunk.

atlas-core: inkling2_loop joins laguna and ricursive in keeping the
checkpoint's BF16 lm_head instead of a runtime NVFP4 twin, so Strict
serves the shipped formats (--lm-head-dtype nvfp4 still forces the twin).

Checked on one Spark: per-visit hidden rows within 11.5% of transformers
(visits 0-46); with the NVFP4 twin the greedy text is unchanged by the
block-residual split. With the BF16 head the greedy text splits at an
exact logprob tie (':' and '.' both -0.887 after "accuracy"), which the
reference broke the other way. Preliminary single runs, C1 decode: NVFP4
twin 33.7 -> 35.4 tok/s from the split; BF16 head 32.2 tok/s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One CTA per query head walked a row's whole context, a warp per key at a
time: 24 CTAs for a decode step, each K/V row read once per query head
of its GQA group, latency-bound (~52 us a visit at ~600 keys and rising
with context). Now a CTA takes one KV head's group of query heads over
1/32 of the row's keys (at least 64 a split, sized from the device
positions so the grid stays graph-static), shares each K/V load across
the group and folds the relative bias into the q.k warp reduction. A
combine kernel merges the splits' partials with the sink. Prefill rows
run one split each.

Checked on one Spark: per-visit hidden rows within 6% of transformers
(visits 0-46). Preliminary single runs, C1 with the BF16 head: 2K-token
prompt -> 256 tokens TPOT 35.0 ms; the 25-token chat prompt 30.8 tok/s,
below the 32.2 of the per-head kernel at that length (the split kernel's
fixed cost; no A/B at 2K was run).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Prefill rows ran the decode expert GEMVs, so every prompt token re-read
its eight experts (~3 TB of reads for a 2K prompt). From 16 rows a forward
now sorts the rows' expert slots by expert (moe_sort_by_expert), runs one
grouped GEMM per projection over all experts, the softcapped SwiGLU
between, and the top-k weighted sum back in row order
(moe_unpermute_reduce_indexed):

- NVFP4 layers use moe_w4a16_grouped_gemm_ptrtable straight on the
  checkpoint's stacked tensors through per-expert pointer tables built at
  load (no repack: its [N, K/2] codes, plain E4M3 [N, K/16] scales and
  per-expert global match). w13 stays interleaved; the new
  inkling2_softcap_swiglu reads the pairs.
- The four MXFP8 layers have no grouped MXFP8 GEMM in Atlas; their experts
  get an exact BF16 copy at load (inkling2_mxfp8_to_bf16; E4M3 x 2^e fits
  BF16) for moe_bf16_grouped_gemm, ~8 GB.

Checked on one Spark: per-visit hidden rows on the 25-token reference
prompt (now through the grouped path) within 11% of transformers, greedy
text unchanged. Preliminary, two runs: 2K random-token prompt TTFT 15.2 ->
5.0 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inkling 2 ships HF-vanilla norm.weight (x * w), but inkling2_loop was not
on ships_vanilla_norm_weights, so the model's final norm ran the default
offset kernel (x * (1 + w)). With w near 1 that doubled the final hidden
scale: argmax was unchanged (greedy text matched the reference), but every
distribution came out flattened through the 30 softcap, which skews any
sampled output and every reported logprob.

Found by recomputing the head in Python on Atlas's own dumped final states:
those matched the transformers logits to the tail while Atlas's raw decode
logits did not. Checked on one Spark after the fix, 30 greedy decode steps
on the short reference prompt: 29/29 greedy agreement, mean |dlogprob| on
Atlas's top-5 against transformers 3.87 -> 0.14 (e.g. a runner-up at -20.53
in the reference: -12.38 before, -20.58 after).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Prefill rows ran the decode-style attention kernel one query row at a
time. They now run Atlas's tensor-core paged prefill body
(common/prefill_paged_compute.cuh, the per-head-sink build) through a new
Inkling wrapper (inkling2_prefill_attn.cu) that turns on two guarded hooks
in that body: INKLING2_PREFILL_BIAS adds rel_bias[row][head][query - key]
for distances under rel_extent, INKLING2_ROW_SINKS reads the sinks per
query row. Both are #ifdef'd, and the per-head sink path computes exactly
what it did (sg0 = sg1 = sinks[head]), so other models' builds are
unchanged. inkling2_rel_bias_table builds each chunk's BF16 bias table
first (the reference adds the bias in BF16).

Also: ops.rs splits into attn_ops.rs and moe_ops.rs (500-line cap), the
routed-expert dispatch moves into calls.rs, and the debug captures gain
the loop messages, the gated q/k inputs and the model output after the
final block residual (dump visit 1000), which is what made the norm-weight
bug in the previous commit findable.

Checked on one Spark: per-visit hidden rows within ~10% of transformers on
the short reference prompt and the model output within 1-4% after the
final norm; greedy text unchanged. On the 3,825-token reference, the
positions that drift (1024, 1912) move as much in transformers itself
between BF16 and fp32 attention (87-93%), so they are not an Atlas bug.
Preliminary, two runs: 2K random-token prompt TTFT 5.0 -> 2.8 s; decode
TPOT 34.4 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
moe_w4a16_grouped_gemm_ptrtable (unpipelined, scalar loads) ran the
NVFP4 prefill experts at ~4-5 TFLOPS, ~1.7 s of a 2K prompt's prefill.
inkling2_moe_gemm_nvfp4 reads the checkpoint's stacked tensors directly:
64 x 128 tiles, cp.async double buffering of the gathered activation rows
and the raw codes, each 32-wide K step dequantised to BF16 in shared
memory (e2m1 x scale x global, rounded as the reference's dequantised
weights) and multiplied with mma.sync m16n8k16, padded rows for
conflict-free fragment loads. NVFP4 layers no longer get pointer tables;
GroupedExperts now only carries the MXFP8 layers' BF16 tables.

Checked on one Spark: per-visit hidden rows on the short and 3,825-token
references unchanged from the previous kernel; greedy text unchanged.
Preliminary, two runs: 2K random-token prompt TTFT 2.8 -> 1.45 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A model directory whose index also maps a Spark overlay (ModelOpt NVFP4
tensors under the transformers module names, model.language_model.* and
lm_head.*) now serves those tensors in place of the checkpoint's:

- attention projections (q, k, v, output gate, output, relative-bias):
  weights.rs Linear::Nvfp4, run through w4a16_gemv for one row and
  w4a16_gemm (BF16 activations) for more; sink and dynamic-conv
  projections stay BF16.
- routed experts of the MXFP8 coda layers: NVFP4 with the per-expert
  weight_scale_2 as the global; the overlay's gate_up keeps transformers'
  [gate rows; up rows] order, so inkling2_interleave_rows restores the
  checkpoint's interleaving once at load.
- lm_head: Atlas's existing prepacked-NVFP4 head path.

Without an overlay nothing changes (Strict). The overlay is the
calibrated GPTQ set (KL 0.0081 vs the checkpoint as shipped on the
calibration eval).

Checked on one Spark: Strict per-visit rows unchanged; Spark greedy text
matches the reference opening; 30 decode steps on the short reference
prompt agree 29/29 with transformers BF16, mean |dlogprob| on the top-5
0.34 (Strict 0.14). Preliminary single runs: C1 decode 47.4 tok/s on the
25-token chat prompt; 2K random prompt TPOT 23.7 ms (Strict 34.4), TTFT
2.0 s (w4a16_gemm prefill projections; Strict 1.45 s).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The NVFP4 expert GEMM's tile body becomes a device function shared by the
grouped entry and a new dense one (inkling2_gemm_nvfp4: one ModelOpt
weight, scalar global), which Spark mode's attention projections now use
for more than one row instead of w4a16_gemm.

Checked on one Spark: Strict per-visit rows unchanged; Spark 29/29 greedy
agreement with transformers BF16 over 30 decode steps, mean |dlogprob| on
the top-5 0.33. Preliminary, two runs: Spark 2K random prompt TTFT 2.0 ->
1.36 s, TPOT 23.7 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A decode batch of 2-15 rows ran the per-row expert GEMVs, so every
(row, expert) pair streamed that expert's weights again. Such batches now
sort their expert slots by expert (moe_sort_by_expert) and run grouped
GEMVs (inkling2_moe_grouped_{gate_up,down}_{nvfp4,mxfp8}): each expert's
weight chunk is loaded once and applied to up to 8 staged rows per pass,
then moe_unpermute_reduce_indexed sums back in row order. Spark-mode NVFP4
projections of 2-16 rows use Atlas's w4a16_gemv_batch8/16 instead of the
64-row tensor-core tile. The INK_OLD_MOE / INK_OLD_ATTN bisect switches
that slipped into earlier commits are removed.

Checked on one Spark: six concurrent prompts stay on their own prompts in
both modes; Strict per-visit rows unchanged. Preliminary single runs
(120-token random prompts, 256 tokens each): Spark C4 56.7 -> 69.0, C8
75.8 -> 95.4 tok/s aggregate; Strict C4 52.1, C8 78.8.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Verify rows journal each visit's conv state and conv inputs (up to 16
  rows); rollback_aux_verify restores the state and replays the accepted
  rows (inkling2_sconv_rewind). decode_multi_seq_rows runs one sequence's
  verify rows the same way, so n-gram and DFlash verify keep the conv
  history. Rows of several sequences are refused for now.
- Multi-sequence decode is graphed: a new multi_seq_prestage hook refreshes
  each visit's conv-state table before capture or replay, and padding rows
  share one pad state (padding_state). Before this, every padded step
  allocated a fresh conv state and journal per padding row and never freed
  them.
- The batched BF16 lm_head runs the batch GEMV (one weight pass) for up to
  8 rows on Inkling 2; dense_gemm took 11.4 ms at 2 rows on GB10.
- MODEL.toml: loop watchdog and stream loop guards off. The stream guard
  ended a Go answer with table-driven tests at 2,982 tokens on RigMark.

Checks on GB10 (preliminary, two runs each, Strict, temp 0):
- Multi-sequence: graph and eager outputs match. Eager itself varies with
  batch timing at 6 sequences.
- n-gram speculation: coherent output. A repeated-list prompt matches the
  non-speculative text exactly; two others diverge at a word choice
  (near-tie drift of the 2-row kernels, not proven bit-exact).
- Aggregate tok/s, 256-token code requests, C1/C2/C4/C8: 30 / 43 / 66.5 /
  99, up from 30 / 34 / 56 / 86 (RigMark: 29.9 / 34.1 / 56.1 / 86.1).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inkling 2 Mini ships a DSpark drafter (mtp.safetensors): 3 bidirectional
layers over tap-mixed target features, an anchor plus mask block, and a
recurrent (rnn_hidden) Markov head. It runs as a variant of the DFlash head
(layers/dflash_head/inkling.rs, kernels inkling2_dspark.cu), following vLLM
PR #69028's numerics:

- Config: parse_dflash_config reads the checkpoint's mtp_config (plus
  vocab_size) as a bidirectional DFlash drafter: local layers on a
  sliding_window + block window, taps as target_layer_ids. The taps name
  visit inputs, so Atlas captures visits t - 1 (4, 22, 40, 47); the drafter
  applies the target's final norm to the last tap.
- Context: per draft layer, softmax(fuse_weight) mix + dflare_norm, then its
  own k_proj_ctx/v_proj_ctx GEMM into the fused layout and k_norm_ctx.
- Block input: the anchor's target embed_norm embedding, then mask_embed.
- Tail: rnn ctx over the drafter's normed rows and f_rnn, per step the gate
  (BF16 rounding per op), the latent folded at load through hidden_out and
  the target head into one [vocab, 264] table (bias column), added to the
  block's base logits before the argmax.
- One sequence at a time (propose_batch_max 1).

Speed pieces found on the way:
- The verify head (8 BF16 rows) and the batched decode head use the batch
  GEMV on Inkling 2. The batched decode head now applies the logit softcap
  like the single-row and verify heads; without it a softcapped model
  sampled its C>=2 rows from uncapped logits (greedy is unaffected).
- The drafter's small-M GEMMs take the batch-GEMV arm on Inkling 2.
- Grouped expert GEMVs stage a block's rows once for four output tiles.

GB10, Strict, temp 0, C1, three prompts (preliminary, single runs):
41-50 -> 47-59 tok/s with DSpark against ~30 without; mean accepted drafts
2.8-3.7 a step. Outputs do not depend on the drafts (NVFP4 and BF16
drafter twins give identical text).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AzeezIsh added a commit that referenced this pull request Nov 22, 2026
…V on AMD; rustfmt

- pdl_tests::pdl_target_kernels_wait_exactly_when_listed reads every definition
  of a listed kernel, AMD branches included: the AMD stubs of
  inkling2_flash_prefill and the activation quantizers, and the WMMA branch of
  inkling2_msg_gate_fused, now call atlas_pdl_enter() (a no-op off sm_90+).
- #401 c4db7a3's inkling2_router_gemv.cu #includes
  common/dense_gemv_bf16_batchm.cu; included text skips build.rs's warp-mask
  widening, and ROCm 10.1 (DevLab runner) static-asserts on the 32-bit
  __shfl_down_sync mask (run 44997959809). The AMD branch passes 0xFFFFFFFFULL;
  NVIDIA tokens are unchanged.
- inkling_turn_tests.rs: cargo fmt layout of one assert (CI fmt).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AzeezIsh added a commit that referenced this pull request Nov 22, 2026
…V on AMD; rustfmt

- pdl_tests::pdl_target_kernels_wait_exactly_when_listed reads every definition
  of a listed kernel, AMD branches included: the AMD stubs of
  inkling2_flash_prefill and the activation quantizers, and the WMMA branch of
  inkling2_msg_gate_fused, now call atlas_pdl_enter() (a no-op off sm_90+).
- #401 c4db7a3's inkling2_router_gemv.cu #includes
  common/dense_gemv_bf16_batchm.cu; included text skips build.rs's warp-mask
  widening, and ROCm 10.1 (DevLab runner) static-asserts on the 32-bit
  __shfl_down_sync mask (run 44997959809). The AMD branch passes 0xFFFFFFFFULL;
  NVIDIA tokens are unchanged.
- inkling_turn_tests.rs: cargo fmt layout of one assert (CI fmt).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…itch removed)

Review on Atlas-Inf#401: the branch added two names over an env
budget main already exceeds. ATLAS_INKLING2_PDL becomes an always-on PDL
switch of the inkling-2-mini target (pdl::ALWAYS_ON): its list is
bit-identical, every listed kernel waits first (pdl_tests contract), and
every measured build ran with it. ATLAS_INKLING2_DUMP (per-visit hidden
dumps for the transformers parity work) is removed with its module; the
multi-sequence decode graph hook stays explicit, since the default
follows the verify-graph hook, which is off for this target.

check_env_budget: 1,139 names, main's count (it was 1,141 with this PR).
pdl tests, inkling_turn tests, clippy (spark-model, spark-runtime) pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@data-angel

Copy link
Copy Markdown
Contributor Author

Thanks for the AMD port and the careful notes. Responses to the three CI points and the effort-none behaviour, all on the branch now (head e6a8a0420):

  • kernel_shadow_detector: fixed in 631593dd4. dense_gemv_bf16_batchm_f32out (the router's FP32 twin) moved out of common/ into inkling-2-mini/nvfp4/inkling2_router_gemv.cu, which includes the common body. The common file again declares only dense_gemv_bf16_batchm (its body is templated on the output type), so neither shadow copy needs to change. The detector passes.
  • ATLAS_* env budget: e6a8a0420 adds no names. ATLAS_INKLING2_PDL is gone: the inkling-2-mini PDL target is now always on (pdl::ALWAYS_ON, an empty switch name). Its list is bit-identical, the pdl_tests.rs contract checks every listed kernel waits first, and every measured build ran with it. ATLAS_INKLING2_DUMP (per-visit dumps from the transformers parity work) is removed with its module. check_env_budget.py now reports 1,139, main's own count; main is still over 1,091 on its own.
  • PR benchmark gate: no gate records from me; I'm leaving the gate runs to you, as with the earlier Spark PRs. If you'd like specific records from a GB10, tell me which.
  • Hidden thinking at reasoning_effort: none: agreed, that's a real cost for small max_tokens and for clients that time the first content chunk. A related bug is fixed in c4db7a368: at effort 0 the checkpoint sometimes opens a tool call as a text block (<|content_text|>NAME<|content_invoke_tool_json|>{…}), and the turn rewrite streamed it as text. A text block's opening is now held while it reads as a name, and turns into a call at the tool marker (tests in inkling_turn_tests.rs). For the hidden block itself, I'm testing whether ending the generation prompt with an empty thinking block at effort none makes the checkpoint answer directly without hurting quality; if not, the fallback is to return the block as reasoning_content. I'll report back here.

Also on the branch since 878d7a7f3: decode batches and verifies of up to 8 rows run their BF16 projections and the router on the batched GEMV, so each row is bit-identical to the one-row GEMV (Strict RigMark C2 / C4 / C8 49.5 / 79.2 / 120.2 -> 52.7 / 81.9 / 122.7 on one GB10). A prompt under 512 tokens skips the prefix cache's tail split, and an exact replay of a block-aligned prompt restores its tail checkpoint.

🤖 Generated with Claude Code

AzeezIsh added a commit that referenced this pull request Nov 22, 2026
AzeezIsh added a commit that referenced this pull request Nov 22, 2026
…target) into feat/inkling2-hip

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AzeezIsh added a commit that referenced this pull request Nov 22, 2026
@AzeezIsh

Copy link
Copy Markdown
Contributor

GB10 verification of #401 at e6a8a04: merge-ready (cc @data-angel)

Box: sparky, one DGX Spark (GB10). Native builds with ATLAS_TARGET_HW=gb10 ATLAS_TARGET_QUANT=nvfp4. Checkpoint thinkingmachines/Inkling-2-Mini (ed40e7d; b85c3cfa differs only in README.md), Spark overlay Enntity/Inkling-2-Mini-Spark-NVFP4 e9df93d. sparkinkling 0.2.0 profile plus --enable-prefix-caching. Every number is tagged with the head it ran on.

Why this stands in for CI: the fork's CI never ran, because GitHub holds fork-PR workflows for maintainer approval and that approval was not given (they execute fork code). These sparky runs are the CI evidence for the merge.

Merge gate on e6a8a04 (job 173z)

inkling-2-mini binary 9ec2b671f86235c8. The only change since c4db7a3 is that PDL is always on for the target and the env names are gone.

check result
cargo fmt --all -- --check clean
cargo clippy --release -p spark-runtime -p spark-model -p spark-server --tests -- -D warnings clean
targeted tests: pdl, inkling2, dflash_loader, lm_head_batched, inkling_turn, dflash_width, prefix_cache, prefix 128 passed, 0 failed
ATLAS_* env names 1139, the same as main. #401 now adds none; main's own ratchet is red at 1139/1091 independently.
Spark + DSpark + ATLAS_DFLASH_ADAPTIVE=1 boot tools 14/14, arith 40/40, needle 12/12, prefix-cache hit == cold 6/6, 0 ERROR/panic
Strict serial, greedy C1 vs C8 8/8 identical (batching is row-invariant since the ≤8-row batched GEMV)
Qwen3.8-27B no-regression vs main (QAD + DFlash2 recipe env; pdl.rs is shared) lp_dump max|Δ| 0.0000 over 26,912 prompt tokens; greedy_eq C1 8/8 and C8 8/8 identical

Both modes on c4db7a3 (job 168, prefix cache on) and ST-995 on db19431 (job 165)

Strict (as shipped) Spark (+NVFP4 overlay)
C1 decode prose / code / json, tok/s (DSpark + adaptive) 35.1 / 38.6 / 34.7 52.9 / 55.9 / 52.1
aggregate C1 / C2 / C4 / C8, tok/s 35.3 / 50.8 / 74.6 / 106.8 52.0 / 69.9 / 95.9 / 120.1
cold prefill: 5,946 tok / 20,824 tok / ~41K tok — / — / 3,325 tok/s 1.94 s / 6.22 s / 3,307–3,342 tok/s
agentic-webserver ×10, cache on 8/10, 7.26 s/turn (MIN 2.0); 9/10, 6.00 s/turn through the recipe (MIN 1.2) 10/10, 5.24 s/turn
ST-995 overall / normalized (db19431, cache off) 79.30 / 79.98 80.00 / 80.34 (serial Spark: 79.70 / 79.91)
cross-contamination / poisoning gate 8/8 identical (serial) / collapsed 0 contaminated 0 / collapsed 0

Head-to-head on the same box, same prompts and harness

vLLM is vllm/vllm-openai:inkling-2-mini with --reasoning-parser inkling --tool-call-parser inkling. Prefix caching is on (vLLM's default). Atlas is c4db7a3.

Atlas Spark + DSpark + adaptive Atlas Strict serial vLLM, no spec vLLM, DSpark 7 (probabilistic)
C1 prose / code / json 52.9 / 55.9 / 52.1 32 flat 36.5 / 36.5 / 36.5 35.6 / 51.0 / 38.3
aggregate C8 120.1 — 123.5 143.8
~41K cold prefill, tok/s 3,307–3,342 — 2,628–2,931 2,646–2,895
20,824-token prefill 6.22 s — 7.28 s 7.42 s
agentic ×10 10/10, 5.24 s/turn — — 10/10, 4.71 s/turn
ST-995 80.00 / 80.34 — — 79.20 / 80.32

Where Atlas loses:

  • vLLM DSpark leads aggregate throughput at C8 (143.8 vs 120.1) and agentic turn time (4.71 vs 5.24 s/turn). Atlas DSpark proposes one sequence at a time (C≥2 decodes plainly), as your PR notes.
  • Like for like, Atlas Strict loses decode to vLLM no-spec: C1 35 vs 36.5 and C8 106.8 vs 123.5. This is the same checkpoint numerics.
  • Atlas wins single-stream decode in Spark mode and every prefill size.
  • ST-995 is a tie within noise (about ±1 pt at n=995).
  • SGLang cannot serve Inkling 2 on GB10: [Feat] inkling2: Support Inkling-2-Mini sgl-project/sglang#51926 is unmerged, and #51896 documents the SM12x gates.
  • TensorFold 1.3.3 cannot serve it either: its CHANGELOG lists the Inkling 2 family as "host-only … nothing serves it yet (#3578)".

Notes (not blockers)

  • DSpark is not output-exact against serial decode, and the PR doesn't claim it is. With DSpark + adaptive in Strict, a prefix-cache hit reproduced the cold answer 4/6 (serial and Spark: 6/6). vLLM's DSpark gets 1/6 on the same probe.
  • Follow-up for the sparkrun recipes: feat/inkling2-401-sparkrun adds --weight-overlay <id> and reads the DSpark drafter straight from the checkpoint repo, so --draft-model thinkingmachines/Inkling-2-Mini works with no assembled dirs. I'll open it as its own PR against main right after this merges. Recipes: recipe(inkling-2-mini): Spark (recommended) and Strict recipes for Inkling 2 Mini sparkrun-recipes#36.

Recommendation: merge. All correctness gates pass on e6a8a04, there is no Qwen regression, it adds zero env names, and it is MERGEABLE against main.

🤖 Generated with Claude Code

@data-angel

Copy link
Copy Markdown
Contributor Author

Thanks for the full GB10 run. Your verification is of e6a8a0420. Two commits have gone onto the branch since then, and you haven't checked them:

  • fed29ccdc, budget forcing. It answers the "template parser or hyper parameter?" question: neither. The scheduler gets a SchedLimits::message_open marker, so it tracks Inkling's reasoning block by the model's own tokens: <|message_model|><|content_thinking|> opens it and <|end_message|> closes it. The existing thinking_budget, THINK_LOOP watchdog and forced-close machinery then apply as they do for <think> models. The close lands on a sentence boundary, and the model then writes its answer. The configuration is MODEL.toml behavior (max_thinking_budget = 8192, enable_think_loop_watchdog, spec_think, eos_ends_thinking), with no new env names; check_env_budget.py still reports main's 1,139. I tested it on the 30 MMLU-Pro questions that were still reasoning at 8,192 tokens at the template's default effort (high, temperature 0), rerun with a 32,768-token limit. Without forcing, 22 of the 30 were still reasoning at the limit; with it, 1 was. Correct answers went from 5 to 18. At low effort it changed nothing measurable (126/150 against 125/150). vLLM's own image leaves 21 of the same 30 unanswered at 8,192. The receipts and a script that recomputes every number are in Enntity/sparkinkling results/2026-11-22-reasoning-loops/.
  • d1b138e67, streamed tool-call arguments. Once a tool block reads {"name":NAME,"args":, inkling_turn.rs opens the Hermes envelope and passes the argument tokens through as they arrive, so the JSON path in stream_ready_fragments streams function.arguments. For compact call JSON the bytes are the same as the whole-call rewrite's; a block of any other shape is still rewritten whole at its close. With the tool guard on, the deltas are held exactly as before. Tests feed the rewrite token by token through StreamingToolDetector. The spark-server bin suite passes except for the three tests that need a .git directory.

If you'd rather merge exactly what you verified, I'll reset this branch to e6a8a0420 and open the two commits as a follow-up PR on top of it. Otherwise they can stay here; I can give you targeted test output and a GB10 boot record for both, if that helps.

🤖 Generated with Claude Code

@AzeezIsh

Copy link
Copy Markdown
Contributor

@data-angel thanks. Please take your first option: reset inkling2/mini-20261121 to e6a8a0420 and open fed29ccdc + d1b138e67 as a follow-up PR on top of it. We merge one verified change per PR, so #401 merges at exactly the head the sparky gate ran on.

Once the branch is back at e6a8a0420, I'll approve the fork CI runs. If the workspace jobs pass, #401 gets merged.

The follow-up changes the shared scheduler (think state, post-close mask, fast_greedy, prefill phases), not just Inkling. So its gate covers two things:

  • the Inkling gate: tools including streamed calls, arith, needle, cache hit == cold, agentic ×10 and budget forcing;
  • a Qwen3.8-27B no-regression check against main: lp_dump and greedy C1/C8 with thinking on.

The gate is starting on sparky now against d1b138e67, and I'll post the results on the follow-up PR. Your targeted test output would help too.

@data-angel

Copy link
Copy Markdown
Contributor Author

@AzeezIsh done, and sorry for the delay in seeing this.

  • inkling2/mini-20261121 is back at e6a8a0420, the head your sparky gate ran on. This PR is those 48 commits again, and its description is cut back to that scope.
  • Inkling 2: budget forcing and streamed tool-call arguments (follow-up to #401) #404 is the follow-up you asked for: e6a8a0420 + fed29ccdc (budget forcing) + d1b138e67 (streamed tool-call arguments), head d1b138e67, the commit your gate is running against. Its description lists the targeted tests.
  • Inkling 2: image input, a streaming tool guard, branch checkpoints (second follow-up to #401) #405 is a second follow-up stacked on that one, five commits: image input (the checkpoint's vision tower), a --tool-guard stream setting, branch checkpoints for aux-state models, a fix for forced tool choices streamed with thinking on, and fused Strict projections. It is the engine SparkInkling 0.4.1 ships. I can split it further if you want one change per PR.

Nothing else is on this branch now, and I won't push to it again unless you ask.

🤖 Generated with Claude Code

pdl.rs 530->486 (INKLING2_PDL_KERNELS -> gpu_impl/pdl_inkling2.rs),
inkling2/layer.rs 525->482 (owner_runs + its tests -> owner_runs.rs),
precompute_ctx_kv.rs 513->456 (ctx_positions impl block + carve_region
-> ctx_positions.rs), verify_d.rs 501->498 (layer veto -> a method in
verify_d_graph_policy.rs). No logic changes; CI file-size cap goes green.
@AzeezIsh

Copy link
Copy Markdown
Contributor

@data-angel I pushed one commit onto this branch as a maintainer edit: 9132aa78b, a fast-forward from e6a8a0420.

CI's file-size cap (≤500 lines per .rs, a required workspace job that passes on main) failed on four files in this PR:

file lines at e6a8a0420 after the split what moved
pdl.rs 530 486 INKLING2_PDL_KERNELS → pdl_inkling2.rs
inkling2/layer.rs 525 482 owner_runs and its tests → inkling2/owner_runs.rs
dflash_head/precompute_ctx_kv.rs 513 456 ctx_positions_* and carve_region → ctx_positions.rs
verify_d.rs 501 498 the layer graph veto → layers_veto_batched_graphs() in verify_d_graph_policy.rs

The commit is code moves only: no logic changes, and the comments moved with their code. The workflow's own script, run locally, reports 0 files over the cap.

Sparky check (job 182, bins inkling 9d86ecc8, qwen3.8-27b 4eaebcbb), compared against the e6a8a0420 outputs from job 175:

  • Strict serial: greedy C1 8/8 and C8 8/8 identical.
  • Spark + DSpark + adaptive: greedy C1 8/8 identical.
  • Qwen3.8-27B: greedy C1 8/8 and C8 8/8 identical.
  • tools 14/14.
  • Targeted tests: pdl 6, inkling2 11, owner_runs 2, dflash_head 197, all passing.
  • 0 ERROR/panic.

#404 and #405 will need a rebase onto this commit. The split doesn't touch any of their files except possibly inkling2/mod.rs (one added mod line). The #404 gate on sparky (d1b138e67 vs main) is running now.

@AzeezIsh
AzeezIsh merged commit 992eab2 into Atlas-Inf:main Nov 23, 2026
23 of 26 checks passed
AzeezIsh added a commit that referenced this pull request Nov 23, 2026
strix-hip's inkling2_moe_gemm.cu gains the BF16-row grouped expert GEMMs on
__builtin_amdgcn_wmma_f32_16x16x16_bf16_w32 (the path gb10 carried until #401's
cb10558 moved its prefill to W4A4 / W8A8 only): NVFP4 and MXFP8 stacked
checkpoint tensors dequantised per 32-wide K step to BF16 in gb10's order
(BF16(e2m1 * (E4M3(scale) * s2[e])), BF16(E4M3(code) * 2^(E8M0 - 127))), E4M3 by bit
math, tiles 128 (NVFP4) / 64 (MXFP8) rows x 128 outputs, 8 waves, WMMA operands by
16-byte shared loads; and inkling2_softcap_swiglu between gate_up and down.
moe_prefill takes moe_prefill_bf16 under cfg!(atlas_scale) (kernel handles
resolved only there) instead of the grouped GEMVs.

A/B on framework (grouped GEMVs f350 vs WMMA f351, Strict, one sequence): the
same ~1.8K-token prefill chunks 13.3 / 8.0 / 8.2 / 15.9 s -> 5.3 / 3.2 / 3.2 / 6.2 s
(2.5x); NLL over 57,648 tokens code 0.63694 -> 0.63704, text 0.89798 -> 0.89694
(noise); prefill-vs-decode logprobs 96/96 aligned on all six prompts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AzeezIsh added a commit that referenced this pull request Nov 23, 2026
inkling2_msg_gate_fused gets an AMD branch on
__builtin_amdgcn_wmma_f32_16x16x16_bf16_w32 with the gb10 kernel's phases,
arguments and roundings: rms of every gate's h and m rows; z = BF16(D BF16([rms0(h);
rms0(m)])) on waves 0-3 (one 16-wide rank tile each); then 64 channels a step,
F z on waves 0-3 and G z on waves 4-7 staged in fp32, and
out = (1 - tanh(F z)) * h + tanh(G z) * m with every gate's inputs read before its
outputs are written (out may alias h). Operands by 16-byte shared loads; BF16
staged element-wise (hipcc's bf16 header has no __floats2bfloat162_rn).
spark-model takes it on AMD from 16 rows, as on gb10.

Why: rocprofv3 of a 4,778-token prefill (f355) put the two-kernel path at 15.6%
of prefill (msg_gate_z 4.2 ms + msg_gate_out 2.2 ms per visit and chunk).
A/B on framework (f358 two-kernel at 6eaa417 vs f360 this, which also carries
#401 db19431): prefill 4,778 tokens 3,917 -> 3,524 ms (1,220 -> 1,356 tok/s),
16,725 tokens 1,140 -> 1,266 tok/s; NLL code 0.63704 -> 0.63689, text 0.89694
-> 0.89618; prefill-vs-decode logprobs 96/96 aligned, mean |dlogp| 0.007-0.027.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AzeezIsh added a commit that referenced this pull request Nov 23, 2026
One entry point in the serve-nemotron-strix-linux.sh mould: MODE=spark|strict
and DSPARK=0|1 (default spark, no drafter: on framework DSpark gains only on
Strict code). Downloads the pinned checkpoint, and the Spark overlay or the
DSpark drafter as asked; assembles the index-mapped Spark directory (as
SparkInkling's spark_overlay.py does) and #401's drafter directory
(mtp.safetensors as model.safetensors, config = mtp_config + vocab_size).
Refuses without /dev/kfd or a gfx1151 agent, caps GPU_UTIL at 0.82 below 80 GiB
GPU-visible (the 64 GB-class host OOM line), builds the inkling-2-mini target
when its inputs changed, serves with prefix caching on and prints a ready curl;
--check starts, sends one request and stops. MODEL.toml gains a QUICKSTART note.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AzeezIsh added a commit that referenced this pull request Nov 23, 2026
…V on AMD; rustfmt

- pdl_tests::pdl_target_kernels_wait_exactly_when_listed reads every definition
  of a listed kernel, AMD branches included: the AMD stubs of
  inkling2_flash_prefill and the activation quantizers, and the WMMA branch of
  inkling2_msg_gate_fused, now call atlas_pdl_enter() (a no-op off sm_90+).
- #401 c4db7a3's inkling2_router_gemv.cu #includes
  common/dense_gemv_bf16_batchm.cu; included text skips build.rs's warp-mask
  widening, and ROCm 10.1 (DevLab runner) static-asserts on the 32-bit
  __shfl_down_sync mask (run 44997959809). The AMD branch passes 0xFFFFFFFFULL;
  NVIDIA tokens are unchanged.
- inkling_turn_tests.rs: cargo fmt layout of one assert (CI fmt).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AzeezIsh added a commit that referenced this pull request Nov 23, 2026
…es only)

moe_ops.rs 564->455 (moe_prefill_bf16 + the GEMM_M_TILE_* consts ->
moe_prefill_hip.rs), ops.rs 519->392 (the MsgGate/msg_gate cluster ->
gate_ops.rs, re-exported as ops::* like attn_ops/moe_ops). No logic
changes; with #401's four splits the CI file-size cap goes green.
AzeezIsh added a commit that referenced this pull request Nov 23, 2026
…s (follow-up to #401)

Inkling 2: budget forcing and streamed tool-call arguments (follow-up to #401)
data-angel pushed a commit to Enntity/atlas that referenced this pull request Nov 23, 2026
Lets Inkling 2 Mini (Atlas-Inf#401) serve straight from its Hugging Face repos, with
no assembled model or drafter directory, so a sparkrun recipe (HF ids, HF
offline after sync) can start it:

- `--weight-overlay <id|path>` loads every *.safetensors of an overlay repo
  beside the checkpoint and adds its tensors under their own names (a name
  the checkpoint already has is an error). Spark mode:
  `--weight-overlay Enntity/Inkling-2-Mini-Spark-NVFP4`. The Inkling loader
  already switches on those tensor names, so the result is the same store
  the assembled index produced.
- A `--draft-model` whose config.json carries an `mtp_config` beside an
  `mtp.safetensors` (Inkling 2 Mini's DSpark drafter) is read as that
  drafter: config = mtp_config + text_config.unpadded_vocab_size, weights =
  mtp.safetensors. `--draft-model thinkingmachines/Inkling-2-Mini` works.

Each such file reaches the loader as model.safetensors through one symlink
in a private temp directory; nothing in the checkpoint is copied or renamed.
WeightStore::absorb merges a second store. No new env names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
data-angel added a commit to Enntity/atlas that referenced this pull request Nov 23, 2026
…split, Atlas-Inf#403, Atlas-Inf#404, Atlas-Inf#406, Atlas-Inf#410) into the images follow-up

Two conflicts, both from the split of 401: layers/inkling2/mod.rs declares
owner_runs and proj, and inkling2_proj_gemv joins the PDL list in its new
file pdl_inkling2.rs. The tree equals this branch's five commits replayed
onto main.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
data-angel added a commit to Enntity/atlas that referenced this pull request Nov 25, 2026
Brings the branch up to main (76 commits: Inkling 2 Mini Atlas-Inf#401/Atlas-Inf#404/Atlas-Inf#410,
Atlas-Inf#332 and the rest). Nine conflicts, each two additions in the same place,
resolved as unions: the config parser imports and the dispatch list,
kv_only_prefix_cache_is_safe (deepseek_v41 and inkling2_loop both false),
the factory loaders and its supported-model list, the aux-state model list,
the PDL module doc, the tokenizer modules, tool_call_ids_in_template
(main's matches! for Inkling, this branch's `!= ChatEncoding::Jinja`, since
ChatEncoding is now Jinja | Deepseek(dialect)), and tool_defaults.toml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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