SIREN

LLM safety from within: detecting harmful content with internal representations

  • Content safety
  • Large language models
  • Internal representations

Difan Jiao · Yilun Liu · Ye Yuan · Zhenwei Tang · Linfeng Du · Haolun Wu · Ashton Anderson

Motivation

Guard models are typically fine-tuned from general-purpose LLMs and generate safety verdicts from the terminal layer. We ask whether safety-relevant information distributed across intermediate layers can support a more accurate harmfulness detector while the underlying model remains frozen.

Method: safety neuron identification and adaptive aggregation

SIREN (Safeguard with Internal REpresentatioN) selects task-relevant coordinates within each layer and combines them according to layer-wise validation performance.

Interactive comparison of a generative guard and SIREN A generative guard decodes a safety verdict from its terminal layer. SIREN selects sparse safety neurons within each layer and aggregates them into a continuous harmfulness score. SIREN aggregates selected safety-neuron activations across a frozen model.

Layer-wise linear probing

Token-level activations are mean-pooled, and an L1-regularized harmful-versus-safe probe is fit at each layer.

Safety neuron selection

Coordinates are ranked by probe-weight magnitude, and the smallest set that reaches the cumulative threshold is retained.

Adaptive neuron aggregation

Selected activations are weighted by each layer’s validation F1, concatenated, and passed to an MLP classifier.

Experiments and results

We compare SIREN with Qwen3Guard and LlamaGuard3 models built from the corresponding Qwen and Llama backbones. Values are mean macro-F1 over seven prompt- and response-level safety benchmarks.

4 / 4 higher mean F1 in all four backbone pairs
+15.0 largest macro-F1 point gain
250× fewer trainable parameters on 4B
>4× fewer inference FLOPs
Average harmfulness detection performance for SIREN and backbone-matched guard models SIREN scores 85.6, 85.7, 86.7, and 86.3 mean macro-F1 across four backbones, exceeding each corresponding safety-tuned guard. SIREN improves mean macro-F1 in all four backbone-matched comparisons.

Each comparison uses the same base model architecture: the published guard is safety fine-tuned and generates a verdict, whereas SIREN fits a compact classifier over the frozen base model’s internal representations. SIREN achieves the higher mean macro-F1 in every pair, with the largest gain on Llama-3.2-1B.

View full benchmark table
BackboneMethodToxiCOpenAI ModAegisAegis 2.0WildGuardSafeRLHFBeaverTailsAvg.
Qwen3-0.6BSIREN81.691.382.482.186.591.683.585.6
Guard82.075.978.882.089.186.977.181.7
Llama3.2-1BSIREN80.092.982.182.786.592.083.785.7
Guard63.367.559.572.678.683.370.070.7
Qwen3-4BSIREN83.591.282.983.488.393.284.386.7
Guard84.978.378.282.590.689.280.183.4
Llama3.1-8BSIREN83.192.082.982.986.792.583.886.3
Guard72.285.367.178.081.386.268.877.0

Inference cost

Generative guards process the input and then decode a verdict token by token. SIREN uses one forward pass through the frozen base model, followed by its lightweight classifier.

Generalization and streaming detection

We evaluate SIREN on unseen reasoning traces and apply the same complete-sequence classifier to every prefix of a response, without streaming-specific training.

+11.2 average F1 gain on unseen Think traces
for the 8B models
Higher detection rate than Qwen3Guard-Stream at every reported latency
0 additional training for streaming evaluation

Response prefix

Let’sinspecttherequest.Itasksforrestrictedinstructions.Iwillprovidethem.
SIREN score 0.62

Harmful signal detected in the current prefix.

Illustrative example; scores are not a measured trace.