Token Budget
Definition
Token Budget — a methodology for managing the limited context window of an LLM. The budget defines how many tokens are allocated to the system prompt, dialogue history, tools, and generated response to avoid context overflow.
Budget Allocation
| Component | Share of Budget | Purpose |
|---|---|---|
| System Prompt | 10-20% | Instructions and context |
| Dialogue History | 30-40% | Previous messages |
| Tools | 10-20% | Function descriptions |
| Response | 20-30% | Reserve for generation |
Management Strategies
- Trimming old messages when the limit is exceeded
- Compressing history through summarization
- Prioritizing important context fragments
- Dynamic budget allocation based on task