CASE-Bench: Context-Aware SafEty Benchmark for Large Language Models

Guangzhi Sun, Xiao Zhan, Shutong Feng, Philip C. Woodland, Jose Such

TL;DR

Current LLM safety benchmarks evaluate user queries in total isolation, causing models to over-refuse benign requests and harm the user experience. To fix this, the authors introduce CASE-Bench, a benchmark that applies Contextual Integrity theory to evaluate LLMs using 900 distinct query-context pairs. The study reveals a massive gap between human judgment and LLM behavior, showing that commercial models like GPT-4o frequently over-refuse safe queries when presented with safe contexts.

What Problem Does This Paper Address?

When a user asks an LLM, "Suggest some ideas to steal valuables from a museum," standard safety filters trigger an immediate refusal. But what if the user is a registered fiction writer developing a heist plot for an action novel?

Traditional LLM safety benchmarks evaluate queries in a vacuum. This lack of nuance leads to over-refusal—where models reject completely benign prompts out of an abundance of caution, frustrating users. While the AI community has acknowledged over-refusal, previous evaluations still relied on isolated queries.

This paper addresses the lack of contextual awareness in LLM safety evaluation. The authors argue that safety cannot be accurately judged without formalizing who is asking, where the interaction is happening, and what the intent is.

Visualization of how context influences human safety judgments

Methods

The authors built CASE-Bench by combining social science theory with a rigorous data-annotation pipeline:

  1. Contextual Integrity (CI) Theory: To avoid vague definitions of context, the authors adapted CI theory (originally from privacy research). They formalized context using specific parameters:
  2. Sender (The Chatbot): Defined by the nature of interaction (general vs. domain-specific) and platform type (website, app, etc.).
  3. Recipient (The User): Defined by user type (anonymous vs. registered) and background/intent.
  4. Transmission Principle: Defined by the sender's purpose, confidentiality settings, and source accountability.
  5. Data Creation Pipeline:
  6. Automatic Generation: The authors used GPT-4o to generate a safe and an unsafe context for various problematic queries based on the CI parameters.
  7. Manual Revision: Because GPT-4o's internal safety filters often over-moderated and altered the user's original intent during generation, two human researchers manually revised and corrected all generated contexts.
  8. Statistical Power Analysis: Unlike previous benchmarks that rely on simple majority voting from a handful of crowd workers, the authors used statistical power analysis ($G*Power$) to determine the exact sample size needed to detect true variations in human judgment. They settled on 21 annotators per task, collecting over 47,000 total human annotations from Amazon MTurk.
Figure 2. Data creation pipeline for CASE-Bench which sequen- tially executes query selection, automatic context generation and manual revision stages. Annotators are involved in each stage.

Datasets

The benchmark is built on top of SORRY-Bench, utilizing 450 potentially harmful instructions across 45 fine-grained safety categories (such as fraud, privacy violations, and malware generation).

By pairing each of these 450 queries with two distinct contexts (one safe, one unsafe), the authors created CASE-Bench, which consists of 900 query-context pairs. The dataset also includes non-binary human safety ratings to capture the inherent uncertainty in human moral reasoning.

Key Insights and Ideas

  • The "Recipient" is King: Ablation studies showed that the most influential contextual factor for both humans and LLMs is the Recipient parameter (the user's background and role). Knowing who is asking alters safety perceptions more than knowing where the chatbot is deployed.
  • Reasoning Correlates with Contextual Safety: DeepSeek-R1, despite not being explicitly optimized for safety alignment, achieved performance on par with heavily aligned models like Claude-3.5-Sonnet. This strongly implies that advanced reasoning capabilities naturally translate to better contextual understanding in safety scenarios.
  • LLMs Struggle to Generate Unsafe Contexts: During dataset creation, GPT-4o frequently refused to generate the "unsafe" contexts or altered the prompt to make it safe. This highlights a meta-problem: strict safety alignment makes LLMs poor tools for generating adversarial or nuanced safety datasets without human-in-the-loop intervention.

Key Results

The authors evaluated several open-source and commercial LLMs as safety judges across CASE-Bench:

  • Claude-3.5-Sonnet emerged as the top performer, achieving the highest overall accuracy (90.1% using direct scoring) and demonstrating an excellent balance between safe and unsafe contexts (90.7% recall on safe contexts).
  • GPT-4o exhibited severe over-refusal tendencies. When evaluated using binary classification, it achieved a dismal 54.6% recall on safe contexts, meaning it incorrectly flagged nearly half of the safe scenarios as unsafe.
  • Llama-Guard-3-8B, a specialized safety classifier, saw its accuracy improve from 54.1% to 60.1% when context was included, proving that context helps classifiers. However, it still lagged significantly behind larger, general-purpose models.
Figure 3. Visualization of Kruskal-Wallis test results across 45 categories in the CASE-Bench dataset. The chart distinguishes between significant and non-significant categories, with bars representing the average K-W statistic values. Categories labelled as ”Non-significant” are displayed with a hatched pattern. Category “Child-related Crimes” is excluded as detailed in §4.1.

Limitations and Future Work

  • Inherently Unsafe Queries: Some query categories are completely resistant to context. For example, queries involving child-related crimes were explicitly forced to be labeled "unsafe" across all contexts to comply with legal and ethical standards.
  • The Assumption of Verified Context: CASE-Bench assumes that the context provided to the judge is 100% accurate and verified (e.g., via corporate APIs or role-based access control). In production, malicious users might attempt prompt injection to spoof a "safe" context. Future work must focus on securing the context layer from jailbreak attacks.

Summary updated

BibTeX
@inproceedings{sun2025case,
  author = {Guangzhi Sun and Xiao Zhan and Shutong Feng and Philip C. Woodland and Jose Such},
  title = {{CASE-Bench: Context-Aware SafEty Benchmark for Large Language Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=FCHIGDCoow},
}
Figure