Back to course overview
Module 1How models read your prompt 12 min

Tokens & context windows

What the model actually receives: tokens, the context window as a hard budget, and the position effects that decide what gets ignored.

Foundations taught you to brief a model. This course teaches you to engineer it — to build prompts that behave the same way on the thousandth run as the first. That starts with seeing what the model actually receives, because it isn't text as you think of it.

Your workspace (read this first)

Everything in this course works in a chat window — claude.ai, ChatGPT, or Gemini. No code, no API, nothing to install. You'll produce a handful of artifacts (your prompt versions, a test set, logs); keep each as a plain-text file in TextEdit, Notepad, or Google Docs — one file per artifact. When a later lesson says "version control," it means exactly that discipline: one file per version with a short change note at the top — not a tool you have to set up.

Tokens: the model's unit of everything

Before your prompt reaches the model it's chopped into tokens — chunks of roughly 3–4 English characters. understanding might be under+standing; the is one token; a rare surname might be four. Everything is priced, budgeted, and limited in tokens: a 1,000-word document is roughly 1,300–1,500 tokens; a 50-page PDF is ~25,000.

  • Cost scales with tokens — in, and out. A verbose prompt run 10,000 times a month is a real line item; trimming 400 useless tokens from a production prompt is free money.
  • Latency scales with output tokens — models generate one token at a time. Asking for 'a brief answer' isn't politeness; it's a performance knob.
  • Weird splits explain weird failures — token boundaries are why models miscount letters in words and mangle very long IDs. Now you know why.

The context window: a hard budget, not a suggestion

The context window is the total tokens a model can consider at once — prompt, pasted documents, conversation history, and its own output, combined. Modern models offer large windows (hundreds of thousands of tokens), but two things stay true at every size: when it's full, something gets dropped or truncated — usually silently; and more context isn't free — you pay for every token whether or not it helped.

Position effects: the middle is a bad neighborhood

Models attend most reliably to the beginning and end of the context — a measured effect often called lost in the middle. Facts buried in the center of a 40-page paste are recalled worse than the same facts placed at the top or bottom. Three practical rules follow:

  1. 1Instructions first, restated last for long prompts: open with the task, then context, then close with 'Now, following the instructions above, …'.
  2. 2Critical facts near the edges. If one paragraph decides the answer, don't leave it on page 17 of the paste.
  3. 3Relevance beats volume. Five relevant paragraphs outperform fifty mixed ones — irrelevant context isn't neutral, it's noise that dilutes attention. (This instinct becomes RAG in Module 4.)
Prompt to try

Estimate the token count of the following text, then tell me: if I sent this as part of a prompt 5,000 times a month, roughly how many total tokens is that, and what would you cut to reduce it by 30% without losing meaning? Text: [paste one of your real recurring prompts]

Models estimate token counts and spot fluff well. Auditing a production prompt this way is a habit — later modules will give you harder tools for the same question.

The course project

Throughout this course you'll build one production prompt system: an email triage assistant for Harbor Lane (the retailer from Foundations) — read a customer email, classify it, extract structured facts, draft a reply. Each module adds a layer; by Module 7 you'll have a documented, evaluated, guarded prompt SYSTEM.