Apply to my task
arXiv:2605.23170 ★ 92 May 22, 2026

Where the Task Sits in Your Context: Why an LLM Ignores the Question Unless It Comes Last

Key result

From 96% to 8% accuracy in one move: the question slid from the end of the context to the middle. Same model, same question, same context. This explains why models so often answer "the wrong thing" when you work with big documents, and it hands you a direct fix. Put the task last in the context: it's the only position where the model reliably "sees" it right before generating an answer. If the structure doesn't allow that, repeat the question at the very end: accuracy recovers to within ±4 points of the maximum for all 9 models tested.

01

TL;DR

LLMs lose accuracy fast when the task lands in the middle of a long context, even when they have plenty of tokens left to answer. Some models drop from 96% to 8% accuracy when the question is sandwiched between similar examples on both sides. The longer the context, the more catastrophic the drop.

The real pain: you paste a big document, then type your question somewhere in the middle, or interleave context with questions, and the model "loses" the task. Not because it can't answer: put the identical question at the end of the same context and it gets it right. The problem isn't difficulty, it's position. The model gets swamped by the surrounding material and starts confusing its answers with your task: 76% of errors at the middle position are numbers lifted from neighboring examples, not from the actual problem.

One rule: put the task / question / instruction at the very end of the context. If the structure forces the question into the middle, repeat it once more at the end. This trick brought accuracy back to "end of context" levels for all 9 models tested.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

PRINCIPLE: The task always goes at the end of the context

✅ CORRECT STRUCTURE:

{document / examples / background context}

────────────────────────────

Task: {question / instruction}

──────────────────────────────────────────────

❌ RISKY STRUCTURES:

Task: {question}       ← question first, context after
{large context}

──────────────

{context 1}
Task: {question}       ← question in the middle
{context 2}

──────────────────────────────────────────────

🔧 DIAGNOSTIC TRICK (if the question has to sit in the middle):

{context 1}
Task: {question}       ← question in the middle
{context 2}

────────────────────────────

Reminder: solve this task: {question}  ← copy at the end

It all works inside a single prompt. No separate requests.

03

Example in Practice

Task: You're reviewing a commercial lease for retail space in Chicago, 15 pages of text. You want to know whether any clauses could hurt your business.

❌ What most people do (risky structure):

Review this lease and flag every clause 
that could be unfavorable to the tenant.

[15 pages of lease...]

The question is buried under a mountain of text. The model reads the context, reaches the end, and finds no task there. So it starts summarizing the text however it sees fit.


✅ The right structure:

[15 pages of the lease...]

────────────────────────────────────────

Your task: flag every clause in the lease above 
that could be unfavorable to the tenant. 
For each clause, explain what the risk is 
and what's worth negotiating with the landlord.

Result: The model gets a clear task after the context, in the position of highest attention. You get a structured list of risks with explanations instead of a generic recap of the lease.


🔧 If the structure forces the question into the middle (say, documents and instructions are interleaved):

[Lease, part 1: pages 1-8...]

Pay special attention to the rent escalation clauses.

[Lease, part 2: pages 9-15...]

────────────────────────────────────────

Task reminder: flag every clause in the lease above 
that could be unfavorable to the tenant, 
especially anything about rent escalation.
04

Why It Works

The LLM weakness: A model processes tokens sequentially and builds a "working memory" as it reads. By the time it generates an answer, the most recent tokens take priority: they sit closest to where the output begins. This isn't a bug; it's a consequence of the transformer architecture.

What goes wrong with a task in the middle: If the question is surrounded by lots of similar content (solved examples, other questions), the model "grabs" answers from nearby text instead of solving the task. The study found that 76% of errors at the middle position are numbers or answers taken from neighboring examples. At the end position, accidental matches account for only 22%.

Why repeating it at the end works: When a copy of the task comes last, the model "sees" it right before it starts generating. That completely wipes out the positional effect. In the experiment, repetition restored accuracy to within ±4 percentage points of the "ideal" position for all 9 models at 8K tokens of context.

