Skip to content

feat: the model's draft head as the guesser, on the CPU, on the device and in the server - #34

Merged
Defilan merged 9 commits into
mainfrom
agent/i2-draft-head
Nov 25, 2026
Merged

Defilan merged 9 commits into
mainfrom
agent/i2-draft-head

Conversation

@defilan-agent

@defilan-agent defilan-agent Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

What

The model's own draft head as the guesser, on the CPU and on the device, and wired into the server. Inkling 2 Mini on the GB10, same prompt, same text: 28.1 tokens per second without guesses, 33.5 with the head proposing 2 a sweep.

  • Drafter is generic over the model's values and has two new methods with defaults: wants (after how many layer applications the running sum is wanted) and fed (told after every batch what was kept). Inkling::tap keeps the wanted values per batch. A drafter that only reads the text is unchanged.
  • dluth-model/src/inkling/mtp.rs: the head on the CPU in 32-bit floats, the reference for the device.
  • dluth-cuda/src/draft_head.rs and kernels/draft_head.cu: the head on the device.
  • The scores of each guess do not go through the output table again. The corrected hidden state is the block's hidden state plus a fixed matrix times a small vector, so the table times that matrix is computed once at load, and a guess reads that product and adds the block's scores.
  • dluth-cuda serve loads the head when the checkpoint has one and proposes 2 a sweep. --head off and --guesses change that. A head that cannot be read is done without, with the reason printed.
  • examples/generate.rs head [most] measures it. Learning note 25; README updated.

How the head's weights are used was worked out from the public papers (arXiv 2606.02091, arXiv 2607.05147) and from measurements on the checkpoint. Three points of that reading are still open and are each worth a few percent of right guesses; the note names them. A wrong reading cannot change the text: a guess is only kept when it is the model's own choice.

Measured

GB10, 199 tokens after the first, greedy:

Guesses per sweep Tokens per second Sweeps Guessed Right
none 28.1 199
1 30.9 126 125 73
2 33.5 102 203 97
3 31.4 97 288 102
4 30.0 91 364 108

Through the server, 300 new tokens: an explanation 33.3, a Rust function with tests 39.1, the explanation with drawn tokens at temperature 1, 30.4.

How it was checked

  • Mac: format, lint, and the test suite with the real model.
  • GB10: format, lint, and the whole workspace's tests with the real model. The reference still matches 96 of 96; the real head on the device takes 35 sweeps for 96 tokens with the same text.
  • A head of random weights on the tiny model changes nothing in the text, whatever it proposes, and its proposals are written down in a test. The device head makes the same proposals as the CPU head.
  • Planted bugs 153 to 171 new: the head's parts on the CPU, its parts on the device, and the plumbing that tells a drafter what was fed. All CPU planted bugs and all GPU planted bugs were run, each caught.

Review

Changes requested. Fixed:

  • --head off did not help when the head's description could not be read. A head that is off is now not looked at.
  • Wrong guesses were undone after the drafter was told, so a drafter that failed there left them fed. They are now undone first.
  • The product computed for the head's guesses kept 205 MB of device memory it only needed while loading. Freed.
  • An engine asked for no guesses still kept its drafter in step, token by token. It no longer does.
  • Added because nothing exercised it: a conversation that goes on with a head as the guesser.

Declined:

  • "After an error the drafter is out of step for the life of the process." The engine forgets what the model holds on any failure and feeds the next request from position 0, which starts the drafter afresh. The case the finding built on (a prompt batch above 16 with the device head) is refused by the device model before the drafter hears of it; the serving program now also refuses that setting at startup, in words.

@Defilan
Defilan merged commit f8fdebc into main Nov 25, 2026
2 checks passed
@Defilan
Defilan deleted the agent/i2-draft-head branch November 25, 2026 18:50
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