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

Where the Task Sits in Your Context: Why Some LLMs Lose 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 (MiMo-v2-Flash), same math questions, same 64K-token context packed with solved example problems. Other models dropped less, and a few not at all. 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: at 8K tokens accuracy recovered to within ±4 points of the end-position level for all 9 models tested (at 64K, fully for only 2 of 4 models checked).

01

TL;DR

Many 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. In one striking case, MiMo-v2-Flash dropped from 96% to 8% accuracy at 64K tokens when the math question was sandwiched between solved math problems on both sides. How big the drop is depends heavily on the model and on what surrounds the question; for vulnerable models it gets worse as the context grows.

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: in the first five models tested, 76% of wrong answers at the middle position matched the answer of one of the surrounding example problems (versus 22% at the end).

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. At 8K tokens this brought accuracy back to "end of context" levels (within 4 points) for all 9 models tested; at 64K it fully worked for only 2 of the 4 models checked. The authors treat this repeat as a diagnostic check, not a tested fix, so read it as our practical takeaway.

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 (not tested in the paper)
{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

Our illustration, not an example from the paper (the paper used math and science test questions).

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 sits far from the point where the model starts answering, with a mountain of text in between. Note that the paper only compared a task in the middle with a task at the end; it did not test the question-first layout, so treat this as a likely risk rather than a measured one.


✅ 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.

Expected result: The model gets a clear task after the context, the position where models in the study did best. You should get a focused list of risks rather than 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 common explanation is that a model reading a long context gives extra weight to the most recent tokens, which sit closest to where the output begins. The paper itself does not pin down the mechanism: it shows the effect is about position, and leaves the cause open.

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, in the first five models tested, 76% of wrong answers at the middle position matched the answer of a neighboring example problem. At the end position, such matches (mostly coincidences between small numbers) 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. At 8K tokens that wiped out the positional effect: repetition restored accuracy to within ±4 percentage points of the "ideal" position for all 9 models. At 64K it was only partly effective (see Limitations).

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 for most models (Qwen 2.5-7B still dropped about 30 points at 32K and 64K)
Repeat the task at the end when it's stuck in the middle Full recovery at 8K; partial at 64K for some models
The shorter the context, the lower the risk For most vulnerable models 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. The newer releases (GLM-5.1, Kimi-K2.6, DeepSeek-V4-Pro) hold up much better than older versions when the background is solved examples, but still lose 16 to 56 points when it is unanswered questions. Your model may behave differently, so test it.

⚠️ The type of background content is critical: Neutral text (Wikipedia, news) causes almost no interference for most models, with one exception: Qwen 2.5-7B still lost about 30 points at 32K and 64K. 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: For most vulnerable models the drop at 8K tokens is moderate (Qwen 2.5-7B is the exception: already -86 points at 8K). At 64K it's catastrophic for vulnerable models. Contexts shorter than 8K were not tested. 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 fully restored accuracy for only 2 of the 4 models checked (Qwen 2.5-7B reached 84% vs 94%, GLM-4.7-FlashX 78% vs 90%), and the newer releases were not checked at 64K. At 8K it works for all 9 models. The authors call it a diagnostic, not a proven fix.

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. At 8K, accuracy bounced back to the "task at the end all along" level for all 9 models. The authors read this as consistent with the issue being position, not task difficulty, while noting the probe does not isolate the exact mechanism.

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 nothing at all (it scores 2 points higher) when it's neutral Wikipedia text. So for this model it's not "long context kills accuracy": it's topically similar content that creates interference (Qwen 2.5-7B, by contrast, dropped even with neutral text). Most wrong middle-position answers match an answer from the surrounding examples, which suggests the model is pulling answers from them instead of solving 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 such as NIAH, RULER or LongBench in their main result tables. The headline tables showcase coding and agent benchmarks. Where such tests appear at all, it is outside the main tables (for example, in a base-model table or an architecture ablation).

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 (Bonferroni-corrected); other drops are not

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, extended by us: "task last" should help at the level of the whole conversation history too. The paper only tested single prompts.

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 in the middle of 500-1000 words 
of similar questions (neutral text rarely triggers the effect).
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, Hongyu Cui, Xiaowen Huang, 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 (MiMo-v2-Flash), same math questions, same 64K-token context packed with solved example problems. Other models dropped less, and a few not at all. 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: at 8K tokens accuracy recovered to within ±4 points of the end-position level for all 9 models tested (at 64K, fully for only 2 of 4 models checked).

Principle

One common explanation (the paper doesn't test the mechanism): by the time a model generates an answer, the last tokens carry extra weight, since they're closest to the model's "mouth". A task in 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. In the first five models tested, 76% of wrong answers with a mid-context task matched a neighbor's answer (vs 22% at the end), which points to copying from the neighbors as the main error type. 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

A likely reason (not isolated by the paper): the last tokens get extra weight 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 can be catastrophic, with one model dropping from 96% to 8%. At 8K tokens it's usually moderate (one small model already lost 86 points there). For vulnerable models, the longer the context, the deeper the middle gets buried. This isn't a bug in one particular model, but it is model-dependent: with solved examples around the question several models showed no drop, while with unanswered questions around it all 9 models lost accuracy.

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. The paper didn't test contexts shorter than 8K tokens; at 8K the effect was usually moderate, but one model (Qwen 2.5-7B) already lost 86 points there.

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]`. In the paper, at 8K tokens, accuracy returned to the end-position level for every model (only partly at 64K for some). 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

Our illustration (the paper used math and science questions, and compared task-in-the-middle with task-at-the-end; task-first was not tested): [RISKY]: `Review this lease and find the clauses that are unfavorable to the tenant. [15 pages of lease...]` The question is far from where the model starts answering, with a mountain of text in between. [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 doesn't treat every position the same. For many models, a task placed in the middle of the context gets solved far less often than the same task placed at the very end.

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: one model's accuracy (MiMo-v2-Flash, at 64K tokens) crashed from 96% to an embarrassing 8% when the math question was surrounded by solved math problems on both sides. Most of the wrong answers matched the answer of one of the neighboring problems: the model grabbed a number from the wrong task.

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 many models, including some newer releases, stumble when the question sits in the center of a pile of similar questions, while a few are nearly immune. Put a copy of the question at the end and, at 8K tokens, every model got back to its normal accuracy. The authors don't claim a mechanism, but the practical lesson is simple: the end of the prompt is the safe spot.

The paper only tested math and science questions, but the lesson plausibly carries over to 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 Some LLMs Lose the Question Unless It Comes Last arXiv:2605.23170

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