TL;DR
SELF-ANCHOR is a prompting method that automatically steers the model's attention while it reasons. The gist: the model first breaks the task into plans (plan steps), and then, as it generates each reasoning step, it explicitly "anchors" its attention back to the original question and the current plan. This prevents the classic problem where the model "forgets" key parts as the context grows.
The problem is that an LLM has a limited attention budget. In long reasoning chains (Chain-of-Thought, planning, iterative generation), intermediate steps and the original prompt get lost in the middle of the context. The model starts paying more attention to the latest tokens than to what actually matters for the task. Result: reasoning errors, drifting off topic, losing sight of the original goal. This is called attention misalignment: attention shifts to the wrong place.
The method works in two stages on every iteration: (1) generate the next plan with attention on the question, (2) generate the reasoning for that plan with attention on the question + the current plan. The process repeats until the final answer. On top of that, the strength of the attention "anchoring" is tuned dynamically: if the model is confident (high token probabilities), anchoring is relaxed; if it's unsure, anchoring is strengthened.
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.
Method Blueprint
ITERATION i:
STEP 1 (Planning):
Inputs: system prompt + question + all previous plans
Attention anchor: question
→ Generate: plan_i (the next solution step)
STEP 2 (Reasoning):
Inputs: system prompt + question + all previous plans + plan_i
Attention anchor: question + plan_i
→ Generate: reasoning_i (solving the current plan)
Repeat until the final answerBoth steps run in a single prompt (via a structured JSON format).
The full version (requires API access) also modifies the model's logits via the SPA (Selective Prompt Anchoring) mechanism to strengthen attention steering.
The simplified version (works in a chat) uses only the structured prompt, with no logit modification.
Example in Practice
Task: Decide whether a small software company should launch its new SaaS product for small businesses on the Shopify App Store
Prompt:
Break this task into a step-by-step plan and solve it, constantly returning to the original question and the current plan step. Format: JSON with "plan step" → "reasoning for that step" pairs.
Task: Should our company launch on the Shopify App Store with a SaaS product for small businesses (a CRM for retail, $29/month subscription)? Current base: 200 customers via direct sales. Competitors on the App Store: 5-7 similar apps priced at $25-49/month.
Return the answer in this format:
{
"Step 1: [name]": "[reasoning]",
"Step 2: [name]": "[reasoning]",
...
"Final answer": "[conclusion]"
}Result: The model will return structured JSON with 5-7 analysis steps: sizing up the App Store's target audience, analyzing competitors, working out unit economics, assessing risks, and checking that the product meets the marketplace's requirements. At every step the model will explicitly tie its reasoning to the original question and the current plan. At the end: a well-grounded conclusion with concrete conditions (e.g., "Yes, but only if...", "No, because...").
Why It Works
LLMs suffer from attention dilution in long contexts. The self-attention mechanism is physically limited: the more tokens, the less attention "weight" each one gets. By default, models look hardest at the beginning (attention sink) and the end of the context (recency bias), while the middle, which is exactly where the intermediate reasoning and the details of the original question live, gets too little attention. Result: the model can "forget" what exactly it's supposed to solve or lose an important intermediate conclusion.
SELF-ANCHOR plays to an LLM's strength: its ability to follow structured instructions and work with explicit links. Planning creates a clear hierarchy (question → plan → reasoning), and explicitly reusing key parts of the context (by repeating the question and the current plan) compensates for the weakness of the attention mechanism. The model doesn't have to "keep everything in its head" at once; it follows a structure that constantly reminds it of what matters.
Control levers for the prompt:
- Output format (JSON vs. free text) → JSON reinforces the structure; free text is more flexible for unusual tasks
- Anchoring frequency (every step vs. once every N steps) → less often for simple tasks, every step for complex ones
- What to anchor (just the question vs. the question + all plans) → question + current plan only = the sweet spot; all plans = diluted attention
- Anchoring strength (in the full API version) → dynamic tuning via the harmonic mean of token probabilities
Prompt Template
Break the task into a step-by-step plan and solve it, constantly returning to the original question and the current plan step. Format: JSON with "plan" → "reasoning" pairs.
Task: {your_task}
Return the answer in this format:
{
"Step 1: [plan_name]": "[detailed_reasoning_for_this_step]",
"Step 2: [plan_name]": "[detailed_reasoning_for_this_step]",
...
"Final answer": "[final_conclusion]"
}
At every reasoning step, explicitly connect it to the original task and the current plan.What to plug in:
{your_task}: the specific problem you need solved (a business decision, a situation analysis, a logic check, multi-stage calculations)
🚀 Quick start: paste this into the chat:
Here's a SELF-ANCHOR template for structured reasoning with automatic focus on the key parts. Adapt it to my task: [your task]. Ask me questions to clarify the details.
[paste the template above]The LLM will ask about the specifics of your task (which factors to consider, how deep the analysis should go, what output format works for you); it needs this to break the task into plans correctly. It will take the "plan → anchored reasoning" pattern from the template and adapt it to your case.
Limitations
⚠️ Doesn't fix logic errors: The method keeps the focus on the right context but doesn't make up for a model's weak reasoning skills. 42% of the errors in the study were wrong conclusions even with attention focused correctly.
⚠️ Doesn't help with misunderstanding: If the model misread the task from the start (36.5% of errors), structuring won't save it. You need a clearer initial prompt.
⚠️ Overhead on simple tasks: Planning + a structured format add tokens. For tasks like "capital of France" it's overkill; use plain CoT or no special prompting at all.
⚠️ Calculation errors remain: 21.5% of errors were arithmetic slips. SELF-ANCHOR doesn't improve math skills, only how the process is organized.
How They Tested It
The researchers took 6 models (from 3B to 30B parameters: Llama-3.1/3.2, Phi-4/Phi-4-mini, Qwen3-4B/30B) and tested them on 6 benchmarks of varying difficulty: grade-school math (GSM8K), GMAT-level problems (AQuA), competition math (MATH), commonsense (StrategyQA), social reasoning (T4D), and a multi-task suite (BIG-Bench Hard). They compared against three baseline prompting methods (Chain-of-Thought, Plan-and-Solve+, Re-Reading) and five specialized reasoning models (DeepSeek-R1, Phi-4-reasoning, and others).
The key experiment: an ablation study (Table 4) showed that even without modifying attention via the API (i.e., just the structured prompt), the method delivers gains. For example, on Llama-3.1-8B: GSM8K +11%, T4D +8.5%, BBH +3.3% vs. plain CoT. That proves structured planning works on its own, and the logit modification is an extra boost.
The surprising finding: SELF-ANCHOR with non-reasoning models nearly catches up with reasoning models. For example, Phi-4-mini (4B, a regular model) + SELF-ANCHOR = 88% on GSM8K vs. 81% for Phi-4-mini-reasoning (a specially trained model). A gap of 5-7%, without the huge cost of RL training. That shows attention misalignment is a critical problem, and fixing it with prompting has an effect comparable to expensive post-training.
Dependence on difficulty: the method gives the biggest boost on medium- and high-difficulty tasks (0.5-1.0 on the difficulty scale). For easy tasks (<0.33 difficulty) the gain is smaller: the overhead of the structure outweighs the benefit. They also noticed that the harder the task, the longer the reasoning chain SELF-ANCHOR generates (consistent with findings from Wu et al., 2025: hard problems need more steps).
Original Prompt from the Paper
Context: This is how the model was prompted in the full version of SELF-ANCHOR (a simplified reader-friendly version is in "Prompt Template" above)
Decompose the given problem into step-by-step plan, reasoning the plan and solve the problem step by step in JSON format. For each plan step, provide a key-value pair: the key is the plan step, the value is the detailed reasoning for that step.Sample output:
{
"Step 1: Identify the pronoun": "The pronoun in the sentence is 'her'.",
"Step 2: Determine the antecedent of the pronoun": "To find the antecedent, we need to look for the noun that 'her' refers to. In this case, 'her' is a possessive pronoun that refers to the analyst.",
"Step 3: Analyze the sentence structure": "The subject of the sentence is 'The secretary', and the object of the verb 'helped' is 'her'",
"Step 4: Identify the antecedent based on the sentence structure": "'her' refers to the analyst, not the secretary.",
"Step 5: Choose the correct option": "Since 'her' refers to the analyst, the correct option is (B) Helped the analyst book a flight."
}
```
## Adaptations and Extrapolations
### 💡 Adaptation for reviewing legal documents
Same plan → reasoning structure, but focused on **finding contradictions**:
```
Check this contract for internal contradictions. Break the review into steps and analyze each step, constantly returning to the goal: finding inconsistencies.
[contract text]
Return in this format:
{
"Step 1: Check the subject of the contract and the price": "[contradiction analysis]",
"Step 2: Check deadlines and termination terms": "[contradiction analysis]",
...
"Contradictions found": "[list with clause references]"
}
```
### 🔧 Technique: drop the JSON → get natural language while keeping the structure
If JSON feels too rigid, you can loosen it to "think out loud, but in a structured way":
```
Break the task into plans. At each step:
1. Write the name of the plan
2. Justify the solution in detail
3. Remind yourself of the original question before moving to the next step
Task: {your_task}This gives more natural-sounding text but keeps the principle of "anchoring through explicit reuse of context".
Resources
Paper: "SELF-ANCHOR: Large Language Model Reasoning via Step-by-Step Attention Alignment" (Preprint, 2025)
Authors: Hongxiang Zhang, Yuan Tian, Tianyi Zhang (Department of Computer Science, Purdue University)
Full API version: Requires implementing the SPA (Selective Prompt Anchoring) mechanism via logit modification; see the original paper and code (to be released upon acceptance)
Simplified chat version: Uses the prompt pattern from this summary