TL;DR
Large language models (LLMs) and other foundation models are vulnerable to adversarial attacks that exploit subtle semantic pathways. TraceRouter introduces a novel "discover-trace-disconnect" framework that precisely identifies and severs these harmful circuits at the path level, offering robust safety without compromising model utility.
What Problem Does This Paper Address?
Foundation models (FMs), like LLMs and diffusion models, are incredibly powerful but also susceptible to adversarial manipulation. Current safety measures often rely on the "locality hypothesis," which assumes harmful concepts are localized to specific neurons or features. However, research shows that harmful semantics are often distributed across multiple layers, forming complex "circuits" that can bypass localized defenses. This leads to "semantic leakage" where models still generate undesirable content, or worse, these interventions can degrade the model's overall performance by disrupting essential computations. The core challenge is to develop safety interventions that are both effective against these distributed harmful semantics and preserve the model's general capabilities.
Methods
TraceRouter proposes a three-stage, architecture-agnostic framework:
- Discover:
- Sensitive Onset Layer Identification: The framework first identifies the earliest layer where harmful semantics begin to emerge. This is done by analyzing attention divergence between sensitive and non-sensitive prompts, calculating a "sensitivity score" (SS) that peaks at the onset layer.
- Feature Disentanglement: Sparse Autoencoders (SAEs) are used to decompose dense neural activations into interpretable, sparse features. Differential activation analysis helps isolate features specifically triggered by illicit concepts.
- Trace:
- Causal Semantic Pathway Tracing: Identified sensitive features are back-projected into the model's latent space. Zero-out interventions are then used to quantify the "Feature Influence Score" (FIS), which measures how much a specific feature's activation affects downstream neurons. This allows tracing the causal flow of harmful information across layers.
- Disconnect:
- Selective Path-Level Suppression: Based on the traced pathways and FIS, TraceRouter creates a mask to identify the "sensitive pathway" (harmful circuit) and its orthogonal "general utility" pathways. A suppression factor ($\lambda$) is then applied to selectively dampen the harmful circuit, effectively severing the flow of illicit semantics while leaving benign computations intact.
Datasets
The paper evaluates TraceRouter on a variety of models and benchmarks:
- Diffusion Models (DMs):
- Safety/Robustness: I2P (nudity, violence), P4D, Ring-A-Bell attacks.
- Fidelity: MS COCO.
- Large Language Models (LLMs):
- Safety: GCG, AutoDAN, Template, Prefill, Template+Prefill attacks.
- General Capabilities: Global-MMLU-Lite.
- Multimodal Large Language Models (MLLMs):
- Safety: FigStep dataset (multimodal risks).
- General Capabilities: MM-Bench.
- Specific Models Evaluated: Stable Diffusion 1.4, LLaMA3-8B-Instruct, Mistral-7B-Instruct, LLaVA-1.5-7B, MiniGPT-4-7B, FLUX.1 Dev, Show-o2.
Key Insights and Ideas
- Beyond Locality: The paper strongly argues against the "locality hypothesis." Harmful semantics are not isolated but form distributed, cross-layer "circuits." This fundamental insight drives the need for path-level interventions.
- Causal Pathways are Key: Identifying and severing the causal flow of harmful information, rather than just suppressing individual neurons, is crucial for robust safety. TraceRouter's FIS metric is key to this.
- Orthogonality for Utility: The framework leverages the idea that harmful semantic pathways are often orthogonal to general utility pathways. By precisely targeting the former, the latter can be preserved.
- "Sensitive Onset Layer" is Critical: Pinpointing the earliest layer where harmful semantics emerge is more effective than targeting later layers or relying on global maximums. This acts as a "causal bottleneck."
- SAEs for Interpretability: Sparse Autoencoders are vital for disentangling complex neural representations into interpretable features, making it possible to identify the specific components of harmful circuits.
Key Results
- Diffusion Models: TraceRouter achieved a state-of-the-art 99.2% DSR for I2P nudity and 93.6% for violence. It also maintained the best CLIP Score (31.27) and FID (16.24), demonstrating superior safety without sacrificing image quality.
- LLMs: TraceRouter achieved near-perfect DSR (99.6% on LLaMA3-8B, 98.8% on Mistral-7B) across various jailbreak attacks, significantly outperforming baselines.
- MLLMs: TraceRouter achieved a 99.60% average safety rate on LLaVA-1.5, surpassing baselines like SafePTR.
- Utility Preservation: Across LLMs and MLLMs, TraceRouter caused negligible performance degradation (e.g., <1% drop on Global-MMLU-Lite and MM-Bench).
- Path vs. Neuron Level: Path-level intervention consistently outperformed neuron-level baselines, highlighting the importance of targeting circuits.
- Scaling Factor: An optimal suppression factor ($\lambda=2$) was found to effectively eradicate harmful concepts while preserving semantic identity.
Limitations and Future Work
- Focus on Safety-Oriented Tasks: The current framework is primarily validated for preventing harmful content generation and defending against jailbreak attacks. Its applicability to more general-purpose tasks like logical reasoning or knowledge retrieval needs further exploration.
- Broader Domain Validation: Future work aims to investigate TraceRouter's effectiveness in a wider range of non-safety domains to see if similar topological disconnection can modulate complex, multi-functional neural pathways without compromising cognitive integrity.
- Computational Cost: While efficient at inference, the SAE training and tracing are one-time offline costs that need to be performed for each unique architecture. However, the paper notes that identified pathways can be reused if models share components (e.g., a frozen CLIP text encoder).
Summary updated