TopoSteer: Topological Layer Selection for LLM Activation SteeringTopoSteer: Topological Layer Selection for Activation Steering in LLMs
The authors propose TopoSteer, which uses the H0 total persistence (MST length) of the displacement point cloud to select layers for mean-difference activation steering, and outperforms most settings of LayerNavigator on 5 models and 6 persona tasks without held-out validation.
- The effect of mean-difference activation steering depends strongly on the injection layer, and exhaustive layer selection requires per-layer evaluation on held-out data. Existing validation-free layer-selection methods score by class separability and direction consistency; the authors argue that they do not characterize the spread of the per-sample displacement point cloud that MD actually averages.
- TopoSteer forms a displacement point cloud from the per-sample contrastive activation differences at each layer, scores layers by its total H0 persistence (equal to the total edge length of the Euclidean minimum spanning tree), and injects the original MD vector at the top-K scoring layers; it also reports a bridge share to diagnose whether the score is dominated by a single long edge, and gives a theoretical result showing the opposite direction from separability.
- On 5 instruction models and 6 persona tasks, with simultaneous injection TopoSteer outperforms LayerNavigator in 10 of 15 model×budget combinations; the largest improvement is on Qwen-3B (66.20%→79.71% at K=3). Average alignment is lower than W2S-Multi, which requires validation-set training (78.90% vs. 81.25%), but runtime is shorter (8.4 vs. 15.9 minutes); MMLU change is near zero.
- The authors note: applicable only to paired positive and negative samples and the mean-difference extractor; multi-layer steering reduces perplexity on some models; Theorem 1 covers only a single-parameter family at a fixed layer; the bridge share guarantee may miss mode splits concentrated in a few coordinates. Experiments cover only 5 open-source instruction models and 6 persona tasks, and no statistical significance tests are reported.
- Evaluated models
- Llama-3-3B-InstructLlama-3-8B-InstructQwen2.5-3B-InstructQwen2.5-7B-InstructQwen2.5-32B-Instruct
- Benchmarks
- Anthropic Persona Dataset(六个二元 persona 任务)MMLU
- Metrics
- aligned-answer probability (Prob)generation perplexity (PPL)MMLU accuracytotal H0 persistence / connectivity length Lbridge share
TopoSteer proposes a topology-based layer selection method for LLM activation steering, achieving more effective steering across multiple language models and steering tasks without held-out validation. It scores layers by the total H_0 persistence of the per-sample displacement cloud, which equals the length of the Euclidean minimum spanning tree of the displacement cloud. The authors also show that as sample-level variation increases, TopoSteer and discriminability move in opposite directions, so the two may give opposite layer rankings.
Paper analysis
What problem does this paper attempt to solve?
Solving validation-free injection-layer selection for mean-difference activation steering: replacing class-separability scores with the topological spread of the displacement point cloud.
Core problem: the effect of mean-difference (MD) activation steering depends strongly on the injection layer; how to select effective layers using only extraction data, without held-out validation.
- Setting and importance: activation steering adds a vector to internal representations at inference time to control behavior, without changing parameters; the authors cite that it is effective in alignment, reasoning and safety mitigation, but injection at a poorly chosen layer can be worse than no steering (Figure 1(a): on Llama-8B, early layers are near baseline, layer 15 improves, other layers are below baseline). Exhaustively selecting K layers from L layers requires evaluating all subsets on held-out data, which is impractical.
- Shortcomings of existing methods: the authors argue that LayerNavigator's discriminability term D (a Fisher-type between-class/within-class scatter ratio) only looks at the separability of the two activation clouds and never at the per-sample displacement cloud that MD actually averages; the consistency term C is a cosine mean that only looks at direction and discards the extent of the displacement.
- Core observation: the MD vector is the mean of per-sample displacements, so whether a single vector can represent a usable signal is a property of the displacement cloud ∆l; the authors argue that what should be scored is the extent of the displacement cloud, not the separability of the two activation clouds or the alignment of individual displacements with the mean.
- Proposed in the paper: TopoSteer—a validation-free layer selector that uses the total H0 persistence of the displacement cloud (equal to the total edge length of its Euclidean minimum spanning tree) as the layer score; and it proves that as sample-level variation increases, TopoSteer and discriminability move in opposite directions (Theorem 1), and the two criteria may give opposite layer rankings.
- Threat model: not applicable. The paper does not involve an attacker; it studies the layer selection problem of an inference-time behavior control method itself. The ethics statement mentions that steering could be misused to manipulate outputs or bypass guardrails, but the paper only performs controlled persona steering tasks.
What related research exists?
Related work falls into three groups: activation steering and layer selection, persistent homology of neural representations, and adaptive (per-input) steering; LayerNavigator is the most direct comparison.
Activation steering and layer selection
- Zou et al. (2023), Turner et al. (2023)—propose activation steering: compute a direction associated with a concept or behavior and add it to the residual stream at inference time.
- Rimsky et al. (2024b)'s contrastive activation addition, Arditi et al. (2024)'s refusal-direction, Li et al. (2023)'s inference-time intervention—construct directions from the difference of paired contrastive activations, with parameters unchanged.
- Sun et al. (2025)'s LayerNavigator—the most recent comparison named in the paper: scores layers using a Fisher-type discriminability D plus a direction consistency C. The paper points out that D is composed of class means and within-class scatter and does not look at the displacement cloud, while C only looks at direction and discards extent; what TopoSteer scores is precisely the displacement extent that neither captures. The paper states that its contribution is orthogonal to direction construction: the extractor is given, and it only asks where to inject; it also notes that existing selection strategies rely on probing accuracy, linear separability, activation differences, or heuristics such as "inject in the middle third".
Persistent homology of neural representations
- Edelsbrunner & Harer (2008)—persistent homology gives a multi-scale description of point clouds; Rieck et al. (2019), Gabrielsson et al. (2020), Naitzat et al. (2020), Uchendu & Le (2026) use it to study the geometry of neural representations.
- Fay et al. (2026)—analyzes the LLM activation space and states that adversarial inputs induce topological compression; Gardinazzi et al. (2025)—documents layer-by-layer changes in transformer intrinsic dimension and anisotropy with depth.
Adaptive (per-input) steering
- W2S (Gadgil et al., 2026)—learns to predict the per-input optimal intervention layer, constructing supervision signals from candidate-layer evaluations.
- Dynamically Scaled Activation Steering (Ferrando et al., 2025)—learns per-input, per-layer scaling factors.
- Nelwan & Wicaksono (2026)'s W2S-Multi—multi-layer adaptive selection, training a prompt-based ranker. The paper notes that such methods require candidate-layer evaluation or additional training, whereas TopoSteer selects layers directly from contrastive extraction data.
Baselines and benchmarks: comparison baselines are LayerNavigator, discriminability only (Disc), random layer selection (drawn without replacement from the middle third of layers) and unsteered model (Base); it is also compared with W2S-Multi, which requires validation-set evaluation. The benchmark is six binary persona tasks from the Anthropic Persona Dataset, with MMLU for utility.
Positioning: the authors state that TopoSteer uses persistent homology as a validation-free diagnostic tool rather than a classifier or training objective, and is a theoretically grounded alternative to discriminability/separability-based layer selection.
How does the paper address this problem?
Form a displacement cloud from the per-sample contrastive activation differences at each layer, score layers by the total edge length of its Euclidean minimum spanning tree (total H0 persistence), and inject the original MD vector at the top-K layers.
Overall idea: the MD steering vector is the mean of per-sample displacements, so layer selection should evaluate the geometry of the displacement cloud rather than the separability of the two classes of activations. TopoSteer uses the connected length of the displacement cloud as the layer score, replacing only the layer-selection rule; the extraction and injection procedures are unchanged.
Problem setup and displacement cloud
- Fix layer l and width d; given N pairs of contrastive inputs (xi+, xi−), take the residual-stream activations at the final prompt token; the MD vector vlraw is the mean of the raw activation differences, and α vlraw is injected.
- To make the geometry comparable across layers, activations are standardized coordinate-wise (Equation 2: subtract the coordinate mean, divide by the coordinate standard deviation; the mean and standard deviation are estimated over all 2N activations at that layer).
- The displacement cloud is defined as δli := ãl(xi+) − ãl(xi−), Δl := {δli}i=1N; each displacement is decomposed into the common mean µδ,l plus a residual displacement ξli.
Layer score and its properties
- The layer score is the H0 total persistence of the displacement cloud, computed as the total edge length of the Euclidean minimum spanning tree: sl := TotPers0(Δl) = ∑e ∈ MST(Δl) w(e) =: L(Δl), i.e., "connected length" as a measure of the spread of the displacement cloud.
- The score is translation-invariant and 1-homogeneous (Proposition 4); Corollary 1 gives L(∆l) = L(Ξl): the score is invariant to a common-mean shift of the cloud and depends only on the relative arrangement of the residual displacements; class separation enters the score only through standardization (Equation 2) (Proposition 1: L is non-increasing in the separation-to-noise ratio ρl,k of each coordinate).
- Computational cost: O(N²d) per layer starting from the pairwise distance matrix, reusing activations already cached when extracting the MD vector; no additional forward passes, held-out steering evaluation, or selector training are needed (Sec. 3.3, Appendix H).
Layer-selection procedure and diagnostics
- Algorithm 1: run the model once to cache activations at each layer → for each layer compute the MD vector, standardize, construct the displacement cloud, compute the MST to obtain the score → take the K layers with the highest scores.
- Also returned is the bridge share bl = weight of the longest MST edge / L(∆l): the score may be dominated by many short edges (structure within the cloud) or by a few long edges/outliers spanning modes, the latter meaning L measures separation between modes rather than arrangement within a mode; bl is used to distinguish the two cases (Appendix F).
- Injection uses the raw (unstandardized) MD vector; the standardized displacement cloud is used only for scoring; the intervention position is all intervention tokens, with default α = 1.0.
Two steering protocols
- Simultaneous: the K selected layers are injected at once, with a single extraction; this is the protocol used by prior validation-free selectors, assuming that scores computed on the unsteered model still hold after the first injection.
- Sequential: each round re-extracts and recomputes the MD vector and scores on the model already injected in the previous k−1 rounds, and takes the argmax among unselected layers; the output is an ordered tuple of non-repeating layers, and the two protocols coincide at K=1; the cost is K extractions, and the authors call it a protocol rather than a selector.
Success criterion and theoretical comparison
- Behavioral metric: the model's average probability of assigning an answer aligned with the target behavior (aligned-answer probability); generation perplexity is also reported to measure the fluency cost.
- Theoretical comparison (Sec. 5): Theorem 1 proves that on a single-parameter family with fixed class means and within-class residuals scaled by σ, total persistence strictly increases with σ while discriminability D strictly decreases, so the two criteria rank in opposite order; Sec. 5.3 analyzes the answer-polarity axis introduced by the contrastive format (the difference in Yes/No response tokens), which splits the displacement cloud into two lobes and carries no between-class information; its effect on D depends on its alignment ε with the steering direction, and its effect on L is dominated by the spanning-tree bridge edge and the merging of the two lobes.
What experiments did the paper conduct?
5 instruction models × 6 persona tasks × K∈{1,2,3}: under simultaneous injection, TopoSteer is better than LayerNavigator in 10 of 15 combinations, with the largest gap on Qwen-3B.
Experimental setup
- Models tested: Llama-3-3B-Instruct, Llama-3-8B-Instruct, Qwen2.5-3B-Instruct, Qwen2.5-7B-Instruct, Qwen2.5-32B-Instruct, 5 instruction-tuned models in total.
- Tasks and data: 6 binary persona tasks from the Anthropic Persona Dataset (Conscientiousness, Religion Following, Self-Awareness, Self-Improvement, Alliance Building, Impact Maximization); about 1000 samples per behavior, about 700 pairs used to extract MD vectors and compute layer scores, and 100 held out for evaluation.
- Baselines: LayerNavigator (LN), discriminability only (Disc), random layer selection (drawn from the middle third of layers), unsteered model (Base); also reports a unit-sphere projection variant of TopoSteer, Oursℓ2, and a comparison with W2S-Multi, which requires a validation set for training.
- Metrics: aligned-answer probability (%, higher is better) and generation perplexity (lower is better); utility measured by 5-shot MMLU accuracy.
- Protocol: α = 1.0, K ∈ {1, 2, 3}, both simultaneous and greedy sequential injection protocols, activations taken at the final prompt token, all filtrations using Euclidean distance.
- Number of repetitions and statistical tests: not reported in the paper.
Main results
According to Table 1 (aligned-answer probability averaged over six tasks, %, simultaneous injection; sequential injection is given in the bullet points below):
Swipe horizontally to read the table
Model Base K=1 LN K=1 Ours K=2 LN K=2 Ours K=3 LN K=3 Ours K=3 Oursℓ2 Llama-3B 66.73 73.79 72.79 81.38 81.38 75.12 80.49 77.40 Llama-8B 77.62 81.26 83.44 84.87 84.26 86.43 85.91 84.73 Qwen-3B 64.26 64.30 64.86 64.16 60.90 66.20 61.07 79.71 Qwen-7B 85.24 85.60 85.84 86.10 85.85 84.97 85.88 85.40 Qwen-32B 82.68 83.42 83.24 83.08 83.91 81.75 83.66 83.64 - The authors report: under simultaneous injection, TopoSteer is better than LN in 10 of 15 model×budget combinations, tied in 1, and lower in 4; the largest improvement is on Qwen-3B (K=1 from 64.30% to 71.77%, K=2 from 64.16% to 77.63%, K=3 from 66.21% to 79.71%; the main-text numbers differ slightly from 66.20 in Table 1, and the table is authoritative).
- The authors state that gains on Qwen-7B and Qwen-32B are smaller and mixed, and that gains depend on the model and layer budget; increasing the number of selected layers does not necessarily improve alignment.
- Sequential injection (lower block of Table 1): on Llama-3B, LN is higher at K=2 (80.61 vs. 80.41) and TopoSteer is higher at K=3 (78.13 vs. 75.17); on Qwen-3B, Oursℓ2 is 76.72 and 79.19 at K=2 and K=3 respectively, while the normalized variant is lower than LN; the authors state that sequential reselection changes which method is preferred, and the effect depends on the model and scoring variant.
Comparison with evaluation-based selection methods (W2S-Multi)
- What was measured: comparison with the per-input multi-layer selection method W2S-Multi on the same 5 models, 6 tasks, K∈{1,2,3} in terms of alignment probability, perplexity and total runtime (Table 2).
- Results: W2S-Multi averages 81.25% alignment vs. TopoSteer's 78.90%, perplexity 14.53 vs. 13.78, total runtime 15.9 minutes vs. 8.4 minutes; by model, W2S-Multi is higher on Llama-8B, Qwen-3B, Qwen-7B, Qwen-32B, and 0.16 percentage points lower on Llama-3B.
- Authors' interpretation: W2S-Multi's extra cost comes from evaluating candidate layers on labeled validation prompts (offline cost O(LNvCf)), whereas TopoSteer requires no held-out steering evaluation or selector training.
Model utility after steering (MMLU)
- What was measured: change in MMLU accuracy of steered models relative to unsteered models, averaged over K∈{1,2,3} (Figure 2; per-K results in Tables 10, 11, conscientiousness task, α=1.0).
- Results: in Figure 2 the changes for all three steering variants are small, with TopoSteer near zero on Qwen-7B and Qwen-32B; in Tables 10/11 the largest drop is −3.07 percentage points for Ours on Llama-3B at K=3, and Ours is +0.08 on Qwen-7B at K=3.
- Authors' interpretation: alignment gains generally have limited effect on downstream task performance.
Analysis of selected layer positions and the answer-polarity axis
- Differences in selected layers: in Figure 3, for Qwen-3B, conscientiousness, K=3, Disc and LN select layers 21–23 while TopoSteerℓ2 selects layers 33–35, with alignment probability going from 51.58% for LN to 84.86% for TopoSteerℓ2; Table 8 shows that the baselines concentrate in the middle of the stack, while TopoSteer (ℓ2) consistently selects the final layers on Qwen-3B.
- Polarity-axis diagnostic: in Figure 4, after projecting out the answer-polarity axis, the top-5 layer set of D changes while the top-5 of L does not ((a)(b), Alliance Building); the projection is a diagnostic rather than a correction, bringing LN's ranking closer to TopoSteer on one task and farther on others; the authors' claim is narrower: the value of a criterion should not be dominated by directions with zero between-class variance.
Other ablations and analyses
- Appendix N: sweeping H0/H1/H2 persistence statistics, entropy, composite scores, 7 distances, k∈{1,2,3,5}, the post-hoc best "oracle upper bound" matches or exceeds LN in 29 of 30 model×behavior pairs, by 4.0 percentage points on average; the authors note that no single descriptor or distance is best on all pairs.
- Appendix Q: comparing connected length with the "sum of distances to the mean", the latter cannot distinguish or is misleading in each case; bridge share is invariant to normalization scaling, and in simulations unimodal ≈0.026, bimodal ≈0.058 (N=40).
- Appendix F: a two-dimensional construction verifies the ranking reversal of Theorem 1 (σ=0.6: D=0.98, L=4.79; σ=2.4: D=0.78, L=19.16).
- Appendix L: gives a separation-independent score form L(Hl); the authors state that comparing rankings under the two normalizations is left for future work.
What are some points that can be further explored?
Limitations listed by the authors: restricted to paired samples and the MD extractor; perplexity cost of multi-layer steering; the theorem covers only a fixed layer; experiments cover 5 open-source models and 6 persona tasks.
Limitations and future directions noted by the authors
- The method assumes paired positive and negative samples, and currently only considers mean-difference steering; other extractors are left for future work (Sec. 6 Limitations).
- Multi-layer steering reduces perplexity on some models (Sec. 6 Limitations).
- Theorem 1 applies only to a single-parameter family at a fixed layer; cross-layer implications remain empirical (Sec. 6 Limitations).
- Appendix Q shows that the relevant guarantee may miss mode splits concentrated in a few coordinates (Sec. 6 Limitations).
- The authors consider style control (author style imitation or obfuscation) a promising direction, because style signals may be dispersed and layer-dependent, and validation-free layer selection may be particularly useful there (Sec. 6 Limitations).
- Appendix G: extending the topological diagnostic to whitening, subspace and probe-type extractors is left for future work; Appendix L: comparing layer rankings under the two normalizations is left for future work.
Scope of experiments
- Models tested are Llama-3-3B/8B-Instruct and Qwen2.5-3B/7B/32B-Instruct, 5 open instruction models in total (Sec. 4).
- Tasks are 6 binary persona tasks from the Anthropic Persona Dataset; about 700 pairs for extraction and 100 for evaluation per task (Sec. 4, Appendix J).
- Layer budgets tested are only K∈{1,2,3} (the Appendix N ablation additionally includes k=5), steering strength is fixed at α=1.0, and activations are taken at the final prompt token (Appendix J).
- Utility is evaluated with MMLU (5-shot, measured only after steering on the conscientiousness task, Tables 10/11); fluency uses generation perplexity.
- The paper does not report the number of repetitions, confidence intervals or statistical significance tests; the best TDA configuration in Appendix N is a post-hoc oracle upper bound (as stated in Appendix N).
Summarize the main content of the paper
TopoSteer uses the minimum spanning tree length of the displacement cloud for validation-free layer selection for MD activation steering, outperforms LayerNavigator in most settings, and has a theoretical characterization that runs opposite to separability.
A methods paper on layer selection for activation steering: it addresses the validation-free selection problem of "which layer to inject into" for mean-difference (MD) steering.
- Problem: the effect of MD steering depends strongly on the injection layer, and exhaustive layer selection is impractical; the authors argue that LayerNavigator's discriminability term only looks at the separability of the two classes of activations and its consistency term only looks at direction, both discarding the extent of the per-sample displacement cloud that MD actually averages.
- Method: TopoSteer forms a displacement cloud from the normalized per-sample contrastive activation differences at each layer, uses its total H0 persistence (equal to the total edge length of the Euclidean minimum spanning tree) as the layer score, and injects the original MD vector at the top-K layers; it reuses activations cached during extraction, requiring no held-out steering evaluation or selector training; it also reports a bridge share to diagnose whether the score is dominated by a single long edge. Theorem 1 proves that on a single-parameter family with fixed class means, this score ranks oppositely to discriminability.
- Main results: on 5 instruction models × 6 persona tasks, under simultaneous injection TopoSteer is better than LayerNavigator in 10 of 15 model×budget combinations (Table 1); the largest gap is on Qwen-3B, where at K=3 Oursℓ2 is 79.71% vs. LN's 66.20%.
- Cost and comparison: average alignment 78.90%, lower than W2S-Multi's 81.25%, which requires validation-set training, but total runtime is 8.4 minutes vs. 15.9 minutes (Table 2); MMLU accuracy change is near zero (Figure 2).
- Exceptions: gains on Qwen-7B and Qwen-32B are small and mixed; under sequential injection the preferred method varies with model and scoring variant.
- Authors' conclusion: displacement-cloud connectivity is a theoretically grounded alternative to discriminability/separability-based layer selection; limitations include supporting only paired samples and the MD extractor, the perplexity cost of multi-layer steering, and the theorem covering only a fixed layer; the authors propose style control as a promising future direction.