Control levers:

What we change Effect
Move the task to the very end Maximum accuracy
Use neutral background text instead of similar examples Less interference
Repeat the task at the end when it's stuck in the middle Full accuracy recovery
The shorter the context, the lower the risk The effect is weaker at 8K than at 64K
05

Prompt Template

{background_context}

────────────────────────────────────────

{task_or_question}

What to fill in: - {background_context}: the document, article, data, email thread, examples, anything you want the model to take into account - {task_or_question}: the specific instruction or question, always last

If the context comes in parts:

{context_part_1}

{context_part_2}

────────────────────────────────────────

Task: {question_or_instruction}

If the task has to sit in the middle:

{context_part_1}

{intermediate_instruction}

{context_part_2}

────────────────────────────────────────

Reminder, your task is: {question_or_instruction}
06

Limitations

⚠️ Model dependence: The effect varies a lot across models. DeepSeek in reasoning mode barely loses accuracy with similar background content, but it does drop with unanswered background questions. Among the new releases, GLM-5.1 and Kimi-K2.6 hold up better than their older versions. Your model may behave differently, so test it.

⚠️ The type of background content is critical: Neutral text (Wikipedia, news) causes almost no interference. Similar examples are the danger, especially if they contain numbers or answers of the same type as your task. Don't use solved examples as "separators" when the task sits in the middle.

⚠️ The effect grows with context length: At 8K tokens the drop is moderate. At 64K it's catastrophic for vulnerable models. If you work with big documents, the "task last" rule goes from nice-to-have to mandatory.

⚠️ The diagnostic trick isn't always 100%: With very long contexts (64K), repeating the task at the end helps, but for some models it doesn't fully restore accuracy. At 8K it works for all 9 models.

07

How They Studied It

Researchers from Beijing Jiaotong University took 9 current LLMs from different providers (DeepSeek, Kimi, GLM, Qwen, MiMo) and tested them on math word problems (GSM8K) and science questions (ARC-Challenge). The idea was simple: take the same task, surround it with background text, and see what happens when the task sits at the end versus in the middle across different context sizes: 8K, 32K and 64K tokens.

The key experiment was a "diagnostic probe": they placed a task in the middle (where it loses accuracy), then added a copy of the same task at the end. Accuracy instantly bounced back to the "task at the end all along" level for all 9 models. That proves the issue isn't task difficulty or context volume as such, but specifically position.

The most surprising result: different kinds of background content have radically different effects. At 64K, MiMo-v2-Flash loses 88 percentage points of accuracy when the background is solved problems, and 0 points when it's neutral Wikipedia text. So it's not "long context kills accuracy": it's topically similar content that creates interference. The model literally pulls answers from the surrounding examples and passes them off as its answer to your task.

A telling detail from the audit: the researchers checked the release reports of four major vendors (DeepSeek, Kimi, GLM, MiMo) and found that none of them included position-controlled tests in their headline tables. The headline tables showcase coding and agent benchmarks. How much a model's accuracy depends on where the task sits is reported nowhere.

08

Original Data from the Paper (Key Numbers)

Results table: accuracy drop when the task moves from the end to the middle (GSM8K, background = solved problems):

Model               | 8K Drop | 32K Drop | 64K Drop
────────────────────|────────|─────────|─────────
Qwen 2.5-7B         |  −86pp  |  −84pp   |  −94pp ★
MiMo-v2-Flash       |  −12pp  |  −24pp   |  −88pp ★
MiMo-V2.5-Pro       |   −8pp  |  −16pp   |  −32pp ★
GLM-4.7-FlashX      |  −12pp  |  −20pp   |  −34pp ★
GLM-5.1             |   +0pp  |   +2pp   |   +2pp
DeepSeek-R          |   +0pp  |   +0pp   |   +0pp
DeepSeek-V4-Pro     |   −2pp  |   −2pp   |   −4pp
Kimi k2.5           |   +4pp  |   +0pp   |   −6pp
Kimi-K2.6           |   +2pp  |   −2pp   |   +2pp

