Skip to content
ML Academy

LLMs, GenAI, RAG, agents, evaluation · insight-1505

Put long documents first and the question last, then test the reverse on your own task

Evidence type
empirical finding
Difficulty
easy
Roles
Applied AI, ML engineer
Industries
aviation, cross-industry

Summary: situation, action, reason, boundary

  1. Situation

    A contract-review prompt places the instructions and question at the top and pastes 150 pages of terms underneath.

  2. Action

    Place documents first, wrapped and labelled, with the question and key constraints after them; run both layouts on the same long-input cases and keep the better one per model.

  3. Reason

    Anthropic's prompting guide recommends long data above the query and says a query at the end improved response quality by up to 30 percent in its tests on multi-document inputs; the test setup is not published.

  4. Boundary

    Long single-document or multi-document prompts with a final question.

Symptom or risk

Answers ignore or mix up late clauses in long inputs, and edits to the instructions do not help.

Exceptions

Short inputs, and models or tasks where your eval shows no difference.

Trade-offs

Templates that put instructions first must be restructured, and the question has to be repeated in each variable suffix.

Pitfalls

Carrying a vendor-reported relative gain over to another provider's model without measuring it.

Lessons and concepts

Claims and their sources

  • Anthropic's prompting guidance advises placing long documents near the top, above the query, and states that queries at the end can improve response quality by up to 30 percent in tests, especially for complex multi-document inputs (vendor-reported; test details not published).

    Prompting best practices (Claude Platform documentation)