Skip to content

[Draft] EXL3 Flash Next: drafts on by default for one user, guarded by measured tokens a ms (slice 6, #1419) - #51

Draft
BlivionIaG wants to merge 1 commit into
chain/s5-basefrom
chain/s6-drafts-guard
Draft

BlivionIaG wants to merge 1 commit into
chain/s5-basefrom
chain/s6-drafts-guard

Conversation

@BlivionIaG

@BlivionIaG BlivionIaG commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Draft, slice 6 of the chain in ashhart#1419. Stacked on slice 5; review only the last commit.

What

For one user the serve script now loads the MTP head and drafts by default, and the lane engine's depth rule decides per stream whether a round is drafted:

  • A drafted verify window on offloaded experts costs about 18 ms for its first extra row (the missed experts' PCIe copies), so drafts only pay where they land often. The depth rule now keeps, per stream, the tokens a ms of rounds that launched the head's chain and of rounds that did not (a round's time carries the chain it launched), runs plain where plain earns more, leaves plain only on a 20% win, and probes one drafted round after a growing run of plain ones (8, 16, 32, 64).
  • The guard applies to EXL3 engines with offloaded experts only; NVFP4 Flash Next and every other family keep their behaviour (the backend reports plain_guard only then).
  • Verify-window graphs capture on their 12th sighting, a decode round on its 2nd: a tensor-parallel capture is an instantiation of about 39 ms and most window keys (rows x state set x attention seams) were replayed zero or one time. TF_FLASHNEXT_EXL3_GRAPH_DECODE_AFTER still overrides both.
  • tools/exl3_serve_tp2.sh drafts by default at PARALLEL=1 only: with two lanes a plain round in a drafting engine costs more (about 41 ms for two streams against about 25 ms on a no-draft server), and two concurrent prose streams were 22% slower with drafts. TF_FLASHNEXT_DRAFT_ENABLE=0 turns drafts off.

Exactness

Drafted output equals draft: false output: bench_concurrent.py --alone --serial reports equal on every cell (one stream and two), and 24 prompts at temperature 0 are byte-identical to the no-draft run. Concurrent replies equal their solo runs.

Measurements (2x RTX 5060 Ti sm_120, PCIe 4.0 x8, EPYC 7452, 251 GB RAM, driver 615.71, CUDA 13.4, Zig 0.17.0, TP=2, one user)

Both rows measured on the two slice trees (build, 294 host tests, kernel-contract tests pass on each); output hashes are identical between them (40 tokens 90e6c65ca5ba, Zig 6dfc89b1abb6, docs e6834625432c). Client: 192 tokens, temperature 0, second request. TTFT s / decode tok/s / mean ITL ms:

prompt slice 5, plain (80 lines) this slice, drafts + guard (80 lines)
40 tokens 0.34 / 46.6 / 21.4 0.37 / 46.5 / 21.5
16,022 tokens (Zig source) 10.63 / 34.9 / 28.7 11.22 / 104.7 / 9.6
12,780 tokens (docs) 10.44 / 36.5 / 27.4 10.95 / 57.3 / 17.4

Repo clients (bench_openai.py 256 tokens x3 greedy; bench_cache.py exact token-ID prompts with --require-cold, prompt cache off), drafts on: decode 44.9 tok/s (code prompt) and 49.3 (prose); cold prefill TTFT 2,048 tokens 2.4 s, 8,192 tokens 5.6 s, 30,000 tokens 22.0 s; all repeated and concurrent replies equal the first reply's token hash. Peak process memory: 33.1 GB and 33.8 GB resident (22 GB pinned expert bank), 15.2 / 14.3 GB device used.

Costs, stated plainly: drafts add about 5-6% to TTFT and lower prefill on long prompts (the head's prompt pass and 8 fewer expert lines); drafted streaming is bursty (Zig: about 17 tokens every 180 ms, p99 gap 300 ms against 62 ms plain); a 31k-token prompt gets no drafted decode gain; short prose is about equal to plain.

Tests run

zig build native, test-flashnext-exl3-host (294 pass), compile-cuda-tests, test-kernel-contract pass on sm_120; unit tests for the guard in core/lanes/depth.zig. Not run: other architectures, the FP64 references (this slice reorders no arithmetic), test-golden on a Mac, Linux CI, HIP.

Not done in this PR

  • Two concurrent users: the guard learns in shared rounds (tried) but the plain round in a drafting engine stays more expensive, so the script does not draft above one lane.
  • Sampled (temperature above 0) draft behaviour is not measured here.

…ed tokens a ms

A drafted verify window on offloaded experts costs about 18 ms for its first extra row (the missed experts' PCIe copies), so
drafts pay only where they land often. The lane engine's depth rule now keeps, per stream, the tokens a ms of rounds that
launched the head's chain and of rounds that did not, runs plain where plain earns more, leaves plain only on a 20% win and
probes a drafted round after a growing run of plain ones. The guard applies to offloaded EXL3 engines only; NVFP4 Flash Next and
the other families keep their behaviour. Verify-window graphs capture on their 12th sighting (a decode round on its 2nd): a
tensor-parallel capture is an instantiation of about 39 ms and most window keys were replayed zero or one time.
The serve script drafts by default at PARALLEL=1 only: with two lanes a plain round in a drafting engine costs more than on a
no-draft server. TF_FLASHNEXT_DRAFT_ENABLE=0 turns drafts off.

This branch has not been deployed

No deployments
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