flâneur

Decoding Speculative Decoding from First Principles / JW Labs

jwlabs.vercel.app · 3,564 words · saved by 1 readers

JW Labs research post.

Prereq knowledge on autoregressive language models and hardware Large language models work like this: Old tokens + KV is fed through the model to predict the new token and KV. This is done in an iterative loop to keep generating next tokens. This loop needs to run even when reading the user's query (though the predicted next token is discarded). Where token is the word outputted, and KV is the cumulative knowledge of the sentence that gets iteratively built up. You should observe that generation is sequential. Token #50 depends on token #49 which depends on token #48 and so forth. This…

saved by

related reading