★ = statistically significant

Diagnostic probe (8K, each model on its worst background type):

Model           |  End  |  Middle  | Middle×2  |  Middle+End
──────────────  |──────|─────────|───────────|────────────────
Qwen 2.5-7B     |  90%  |    4%    |     4%    |      94%
MiMo-v2-Flash   |  98%  |   22%    |    70%    |      98%
MiMo-V2.5-Pro   | 100%  |   44%    |    68%    |     100%
Kimi k2.5       |  94%  |   40%    |    92%    |      96%
DeepSeek-V4-Pro | 100%  |   68%    |    72%    |      96%

Context: The researchers tested 9 LLMs through the providers' official APIs (DashScope, Xiaomi, Zhipu, DeepSeek, Moonshot). N=50 examples per condition, seed=42.

09

Adaptations and Extrapolations

1. Adaptation: working with multiple documents

When you need to compare several documents or feed the model many sources, the structure is the same:

💡 Adaptation for comparing documents:

=== Document 1 ===
{text 1}

=== Document 2 ===
{text 2}

=== Document 3 ===
{text 3}

────────────────────────────────────────

Compare these three documents on the following criteria: {criteria}

2. Technique: a "closing reminder" for long conversations

🔧 Technique: restate the task at the end of a long conversation

If your chat with the model has stretched across many messages and answer quality is slipping, restate the task explicitly in your next message:

[Quick reminder of what we're working on: we're {task_summary}]

Next step: {specific_instruction}

Same logic: "task last" works at the level of the whole conversation history too, not just inside a single prompt.

3. Extrapolation: stress-test your own model

Want to see how vulnerable your model is to the positional effect? Run a quick test:

Take any question with a known answer.
Put the question first, then add 500-1000 words 
of neutral text after it.
Compare the answer with the version where the question comes last.

If the answers differ, your model is vulnerable 
to the positional effect even with short contexts.
10

Resources

Paper title: Positional Failures in Long-Context LLMs: A Blind Spot in Reasoning Benchmarks

Authors: Chuyifei Zhang, Xiaowen Huang, Hongyu Cui, Jitao Sang

Universities: Beijing Jiaotong University, Central South University of Forestry and Technology

Benchmarks mentioned: Needle-in-a-Haystack, RULER, GSM8K, ARC-Challenge, SCROLLS, LongBench, LooGLE, BABILong

Research digest

Key result

From 96% to 8% accuracy in one move: the question slid from the end of the context to the middle. Same model, same question, same context. This explains why models so often answer "the wrong thing" when you work with big documents, and it hands you a direct fix. Put the task last in the context: it's the only position where the model reliably "sees" it right before generating an answer. If the structure doesn't allow that, repeat the question at the very end: accuracy recovers to within ±4 points of the maximum for all 9 models tested.

Principle

A transformer reads context sequentially. By the time it generates an answer, the last tokens carry the most weight: they're closest to the model's "mouth". The middle sinks under the layers of text that follow it. The kicker: similar examples around the question aren't help, they're a trap. The model sees the pattern "similar problem, answer right next to it" and grabs a number from a neighboring example instead of solving your task. 76% of errors with a mid-context task are exactly that: answers copied from the neighbors, not reasoning failures. It's like a student in an exam copying off the kid next to them, because the questions look alike and they can't find their own.

Why it works

