passdrill
AI & LLM Engineering · Prompt Engineering · Card 022/024 medium

Anthropic's current documentation on long-context prompting recommends where to place long documents or data-rich inputs (roughly 20,000+ tokens) relative to the query and instructions. What does it recommend, and what improvement does it cite?

  1. Place the long documents and other inputs near the top of the prompt, above the query, instructions, and examples; the documentation notes that putting queries at the end can improve response quality by up to 30 percent in tests, especially for complex, multidocument inputs
  2. Place the long documents at the very end of the prompt, after the query and instructions, because Claude always weighs the last few hundred tokens of a prompt most heavily regardless of content length
  3. Split the long document into many short, separate API calls of under 500 tokens each, since Claude cannot process more than roughly 20,000 tokens of context in a single request
  4. Interleave single sentences of the long document between each instruction sentence so that context and instructions alternate line by line throughout the prompt
Next card → Shuffle