Context Dependent Safety Alignment for Language Models

36 concepts27 papers1 proposal

Standard safety alignment for large language models (LLMs) operates on a straightforward assumption: text can be cleanly categorized as either universally safe or universally harmful. To enforce this, developers typically use static system prompts, rigid moderation filters, or global Reinforcement Learning from Human Feedback (RLHF) to draw a hard boundary around prohibited topics.

However, this binary framing creates a fundamental tension. A prompt that is perfectly benign in one scenario can be dangerous in another, and a strict safety filter often ends up blocking legitimate, helpful interactions. True safety is not an intrinsic property of text in a vacuum; it is an emergent property defined by the intersection of the text, the user's profile, the deployment domain, and local cultural or legal norms.

A growing body of research is shifting the paradigm from universal guardrails toward context-dependent and personalized safety alignment. This approach seeks to make safety boundaries dynamic, allowing models to adapt their risk assessments to the situational context of each interaction.


The Failure Modes of Universal Guardrails

When we force a model into a one-size-fits-all safety framework, it suffers from two primary failure modes: over-refusal and under-protection.

Over-Refusal (The Guardrail Tax)

When safety rules are static and absolute, models lack the flexibility to distinguish between malicious intent and the legitimate use of sensitive terminology. As highlighted by Eliott Zemour et al., this rigidity imposes a "guardrail tax," where making a model safer inadvertently degrades its utility.

For example, a model might refuse to discuss clinical terms for self-harm or weapon mechanics even when queried by a medical professional or a creative writer. By evaluating queries in isolation, as demonstrated by Guangzhi Sun et al. with the CASE-Bench framework, commercial LLMs frequently suffer from over-refusal, failing to provide helpful responses even when the surrounding context makes the query completely benign.

Under-Protection (Universal Blind Spots)

Conversely, universal filters are blind to context-dependent harms. A standard safety classifier trained to look for universally prohibited keywords will completely miss scenarios where a benign instruction becomes hazardous due to the specific attributes of the user.

As uncovered by Yeonjun In et al. using U-SAFEBENCH, leading LLMs routinely fail to protect specific user profiles—such as minors or individuals with specific medical conditions—because the requests themselves look entirely safe to a general audience. A high-sugar recipe or a standard exercise routine is harmless for the public, but potentially dangerous when delivered to a user with specific metabolic vulnerabilities.

Universal Safety:   [User Query] ──> [Static Filter (Keywords/Toxicity)] ──> [Safe/Unsafe Binary Decision]
                                                                                │
                                                                                └──> Causes Over-refusal or Blind Spots

Contextual Safety:  [User Query] ──┐
                    [User Profile] ┼──> [Dynamic Risk Assessment] ─────────> [Tailored, Safe Response]
                    [Domain/Norms] ┘

The Three Dimensions of Context

To build systems capable of dynamic risk assessment, researchers break context down into three primary dimensions:

1. User Profile and Vulnerabilities

A model's safety argument must be instantiated for specific user profiles to account for environmental, biological, or professional variability. Josephine Lamp et al. demonstrate this necessity in medical cyber-physical systems, where generalized models pose severe risks if they fail to adapt to individual metabolic profiles or age groups.

Furthermore, Nikita Haduong et al. show that the severity of a model's failure depends heavily on the intersection of task risk and user expertise; a novice requires significantly tighter safety guardrails and more precise procedural guidance than an expert who can independently verify a model's instructions.

2. Deployment Domain

The perceived harm of text shifts dramatically depending on whether a model is acting as a creative writing assistant or a corporate advisor. Eve Fleisig et al. found that users exhibit significantly higher sensitivity to problematic content or subtle stereotyping in professional contexts compared to creative writing.

Standard moderation APIs cannot adapt to these conflicting policy needs, as noted by Hao Sun et al.. In technical or medical fields, personalization acts directly as a safety feature: by resolving linguistic ambiguities specific to the user's environment, the model can provide precise instructions that generic models might omit, preventing hazardous misunderstandings (Shiran Dudy et al.).

