Skip to content

integ: train 2026-10-27 (#191 #192 #204 #196 #205 #206 #207 #208 #210), gated on GB10 FP4-Local - #212

Merged
AzeezIsh merged 27 commits into
mainfrom
integ/train-2026-10-27
Oct 27, 2026
Merged

AzeezIsh merged 27 commits into
mainfrom
integ/train-2026-10-27

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Summary

Integration train (per the repo's verify-before-merge policy: one shared GB10 gate instead of a GPU run per PR). origin/main 504063a plus each PR merged --no-ff, so authorship survives and the constituent PRs close as merged when this lands:

PR What Head
#191 spark-storage keepalive test waits on deadlines (fixes the flaky ticks_only_while_active that reds cargo test / llvm-cov) 7a36da2
#192 strix-hip: drop Nemotron's dead dequant_nvfp4_bf16 override (kernel-shadow red since #169) b70b352
#204 __float2bfloat16 in batched_embed_nvfp4 so strix-hip builds (second break from #195) d2d114c
#196 tool-parameter markers from the served tokenizer (Nemotron tool calls cut at 1024 tokens) dfd3a80
#205 blocking replies that open with a refusal prefix keep content (#172; also Anthropic /v1/messages blocking) 3778ef2
#206 over-capacity vision request answers 400 / invalid_request_error, not a retryable 500 (#180) fcf3fd3
#207 qwen4_exp direct exact-hit resume (ATLAS_EXACT_DIRECT), aux re-apply; the default ATLAS_MARCONI_EXACT=1 path 500s on qwen4_exp today 4529e1a
#208 two-phase full cache hit emits from the snapshot's stashed hidden (latent wrong first token) 3c88c09
#210 warn when ROWINV runs without the in-pass checkpoint, + @maplepaladin73's truth-table tests d221f72

Zero merge conflicts. The #207/#210 overlap in prefill_b.rs auto-merged at 499 lines (under the cap).

Shared-code note for reviewers: #192 and #204 touch kernel sources (kernels/strix-hip/..., kernels/gb10/common/embed_from_argmax.cu); everything else is Rust in spark-server / spark-model / spark-storage.

Gate (running now on sparky, GB10)

Job 10-train-gate in the sparky nightq runner, started 2026-10-27 06:25 UTC. It builds this exact tip in a fresh worktree, then:

  1. 4-request T=0 control on the default FP4-Local recipe profile (r1short, MTP 3, prefix cache on), diffed against main + kernels: use __float2bfloat16 in batched_embed_nvfp4 so strix-hip builds (second break from #195) #204 (d2d114c).
  2. scheduler: tool-parameter markers from the served tokenizer (Nemotron tool calls cut at 1024 tokens) #196 Nemotron 3.5 Super VL tool-marker smoke.
  3. agentic-webserver 50 iterations, then BFCL ST-995 (bfcl-subset, no overrides) on nvidia/Qwen3.8-Flash-Next-FP4-Local.

Pass criteria, fixed before the run: agentic 50/50 webserver_ok + 50/50 followed_directions with s/turn in line with main's 12.34–12.49 (run-1792654228906033074, run-1792764782219366004); BFCL at or above the committed FP4-Local floors 87.04 / 86.92 (main: 87.44 / 87.32, run-1792664799374893012); no panics in the serve log.

Local checks at the tip: fmt (pinned 1.93.1 + stable) clean; clippy --tests clean on every crate (spark-storage's Linux-only io_uring e2e test can't build on macOS, the same as on main); typos clean. sparky: spark-server --bin spark 2731 passed, spark-model --lib 1875 passed, spark-storage keepalive 3 passed.

Merge plan (owner-approved): merge once both gate legs pass and CI shows only the repo-wide reds (PR benchmark gate, cargo deny, kernel shadow structure; the last should go green here with #192). Results get posted on this PR and in the campaign log (#211).

Test plan

Generated with Devin

AzeezIsh and others added 27 commits October 18, 2026 00:05
…nizer (Nemotron large tool calls were cut at 1024 tokens)

update_tool_param_state tracks whether generation is inside a qwen3_coder
<parameter=KEY> value, whose tokens are exempt from the 1024-token
envelope-stuck cap. It compared against hard-coded Qwen3.6 ids
(< 27, = 28, > 29, </ 510, parameter 15704). Nemotron 3.5 Super VL serves
the same XML tool format with its own tokenizer (1060 / 1061 / 1062 and a
merged >\n 1561 / 1885 / 31960; the Qwen ids are <so_embedding>,
<SPECIAL_510>, ... there), so a value was never recognised: every file
content token counted as envelope, any argument past 1024 tokens tripped
tool_envelope_stuck, and the client got a salvaged fragment. Observed in
an agent session: large create_file writes landing as the 11 bytes
'</parameter', replace_in_file calls losing their replacements array.

The markers are now resolved from the tokenizer when it is loaded
(tokenizer_runtime, startup and model swap), including the merged >\n
forms, and read by the guard. A tokenizer that does not encode a marker as
one token leaves the tracking and the cap off instead of misfiring;
--tool-max-tokens still bounds a runaway envelope. Qwen ids resolve to the
same values as before, so Qwen behaviour is unchanged.

Tests: the resolver on Qwen and Nemotron tables; the real guard on a
Nemotron write with a 1500-token content (with </div> closes) finishes
with the Nemotron markers, trips with the Qwen ids (the old behaviour),
stays off with none, and a never-closed envelope is still cut.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…talls its own; per-thread in tests

The first version started the slot empty, which turned the parameter
tracking off for any caller that never loads a tokenizer, including the
existing think_commit span test that replays a Qwen tool call. The slot now
starts at the Qwen ids the guard was hard-coded to (every serve path
installs the served tokenizer's markers in tokenizer_runtime). Under
cfg(test) the slot is thread-local, so tests installing other markers
cannot race the ones that rely on the default. The emit tests also reset
the fixture's finished flag; the shared fixture builds a finished
sequence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ry, not five ids

An in-stream tokenization battery (both tokenizers, real tokenizer.json)
showed exact-id matching misses openers even on Qwen: BPE merges the '='
into the key's first sub-word for common keys ('=file' '_path',
'=re' 'placements', '=new' '_str'), so those values were never recognised
and their content counted toward the 1024-token envelope cap. Nemotron
merges '>' with the newline ('>\n') and both merge punctuation into the
close ('.</').

ToolMarkers is now five token classes built once per tokenizer from the
decoded text of every vocabulary entry: '<' (leading whitespace allowed),
'parameter', starts-with '=', starts-with '>', ends-with '</'. The guard
matches classes; until a tokenizer installs its own, the slot holds the
five legacy ids, so callers that never load one are unchanged.

Tests: class coverage of the merged forms; a Nemotron 1500-token write
finishes with its classes and is killed by the legacy ids; a Qwen
new_str value (merged '=new') finishes with the classes and is killed by
the legacy ids (the pre-existing Qwen miss); unresolved -> off; a
never-closed envelope is still cut.

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

ticks_only_while_active gave the ticker thread a fixed 30 ms after touch()
to land a read; on loaded CI runners it failed intermittently at the
"touched: ticking" assert (four PRs on 2026-10-18, none touching
spark-storage). Keep touching until a read lands (5 s bound), then stop and
require the count to hold still across 200 ms (5x the idle window, 5 s
bound). Same properties, no scheduling race.

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

#169 (50c6124) linked dequant_nvfp4_bf16.cu into strix-hip/common/; the
Nemotron 3.5 target's own link to the same gb10 file became a dead override,
and check_kernel_shadows (RULE1) now fails on main and on every open PR.
Same file either way, so the build is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
embed_from_argmax.cu is shared into kernels/strix-hip/common by symlink.
HIP's bf16 header has no __float2bfloat16_rn, so the HIP build failed with
"use of undeclared identifier". __float2bfloat16 is round-to-nearest-even
on both CUDA and ROCm (static_cast<__bf16>), so GB10 output is unchanged;
line 123 of the same file already uses it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ix (#172)

The blocking chat path moved the first sentence into `message.refusal` and
set `content` to null whenever the reply opened with one of the 23 prefixes
in refusal.rs, dropping the rest of the answer. The streamed path sends every
content piece and appends the refusal at the end, so the same prompt gave a
full answer streamed and `content: null` blocking (27/200 on the issue's
GLM-5.3 run). The classifier is a prefix heuristic, so a reply such as
"I cannot verify that source. Here is ..." lost real content.

Blocking now matches streaming: `refusal` is still populated, `content` is
kept. ATLAS_DISABLE_REFUSAL_DETECTION=1 is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ryable 500 (#180)

A TP request whose images need more encoder rows than one encode holds
failed in validate_state with a plain anyhow error, which the API mapped
to 500. Agent clients resend the same history on 500, so the session
retried forever (#180: 18 retries over 80 min). validate_state now
returns a typed VisionCapacityError naming rows, image count and cap,
and both prefill entry points route it through send_invalid_request_to_sink
(HTTP 400 for blocking clients; streaming keeps its error frame).

Does not lift the cap itself (#180 ask 1).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On an exact full-prompt leaf hit (ATLAS_MARCONI_EXACT=1) the last prompt
token is re-run for logits, and finalize_last undoes the double advance by
re-restoring the SSM state and the stashed post-norm hidden. On models with
aux layer state the same re-run also advances the PLE n-gram history/conv
carry and the QSA indexer state a second time, and the fixup left those
double-advanced for decode to read. The prefix-hit restore already applies
them (with_aux -> apply_aux_states in prefill_a/prefill_c); apply them again
here, from the same snapshot.

A plausible cause of the quality loss that made the shortcut default-off
on Flash-Next (qwen4_exp has both PLE and QSA; the shortcut predates them).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…grids, not images

Peer review of the first commit: a streaming request (opencode, #180's
client) still got the generic server_error/500 frame, because
send_invalid_request_to_sink sent the same StreamEvent::Error as any
failure. Add StreamEvent::InvalidRequest; the chat stream renders it as
{type: invalid_request_error, code: 400}, and /v1/responses and
/v1/messages streaming inherit it through the chat stream's deltas.
send_invalid_request_to_sink's other callers (strict response_format,
oversize tool grammar) now match their blocking 400 on the stream too.

VisionCapacityError counts grids (grid_count), which is not an image
count for video; say so. Test that a stringified error loses the type.

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

With ATLAS_MARCONI_EXACT=1, an exact full-prompt leaf hit restores SSM and
aux state at token N, re-runs the last prompt token through every layer for
logits, then undoes that re-run's second advance in finalize_last and
overwrites normed with the snapshot's stashed hidden. The re-run's output is
discarded, so its only effect is state the fixup must roll back (and, per
the aux fix, did not fully). ATLAS_EXACT_DIRECT=1 (opt-in) skips the layer
forward on that chunk: finalize_last's fixup already supplies the hidden for
lm_head. Single-stream prefill_b path only; the batched/multi paths keep the
re-run. Not taken when prompt logprobs are requested.

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

prefill_twophase_dispatch takes the proc_count == 0 path when an SSM
snapshot covers the whole prompt. prefill_full_cache_hit then re-embeds the
last token and ran final_norm + lm_head on that embedding, which went
through no layers: the first token came from embedding logits. Not gated
by ATLAS_MARCONI_EXACT. Use the snapshot's stashed last-token hidden, as
finalize_last's exact-hit fixup does; warn when the snapshot has none.

Reachable only when max_prefill_tokens < prompt <= max_batch_tokens
(two-phase runs above max_prefill_tokens, the monolithic arm needs the
whole prompt in the arena); with the defaults (arena = max_prefill + 1)
that is a single prompt length, so this was latent rather than observed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…last back under 500 LoC)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ATLAS_QWEN4EXP_PREFILL_ROWINV=1 disables the tail-checkpoint split (a
block-grid cut is off the 64-row GDN grid) and relies on
ATLAS_QWEN4EXP_PREFILL_MIDCHUNK_CKPT=1 to capture the checkpoint in-pass.
With ROWINV alone no tail SSM checkpoint is ever saved, so every warm
turn recomputes its whole prompt, silently. Measured on Flash-Next
FP4-Local agentic-webserver 50 (GB10): 0 checkpoints, TTFT p50
632 -> 3062 ms, 13.97 vs 12.43 s/turn. With MIDCHUNK_CKPT added: 307
intermediate hits, 11.76 s/turn.

Warn once at the first last-chunk where it applies. No behaviour change.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…-10-27

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Gate progress (sparky GB10, train tip c3bf9aa, job 10-train-gate):

  1. Control: identical. 4-request T=0 control (default FP4-Local recipe profile r1short) matches main + kernels: use __float2bfloat16 in batched_embed_nvfp4 so strix-hip builds (second break from #195) #204 (d2d114c) byte for byte.
  2. scheduler: tool-parameter markers from the served tokenizer (Nemotron tool calls cut at 1024 tokens) #196 Nemotron smoke: pass. NVIDIA Nemotron-3.5-Super-VL-120B-A12B-NVFP4 on the train binary resolves its tool-parameter marker classes from the served tokenizer. Both tool-repro cases finish with tool_calls at 3,240 completion tokens, past the old 1024-token cut, with 0 tool_envelope_stuck.
  3. agentic-webserver 50: running since 06:35 UTC (~75 min), then BFCL ST-995 (~3 h).

Logs: sparky ~/code/nightq/logs/10-train-gate.log, ~/code/perf/nq-train1027-gate-c3bf9aa25/.

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Agentic leg (train tip c3bf9aa, default FP4-Local recipe profile r1short, sparky GB10): 50/50 webserver_ok, 50/50 followed_directions, 12.60 s/turn (run-1793087766586885957, 380 turns, Σwall 4,833 s).

That s/turn sits ~1–2% above the two main-line references, so here's the split against the same harness and profile:

run s/turn turns Σwall decode tok/s (harness) TTFT p50 / p90 (server) Σ TTFT
main + #204 (d2d114c) 12.43 379 4,762 s 21.98 631 / 3,000 ms 428 s
main + #205 + #206 12.34 378 4,705 s 22.15 — —
train c3bf9aa 12.60 380 4,833 s 22.06 648 / 3,017 ms 433 s

Server-side decode and TTFT match main within ~1–3%. Of the +71 s Σwall, the server's TTFT accounts for ~5 s; the rest is one extra turn plus harness-side time (sandbox builds/tests of the code the model writes). That's one run per arm, so I'm reporting it as an observation, not as "no regression". A second agentic sample on this exact binary is queued (job 90-agentic-repeat-default). The control was byte-identical to main, so default-path numerics are unchanged.

BFCL ST-995 running since 07:56 UTC (~3 h).

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Gate PASS: merging. sparky GB10, train tip c3bf9aa, nvidia/Qwen3.8-Flash-Next-FP4-Local, default recipe profile (r1short, MTP 3, prefix cache on, PLE cache 2 GB):

leg result reference (main + #204, d2d114c)
4-request T=0 control byte-identical —
#196 Nemotron-3.5-Super-VL tool smoke pass (2/2, tool_calls at 3,240 tokens, 0 stuck) —
agentic-webserver 50 50/50, 50/50, 12.60 s/turn (run-1793087766586885957) 50/50, 50/50, 12.43 (run-1792654228906033074)
BFCL ST-995 87.44 / 87.32 (run-1793098282379875687) 87.44 / 87.32 (run-1792664799374893012)
serve log 0 ERROR / 0 panic —

BFCL matches main on all 15 subsets (hallucination 93.37, live 82.94, non_live 85.65). The agentic s/turn split is in the comment above: server decode and TTFT agree with main within ~1–3%. CI: only the repo-wide PR benchmark gate and cargo deny remain red (#215 fixes cargo deny); kernel shadow structure is green with #192. Artifacts: sparky ~/code/perf/nq-train1027-gate-c3bf9aa25/.

Still pending for #208: a live repro of the two-phase full-hit path (sparky job 16-twophase-208). It merges now on compile/test + this gate. The repro result will be posted on #208.

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.

1 participant