Apply to my task
arXiv:2512.11986 ★ 88 Dec 12, 2025

ContextLens: Two-Step Analysis for Ambiguous Requests

Key result

The finding: an LLM starts forming its answer before it analyzes the context. Small models refuse on reflex at the word 'destroy,' and big ones miss on 52% of tangled requests. ContextLens makes the model first analyze five aspects of the request (intent, ambiguity, risks, decision, plan) and only then answer. Structured analysis works like a checklist: the model doesn't guess the context, it systematically checks each block. Result: GPT-4o drops from 52% errors to 34%, and small models overplay it safe 6-11% less.

01

TL;DR

ContextLens is a technique that adds an intermediate analysis step before the model answers. Instead of answering directly, the model first generates a context snippet: a description of the user's intent, the ambiguities, the risks and a response plan. That snippet is then used to generate the final answer. It works in a regular chat: you just change the structure of your prompt.

LLMs often get ambiguous requests wrong: they either refuse where they could help ("destroy the competition" = competitive advantages?) or comply where they should ask for clarification. The reason: the model tries to answer right away without working out the intent. Small models suffer the most (up to 8B parameters): they're quicker to see "red flags" in harmless words (destroy, kill, hack) and refuse just to play it safe. Big models do better, but they miss too.

Microsoft researchers proposed three flavors of context analysis: a zero-shot prompt (a ready-made template, no training), thinking traces from reasoning models, and ContextLens, a model trained with RL. The simplest zero-shot flavor gives +5-23% accuracy across different models, including GPT-4o. The core idea: explicitly structure the analysis into five blocks: intent, ambiguity, risks, decision, response plan.

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

Zero-shot flavor (use it right away):

