Skip to content

glm cuda dflash2: opt-in measured window prices and cost-derived width - #4573

Open
ashhart wants to merge 2 commits into
mainfrom
lead/glm-priced-windows
Open

ashhart wants to merge 2 commits into
mainfrom
lead/glm-priced-windows

Conversation

@ashhart

@ashhart ashhart commented Nov 22, 2026

Copy link
Copy Markdown
Owner

What this changes

GLM's DFlash2 path verified windows priced by seed formulas (cuda_lane_costs.zig: only MTP published a measured table) and cut each drafted block with a fixed 0.7 probability product after the block was drafted. With TF_GLM_PRICED_WINDOWS=1:

  • Startup times real-text windows for DFlash2 as it does for MTP and publishes the table to the lane core (seed table as the fallback when timing is refused).
  • A generic lane-core option (priced_windows, core/lanes/window_price.zig) calibrates each draft position's chance from observed landings and asks the existing allocator to score every prefix of the drafted block, verifying the width with the best expected kept tokens per measured cost.

Drafting only decides which rows the target verifies, so outputs are unchanged. Off by default; other families are untouched (the option is per family).

Checks

  • Host tests: the measured table is published; steep costs pick narrower widths and flat costs wider; switch off keeps seed prices and the 0.7 cut; environment table and count; compile-cuda-tests (host runner only); fmt, ast-check.

Still to run

Two GB10s, one stream, prose and code with DFlash2, both arms' tokens equal to a draft-off run (kill if either is slower or the gain is under +3%).

@Bizuayeu

Copy link
Copy Markdown
Contributor

Two GB10s, one stream, prose and code with DFlash2, both arms' tokens equal to a draft-off run (kill if either is slower or the gain is under +3%).

#4573

I can run that check on two GB10s at TP=2, if it helps: this head against main, TF_GLM_PRICED_WINDOWS=1 on the head, the two arms taken in turn, and a draft-off run for the tokens, one stream, on the 64 prose and 64 code prompts of our evaluation set at temperature 0. Two things we measured on that pair point at what this changes. A lone DFlash2 round is priced from the seed table shared_costs (76 ms and 4.1 ms a row, cuda_copy_policy.zig), but served rounds there took 41.87 ms and 5.87 ms for each draft verified (fitted to the seconds of 320 replies at five cuts from 0.9 to 0.2, within-request R² 0.979), on the weights below with the expert form fixed by TF_GLM_EXPERT_FORM=factored; the price moves with the weights and the build, which a table timed at startup takes in. And DFlash2's chances run high: replaying the same replies offline, in a counter that matches serving's tokens a round within 0.013, the mean product of chances at a block's first, third and seventh draft is 0.810, 0.491 and 0.172 for prose, while the share of blocks that landed whole to there is 0.672, 0.206 and 0.026 (code: 0.953, 0.865 and 0.690 against 0.947, 0.792 and 0.508).

The head conflicts with main since 1d7cc5f, in the environment table, the build's host list, cuda_env_test.zig and the timing identity in cuda_lane_costs.zig, none of them in the allocator. I would resolve those locally for the run and can push that head to my fork if you want it; if you would rather rebase it yourself first, I will run on yours. The pair serves our 4-bit checkpoint (Bizuayeu/GLM-5.3-Flash-Jammed-XSFP4) with the published DFlash2 at its default 4 bits; say if you want other weights. I would report decode tok/s for prose and code and each arm's tokens against the draft-off run, against your kill line.

Related: the fit and its per-request data, https://github.com/Bizuayeu/Open-DNeo/tree/v0.8.0/receipts/2026-11-23-round-time

@Bizuayeu

Copy link
Copy Markdown
Contributor

Two GB10s, one stream, prose and code with DFlash2, both arms' tokens equal to a draft-off run (kill if either is slower or the gain is under +3%).

#4573

