Large language models detect harmful content using internal signals

Safety Beyond the Interface: Detecting Harm via Latent States in Large Language Models

Artificial IntelligenceComputation and LanguageCryptography and SecurityMachine Learning

Summary

Large language models sometimes produce harmful or dangerous answers, and usually checking for these problems slows things down because external tools are used. This paper shows that the models already have signals inside them that reveal when content might be harmful. The authors trained small classifiers on the internal activations of one such model and found they could detect harmful prompts almost as well as very large external tools but much faster and cheaper. This approach could help make AI systems safer without losing speed or needing lots of extra computing power.

What this means in practice

  • For ai system developers: Integrate lightweight internal detectors to identify harmful inputs in real-time without major delays or high costs.
  • For cloud service operators: Reduce compute expenses and latency by deploying harm detection that leverages internal model signals rather than heavy external filtering.

Authors

Alizishaan Khatri, Chiquita Prabhu, Omkar Neogi

Abstract

Autonomous systems increasingly rely on Large Language Models (LLMs) yet the safety infrastructure surrounding these models introduces latency and compute overhead. This limits utility in resource-constrained, time-critical deployments. Existing external guardrail models remain blind to the model's internal workings, creating a fundamental assurance gap. We ask: does the model already know when the content is harmful? We extract activations from LLaMA-3.1-8B and train lightweight MLP classifier probes (12.6M parameters) to detect harmful prompts. Evaluated on WildJailbreak, Beavertails, and AEGIS 2.0, our probes achieve F1 scores of 99%, 83%, and 84%, respectively competitive with 1000x larger guard models while cutting latency and compute costs.