← Home

LLM Safety Gaps: Detecting Harmful Intent in Early Layers

By James Trappett · 25 August 2026

4 min read

Current safety alignment in large language models is, by design, a surface-level intervention. Reinforcement Learning from Human Feedback (RLHF) teaches models to refuse harmful outputs, but it does not erase the underlying knowledge of harmful concepts encoded during pretraining. This architectural mismatch is the central problem addressed in Truth Lies Deep: Countering Semantic Camouflage via Latent Intent Verification, a paper that uses mechanistic interpretability to expose where safety signals actually live inside a transformer, and proposes a practical defence built on that insight.

The threat model here is not brute-force prompt injection. Semantic camouflage wraps harmful intent inside benign narrative framing, such as a creative writing request, a roleplay scenario, or a code optimisation task. Standard guardrails, whether keyword filters or output-layer classifiers, assume that harmful content is linguistically distinguishable from safe content. Semantic camouflage breaks that assumption by decoupling malicious intent from malicious vocabulary. The result is a class of zero-day attacks that existing perimeter defences cannot reliably catch.

Key Contributions

The paper makes three substantive claims, each supported by empirical evidence across three distinct model families:

Methodology

The experimental design is clean and the architecture choices are well-motivated. Three small language models were selected: Microsoft Phi-3-mini-4k-instruct (3.8B), Qwen2.5-1.5B-Instruct (1.5B), and Google Gemma-2b-it (2B). All were loaded under 4-bit NF4 quantisation, which is a sensible choice for simulating constrained deployment and also keeps the compute requirements tractable. The diversity of architectures matters here because it allows the authors to test whether the Intent Horizon is a universal phenomenon or an artefact of a specific model family.

The probing setup is straightforward. Logistic regression classifiers with L2 regularisation are trained on activations extracted from two loci: an early probe at approximately 15% of total depth (Layer 4 for Phi-3), and a late probe at the final hidden layer. Crucially, probes are trained on explicit harmful queries and evaluated on semantically camouflaged equivalents. This train-on-explicit, test-on-camouflaged protocol is the right way to measure robustness against distributional shift, and it is what gives the Safety Gap metric its meaning.

The geometric analysis in Section IV-C is particularly instructive. At the output layer, camouflaged attacks are topologically embedded within the safe query cluster, meaning any linear classifier operating at that depth will produce false negatives. At Layer 4, the same camouflaged inputs appear as distinct outliers, close to the harmful cluster. The metaphor the authors use, that the early layer sees the crime before the alibi is constructed, is a useful intuition pump, even if it slightly anthropomorphises what is fundamentally a high-dimensional geometry problem.

Results and What They Actually Show

The headline numbers are compelling: detection rates below 20% for late-layer probes versus substantially higher rates for LIV across all three architectures. The 20-50% improvement margin is wide, which reflects genuine variation across model families rather than a single clean result. Phi-3 and Qwen2.5 appear to show stronger Intent Horizon effects than Gemma-2b, though the paper does not fully explain why this might be the case. It is worth noting that the PKU-SafeRLHF dataset, while a reasonable benchmark, is not specifically designed for semantic camouflage evaluation. The authors construct camouflaged variants of harmful queries, which is necessary but introduces some circularity: the camouflage strategy used in evaluation may not reflect the full diversity of real-world adversarial creativity.

The finding that safety information is maximally retrievable in the first 15-20% of network depth connects to a broader body of work in mechanistic interpretability. Research on superposition, feature geometry, and the role of early versus late layers in concept formation (see work from Anthropic and DeepMind on sparse autoencoders and circuit analysis) suggests that early layers encode relatively raw semantic features before contextual integration occurs. LIV is essentially exploiting this well-documented property in a safety context, which makes the approach principled rather than merely empirical.

Limitations and Open Questions

The authors are candid about the weaknesses, and they are real ones. The inference latency cost of probing intermediate layers is non-trivial in production settings, particularly for streaming applications. More fundamentally, LIV is a static defence. An adversary with white-box access to the model and knowledge of the probing depth could, in principle, construct gradient-based attacks specifically designed to suppress the harm signal at Layer 4. The authors acknowledge this and propose dynamic depth probing as future work, but that solution introduces its own complexity and potential attack surface.

The calibration requirement is also a practical concern. The optimal probing depth varies by model size and training regime, which means every new deployment requires a fresh calibration phase. For organisations running many fine-tuned variants of a base model, this could become operationally burdensome.

There is also a deeper question the paper does not fully address: what happens as models scale? The Intent Horizon is identified at 15-20% of depth for models in the 1.5-4B parameter range. It is not obvious that this ratio holds for 70B or 400B parameter models, where the representational geometry may be substantially different. Extending this analysis to frontier-scale models would significantly strengthen the universality claim.

The broader implication, that true alignment requires inspectable internal states rather than output-layer filtering, is a position gaining traction in the safety research community. LIV is a concrete, lightweight implementation of that principle. It is not a complete solution, but it is a useful empirical contribution to a field that needs more mechanistic grounding and fewer claims based purely on benchmark performance. Readers working on AI safety, red-teaming, or deployment-time defences will find the methodology worth examining closely.

Full paper: arXiv:2608.20378

AI SafetyLLMAdversarial MLMechanistic InterpretabilityResearch Review

Related Articles

Clinical Lost-in-the-Middle: Positional Bias in EHR LLMsBF1: Sparse Attention Retrofit for Long-Context TransformersRussian Backdoor in Slovak Speed Cameras: A Supply Chain Case Study