STEP 1: Analyze the request
├─ User Intent (what the user wants)
├─ Ambiguity (what's unclear)
├─ Potential Risks (possible risks)
├─ Action Decision (answer / clarify / refuse)
└─ Safe Response Plan (plan for a safe answer)
       ↓
STEP 2: Generate the final answer based on the analysis

Both steps run in a single prompt via a structured instruction.

Advanced flavor (ContextLens):

STEP 1: A separate request to a small model (3B)
       → generates the context snippet

STEP 2: The main request with the original prompt + snippet
       → final answer
03

Example in Action

Task: A client wants a post for a food delivery blog titled "How to Destroy Your Competitors in 3 Months." It's unclear: do they want marketing tactics, or shady methods?

Prompt:

Analyze the user's request before answering:

REQUEST: "Write an article 'How to Destroy Your Competitors in the Food Delivery Niche in 3 Months'"

ANALYSIS:

1. USER INTENT:
[What does the user want to get?]

2. AMBIGUITY:
[What in the request could be read in different ways?]

3. POTENTIAL RISKS:
[Which interpretations could lead to problems?]

4. ACTION DECISION:
[Choose: ANSWER / CLARIFY / REFUSE]

5. SAFE RESPONSE PLAN:
[How should you answer given the risks?]

---

Based on the analysis above, give the user your final answer.

Result:

The model will first show a full analysis in five blocks: it'll note that "destroy" could mean both legitimate competition and dishonest methods, flag the ambiguity, and pick the action "CLARIFY" or "ANSWER with caveats." Then it'll give the final answer: either a clarifying question ("Do you want an article about marketing advantages, or...?") or a safe version of the article focused on fair competition, with a caveat about ethics.

04

Why It Works

The LLM's weakness: The model generates text sequentially, left to right. When it sees a request, it starts forming an answer immediately, with no time to "think" about context and ambiguities. Small models in particular (up to 8B) see trigger words (kill, destroy, hack) and refuse on reflex, without working out the intent. The result is either excessive refusals (over-refusal) or compliance with sketchy requests.

The LLM's strength: Models are excellent at following structured instructions and good at analyzing text (identifying intent, spotting ambiguity, assessing risk). If you explicitly ask them to analyze first and answer second, they handle it.

How the method uses that strength: The prompt splits the process into two stages: first the analysis (what the user wants, what the risks are, how best to answer), then the answer based on the analysis. The five-block structure removes ambiguity: the model doesn't guess, it systematically checks each aspect. The final answer is generated with the context already "in the model's head."

Control knobs:

  • Analysis blocks: drop "Ambiguity" if the request is clear-cut (saves tokens), add a "Legal/Ethical Check" for especially sensitive topics
  • Action Decision: replace the "Answer/Clarify/Refuse" options with your own criteria (for example, "Full answer / Answer with limits / Alternative suggestion")
  • Analysis output: add "No explanations, just the decision" if you need a quick result without long reasoning
  • Number of stages: for simple requests use only 3 blocks (Intent → Risks → Decision); for complex ones add "Stakeholders" or "Long-term Consequences"
05

Prompt Template

Analyze the user's request before answering:

REQUEST: {user_request}

ANALYSIS:

1. USER INTENT:
[What does the user want to achieve? What's the real goal behind the request?]

2. AMBIGUITY:
[What in the request could be read in different ways? What interpretations are possible?]

3. POTENTIAL RISKS:
[Which interpretations are dangerous? What could go wrong?]

4. ACTION DECISION:
[Choose one: ANSWER / CLARIFY / REFUSE]
[Justify your choice in one sentence]

5. SAFE RESPONSE PLAN:
[How should you answer given the risks? What caveats are needed?]

---

Based on the analysis above, give the user your final answer.

What to fill in: - {user_request}: the original request that raises doubts or could be ambiguous

🚀 Quick start: paste this into the chat:

Here's a template for two-step request analysis. Adapt it to my task: [your task].
Ask me questions to fill in the fields.

[paste the template above]

The LLM will ask about the specifics of your field (legal risks? technical constraints? ethical aspects?) and which Action Decision options fit (maybe instead of "refuse" you need "suggest an alternative"?). It'll take the structure from the template and tune it to your context.

06

Why It Works (In More Detail)

The study surfaced three key findings about how LLMs behave with ambiguous requests:

1. Small models overplay it safe

Qwen2.5-3B and Llama-3-8B refuse 15-45% of harmless requests if they contain "suspicious" words. The reason: when trained on safety datasets, the model memorizes the pattern "see 'kill/destroy/hack' → refuse" but doesn't learn to tell contexts apart. Two-step analysis forces the model to work through the context first (Intent, Ambiguity) and decide second, and over-refusal drops by 6-11%.

2. Big models miss on adversarial examples

GPT-4o on the Wildjailbreak dataset (deliberately tangled requests) gets it wrong 52% of the time: it either refuses harmless requests or complies with sketchy ones. With context analysis, errors drop to 34% (-18%). Structured analysis works like a checklist: the model doesn't rely on gut feeling, it checks every item.

3. Context transfers between models

The biggest surprise: a context snippet generated by one model (for example, Llama-3-8B) improves another (GPT-4o). Zero-shot analysis from Llama gives GPT-4o +22.9% accuracy on Wildjailbreak. That means the analysis principles are universal, not tied to any specific model's architecture.

ContextLens's autoencoder mechanics

The advanced version (the RL-trained model) uses a clever trick: the context generator creates a snippet that is passed to another model (the decoder) along with a partially masked prompt. The decoder has to reconstruct the original prompt from the snippet. The reward comes if it reconstructs it accurately + both answers (from the generator and the decoder) are safe.

Why: this forces the snippet to carry as much information about the prompt as possible without copying it word for word (there's a penalty for copying). The result: the snippet extracts the essence: intent, context, risks. The trained model adds another +2-4% accuracy on top of zero-shot.

Comparison with reasoning models

Chain-of-Thought and reasoning models (SafeChain, TARS) generate thinking traces for themselves, to answer better on their own. ContextLens generates context for another model, and that's the key difference. The result: - Thinking traces are co-adapted with the model that produces them and transfer poorly to other models - ContextLens generalizes: a single context improves Llama, GPT-4o and Qwen alike

07

Limitations

⚠️ Simple requests: For clear-cut tasks ("capital of France," "translate this text") two-step analysis is overkill: you're burning tokens for nothing. Use it only if the request contains ambiguity or risk.

⚠️ Small models (under 3B): On Qwen2.5-1.5B, context analysis sometimes reduces compliance (fulfilling harmless requests) from 87% to 54%: the model is too small to hold both the analysis and a quality answer. It works well on models from 3B up.

⚠️ Subjective criteria: The method works great for safety (harmful/safe), but for creative tasks (how interesting is the text? how original?) structured analysis can "dry out" the result: the model gets too cautious.

⚠️ Extra tokens: Zero-shot analysis adds 150-300 tokens to every answer (~10-15% overhead on API bills for average requests). The advanced flavor (two requests) doubles the number of API calls.

08

Original from the Paper

The Microsoft researchers tested the method on safety benchmarks: AdvBench, SafetyInstruct (explicitly harmful prompts), Wildjailbreak and XSTest (adversarial: deliberately tangled requests where the model has to tell harmless from harmful).

The zero-shot prompt (from Appendix A.1 of the paper) instructs the model to produce five sections: 1. User Intent 2. Ambiguity
3. Potential Risks 4. Action Decision (direct answer / ask clarification / refuse) 5. Safe Response Plan

The trained ContextLens model (3B parameters, Qwen2.5-3B-Instruct) was trained on 5,000 examples from Wildjailbreak using GRPO (Generalized Reward Policy Optimization). Architecture: - Generator (Qwen2.5-3B) produces context _c_ and answer _r_g - Decoder (Llama-3.2-3B, frozen) receives _c_ + a partially masked prompt _p'_, reconstructs the prompt _p_d + generates answer _r_d - Reward: penalty (0) if _c_ contains a verbatim copy of _p_, otherwise SIM(_p_d, _p_) + Safe(_r_g) + Safe(_r_d)

Results (Table 1 of the paper): - GPT-4o + ContextLens: ASR (attack success rate) on Wildjailbreak fell from 52.65% to 34.35% (-18.3 pp) - Llama-3-8B + ContextLens: ASR on SafetyInstruct fell from 22.7% to 1.6% (-21.1 pp) - Zero-shot context from Llama-3-8B for GPT-4o gives a harmonic mean of 87.86% vs. a 64.07% baseline (+23.8 pp)

09

How They Studied It

Datasets: - AdvBench, SafetyInstruct: 520 and 500 examples of explicitly harmful prompts ("how to make a bomb," "write a phishing email") - Wildjailbreak: 262 adversarial requests (sound harmless but may be harmful, or vice versa) - XSTest: 450 examples alternating adversarial benign (should answer) and harmful (should refuse)

Metrics: - ASR (Attack Success Rate): % of cases where the model fulfilled a harmful request (lower = better) - Compliance: % of cases where the model fulfilled a harmless request (higher = better)
- H-Avg (Harmonic Mean): the balance between (1 - ASR) and Compliance, showing the trade-off between safety and helpfulness

Evaluation process: GPT-4o as the judge received the prompt + the model's answer and classified it: full compliance / full refusal / partial refusal. For each dataset they computed ASR and Compliance, then the harmonic mean.

Training ContextLens: - 5,000 training + 500 validation examples from Wildjailbreak - GRPO (on-policy RL) with learning rate 1e-6, batch size 4, 8 generations per sample - Generator: Qwen2.5-3B-Instruct, Decoder: Llama-3.2-3B-Instruct (frozen) - Early stopping when validation reward > 0.9 - Trained on a single NVIDIA A100 (80GB)

Transferability testing: Context from one model (Qwen2.5-3B, Llama-3-8B, GPT-4o) was applied to other models (Llama-3.2-3B, GPT-4o). Finding: zero-shot context is universal; even context from the small Llama-3-8B improves GPT-4o by 22.9%.

10

Resources

Learning to Extract Context for Context-Aware LLM Inference: Kim et al., Microsoft Research, 2025

ContextLens Project Page

Authors: Minseon Kim, Lucas Caccia, Zhengyan Shi, Matheus Pereira, Marc-Alexandre Côté, Xingdi Yuan, Alessandro Sordoni (Microsoft Research)

Related work: - SafeChain (Jiang et al., 2025): a reasoning model for safety via supervised fine-tuning - TARS (Kim et al., 2025): a reasoning model via RL - GRPO (Shao et al., 2024): a training algorithm based on policy optimization

Research digest

Key result

The finding: an LLM starts forming its answer before it analyzes the context. Small models refuse on reflex at the word 'destroy,' and big ones miss on 52% of tangled requests. ContextLens makes the model first analyze five aspects of the request (intent, ambiguity, risks, decision, plan) and only then answer. Structured analysis works like a checklist: the model doesn't guess the context, it systematically checks each block. Result: GPT-4o drops from 52% errors to 34%, and small models overplay it safe 6-11% less.

Principle

Don't ask the model straight away: ask it to analyze first. The prompt splits into two stages: analysis (5 blocks) → a final answer based on the analysis. The analysis blocks: (1) User Intent: what the user wants to achieve, (2) Ambiguity: what could be read in different ways, (3) Potential Risks: which interpretations are dangerous, (4) Action Decision: answer/clarify/refuse, (5) Safe Response Plan: how to answer given the risks. The model fills in all five blocks first, then generates the answer, and by that point the context is already 'in its head.'

Why it works

The LLM's weakness: it generates text left to right, sequentially. When it sees a request with 'kill' or 'destroy,' it starts forming an answer right away: it refuses or complies on reflex before working out the intent. Small models (up to 8B) suffer most: training on safety datasets taught them the pattern 'see a trigger word → refuse,' but they never learned to tell contexts apart. Structured analysis forces the model to work through the context first and decide second: excessive refusals drop by 6-11%, and errors on tangled requests fall from 52% to 34%. The kicker: context analysis from one model improves another. Llama-3-8B generates the snippet, and GPT-4o gets +22.9% accuracy.

When to apply

Safety checks for chatbots and assistants → when requests contain ambiguous words ('destroy,' 'hack,' 'kill') or could be interpreted in different ways. Especially useful for small models (3-8B) that overplay it safe, and for deliberately tangled requests. NOT suited for clear-cut tasks ('capital of France,' 'translate this text'): you're burning tokens for nothing.

Mini recipe

1. Add an analysis block before the answer: Put five items in the prompt: User Intent, Ambiguity (what's unclear), Potential Risks (dangerous interpretations), Action Decision (answer/clarify/refuse), Safe Response Plan (how to answer safely). 2. Ask the model to fill in each block: Explicitly say 'Analyze the user's request before answering' + the five-block structure. 3. Final answer based on the analysis: After the blocks, add 'Based on the analysis above, give the user your final answer.' 4. Optionally, trim the extras: If the request is clear-cut, use only 3 blocks (Intent → Risks → Decision) and save tokens.

Examples

[BAD]: `Write an article 'How to Destroy Your Competitors in Food Delivery'` → the model either refuses ('I can't help with harmful content') or generates sketchy advice. [GOOD]: `Analyze the request before answering: REQUEST: 'Write an article: How to Destroy Your Competitors in Food Delivery' ANALYSIS: 1. USER INTENT: [What does the user want?] 2. AMBIGUITY: [What could be read in different ways?] 3. POTENTIAL RISKS: [Dangerous interpretations?] 4. ACTION DECISION: [Answer/Clarify/Refuse] 5. SAFE RESPONSE PLAN: [How to answer safely?] Based on the analysis, give the final answer.` → the model figures out that 'destroy' could mean marketing advantages OR dishonest methods, picks 'Clarify' or 'Answer with caveats,' and gives a safe version of the article.

In plain words

In Plain Words: 2512.11986

In Plain Words

Learning to Extract Context for Context-AwareLLMInference

The gist of ContextLens is that models are, by nature, pathologically impatient. They generate text word by word, left to right, and start answering a request before they've "realized" the catch in it. If the question contains a trigger word like destroy, the model panics and refuses, even if it's about perfectly harmless marketing. The method makes the LLM first talk through a context snippet, a kind of inner monologue about the user's intent and the risks, and only then get to the point.

It's like asking a buddy to "take care of the neighbor," meaning the guy's jackhammer noise, and he runs off for an axe before you finish the sentence. ContextLens adds a mandatory pause: your buddy first says out loud: "Okay, the neighbor's being loud, we can't break the law, we need a peaceful fix." That intermediate step turns the model from an impulsive teenager into a thoughtful analyst who sizes up the situation before opening his mouth. Technically it's just extra tokens, but in practice it saves you from dumb mistakes.

In practice it looks like a rigid prompt structure: you make the model pin down the user's intent, highlight the ambiguities and draft a response plan. For example, instead of immediately writing an article about "destroying competitors," the model first notes that it's a business metaphor, not a call to crime. This intermediate analysis lets even small models (up to 8B parameters) stop fumbling where usually only giants like GPT-4 get it right.

The method was tested on safety and answer accuracy, but the principle is universal. You can, and should, plug it into any complex task: from writing code to legal consultations. It's the foundation for context-aware inference, and it treats the main disease of chatbots: shallowness. If the task is harder than "grab some bread," then without analyzing the context first, the model will sooner or later give you a hallucination or an absurd refusal.

Bottom line: stop expecting instant wisdom from the model; make it "think out loud" first. ContextLens proves that the structure of a prompt matters more than its length. You just add one analysis step before generation, and answer quality takes off with no fine-tuning and no extra spend. Anyone who skips this layer of logic will keep getting garbage output and wondering why the model suddenly "got dumber."

ArXiv ID: 2512.11986 | Generated: 2026-01-04 11:50 | Nova Research

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 ContextLens: Two-Step Analysis for Ambiguous Requests arXiv:2512.11986

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