Manuals / Prompt Engineering / Ch 3

A · StructureBeginner30 min read

3. Context windows & token economy

Prompt Engineering · 48 pages source format

Every model has a context limit. Long prompts cost money and attention. Put the most important info first and last — models sometimes lose the middle.

What you'll learn

  • Context limits
  • Token budgeting
  • Lost-in-the-middle

Budget your context

Estimate: system instructions + examples + user task + expected output. Trim fluff.

Do this now

Take a long doc you paste into chat. Summarize it first, then ask questions on the summary.

Pro tip. For code: paste the relevant function, not the whole repo.

Clear?

Chunking strategy

Split large inputs. Process in passes. Merge results with a final synthesis prompt.

Do this now

Process a 10-page doc in 3 chunks. Synthesize with a fourth prompt.

Clear?

Checklist