Repository navigation
Serve Ling-3.2-air at 256K and LingSante Air-VL on one DGX Spark - #411
Conversation
`--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]> (cherry picked from commit 887d178)
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]> (cherry picked from commit 1a36752)
…stimate - ling_latent_decode now runs the absorbed attention on BF16 mma: each warp keeps its query fragments in registers, 32-key tiles stream through shared memory two at a time, and the online softmax runs once per head per tile. Plain decode on a GB10 beside other work, 256 tokens after a prompt of 2K / 32K / 128K / 262K tokens: 42.8 / 37.6 / 33.0 / 28.0 tok/s (the FP32 version: 42 / 30.9 / 16.5 / 10.3). - The Ling loader no longer overrides the cache's per-layer geometry with the old 32 x 130 expanded layout, and the paged cache honours V aliasing for any model that asks for it, not only GLM's plan. - The load pre-flight uses Ling's measured 1.02 device/disk ratio (1.05 with margin) instead of the generic 1.3, which projected 94.3 GB for 72.5 GB of weights and refused to load beside 20 GB of other work. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The single-request prefill takes an MLA prompt in one chunk only when the model has no paged-history prompt kernel (supports_chunked_mla). The batched and mixed paths checked is_mla() alone, so two or more long prompts arriving together reached Ling as whole 49K- or 245K-token chunks and failed against the 8,192-row arena. Both paths now use the same gate. Eight simultaneous 65,524-token Ling prompts then each recalled their own key (524,192 prompt tokens in 279 s on one GB10). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drafted Ling decode in 0.1.1 ran 2-3% behind 0.1.0. An nsys profile of the same eight drafted requests put the attention path at 77 us per layer per step against 0.1.0's ~40. 0.1.0 read kv_b_proj as NVFP4 (2 MB per layer) for each new token; the absorbed form reads both BF16 halves (8 MB) every step, and its kernels and a 256-key minimum split were latency-bound. - ling_q_absorb reads a BF16 transposed key half (kb_t [heads * 512, 128], made once at load) and ling_v_up the value rows, one warp per output row with coalesced loads, a fixed shuffle reduction, and a loop over the rows present only: 21.7 and 21.3 us per call (27.7 and 25.1), near the 4 MB bandwidth floor. - Decode splits hold at least 64 keys, not 256: 11.3 us per call (19.3). - Attention path 59 us per layer per step. Drafted 54.4 / 53.8 tok/s against 0.1.0's 55.0 / 54.4 on the same GB10; drafted text equals plain decode. NVFP4 copies of both halves were tried and reached 0.1.0's speed, but in the absorbed form the key half's error reaches every cached token's score: against vLLM on the same weights, decode-path top-1 agreement fell to 92.6% (BF16: 95.2%, 0.1.0: 94.5%) and GSM8K-200 to 192 (0.1.0: 196). BF16 stays. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous commit kept BF16 absorption because a small decode-path sample (about 100 positions) and GSM8K-200 suggested NVFP4 absorption cost fidelity. A larger sample settles it: against vLLM on the same weights, over ~775 decode positions in 220 contexts, top-1 agreement and total variation are equal within error for 0.1.0 (94.2% +/- 0.8, 0.049), NVFP4 absorption (95.0%, 0.050) and BF16 absorption (94.3%, 0.050). GSM8K-200 moved by up to four problems between numerically equivalent builds (Air-VL: 193, 192, 189). - Under NVFP4 decode precision (ATLAS_LING_NVFP4_DECODE=1) the key half (as kb_t, then released) and the value half of kv_b_proj are quantized to NVFP4 at load like every other Ling NVFP4 decode projection. ling_q_absorb_nvfp4 gives a thread each 64-byte row (11.6 us per call; a warp per row measured 16.7), ling_v_up_nvfp4 a warp each row (11.3 us). Both reduce in a fixed order over the rows present, with the E2M1 table in shared memory. - Checkpoint precision (Strict) keeps the BF16 kernels. - Attention path 38.8 us per layer per step (0.1.0 ~40). Drafted 54.1-54.9 tok/s against 0.1.0's 54.4 in alternating runs on one GB10; drafted text equals plain decode on all eight probe prompts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ling-3.2-air's predictor layer expects the target's final-normed hidden:
the reference implementation's target model returns its rows after
`model.norm`, and the predictor applies its own `hnorm` on top. Atlas hands
over the raw residual stream, so Ling's predictor saw unnormalized rows.
Verify kept the output exact, so nothing looked wrong except the speed:
first-draft acceptance sat near 70% on every prompt, including text the
predictor should never miss.
The predictor now applies `model.norm` to the target rows before `hnorm`,
in `append` and in the tiled prime that serves prompt and catch-up rows.
Measured on one DGX Spark, SparkLing 0.1.1 launch arguments, eight greedy
256-token prompts, first-draft acceptance and decode tok/s (before -> after):
Ling-3.2-air counting 0.735 -> 0.992, 57.0 -> 66.0
Python 0.652 -> 0.966, 53.5 -> 64.0
JSON 0.427 -> 0.843, 46.4 -> 61.3
mean of eight 54.8 -> 61.1
LingSante (borrowed predictor) counting 0.700 -> 0.992, mean 54.1 -> 57.1
vLLM serving the same NVFP4A16 checkpoint and predictor accepts 100% of
first drafts on counting and Python. Output text is byte-identical to 0.1.1
on all sixteen prompts.
The DraftProposer impl moves to ling_mtp/proposer.rs; ling_mtp.rs was
already over the 500-line cap and both files are now under it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Several drafting sequences now verify in one forward and draft in one predictor pass, instead of Ling declining speculation past one request. - KDA layers take decode_verify_multi: two rows per sequence, each sequence's rollback snapshot after its first row; the recurrence runs as two ling_kda_batch launches (every first row, then every second row; the kernel gains a row stride and base). - can_batch_verify admits Ling at two rows per sequence; the batched verify uses decode_position, so text after a Ling image keeps its shifted RoPE. - LingMtp::propose_batch: embed, merge, MLA + MoE body, head and argmax over all rows at once (w4a16_gemv_batch tiers, row-invariant). - The NVFP4 decode copy of the attention projections serves up to 32 rows (was 8; 9+ fell back to a BF16 GEMM), the router and BF16 projections take the batched GEMV in 8-row chunks below 32 rows: a verify row is the bytes serial decode computes for it. RigMark 1.1.0 short-code concurrency, one Spark, thinking off (tok/s, C1/C2/C4/C8): 0.1.2 engine 58.3/66.1/98.8/142.3, this 58.7/91.1/121.3/~142. C8 is bound by routed-expert reads (512 experts, top 8). Co-Authored-By: Claude Opus 5.5 <[email protected]>
SparkLing 0.1.3 drafts for up to four requests (ATLAS_MTP_MAX_SEQS=4), so a batched verify has at most eight rows, and those always took the batched GEMV tiers. The 16- and 32-row NVFP4 tiers and the 8-row chunking of the router and BF16 projections only changed prompt chunks of 9-31 tokens (common as a prefix-cache tail): their projections and routing no longer matched 0.1.2's, and single-request output changed on 7 of 8 probe prompts. Back to 0.1.2's kernels for those widths. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Long-context prefill spent most of its time in the shared BR=64 paged kernel at HDIM 192 (half the warps idle during QK^T, P through shared memory, V padded 128 -> 192) and in re-expanding the whole prefix from the latent for every 2048-row prompt tile. - ling_mla_prefill.cu is now a Ling-specific port of SparkQwen's prefill_paged_rows128 layout: QK^T 192 wide, PV 128 wide, ldmatrix K/V, P in registers, one barrier per key tile, compact [rows][32][128] output. It reads expanded rows directly, so the identity block table, V's zero tail, attn_padded and the narrowing copy are gone. Bit-identical to the BR=64 kernel per row (tests/ling/mla_prefill.cu: output, softmax state and BF16 bytes over seven shapes); 3.5x faster on a visible 8192x8192 tile (62.5 TFLOP/s), 2.8x on the causal tile. - Prompt tiles are a whole 8192-row chunk, so each layer expands its prefix once per chunk instead of four times. Projections still run 2048 rows at a time (LingProjection::forward_pieces), because the BF16 GEMM's rounding follows its row count. One Spark, 0.1.3 release image with this binary, cold prefill TTFT: 8K 2.41 -> 2.25 s, 32K 12.70 -> 9.55 s, 64K 34.61 -> 21.78 s, 128K 106.83 -> 55.06 s (1,227 -> 2,381 tok/s; vLLM MTP3 1,842). Greedy text is unchanged on the eight probes (Ling and LingSante) and on 20K/50K prompts, and prompts within one chunk are byte-identical to 0.1.3 including logprobs. Longer prompts move logprobs at rounding level: 0.1.3 expanded a key differently for different query tiles; both builds sit the same distance from vLLM's logprobs on those prompts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
c7bf36c made prompt tiles chunk-wide and ran the projections in fixed 2048-row pieces, but it rounded the tile down to 128 rows of the prompt: a 2634-token prompt became 2560 + 74 rows where 0.1.3 had 2048 + 586. The BF16 GEMM rounds by its row count, so those rows changed bits, and that was enough to flip LingSante's forced-tool note in the demo (0.1.3: a complete 517-token call; c7bf36c: 800 tokens, blocked by the tool guard). Projection pieces are now the old tile exactly (2048 rows, or the prompt rounded down to 128 below that) and attention tiles are whole multiples of that piece. On the 0.1.3 release image with this binary: the note is the same 517-token call byte for byte; Ling prompts of 1,000, 2,634, 4,000 and 8,000 tokens and the eight probes (Ling, LingSante) keep their logprobs exactly. Prompts longer than a chunk still differ at rounding level, from the once-per-chunk key expansion. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… batched verify (#48) Lift artificial speculative-decoding and batched-MoE limits on Ling-3.2-air while preserving bit-exact greedy parity and zero quality regression: - Unlock speculation inside <think> blocks by implementing verify_bit_exact and batch_verify_bit_exact for Ling. - Support chained multi-step MTP drafting (num_drafts=1..=3, K=2..4) with post-norm hidden chaining, speculative row rollback, multi-window private MTP KV cache, K=3 Prometheus accept/reject counters, and ragged ks batched KDA/MLA verify (eliminating serial fallbacks on ragged batches). - Fix 7-arg vs 8-arg ABI mismatch in batched MTP w4a16_gemv_batch2/batch3 dispatch. - Restore 9-32 row NVFP4 decode/verify projection tiers (keeping cuBLASLt BF16 GEMM above 8 rows) and lower grouped_a16_prefill threshold from 128 to 33 to close the 33-127 row MoE dead zone. Verified on GB10 (ennspark04): 60/60 Ling unit tests, clippy -D warnings clean, draft_decode.py pass, task_probe.py 30/30 math & 10/10 tools, SparkModelBench 15/15 decode gates (code 66.15 vs 49.80 tok/s, prose 57.10 vs 49.02, structured 67.14 vs 54.28; C1/C2/C4 concurrency +35%/+30%/+30%).
|
@data-angel Since my 11-25 gate, this branch has 17 new commits (MLA latent cache, batched MTP verify and draft, the 128-row MLA prefill). Two questions before I re-gate:
It now conflicts with 🤖 Generated with Claude Code |
|
Ready for review and re-gating at 1. Merged
|
|
@data-angel Thanks, and thanks for tracing the 191/193 race. I started the re-gate at #431 moved -#include "../../qwen3.6-27b/nvfp4/skinny_mma.cu"
+#include "../../common/skinny_mma.cu"
The CI runs for the new head were awaiting approval; I've approved them. 🤖 Generated with Claude Code |
|
@data-angel The race fix holds. I gated The 191/193 crash is gone
agentic-webserver ×10: webserver_ok 10/10, followed_directions 7/10, 15.6 s/turn. All three misses hit the 40-turn cap before finishing the run and teardown steps. Ling isn't on No regression on CI: three items before I can merge
(all under Once those are pushed, I'll confirm the tree differs from what I gated only by the splits, re-run greedy identity and the C=4 probe, and merge. sparky nightq 218 · 🤖 Generated with Claude Code |
|
@data-angel I pushed two commits to this branch so it can merge (please pull before you push again):
The workspace CI jobs pass on 🤖 Generated with Claude Code |
|
@data-angel Gated and merging. Sparky job 219, one GB10, built from fresh worktrees:
One follow-up for you, not blocking. Greedy decode of Agentic ×10 wasn't re-run (218: webserver_ok 10/10, followed_directions 7/10). sparky nightq 219 / 219b · 🤖 Generated with Claude Code |
…pseek_v41 Conflicts in five files, each two additions in the same place (Ling-3.2-air from Atlas-Inf#411, DeepSeek-V4.1 here): config.rs and config/dispatch.rs parser imports, the factory loader list and its Supported string, model_type_ships_vanilla_norm_weights, and supports_chunked_mla_impl (DeepSeek-V4.1's early return kept ahead of Atlas-Inf#411's Ling/GLM expression). Both sides kept everywhere.
Summary
Add native Ling-3.2-air text and image serving on one GB10. Ling combines KDA and MLA with 512 routed experts per MoE layer. Its original FP8 shards alone occupy 120.4 GiB, so the strict path pages expert weights from disk while preserving their bytes and scales.
The second path loads Primitive AI’s NVFP4A16 checkpoint. Large prompt batches can quantize routed activations, and small decode batches can use NVFP4 attention projections. The measured profile keeps the checkpoint’s BF16 vocabulary head. The changes also cover recurrent state and prefix reuse, continuous batching, and the model’s tool-call format.
Benchmarks
One DGX Spark, 40,960-token context, BF16 KV, speculation off. Atlas and stock vLLM used the same Primitive AI checkpoint. The figures below use the BF16 output head.
Both engines completed both prose prompts and both structured prompts. Both exhausted the 4,096-token budget on the stock thinking-enabled code prompts. With thinking disabled, both returned visible code on the same Go prompt. The optional NVFP4 vocabulary head missed one prose completion.
Benchmark measurements, controls and rooflines
256K context and LingSante Air-VL
Ling’s full-attention layers now store the shared rotary key once per token. This takes 28.44 GiB for 262,144 slots across seven BF16 KV layers. On one Spark, the NVFP4A16 profile recalled an initial key from 262,132 input tokens with a 12-token output budget. It reused 480 prefix tokens and answered in 482.53 seconds. The original FP8 profile also allocated a full sequence and passed its arithmetic smoke.
The Air-VL loader handles inclusionAI’s MXFP4/32 expert matrices and its original BF16 checkpoint. MXFP4 is resident on GB10. BF16 experts are file-backed. Bailing’s image path now uses the published CLIP channel statistics. The packaged Strict server loaded all 50 original BF16 shards from a USB SSD on GB10, advertised 131,072 tokens and returned the same correct text and image answers.
At a matched 4K window, Atlas and SGLang returned identical arithmetic and image answers and identical text for both 64-token streams. Atlas decoded at 10.47 and 10.48 tokens/s compared with 28.37 and 27.59 for SGLang’s FlashInfer MXFP4 backend. The earlier 40K table covers the original Ling model and engine revision.
Context, model pins, raw responses and rates
Native MTP and Air-VL follow-up
Ling-3.2-air's appended head now drafts one token per step. Prompt priming computes just the predictor's K/V in tiles. Verification batches two target rows and snapshots the KDA recurrent and convolution state at the rejection boundary. On one GB10 and three 64-token greedy streams, ordinary decode measured 44.34 / 44.95 / 45.32 tok/s for counting, prose and Python. The native head with KV-only priming measured 59.04 / 50.47 / 53.99 and accepted 29 / 23 / 25 predictions. Counting and Python matched ordinary output. Prose differed. The SparkLing launcher keeps MTP opt-in. Requests, raw streams and controls
The vectorized Air-VL MXFP4 expert GEMV raised the original 10.47–10.48 tok/s to 30.26–30.31 on unchanged publisher weights. A new paired SGLang run measured 29.22–30.12. With routed experts converted directly from the original BF16 to NVFP4 and optional in-memory NVFP4 attention, shared/dense MLPs and output head, Atlas measured 54.07–54.98 without drafting. All Atlas configurations answered the arithmetic and image controls correctly. The converted expert outputs were closer to BF16 on all 15 sampled experts. The fastest profile matched BF16 on 57/68 teacher-forced positions. On the second distinct cold 2,048-token input Atlas took 0.829 s and SGLang took 0.671 s. Checkpoint provenance, accuracy, speed and rooflines
Atlas also accepts inclusionAI's and Primitive AI's revised config layout, including the 4,608-wide vision merger and top-level video boundary tokens. Old configs still parse. The updated model releases have identical hashes across all pinned inference files except config.json.
Test plan
cargo fmt --all -- --checkOne-Spark drafting comparison
On identical 64-token greedy requests and the same Primitive A16 checkpoint, Atlas with one native draft reached 59.04 / 50.47 / 53.99 tok/s on counting / prose / Python. vLLM with the publisher’s three-token lookahead reached 46.91 / 29.44 / 47.61. The scalar verification control reproduced all three ordinary continuations. Fast verification changed the prose continuation. Matched streams and controls
LingSante Air-VL has no embedded predictor. SparkLing can now attach only Ling’s predictor block to its BF16-derived Santé NVFP4 target using the same Atlas implementation. Drafting increased counting from 54.27 to 60.98 tok/s, prose from 54.30 to 57.66, and Python from 53.69 to 68.87. Counting was 2.05× the fresh SGLang publisher-MXFP4 counting result. Counting and Python matched undrafted target output exactly. Prose changed. Both arithmetic and image-color checks passed. Santé measurements and checkpoint provenance
Authorship
Developed with OpenAI Codex under data-angel’s direction.