Understanding Context Length
Understanding Context Length
Context length is the maximum number of tokens a model can process in a single input/output cycle. Longer context enables handling larger documents.
Common Context Lengths
| Model | Context Length |
|---|---|
| GPT-4 Turbo | 128K tokens |
| Claude 3 | 200K tokens |
| Llama 3 | 8K tokens |
| Mistral | 32K tokens |
| Gemini 1.5 | 1M tokens |
Token Estimation
| Content Type | ~Tokens |
|---|---|
| 1 page of text | 500 |
| 10 page document | 5,000 |
| Average book | 80,000 |
| Codebase (10K lines) | 40,000 |
Use Cases by Context Length
| Length | Best For |
|---|---|
| 4K | Chat, simple Q&A |
| 32K | Long documents, code review |
| 128K+ | Books, large codebases |
Tips
- Chunk large inputs for models with limited context
- Use RAG for knowledge beyond context window
- Consider cost - longer context often means higher price