04 N-gram memory tables

Recent tokens index a large lookup table; the retrieved vectors are added to the model, giving cheap memory without extra compute.

VideoThe idea in a few minutes

The problem

Layers spend capacity re-deriving fixed local patterns (names, phrases, code idioms).

VisualizationWhat early layers end up storing

The idea

Last n tokens → hash → table row → added to the residual stream.

VisualizationLookup path, step by step

The trade-off

Table size vs. quality, and why a lookup costs memory bandwidth but almost no FLOPs.

VisualizationParameters vs. FLOPs per token

Sources

Papers and model reports.