SURE: data-efficient safety guardrailing via internal representations and uncertainty-weighted pseudo-labels

Large language models (LLMs) can produce harmful content when prompted with unsafe inputs, yet inference-time safety interventions often degrade general-purpose performance through over-refusal. We propose SURE (Semi-supervised Uncertainty-weighted Representation-based External detection), a framework that trains a lightweight classifier on the LLM’s hidden state representations to detect harmful inputs entirely outside the inference pipeline, preserving the model’s original capabilities. To overcome annotation scarcity, SURE queries the target LLM to assess unlabeled inputs and weights each pseudo-label by the classifier’s confidence, the LLM’s uncertainty, measured as the perplexity of its single-token safety self-assessment, and their agreement. Experiments across three open-source LLMs (8B–70B parameters) show that SURE achieves average harmonic mean scores of 88–90% with only 80 labeled samples, surpassing both inference-time and representation-based baselines. Performance plateaus at 40 labeled examples, and cross-category generalization confirms over 90% accuracy on held-out categories, indicating that the learned representations capture general safety features.

Authors

Institutions

Publication Details

Journal
npj Artificial Intelligence
Published
2026-07-25
DOI
https://doi.org/10.1038/s44387-026-00141-y
Primary Topic
Adversarial Robustness in Machine Learning
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

SURE: data-efficient safety guardrailing via internal representations and uncertainty-weighted pseudo-labels

Sandeep Madireddy, Hanwen Li, Bhavya Kailkhura, Chenxi Yuan et al.
npj Artificial Intelligence
Adversarial Robustness in Machine Learning
article

SURE: data-efficient safety guardrailing via internal representations and uncertainty-weighted pseudo-labels

Sandeep Madireddy, Hanwen Li, Bhavya Kailkhura, Chenxi Yuan, James Diffenderfer, Kaidi Xu, Jinhao Duan
article en

Abstract

Large language models (LLMs) can produce harmful content when prompted with unsafe inputs, yet inference-time safety interventions often degrade general-purpose performance through over-refusal. We propose SURE (Semi-supervised Uncertainty-weighted Representation-based External detection), a framework that trains a lightweight classifier on the LLM’s hidden state representations to detect harmful inputs entirely outside the inference pipeline, preserving the model’s original capabilities. To overcome annotation scarcity, SURE queries the target LLM to assess unlabeled inputs and weights each pseudo-label by the classifier’s confidence, the LLM’s uncertainty, measured as the perplexity of its single-token safety self-assessment, and their agreement. Experiments across three open-source LLMs (8B–70B parameters) show that SURE achieves average harmonic mean scores of 88–90% with only 80 labeled samples, surpassing both inference-time and representation-based baselines. Performance plateaus at 40 labeled examples, and cross-category generalization confirms over 90% accuracy on held-out categories, indicating that the learned representations capture general safety features.

npj Artificial Intelligence
University of North Carolina at Chapel Hill (US), New Jersey Institute of Technology (US), Argonne National Laboratory (US), Lawrence Livermore National Laboratory (US), City University of Hong Kong (HK)
U.S. Department of Energy, Office of Science, Laboratory Directed Research and Development, Lawrence Livermore National Laboratory
Openalex Percentile: Top 6%
Adversarial Robustness in Machine Learning
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.