Learning to Extract Context for Context-Aware LLM Inference
Not on the map. Why?
Abstract (arXiv)
User prompts to large language models (LLMs) are often ambiguous or under-specified, and subtle contextual cues shaped by user intentions, prior knowledge, and risk factors strongly influence what constitutes an appropriate response. Misinterpreting intent or risks may lead to unsafe outputs, while overly cautious interpretations can cause unnecessary refusal of benign requests. In this paper, we question the conventional framework in which LLMs generate immediate responses to requests without considering broader contextual factors. User requests are situated within broader contexts such as intentions, knowledge, and prior experience, which strongly influence what constitutes an appropriate answer. We propose a framework that extracts and leverages such contextual information from the user prompt itself. Specifically, a reinforcement learning based context generator, designed in an autoencoder-like fashion, is trained to infer contextual signals grounded in the prompt and use them to guide response generation. This approach is particularly important for safety tasks, where ambiguous requests may bypass safeguards while benign but confusing requests can trigger unnecessary refusals. Experiments show that our method reduces harmful responses by an average of 5.6% on the SafetyInstruct dataset across multiple foundation models and improves the harmonic mean of attack success rate and compliance on benign prompts by 6.2% on XSTest and WildJailbreak. These results demonstrate the effectiveness of context extraction for safer and more reliable LLM inferences.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 26 of its 30 references that are in the map. First posted on arXiv 12 Dec 2025.
Builds on
26 of 30 references.
References · 26
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 8,851
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,146
- 2024Qwen2.5 Technical Reportcited by 4,713
- 2022Constitutional AI: Harmlessness from AI Feedbackcited by 2,950
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
- 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,124
- 2023XSTest: A Test Suite for Identifying Exaggerated Safety Behaviours in Large Language Modelscited by 477
- 2024Deliberative Alignment: Reasoning Enables Safer Language Modelscited by 292
- 2023Do Large Language Models Know What They Don't Know?cited by 238
- 2024SafeDecoding: Defending against Jailbreak Attacks via Safety-Aware Decodingcited by 233
14 more
- 2024OR-Bench: An Over-Refusal Benchmark for Large Language Modelscited by 222
- 2025Chain of Thought Monitorability: A New and Fragile Opportunity for AI Safetycited by 222
- 2024WildTeaming at Scale: From In-the-Wild Jailbreaks to (Adversarially) Safer Language Modelscited by 206
- 2025SafeChain: Safety of Language Models with Long Chain-of-Thought Reasoning Capabilitiescited by 133
- 2024On Prompt-Driven Safeguarding for Large Language Modelscited by 109
- 2023Selectively Answering Ambiguous Questionscited by 63
- 2025Utility Engineering: Analyzing and Controlling Emergent Value Systems in AIscited by 63
- 2025Trading Inference-Time Compute for Adversarial Robustnesscited by 60
- 2024Aligning Language Models to Explicitly Handle Ambiguitycited by 55
- 2023Self-Guard: Empower the LLM to Safeguard Itselfcited by 52
- 2024Phi-3 Safety Post-Training: Aligning Language Models with a "Break-Fix" Cyclecited by 32
- 2025Reasoning as an Adaptive Defense for Safetycited by 22
- 2025SafeKey: Amplifying Aha-Moment Insights for Safety Reasoningcited by 20
- 2024Data Advisor: Dynamic Data Curation for Safety Alignment of Large Language Modelscited by 13
Built on by
Citing papers per year: 2026: 1.
1 paper.