Skip to content

glm metal: sampled MTP drafts drawn by the stream's keyed rule, same replies - #3402

Open
ashhart wants to merge 4 commits into
mainfrom
lead/glm-ports
Open

ashhart wants to merge 4 commits into
mainfrom
lead/glm-ports

Conversation

@ashhart

@ashhart ashhart commented Nov 15, 2026

Copy link
Copy Markdown
Owner

GLM-5.3-Flash on Metal: on sampled streams, MTP drafts are drawn by the stream's own keyed rule, so more of them land. Output is unchanged.

The change. Before, each MTP draft was the head's argmax, while the target samples. Now a sampled stream's draft is drawn with that stream's keyed rule, at the position the draft fills and at half the stream's temperature (a flatter head gives a sharper draft). The target's own keyed draw still decides every token, so replies can't change. Greedy streams are unchanged, and a two-Mac pair is untouched. TF_GLM_KEYED_DRAFTS=0 restores the argmax.

Why half the temperature: a sweep of sampled decode gave argmax 84.8 tok/s, full temperature 85.9, half 87.2, a quarter 85.3. At full temperature, creative prose lost speed.

Measured on an M5 Ultra (16 bench prompts, 512 tokens, --no-thinking, short context; two runs each):

Before After
Sampled 84.3 tok/s 87.2 tok/s (+3.4%)
Sampled, prose prompts 77.1 tok/s 78.4 tok/s (+1.6%)
Greedy 92.2 tok/s 92.3 tok/s
"draft": false 69.6 tok/s 69.5 tok/s
  • Replies: 48/48 equal to before.
  • Caveat: the keyed arms ran about an hour after the base arms, not interleaved. The base runs on either side were stable (84.2 and 84.3).

Tests: new tf-glm-drafts passes 30/30 on the full checkpoint. It covers greedy and sampled, generate and the served slots, keyed and argmax drafts, with plenty of misses: every reply equals "draft": false. Lean finds nothing new.

  • Synthena (Ash's Agent)

…half its temperature, where each lands

The MTP head drafted its argmax while a sampled stream's target draws keyed at each row's position, so a draft
matched only when the target happened to draw the head's top token. Each draft is now drawn with the stream's
own rule (seed, top-k, top-p, min-p) keyed at the position it would fill, the key the target's draw of that row
uses, at half the stream's temperature: the head's distribution runs flatter than the target's, and a sweep of
sampled bench decode on an M5 Ultra read argmax drafts 84.8 tok/s, keyed at the stream's temperature 85.9, at
half of it 87.2, at a quarter 85.3. The target's keyed draw still decides every token, so replies are unchanged.
Greedy streams keep the argmax; TF_GLM_KEYED_DRAFTS=0 restores it for sampled ones; a pair (sampled streams
refused) is unchanged.

tf-glm-drafts checks drafted against plain replies on the checkpoint, greedy and sampled, through generate and
the served slots (queued plain rounds; windows, keeps and drafts as the lane core runs them, misses included),
with keyed and argmax drafts, and prints the drafts each case kept.

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