Repository navigation
feat(model): guessed tokens checked in one sweep, and undone when wrong - #31
Merged
Merged
Conversation
…undone; a drafter that looks the text up in itself
…ce; docs: note 23
…e guard on scores after an undo tested, the tightest undo case, a sweep without scores refused
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Milestone I2, the first use of several positions per sweep: guess the next few tokens, let one sweep check them.
What is in it
Inkling::undo(n): takes back the lastntokens of the last batch (never its first; at most 16, 15 on the device).Opsgainsundofor a layer pass.window - 1 + 16tokens when it drops old ones; a convolution memory keeps what it was when the last batch started and what the batch fed, and rebuilds itself.Inkling::generate_greedy_drafted: after each token chosen, aDrafterproposes up to 15 tokens; they are fed in one batch behind the chosen token; guesses are kept while they are the model's own choice, and the rest are undone. The tokens are those ofgenerate_greedy.LookupDrafter: proposes what followed the most recent earlier occurrence of the last few tokens. No weights.examples/generate.rs draft [guesses] [match]measures it. Learning note 23.Measured (Inkling 2 Mini on the GB10)
At most 200 new tokens, up to 4 guesses per sweep after a match of the last 4, 3 or 2 tokens:
The tokens were the same with and without guesses in every run. The mechanism costs what the batch measurements predicted; the lookup is a weak guesser for ordinary text. The checkpoint's own draft head is not loaded yet and would plug into the same trait.
How it was checked
dluth-cudatests with the real checkpoint.tools/mutants.sh cpu: all killed. All 57 that need the GPU applied by hand on the GB10: each caught. One planted bug survived its first run ("the whole last batch can be undone": the CPU operations refuse it a second time); its test moved to the device, where only the model's check stands.Review
The qwen reviewer asked for changes. It traced the position arithmetic, the identity of the tokens with plain generation for any drafter, the undo of histories and convolution memories, and the device argument with numbers, and found them correct.
Made: the note's table said 200 new tokens for a run that ended at 168 (now counted per row); a guard no public call reaches had no test and a comment that claimed one (now a unit test); the trait's doc on how much can be undone; a sentence about drawn tokens that ran ahead of the code; the tightest undo case as a test; the device comment names its numbers; a sweep without scores is an error.
Declined: "sweeps plus right guesses equal tokens minus one only for some drafters" (it holds for any: each sweep gives one token plus its right guesses); "
ring_slotscan divide by zero" (both callers check the channel count first).