Skip to content

scheduler: let strict sequences share the batched MTP verify under ATLAS_STRICT_SPEC - #343

Merged
AzeezIsh merged 3 commits into
Atlas-Inf:mainfrom
maplepaladin73:devin/strict-spec-batched
Nov 11, 2026
Merged

AzeezIsh merged 3 commits into
Atlas-Inf:mainfrom
maplepaladin73:devin/strict-spec-batched

Conversation

@maplepaladin73

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #336. With ATLAS_STRICT_SPEC=1, a speculating strict (response_format) sequence still took a verify forward of its own every step: plan_verify kept every strict grammar on the per-sequence path. N concurrent structured requests ran N verify forwards a step, and a lone one was cut to 3 drafts because the deep window (ATLAS_MTP_DYNAMIC_DEPTH) only runs through the batched verify.

On a full-logits MTP verify the batched pick already runs the same host pipeline per member as the per-sequence verify (the non-strict grammars of #203 ride it). Strict sequences now join the batch, as decode rows too, where strict_spec::rides_batch holds. The argmax-only head and the DFlash batch keep the per-sequence verify.

No new environment variable. ATLAS_GRAMMAR_SERIAL_VERIFY restores one verify per grammar sequence, which is the A/B arm below.

Measured

Qwen3.8-Flash-Next FP4-Local, two GB10 at TP=EP=2, 8 lanes x 262K, --speculative --num-drafts=7, idle pair, GPU clock locked at 2,200 MHz on both nodes, no thermal throttling in any arm. Fresh boot per arm, same build. scripts/dev/strict_spec_ab.py, temperature 0 unless noted, 3 repetitions, one session. Aggregate wall tok/s (prefill included); noise floor from two records of the off arm is about 2%.

case off (lever unset) serial (#336 as merged) on (this PR) on / serial on / off
json_schema, 1 request 36.5 68.5 70.8 1.03 1.94
json_schema, 2 at once 57.0 69.2 101.3 1.46 1.78
json_schema, 4 at once 90.0 67.6 149.0 2.20 1.66
json_schema, 8 at once 134.5 66.7 207.4 3.11 1.54
json_object, 1 request 36.3 64.5 68.9 1.07 1.90
json_schema, temperature 0.8, 4 at once 87.1 58.6 124.6 2.13 1.43
1 json_schema beside 3 plain 78.9 83.1 124.0 1.49 1.57
plain, 1 request (control) 50.0 49.8 50.0 1.00 1.00
  • scheduler: speculate strict structured output on full-logits verifies #336 alone loses under concurrency on this profile: 0.75x at 4 and 0.50x at 8 against the lever off. The profile sets ATLAS_MTP_GATE_FORCE=1, which bypasses the throughput gate that could otherwise fall back to plain decode. This PR removes that loss.
  • Engagement (ATLAS_MTP_ACCEPT_DEBUG): serial verifies are almost all n=1; on reaches n=4 and n=8. A lone structured request ends at depth=k7 tok_step=3.63 in on against depth=k4 tok_step=3.16 in serial.
  • Output: every temperature-0 reply is byte-identical across the three arms, at 1, 2, 4 and 8 concurrent (800-token replies). A separate on run at 2,400 output tokens: every structured reply ends with finish_reason=stop and is schema-valid, 0 invalid in all 11 cases, 0 request errors.

Not measured: the tool-call-or-JSON union (the tested profile serves with --disable-tool-grammar, so it never forms), any model other than qwen4_exp, and the DFlash lane (unchanged by this PR).

Test plan

  • cargo fmt --all -- --check
  • ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --tests
  • bash scripts/check-license-headers.sh, typos
  • cargo test -p spark-server --bin spark scheduler::: 695 passed, 1 ignored (CPU, stubbed CUDA libraries)
  • New step tests (mtp_step/one_forward_strict_tests.rs), each failing with the lever off: routing; two strict members in one forward, one sampled with an illegal draft and an illegal raw top; a window crossing </think>; a lone deep window
  • Tested against a real model / hardware (table above)

Notes for reviewers

  • ATLAS_STRICT_SPEC stays opt-in here. Measurements that would flip it to default: the tool-call-or-JSON union on hardware, and the same A/B on a second full-logits model.
  • The second and third commits replace the pre-run test plan scheduler: speculate strict structured output on full-logits verifies #336 brought in (docs/notes/HANDOFF_PR336_strict_spec.md, which still said nothing had run on hardware) with the three-arm harness that produced the table. Its default output budget is now 2,400 tokens; 800 truncated the 12-item reply in every arm.
  • Also corrects comments scheduler: speculate strict structured output on full-logits verifies #336 left saying strict speculation is GLM-only or that the verify trims drafts.
  • Adds no ATLAS_* name. scripts/check_env_budget.py already fails on main.

CLA

maplepaladin73 and others added 3 commits November 10, 2026 17:28
…LAS_STRICT_SPEC

A speculating strict (response_format) sequence still took a verify
forward of its own every step: plan_verify kept every strict grammar on
the per-sequence path. N concurrent structured requests ran N verify
forwards a step, and a lone one was cut to 3 drafts because the deep
window (ATLAS_MTP_DYNAMIC_DEPTH) only runs through the batched verify.

On a full-logits MTP verify the batched pick already runs the same host
pipeline per member as the per-sequence verify (the non-strict grammars
of Atlas-Inf#203 ride it), so strict sequences now join the batch, as decode rows
too, where strict_spec::rides_batch holds. The argmax-only head and the
DFlash batch keep the per-sequence verify. ATLAS_GRAMMAR_SERIAL_VERIFY
restores it for every grammar, which is the A/B arm. No new variable.

Tests: routing, two strict members in one forward (one sampled, with an
illegal draft and an illegal raw top), a window crossing </think>, and a
lone deep window. Not run on hardware.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The harness takes a third arm (lever on, one verify per structured
request: ATLAS_GRAMMAR_SERIAL_VERIFY), names its columns after the
records, and defaults to 2400 output tokens: 800 cut the 12-item reply
short in every arm, which read as invalid JSON.

docs/notes/HANDOFF_PR336_strict_spec.md was the plan written before any
hardware run and still said so; the measured result is in the PR.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The previous commit's message describes this default, but the edit was
left unstaged.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@maplepaladin73 maplepaladin73 changed the title Devin/strict spec batched scheduler: let strict sequences share the batched MTP verify under ATLAS_STRICT_SPEC Nov 10, 2026
devin-ai-integration Bot added a commit to maplepaladin73/atlas that referenced this pull request Nov 10, 2026
…tep timing)

The probe takes --final-tool-choice auto (tool_choice unset on the final
turn, the union); the harness takes --cases and defaults to 2400 output
tokens.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
maplepaladin73 added a commit to maplepaladin73/atlas that referenced this pull request Nov 11, 2026
…ol-call-or-JSON union A/B

Generated with [Devin](https://devin.ai)

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

Copy link
Copy Markdown
Contributor Author

Follow-up measurements

Same pair, build and profile as the table in the description; fresh boot per arm, idle pair, no throttling. off = lever unset, serial = #336 as merged (ATLAS_GRAMMAR_SERIAL_VERIFY set), on = this PR.

1. Second workload: 6 json_object + 6 json_schema requests, thinking off, 400 max tokens, one at a time, then through a pool of 8

off serial on
1 at a time, per-request median decode tok/s 36.7 59.6 60.5
pool of 8, per-request median decode tok/s 17.5 8.1 24.0
pool of 8, aggregate tok/s 155.0 77.1 197.2

All 12 replies are byte-identical across the three arms, alone and concurrent; 12/12 valid in every arm, 0 request errors.

2. Tool grammar on (served without --disable-tool-grammar), lever off against on

case off on on / off invalid on identical
json_schema, 1 request 36.6 70.8 1.93 0/3 3/3
json_schema, 4 at once 86.8 145.0 1.67 0/12 12/12
json_object, 1 request 36.5 69.8 1.91 0/3 3/3
plain, 1 request 50.2 50.3 1.00 0/3 3/3

A request carrying tools and response_format (the tool-call-or-JSON union, scripts/dev/tools_rfmt_probe.py) returned schema-valid JSON identical to the lever-off boot in 15 of 15 runs, at serial=0.03 mtp=0.97 with the lever on. The model took the JSON branch in every run in both boots, so a union reply that opens a tool call under the lever is still not measured on hardware.

3. Step timing (ATLAS_MTP_TIMING, 1 request, lever on)

per verify step json_schema plain
forward ~43 ms ~37.5 ms
propose ~7.5 ms ~4.5 ms
grammar pick work (fast_greedy + pipeline) 1.2-2.3 ms ~0
total ~52 ms ~42 ms
tokens per step 3.63 2.16

The grammar path is 3-4% of a strict step; the rest of the difference from plain is the deeper draft window (depth=k7 against k4).

@AzeezIsh
AzeezIsh merged commit 32fa2a3 into Atlas-Inf:main Nov 11, 2026
21 of 26 checks passed
@AzeezIsh

Copy link
Copy Markdown
Contributor

Merged after an A/B on ONE GB10 (sparky). Setup: Qwen3.8-Flash-Next NVFP4 (the vendor pack, not FP4-Local), a local test merge of main 595cfb31c + this PR vs main itself, both qwen3.8-flash-next builds. Serve: the shipped NVFP4 recipe line with --max-num-seqs 8 --max-batch-size 8 --num-drafts 7 and ATLAS_MTP_GATE_FORCE=1, as in your profile. Probe: 6 json_object + 6 strict json_schema, greedy, thinking off, C1 then C8.

arm valid / schema accepted drafts C1 median tok/s C8 median tok/s
main (strict serial) 12/12 / 12/12 0 17.3 5.13
PR, switch unset 12/12 / 12/12 0 17.3 5.13
PR, ATLAS_STRICT_SPEC=1 ATLAS_GRAMMAR_SERIAL_VERIFY=1 (#336) 12/12 / 12/12 801 26.2 3.68
PR, ATLAS_STRICT_SPEC=1 (this PR) 12/12 / 12/12 799 26.2 5.05
  • This PR removes scheduler: speculate strict structured output on full-logits verifies #336's concurrency loss on one Spark too: at C8, 3.68 → 5.05 tok/s, now level with strict serial. It keeps the 1.5× C1 gain. Batched strict verifies engage (n=8 rows in the accept log).
  • On this single-Spark profile C8 only gets back to parity rather than your pair's 1.54× over off. A single NVFP4 box is more bandwidth-bound per step.
  • Switch unset == main: 12/12 at C1, 11/12 at C8. The one C8 difference is batching noise; this profile isn't batch-invariant without the exact levers (main's own C1 vs C8 is 7/12). For the same reason, temp-0 text isn't byte-comparable across arms here, unlike your exact-lever run.
  • 0 serve errors; strict_spec 11/11; scheduler:: 698/698. CI: I approved the fork's workflow runs; cargo test, clippy, fmt and rustdoc pass.

Receipts: nq-120-pr343-strict-mtp on sparky.

AzeezIsh pushed a commit that referenced this pull request Nov 12, 2026
…-f341)

Campaign against frozen main f3f700a (#343 strict-spec batching + #350/#351
kv_budget/dflash follow-ups). Ten required gates run on two exclusive GB10
boxes; records split b4ee (echolp, ttft x2, ssm, decode-floor, concurrency,
vision, video) / f341 (bfcl-subset, agentic-webserver).

video-fidelity FAILS its gate floor: backend-parity leg — mp4 (32f/8fps)
samples to 16 groups/928 tok while the zero-delay gif fixture lands at 4
groups/244 tok; deterministic divergence between the ffmpeg subprocess and
in-process gif decoders on this tree. Record committed is the earlier
ffmpeg-absent run (7/13 legs, 6 skipped); the full-ffmpeg rerun scored
12/13 and wrote no record because the run ended Failed.

Required manual fixes this campaign needed: libssl-dev + ffmpeg on the
gate boxes, soundfile in the bfcl venv, and a serve-override restoring the
bfcl recipe's shell-quoted default_chat_template_kwargs as raw JSON.
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