The cost — why length gets expensive.
Attention's power comes from every note listening to every other. That same “everyone hears everyone” is exactly why a longer line costs so much more.
Here's the bill for that any-to-any reach. To choose the next note, each note in the line has to be weighed against every other note. Two notes: a couple of comparisons. Ten notes: every one checked against all ten. The work isn't the length of the line — it's the length times itself.
That's the shape people mean by “attention is quadratic”: n notes cost about n × n comparisons. It's like a room where everyone must shake hands with everyone — add a few more people and the number of handshakes jumps far faster than the headcount.
This is the hidden price behind the context window from Lesson 2. Doubling the prompt doesn't double the work — it roughly quadruples it. Attention is the piece that scales this way; the rest of the model grows only in step with the length, which is why context length, not raw model size, has been the wall — and why “just paste everything in” has a real ceiling.
Stretch the line and watch the grid of comparisons fill in — every note against every other. The count is the real cost, and it climbs far faster than the line gets longer.
64
256
n notes, n × n comparisons.
Attention scores every position against every other — a full grid. That double loop is why the cost grows with the square of the length, not the length itself.
# every note is weighed against every other note for a in notes: # n notes for b in notes: # × n notes score[a][b] = relevance(a, b) # total comparisons = n × n = n² # 10 notes -> 100 # 100 notes -> 10,000 # 1000 notes -> 1,000,000 ← 10× the line, 100× the work
Power and price, same coin.
Letting every note hear every other note is what gives attention its reach — and it's the very thing that makes it expensive. The comparisons grow with the square of the line, so a prompt that's ten times longer is roughly a hundred times the work. That single fact sits behind why bigger context windows are hard, slow, and pricey.
Use it: shorter, well-aimed prompts aren't just tidier — they're cheaper and faster. Retrieving the few relevant chunks (Lesson 7) beats pasting a whole long document, because you pay for length squared.
Attention's genius and its bill are the same mechanism: everyone hears everyone. Great for holding a thread — costly the longer the thread gets.