The transformer architecture works like this: the last tokens get structural priority when the answer is formed. When the task comes last, the model starts generating from it. When the task is surrounded by lots of similar content (solved examples, other people's questions with answers), the model "recognizes" a familiar pattern and copies a neighbor's answer instead of computing its own. Brutal: at 64K tokens of context the effect is catastrophic, with some models dropping from 96% to 8%. At 8K tokens it's moderate. The longer the context, the deeper the middle gets buried. This isn't a bug in one particular model: the effect showed up across all 9 models tested.

When to apply

Works anywhere you have a long context plus a specific task. Critical for document analysis (contracts, papers, financial reports), especially when you upload a file and type your question afterward: check where it ended up. Risky with a handful of examples placed before the question if those examples contain numbers or answers of the same type, since they cause interference. Important when building prompt chains in automated systems, where the task can "drift" into the middle. Not critical with short contexts (under 4K tokens): the effect is weak and barely affects the result.

Mini recipe

1. Check your prompt structure: is the task last? If not, move it. It takes 10 seconds and can save you from a failed answer. 2. If you can't move it: add a line at the very end: `Task reminder: [repeat the question]`. Accuracy returns to the ideal-position level. 3. If you use examples: put them BEFORE the task, not around it. Examples with numbers right next to the question are a trap, not help. 4. If the context is over 32K tokens: repeating the task at the end isn't a bonus, it's a must. Without it, the odds of the question getting "lost" climb sharply.

Examples

[BAD]: `Review this lease and find the clauses that are unfavorable to the tenant. [15 pages of lease...]` The question is buried under a mountain of text. Task first, context after: the model reaches the end and answers however it likes. [GOOD]: `[15 pages of the lease...] Your task: flag every clause above that could be unfavorable to the tenant. For each one: what the risk is and what's worth negotiating with the landlord.` If the question has to sit in the middle: `[Lease, pages 1–8...] Pay special attention to the rent escalation clauses. [Lease, pages 9–15...] Task reminder: flag every clause in the lease above that could be unfavorable to the tenant, especially around rent escalation.`

In plain words

Today's models brag about huge "context windows" and promise to swallow all of "War and Peace" in one go, but in practice they have a serious attention-span problem. The catch is that LLMs lose focus when the heart of the task is tucked into the middle of a long text. Even if a model officially supports 128 thousand tokens, it physically can't hold the whole thing in its "head" evenly. It's a fundamental quirk of the transformer architecture: they remember the beginning and the end just fine, but the middle of the context is a blind spot where information simply dissolves into digital noise.

It's like asking a friend to read a long lease and find the clause about penalties, and they carefully study only the header and the signatures. Technically they read the whole thing, but they answer your question with a guess because their brain checked out on page five. The study calls this a positional failure: a model's accuracy can crash from 96% to an embarrassing 8% if the key fact is surrounded by similar content on both sides. The model just can't tell what to focus on and produces a confident but completely useless hallucination.

The numbers in paper 2605.23170 are scary: the longer the context, the more catastrophic the drop. The researchers used a mid-context task injection setup, surrounding the task with "distracting" examples. It turned out that even top models stumble when the question sits in the center of a big pile of data. The logic is simple and a little insulting: recent tokens win. Whatever the model read a second ago matters more to it than whatever was in the middle, so it flat-out ignores key conditions unless they're staring it in the face at the end of the prompt.

This principle is universal and goes way beyond fancy benchmarks into your everyday work. Whether you're reviewing contract terms, digging through an annual report, or asking for a summary of a long Slack thread, the risk of missing a critical detail is huge. If you drop 15 pages into ChatGPT and bury your question somewhere in the pile, you're playing roulette. Prompt optimization now means understanding this weakness: important instructions and data need to be repeated or moved to the end, otherwise the model will simply "blink" and miss them.

Bottom line: don't count on AI's "bottomless memory". It's leaky exactly where you least expect it. The main takeaway of the study: context length is not the same as comprehension. If you want a reliable result, don't hide the point in the middle of a wall of text; better yet, break the task into parts. Anyone who keeps trusting the magic of long prompts without accounting for positional failures will sooner or later get a critical error in calculations or analytics, just because the model decided to "take a breather" halfway through reading.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on Where the Task Sits in Your Context: Why an LLM Ignores the Question Unless It Comes Last arXiv:2605.23170

Sign in to apply this study New accounts get 50 free credits.