What is considered safe, legal, or offensive is highly subjective and varies across cultures, geographies, and time periods (Megan Ung et al., A. Stevie Bergman et al.). Binary classifications ignore this reality. As Da Yin et al. point out with the SafeWorld benchmark, a query about the legality of an 18-year-old entering a pub is a standard regional variation in the UK but flags safety concerns in a US-centric model.

Aligning models to a single Western-centric worldview causes them to fail under different local jurisdictions where the legal or cultural status of information changes (Jingtong Su et al.).


Mechanisms for Dynamic Safety Steering

Moving away from static guardrails requires technical mechanisms that can adjust a model's behavior at runtime without requiring expensive retraining or fine-tuning for every possible user scenario.

Activation Interventions

Instead of altering model weights permanently, researchers can surgically steer a model's internal representations during inference. Tran Huynh et al. introduced Paired Contrast Mean Shift (PCMS), a training-free method that isolates a specific "harm direction" within the model's activation space.

By calculating the difference in mean activations between safe and unsafe examples for a specific context, PCMS allows users or developers to dynamically shift the model's internal representations. This suppresses specific undesired content (like political bias or violence) tailored to a personalized boundary while leaving the model's general intelligence and helpfulness intact.

Dynamic Routing and Mixture-of-Experts (MoE)

Another approach is to dynamically alter the safety pipeline based on input features. The Adaptive Integration of Detectors (AID) framework, proposed by Enmao Diao et al., uses an MoE architecture to combine multiple specialized safety detectors. Rather than relying on a single gatekeeper, AID dynamically weights the inputs of different expert detectors based on the contextual features of the prompt, significantly outperforming standard ensembles on multi-faceted safety tasks.

Similarly, Eliott Zemour et al. utilize a tuning-free routing process driven by in-context learning to bypass rigid system prompts, directing queries to appropriate safety profiles dynamically.

Context Elicitation and Belief Augmentation

When the user's background is unknown, the model must actively resolve ambiguity. The RAISE framework, introduced in the authors' work on Personalized Safety in LLMs: A Benchmark and A Planning-Based Agent Approach, uses a planning-based agent that strategically asks the user for clarifying background information when a high-stakes query is detected. This minimal interaction overhead allows the model to calibrate its safety response accurately.

On the defense side, frameworks like Joint Adversarial Prompting and Belief Augmentation (JAB), developed by Ninareh Mehrabi et al., dynamically generate natural language "belief instructions" that act as targeted patches for specific adversarial contexts, moving away from the search for a single, universal safety prompt.

System-Level Governance

Finally, this contextual awareness is being integrated into broader governance and operational frameworks. Systems like the Usage Governance Advisor (UGA), developed by Elizabeth M. Daly et al., translate natural language intents into structured, task-specific risk profiles rather than relying on static compliance checklists.

This mirrors developments in physical AI environments, such as smart homes, where systems like IoTMEDIATOR (Haotian Chi et al.) discard generic security policies in favor of threat-tailored handling options that depend entirely on the operational context of the interaction. By quantifying these vulnerabilities through dynamic metrics like the Model Adversarial Score proposed by Yan Chu et al., the AI community is establishing standardized, context-aware thresholds that reflect real-world deployment risks.

Key Foundational Work

SecureAS: A Vulnerability Assessment System for Deep Neural Network Based on Adversarial Examples (2020) — contributed 1 concept elements to this direction.
Refocusing on Relevance: Personalization in NLG (2021) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_context_dependent_safety_510b3643,
  title = {context-dependent safety},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/context-dependent-safety/rdr_510b3643857547b6b811f8da38cf49fa},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-20},
}

This exact version (version 1, frozen text):

@misc{lacuna_context_dependent_safety_510b3643_v1,
  title = {context-dependent safety},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/context-dependent-safety/rdr_510b3643857547b6b811f8da38cf49fa/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-20},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake