Blockwise and Semi-Autoregressive Generation › Why One Token at a Time Is Expensive

Michael BrenndoerferNovember 17, 20262 min read
Language AI HandbookAll chapters
Part 19 of 67Alternative Sequence and Generative Architectures
Chapter 137Blockwise and Semi-Autoregressive Generation › Why One Token at a Time Is Expensive
Reading section 2 of 11 · Why One Token at a Time Is Expensive · 2 minSection 2 of 11 · 2 min

Section 2 of 11 · 2 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Recall from Decoder Architecture that the attention layer for a newly processed position can use keys and values cached for its prefix. With dense attention and a fixed model width dd, scoring that position against tt keys takes O(td)O(td) attention work per layer. The feed-forward cost for a fixed width is independent of tt. The cache avoids computing prefix keys and values again. The sampled token still needs to be chosen before it can serve as input for the next decision.

A model with NN parameters stored in bfloat16 uses about 2N2N bytes for weights alone. A 70-billion-parameter example takes about 140 GB of weight storage in decimal units before sharding or compression. This measures storage. Traffic on an actual device depends on how weights and cached activations are laid out, what fits in faster memory, and what the runtime reuses. In the bandwidth-limited setting discussed by Leviathan et al., processing multiple positions together can make greater use of the hardware while reusing the weight read.

A decoder's critical path counts steps whose inputs depend on earlier outputs. How that translates into elapsed time depends on the cost of each step. Time to first token includes prompt processing and the work before the first output. Inter-token latency measures the spacing between emitted tokens, so several tokens arriving together followed by a pause can have the same mean spacing as a smooth stream. Throughput measures aggregate output over time, usually across requests. Operation count and accelerator time are separate ways to track cost. Batching can improve aggregate throughput through reuse without shortening the logical dependency chain of an individual sequence.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy