Manuscript Offprint

arXiv:2611.04878

TraceRouter++: Causal Semantic Routing Realignment via Optimal Transport

Chuancheng Shi, Shangze Li, Wenhua Wu, Hengzhi Chen, Fei Shen, Li Zhuo, Zhiyong Wang, Tat-Seng Chua

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Chuancheng Shi†1^{\dagger 1}, Shangze Li†2^{\dagger 2}, Wenhua Wu1^{1}, Hengzhi Chen1^{1}, Fei Shen⊠4^{\boxtimes 4}, Li Zhuo3^{3}, Zhiyong Wang1^{1}, and Tat-Seng Chua4^{4}

1^{1}The University of Sydney

2^{2}Nanjing University of Science and Technology

3^{3}Beijing University of Technology

4^{4}National University of Singapore

† Equal Contribution

✉ Corresponding Author

Abstract—Despite their remarkable capabilities, large foundation models (LFMs) remain susceptible to adversarial manipulation. Current safety intervention methods primarily rely on the locality hypothesis, rigidly suppressing isolated neurons or features. However, harmful semantics manifest as distributed, cross-layer circuits, rendering localized ablations both brittle against complex jailbreaks and detrimental to general utility. To bridge this gap, we propose TraceRouter++, a routing-level safety intervention framework that explicitly traces safety-relevant causal routing pathways activated under harmful inputs and realigns their unsafe activation states. Our framework operates in a Discover-Trace-Realign paradigm: it first pinpoints a sensitive onset layer via attention divergence and disentangles dense activations into interpretable routing features using sparse autoencoders (SAEs). Subsequently, it maps these features to downstream causal circuits via feature influence scores (FIS). Crucially, departing from rigid suppression paradigms, TraceRouter++ introduces a constrained optimal transport (OT)-based soft routing realignment. By formulating safety intervention as a tractable coordinate-wise marginal optimal transport approximation, our method redirects unsafe activation marginals toward safe-reference marginals within causally identified routing subspaces while preserving non-selected coordinates at the intervention point. This mechanism safely redirects malicious semantic flows while leaving orthogonal computational routes intact. Extensive experiments across representative large language models (LLMs), multimodal large language models (MLLMs), and diffusion models (DMs) show that TraceRouter++ outperforms evaluated baselines, improving adversarial robustness while maintaining a favorable safety-utility trade-off. WARNING: This paper contains unsafe model responses.

I. INTRODUCTION

THE widespread deployment of large foundation models (LFMs), spanning large language models (LLMs) [88], [78], [92], [27], multimodal large language models (MLLMs) [79], [82], [33], [91], and diffusion models (DMs) [18], [49], [11], [66], [65], is accompanied by significant adversarial risks [77], [95], [43]. Existing safety intervention methods [29] primarily rely on the locality hypothesis, attempting to mitigate harmful semantics by suppressing isolated neurons or features. However, semantic representations within LFMs are inherently

Figure

Fig. 1. Illustration of neuron-level and path-level safety intervention. Given an illustrative unsafe prompt, (a) neuron-level intervention suppresses isolated unsafe activations, which may disrupt benign neurons while allowing harmful information to recover through alternative propagation routes. In contrast, (b) path-level intervention identifies safety-relevant cross-layer routes that respond to harmful inputs and realigns their unsafe activation states, thereby reducing harmful outputs while limiting interference with benign computations.

distributed [17]. Harmful concepts are rarely confined to isolated components; instead, they propagate through complex, cross-layer topological trajectories [4]. Consequently, localized interventions act as isolated roadblocks, unable to contain semantic leakage under sophisticated adversarial attacks. Furthermore, forcibly severing entangled neural components inevitably disrupts benign computations and degrades general utility. These critical vulnerabilities necessitate a structural paradigm shift from rigid node suppression toward continuous routing interventions. By smoothly realigning malicious semantic propagation, this approach mitigates harmful outputs while limiting distortion to the representation manifold.

Current internal interventions [29], [74], [93] typically impose rigid ablations on specific features or local neurons under the assumption that harmful semantics are spatially localized (see Fig. 1(a)). This component-centric perspective, however, overlooks the cross-layer evolution of representations: adversarial semantics exist in superposition across layers and propagate along structured computational circuits. Recent neuroscientific evidence [39], [34] further corroborates that complex behaviors emerge from topological circuits rather than isolated nodes. Thus, ablating individual units often fails to comprehensively regulate the holistic flow of malicious information, leaving models vulnerable to adversarial semantic escape. Furthermore, indiscriminate rigid suppression can damage benign orthogonal pathways, degrading general performance. Effective safety alignment, therefore, suggests a departure from forcibly severing connections, pointing towards a necessity for continuous, optimal transport [53] (OT)-driven soft realignment over these underlying causal pathways.

Motivated by these mechanistic insights, we formalize the routing-level representation hypothesis: safety-critical semantics in LFMs are encoded and transmitted via distributed causal routing circuits rather than localized units. Crucially, abruptly disconnecting these highly entangled circuits tends to disrupt orthogonal benign computations. Accordingly, as illustrated in Fig. 1(b), we posit that formulating safety intervention as a distribution alignment problem, specifically, executing an OT-driven soft realignment over these estimated routing pathways, provides a theoretically grounded and empirically robust approach for enhancing safety control while mitigating unintended utility degradation.

To address this problem, we propose TraceRouter++, a generalized routing-level safety intervention framework operating through a universal Discover-Trace-Realign paradigm. In the discovery stage, we localize a sensitive onset layer, defined as the earliest representational bottleneck where harmful-context-specific attention divergence becomes salient. Subsequently, we employ a Top-K sparse autoencoder (SAE) [15] to decompose dense layer activations into interpretable, sparse routing features, thereby isolating components that exhibit preferential activation under malicious induction relative to benign queries. In the tracing stage, we project these sparse features back into the backbone and utilize zero-out interventions to quantify the feature influence score (FIS) across downstream layers. This causal tracing fundamentally moves beyond localized node analysis, enabling the precise reconstruction of cross-layer computational circuits associated with unsafe behaviors. Finally, in the realignment stage, TraceRouter++ supersedes heuristic rigid suppression with an OT-inspired coordinate-wise soft routing policy. By framing the intervention as a tractable, coordinate-wise transport problem under a conditional independence assumption, TraceRouter++ smoothly maps unsafe activation distributions along identified malicious pathways toward safe reference distributions. This paradigm shift, from rigid neural ablation to continuous distributional redirection, effectively curtails adversarial propagation while better preserving the underlying representation manifold in our evaluations.

We highlight the following contributions of this extended work [67]:

• We propose TraceRouter++, a routing-level intervention framework evaluated across representative LLM, MLLM, and diffusion architectures. It introduces a systematic “Discover-Trace-Realign” paradigm to explicitly identify and redirect harmful information flows within LFMs.

• We introduce a novel OT-inspired soft routing mechanism. By formulating safety intervention as a constrained distribution alignment problem, this approach maps unsafe activation distributions toward safer reference distributions, mitigating malicious concepts while alleviating the catastrophic utility degradation often associated with brittle hard-pruning.

  • We seamlessly integrate SAEs [15] with FIS to facilitate fine-grained feature disentanglement, enabling the precise estimation of intervention-sensitive causal propagation paths at the routing level.

  • Extensive evaluations across diverse generative architectures demonstrate that our framework significantly improves adversarial robustness, consistently establishing a highly favorable safety-utility Pareto frontier compared to the evaluated baselines.

References (92)