Module 4 · What the model can see

Budgeting the window, line by line

In this lesson

  • 8 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 2 of 9 in this chapter

This chapter’s goalBudget a context window across system prompt, history, retrieved material and output; predict where in a long prompt information is most likely to be missed; and explain why prompt injection is a structural property of the input format rather than a bug awaiting a patch.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
A 128,000-token window, and the 21,440 tokens actually claimedSystem prompt and policy: 1,800Grows by three sentences each time somebody patchesan edge caseTool and function definitions: 2,400Serialised into every request, including the oneasking when the office closesFew-shot examples: 1,200Cheap to add, rarely revisited, occasionallycontradicting the system promptRetrieved documents, six at 700: 4,200Six good passages beat forty mediocre ones, and notonly on priceConversation history, 18 turns: 9,600Nearly half the input alreadyThe current user message: 240The only part a person actually wroteReserved for the response: 2,000Input and output share the window; unreserved, thereply is cut off mid-sentenceThis application is nowhere near its limit, so a bigger window would fix nothing it has wrong. Thepressure will come from history, which is the only line that grows every turn, and the line nobody hasever examined is the tool definitions.
This application is nowhere near its limit, so a bigger window would fix nothing it has wrong. The pressure will come from history, which is the only line that grows every turn, and the line nobody has ever examined is the tool definitions.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 7Free · no account needed
Lesson steps

Write down where it all goes

People discover their context budget when something breaks. It is better to compute it in advance, because every item on the list is a decision somebody made and can unmake.

A realistic assistant with a 128,000-token window:

Text
system prompt and policy               1,800
tool / function definitions            2,400
few-shot examples                      1,200
retrieved documents (6 × 700)          4,200
conversation history (18 turns)        9,600
current user message                     240
------------------------------------------
input                                 19,440
reserved for the response              2,000
------------------------------------------
total                                 21,440   of 128,000

Two things become visible immediately. First, this application is nowhere near its limit, so “we need a bigger window” would be the wrong diagnosis for any problem it has. Second, history is nearly half the input and growing every turn, which is where the eventual pressure will come from.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the AI, Actually Explained exam.

Stuck on something?Ask Anjali, your AI tutor

How to cite: Addaly (2026) ‘Budgeting the window, line by line’, in How a Language Model Actually Works. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/how-llms-work/what-fills-the-window (Accessed: 29 November 2026).