I ran that check on two GB10s at TP=2, on this head as it stands (6ea7cc6a7f) against its base on main (ce0264367e). Tokens equalled the draft-off run in all 512 replies. Prose was 6.2% slower, and code showed no gain (−0.4%, the same size as the 0.2–0.3% between its own launches). By the description's line, that is a kill.

decode tok/s (pooled, mean of two launches) base ce0264367e head, TF_GLM_PRICED_WINDOWS=1 change
prose (64 prompts) 36.50 34.25 −6.2%
code (64 prompts) 61.88 61.63 −0.4%

Setup. Both natives were built with an empty Zig global cache (Zig 0.17.0, nvcc 13.3, sm 121). The head conflicts with current main, so I measured it unrebased against its merge base instead of a local resolution. The checkpoint was Bizuayeu/GLM-5.3-Flash-Jammed-XSFP4 at 0a22bb46ec, with the published DFlash2 (incoai/GLM-5.3-Flash-DFlash2 at 6cc6c481ee, its default 4 bits), at context 1048576 and parallel 4. Every launch pinned TF_GLM_EXPERT_FORM=factored and kept the default cut. Each launch was fresh and sent the 64 prose and 64 code prompts of our evaluation set one at a time, greedy, on /v1/completions. The order was a draft-off run (every request "draft": false), base, head, head, base. No heat wait or heat-cap change fell inside any launch.

Exactness. In each of the four drafting launches, every reply's token_sha256 equalled the draft-off run's for the same prompt: 512 of 512.

Speed. Decode tok/s is the engine's own tokens / decode from its done lines, pooled over a class's 64 replies.

launch prose tok/s prose tokens a round code tok/s code tokens a round
draft-off 25.83 1.004 25.80 1.004
base 1 36.54 2.040 61.83 4.782
head 1 34.38 2.206 61.71 5.128
head 2 34.12 2.204 61.55 5.131
base 2 36.47 2.040 61.94 4.788

The two launches of an arm differed by 0.8% at most. Both head launches started from glm: windows (kept): 38.06 ms at 1 row, 61.03 at 4, 173.15 at 32, a draft 0.67 ms. That table was timed at the start of one earlier head launch, which my own log check stopped before it sent any request.

The head took more tokens a round, and each round took longer by more than that:

per round (both launches of an arm) prose base prose head code base code head
tokens 2.040 2.205 (+8.1%) 4.785 5.130 (+7.2%)
decode ms 55.9 64.4 (+15.2%) 77.3 83.2 (+7.6%)

The median time to the first token was the same in both arms (prose 0.385 s and 0.384 s, code 0.371 s).

What this does not cover. I did not run the head with the switch off, so the difference is the base binary against the head binary with TF_GLM_PRICED_WINDOWS=1, not the switch alone. This is the unrebased head against its own base, not a measurement on current main. It is one checkpoint, one pair of GB10s, one stream, replies of up to 256 tokens, and prose and code only. The window table was timed once and read as kept in both counted launches; I did not check whether timing it again moves the table.

@Bizuayeu

Copy link
Copy Markdown
Contributor

I did not run the head with the switch off, so the difference is the base binary against the head binary with TF_GLM_PRICED_WINDOWS=1, not the switch alone.

#4573 (comment)

I have now run that: two launches of the head with the switch off, with a third base launch between them, on the same pair, setup and prompts. With the switch off, the head matched the base, so the slowdown above comes from the switch.

decode tok/s (pooled) base (3 launches) head, switch off (2) head, switch on (2, above)
prose 36.48 36.55 (+0.2%) 34.25 (−6.1%)
code 61.87 61.93 (+0.1%) 61.63 (−0.4%)

The changes are against the base's three launches. With the switch off, the head took the same tokens a round as the base (prose 2.040 in every launch, code 4.782 to 4.788) and printed no windows line. In all 384 replies of the three new launches, tokens equalled the draft-off run. The third base launch was within 0.2% of the first two.

@ashhart
ashhart force-pushed the lead/glm-priced-windows branch from 6ea7cc6 to b7eae3b Compare November 26, 2026 21:31

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.

2 participants