Introduction
As Large Language Models (LLMs) are increasingly integrated into sensitive enterprise workflows—such as legal, financial, and medical services—ensuring they adhere to complex organizational policies is critical. Traditional safety guardrails often focus on broad categories like hate speech, but struggle with nuanced, domain-specific rules. Current solutions typically rely on "LLM-as-a-judge" (accurate but slow and expensive) or fine-tuning (data-intensive and hard to update).
This paper introduces a training-free method that detects policy violations by analyzing the model's internal "activation space." By applying a statistical technique called whitening to hidden states, violations are identified as "out-of-distribution" events. This approach taps into the model's internal representations, which often signal a violation before the text is even fully generated.
Methodology: Activation-Space Whitening
The core of this approach is framing policy compliance as an Out-of-Distribution (OOD) detection problem within the model's internal activations. The process involves three main steps:
- Activation Extraction: The system captures the hidden representations (activations) of the last token in a dialogue.
- Whitening Transformation: A linear transformation is applied to these activations to center them at zero, scale them to unit variance, and remove correlations between dimensions. This filters out noise and highlights policy-relevant signals.
- Compliance Scoring: In this whitened space, compliant responses cluster near the origin. The "compliance score" is the Euclidean distance from the center. If a response's activation exceeds a calibrated "Governance Threshold," it is flagged as a violation.
Crucially, this method is training-free; it only requires a small set of in-policy examples to calculate the initial whitening statistics and a few contrastive samples to set the threshold.
Experimental Evaluation
The researchers evaluated the method using DynaBench (multi-turn dialogues across 12 business categories) and τ-bench (complex airline domain trajectories). They compared their approach against fine-tuned baselines like DynaGuard and high-performance judges like GPT-4o-mini.
Key insights from the experiments include:
- Policy-Specific Depth: Different policies are encoded at different layers. For instance, information leakage is often detectable in early layers, while complex transactional rules require deeper processing.
- Efficiency: The detection adds negligible latency (0.03 to 0.05 seconds), making it orders of magnitude faster than calling a second LLM judge.
Results
The proposed method achieved a superior 86.0% F1 score, significantly outperforming both fine-tuned models and LLM-as-a-judge approaches. As shown in the performance comparison below, the whitening-based method consistently provides a more robust detection signal across different data types.
Discussion and Future Work
While highly effective, the method's performance depends on the base model having some inherent understanding of the policy. Future work aims to move from detection to prevention, using these internal activation signals to steer the model's generation in real-time, effectively "braking" before a violation is fully articulated. This training-free, low-latency framework represents a significant step toward scalable and efficient AI governance in enterprise environments.
Summary updated