Prefill and decode: the two speeds of a chat model
Reading all prompt tokens at once ran at 524 to 531 tokens per second at 1k context, against about 67 when we replayed one token at a time. Writing the answer stays one token at a time.
Posts with this tag: 4
Reading all prompt tokens at once ran at 524 to 531 tokens per second at 1k context, against about 67 when we replayed one token at a time. Writing the answer stays one token at a time.
Writing one token means multiplying one row of numbers against a big table, a shape where the card waits for memory, not math. Four rounds of tuning on that shape ended with our kernel at 121.8 microseconds against AMD's 122.1, about 1 percent ahead.
A model reads your text, scores every possible next piece, picks one, adds it and repeats. We show the loop with our own engine, which runs it about 130.7 times a second on one RX 7900 XTX.
Square GEMM is the benchmark everyone runs; decode is M=1 streaming weights out of GDDR6 memory. Four frozen rounds, three wrong predictions, and a one-percent win that came from occupancy relief rather than fewer bytes.