Revisiting the robustness of LLM safety alignment through selective geometric controlRevisiting Robustness for LLM Safety Alignment via Selective Geometry Control
ShaPO performs preference alignment with selective geometric control; LLaMA-3-8B out-of-distribution average ASR is 0.70% (Table 2).
- Preference alignment still produces unsafe responses under distribution shift and noisy preference supervision. The authors argue that existing robust methods mainly handle data uncertainty, ignoring how optimization geometry amplifies this uncertainty.
- ShaPO performs worst-case perturbation only on the safety-critical parameter subspace selected by the probe, avoiding uniformly constraining all parameters. The token level acts on a DPO-like likelihood objective; the reward level uses the preference probability of a pretrained reward model.
- After training on PKU-SafeRLHF-30K, LLaMA-3-8B out-of-distribution average ASR: ShaPO-R 0.70%, Dr.DPO 2.09% (Table 2). On Qwen2.5-7B, ShaPO-T is 0.42%, lower than ShaPO-R's 0.55%.
- The conclusion notes that geometry-aware optimization has additional overhead, and efficiency and scalability, especially for larger models, still need improvement; key direction identification is based on approximate signals. Experiments cover four backbones and five safety benchmarks; the paper does not report sample sizes, number of repetitions, or the ρ value.
- Evaluated models
- Pythia-2.8BLLaMA-3.2-3BLLaMA-3-8BQwen2.5-7B
- Benchmarks
- PKU-SafeRLHF-30KHH-RLHF-SafetyDo-Not-AnswerHarmBenchSaladBench
- Metrics
- Win Rate (WR)Attack Success Rate (ASR)
The paper proposes ShaPO, a geometry-aware preference optimization framework that improves the robustness of LLM safety alignment by applying selective geometric control over alignment-critical parameter subspaces. The authors argue that robustness failures in safety alignment cannot be solved by data-centric methods alone, and that fragility introduced by optimization itself is equally critical. ShaPO is implemented at two levels: the token level stabilizes likelihood-based proxy optimization, and the reward level enforces reward-consistent optimization under noisy supervision. Across multiple safety benchmarks and noisy preference settings, ShaPO consistently improves safety robustness over popular preference optimization methods and can be combined with data-robust objectives for additional gains. The code has been open-sourced on GitHub.
Paper analysis
What problem does this paper attempt to solve?
The robustness of preference alignment is also affected by optimization geometry; ShaPO constrains only the safety-critical parameter subspace.
Safety alignment under preference optimization remains fragile under domain shift and noisy preferences; existing robust methods mainly handle data, not the optimization geometry.
- Scenario: the authors argue that preference optimization such as RLHF and DPO has become a common practice for safety alignment, but under domain shift or noisy preference supervision, models that train well can still give unsafe answers.
- Limitations of existing work: data selection, margin reweighting, and distributionally robust optimization over the preference distribution mainly target supervision uncertainty. The authors argue these methods attribute robustness failures to data, while a sharp alignment landscape amplifies preference noise.
- Observation: the authors rank neurons by similarity to the probe safety direction. Figure 1 compares the cumulative share of the worst-case alignment loss increase for Top-K, Random-K, and Bottom-K; the authors say perturbing less than 0.5% of safety-critical neurons accounts for more than 80% of that increase.
- Approach: they propose ShaPO, which optimizes the worst-case alignment objective only on the alignment-critical parameter subspace, instantiated at the token level and the reward level. The authors say it targets optimization-induced fragility and can be stacked with data-side robust objectives.
What related research exists?
Related work covers preference alignment, data-side robustness, and geometric optimization; the authors treat geometry as a complementary axis.
The authors position this paper in terms of preference alignment, data-side robustness, and geometric robustness.
Preference Alignment
- RLHF (Christiano et al., 2017; Ouyang et al., 2022; Bai et al., 2022): uses reward modeling and policy optimization to make models prefer safe responses. The authors state it is computationally expensive and may be sensitive to noisy supervision (Gao et al., 2023).
- DPO (Rafailov et al., 2023): formulates alignment as supervised learning on preference pairs without an explicit reward model or reinforcement learning. Follow-ups include group-relative or multi-objective optimization (Shao et al., 2024; Guo et al., 2025; Zhao et al., 2025a).
- The authors state that preference safety alignment still generalizes poorly under distribution shift or adversarial prompts (Wei et al., 2024).
Data-Side Robustness
- Noise- and distribution-robust objectives: IPO (Gheshlaghi Azar et al., 2023), cDPO (Mitchell, 2023), rDPO (Chowdhury et al., 2024), Dr.DPO (Wu et al., 2024), as well as WDPO, KLDPO (Xu et al., 2026), DoRA (Zhu et al., 2025a), and BalDRO (Shao et al., 2026).
- Data selection and filtering: reward margins (Deng et al., 2025; Huang et al., 2025), external guidance (Zhang et al., 2025), learning criteria (Gao et al., 2025), and implicit margins (Liu et al., 2026). The introduction also mentions Kong et al. (2024) and Yeh and Li (2025).
- The authors argue that these methods mainly handle noise and bias at the data level and assume stable optimization dynamics in parameter space, so parameter-space robustness has not been systematically addressed.
Geometry and Safety Locality
- SAM-type methods (Foret et al., 2020; Bahri et al., 2021): control the worst-case loss in a parameter neighborhood, usually with a uniform constraint over all parameters. The authors cite Ghorbani et al. (2019), Mi et al. (2022), etc., stating that sensitivity is anisotropic and loss changes concentrate in a few directions.
- Locality of safety representations: Wei et al. (2024) and Zhao et al. (2025b) discuss that safety behavior concentrates in a small number of internal representations; Lee et al. (2024) analyze DPO and toxicity-related value vectors. The authors argue that uniform constraints tend to over-constrain parameters unrelated to safety (Niu et al., 2025; Perin et al., 2025).
- The authors state that geometric robust optimization has not been systematically applied to preference safety alignment, and that optimizing sensitivity can amplify residual noise or distribution shift.
Baselines and Benchmarks
- Baseline methods: Vanilla LLM, SFT, DPO, IPO, cDPO, rDPO, Dr.DPO.
- Benchmarks: trained and evaluated in-distribution on PKU-SafeRLHF-30K; out-of-distribution uses Do-Not-Answer, HarmBench, HH-RLHF-Safety, SaladBench. The noise setting follows the label flipping of Wu et al. (2024).
The authors view optimization geometry as a complementary axis to data uncertainty: only stabilizing alignment-critical directions and combining with data-side objectives.
How does the paper address this problem?
ShaPO performs SAM-style worst-case perturbation within a safety-critical subspace selected by a probe, at both token level and reward level.
ShaPO minimizes the worst-case alignment loss only on a safety-critical parameter subspace, avoiding uniform geometric constraints over all parameters.
Alignment Objective
- Preference data are triples (x, y^w, y^l). DPO's implicit reward is r_θ(x, y) = β log(π_θ(y|x) / π_ref(y|x)), and the general preference objective is denoted L_align(θ).
- The full-parameter version maximizes L_align(θ+ε) within ||ε||≤ρ. ShaPO restricts the perturbation to a subspace S: LShaPO(θ)=max|ϵS|≤ρLalign(θ+ϵS). This means it only performs a worst-case perturbation of radius ρ along safety-critical directions and optimizes the perturbed alignment loss.
- For differentiable losses and small ρ, the authors use a second-order expansion to show that this objective reduces the gradient norm and the maximum Hessian eigenvalue λ_max(H_S) on the safety subspace. Appendix C discusses a PAC-Bayes-style generalization bound and a bypass bound under risk threshold τ; the authors state that reducing λ_max(H_S) widens this bound.
Safety-Critical Subspace
- Take the last-layer Transformer residual stream representation h, train a linear probe p by minimizing logistic loss. In the main text, y ∈ {+1, −1} indicates whether a response is labeled safe or unsafe.
- Focus on the value vectors v_j of each block. In the main text, similarity is the inner product ⟨v_j, p⟩; Algorithm 1 uses absolute value; Appendix E.1 writes cosine similarity and defines p = w_1 − w_0. The parameters with the highest scores form S.
- The authors state that conservatively selecting Top-1% neurons covers more than 90% of worst-case loss. Figure 1 uses the same probe Top-K procedure.
- Appendix E.1: the backbone is frozen, and the probe is trained on PKU-30k with harmless as the label. Figure 7 shows loss and accuracy over ten epochs for four backbones; the main text does not give accuracy. Table 7 lists the Top-20 tokens decoded by the probe; not repeated here.
Two-Level Instances
- ShaPO-T: adds selective geometric control to a token-likelihood-type objective. The text uses DPO as an example and states it can be applied to rDPO, Dr.DPO, etc. The perturbed policy enters the per-token log probabilities of chosen and rejected, then through β and sigmoid. No explicit reward model is needed.
- ShaPO-R: a pretrained reward model R_φ gives scalar scores. The soft label is the reward difference passed through β_r and sigmoid; the policy uses the sigmoid of its own score difference as the preference probability, the loss is binary cross-entropy, and the worst case of this loss is taken within the subspace.
- Experiments use PKU-Alignment/beaver-7b-v1.0-cost. It was originally a cost model; the authors negate its output so that higher values correspond to more harmless. Experiments set β_r = 10. Appendix Figure 6 also plots the sigmoid distribution on PKU-30K for β_r of 0.1, 1, and 10.
- The authors' rationale: the reward-level objective is defined on preference probability rather than token likelihood; optimization remains offline while having structural ties to online RLHF; an external reward can mitigate token-level annotation noise.
Training Steps
- Inspired by SAM, two forward–backward passes. First compute g_S = ∇_{θ_S} L_align(θ), then take the perturbation ϵS=ρ· gS/(|gS|2+ε), lying on the L2 sphere centered at θ_S. Algorithm 1 writes the stabilization term as 10^{-12}.
- The second step updates all θ with the gradient at the perturbed parameters.
- To reduce overhead, this update is not done every step. The main text says every T steps; Appendix D.3 sets τ = 5. Algorithm 1 uses the perturbed gradient when t mod τ = 0, otherwise the unperturbed gradient.
- All preference methods share β = 0.1 and learning rate 5×10^{-7}. Dr.DPO additionally sets β′ = 1.0. The paper does not report the ρ used in experiments.
What experiments did the paper conduct?
ShaPO's out-of-distribution average ASR is lower than DPO and Dr.DPO; on Qwen2.5-7B, ShaPO-T is 0.42%.
Experimental Setup
- Backbones: Pythia-2.8B, LLaMA-3.2-3B, LLaMA-3-8B, Qwen2.5-7B. Reward level uses beaver-7b-v1.0-cost.
- Data and Benchmarks: Trained on PKU-SafeRLHF-30K. In-distribution evaluation uses this dataset; out-of-distribution evaluation uses Do-Not-Answer, HarmBench, HH-RLHF-Safety, SaladBench. The paper does not report sample sizes for each benchmark.
- Baselines: Vanilla, SFT, DPO, IPO, cDPO, rDPO, Dr.DPO.
- Metrics and Judges: Higher WR means safer, judged by GPT-4.1-mini at temperature 0.7. Lower ASR means safer, judged by MD-Judge-v0_2-internlm2_7b (MD) and NVIDIA Llama-3.1-Nemotron-Safety-Guard-8B-v3 (NV), with inference temperature 0.0 and top_p 1.0. The paper does not report agreement with humans or number of repetitions.
- Noise Protocol: Controlled label flipping on training preferences following Wu et al. (2024); the main text writes 0% to 40%, and WR is evaluated on a clean validation set. Section 4.4 does not specify the validation set name.
- Implementation: Pythia-2.8B and LLaMA-3.2-3B use 2 H100 GPUs with batch size 128; the other two backbones use batch size 32; gradient accumulation over 2 steps. The paper does not report the number of epochs or ρ.
Main Results
The table below shows average ASR across the four out-of-distribution benchmarks for MD and NV, where lower is safer. The first two rows are from Table 2, the last two from Table 8. All are trained on PKU-SafeRLHF-30K. Vanilla, SFT, IPO, and cDPO are not listed in the table.
Swipe horizontally to read the table
Backbone DPO rDPO Dr.DPO ShaPO-T ShaPO-R LLaMA-3-8B 22.85% 3.97% 2.09% 1.37% 0.70% Qwen2.5-7B 14.39% 3.18% 1.05% 0.42% 0.55% Pythia-2.8B 41.21% 39.67% 23.90% 7.71% 6.91% LLaMA-3.2-3B 8.58% 3.27% 1.20% 0.59% 0.99% - The authors state that data-side methods alone cannot solve robustness failures under distribution shift. In the table, on Qwen2.5-7B and LLaMA-3.2-3B, ShaPO-T has lower average ASR than ShaPO-R, which is not fully consistent with the claim that "ShaPO-R achieves the lowest average ASR on both backbones."
- In Table 2, for LLaMA-3-8B, Vanilla and SFT average ASR are 46.27% and 64.03%, and for Qwen2.5-7B they are 23.02% and 62.37%, all higher than DPO in the same table. The authors do not explain why SFT is higher than Vanilla.
- The authors state that ShaPO-R outperforms Dr.DPO and rDPO on HH-RLHF and SaladBench. This holds relative to those two baselines in Table 2; on HH-RLHF for Qwen2.5-7B, ShaPO-T has MD of 1.09% and ShaPO-R 1.31%. On Do-Not-Answer for LLaMA-3-8B, ShaPO-T has NV of 0.11% and Dr.DPO 0.00%.
In-Distribution Alignment
- Table 1 trains and evaluates on PKU-SafeRLHF-30K. ShaPO-T WR: Pythia-2.8B 56.14%, LLaMA-3.2-3B 85.88%, LLaMA-3-8B 85.45%, Qwen2.5-7B 89.26%, all higher than baselines in the same table. ShaPO-R WR is 57.14% on Pythia-2.8B and 87.45% on LLaMA-3-8B, higher than the corresponding ShaPO-T.
- On LLaMA-3-8B, ShaPO-R MD/NV is 1.13%/0.13%, and ShaPO-T is 2.76%/0.13%. On Qwen2.5-7B, ShaPO-T MD is 0.75% and ShaPO-R 1.13%; NV is 0.13% and 0.00%, respectively. The authors state that ShaPO-R further reduces MD and NV on larger backbones; Qwen's MD is not fully consistent with this.
- SFT WR is lower than Vanilla on the three larger backbones. On LLaMA-3-8B it is 23.85% versus 42.82%. The authors do not explain this.
Noisy Supervision and Combination
- The authors state that as the flip ratio increases, DPO WR decreases, data-side variants mitigate this but still decline; ShaPO-R is highest at all flip ratios and remains above baselines at 40% flipping. Section 4.4 refers to Figure 5; Figure 3's caption corresponds to 10%, 20%, 40% flipping, with axis text containing 0%; Figure 5's caption is about neuron proportion. The main text does not give these WR values.
- The authors attribute ShaPO-R's advantage at high flip ratios to decoupling the external reward from corrupted preference labels.
- Figure 4 stacks ShaPO on DPO and its variants on Pythia-2.8B and LLaMA-3.2-3B, with the metric being WR relative to the chosen response. The authors state there are still gains on top of existing data-side objectives. The main text does not list values per method.
Geometry, Curvature, and Reward Ablations
- Table 3 compares control positions on LLaMA-3-8B with the DPO loss. IID MD/NV: no control 26.57%/14.41%, random 26.89%/14.34%, uniform 25.56%/13.03%, selective 27.32%/13.91%. OOD average MD/NV: 28.78%/16.91%, 28.56%/16.87%, 26.83%/15.12%, 26.31%/14.12%. The authors state that IID results are close and OOD selective is lowest. These numbers are not the same result as ShaPO-T in Table 1 (MD 2.76%).
- Table 4: LLaMA-3-8B Max HE goes from Base 25.2336, DPO 14.9509, Dr.DPO 9.4993 to ShaPO-T 6.2466; WR is 42.82%, 69.19%, 82.50%, 85.45%. The authors state that decreasing curvature co-occurs with higher WR.
- Table 5 stacks ShaPO-R on DPO and Dr.DPO separately. DPO path IID MD/NV: DPO 26.57%/14.41%, DPO+Reward 18.42%/8.40%, ShaPO-R 16.32%/7.52%; OOD average 28.78%/16.91%, 17.33%/7.02%, 15.98%/6.26%. Dr.DPO path IID: 4.39%/0.50%, 3.38%/0.38%, 1.13%/0.13%; OOD average 3.72%/0.45%, 2.25%/0.35%, 1.30%/0.09%. The authors state that reward supervision and geometric control come from different sources, and that the gains come from optimization geometry rather than stronger supervision.
Other Ablations and Analyses
- Neuron proportion: the authors state that on LLaMA-3-8B, average ASR across four benchmarks decreases from Top-0.01% to Top-1%, is lowest at Top-1%, and rises again after increasing further (Figure 5). The main text does not give ASR for each proportion.
- Runtime (Table 6, mins): DPO family / ShaPO-T / ShaPO-R on Pythia-2.8B is 16/21/30, LLaMA-3.2-3B is 18/24/35, LLaMA-3-8B is 46/89/99, Qwen-2.5-7B is 44/85/95.
- Probe curves are in Figure 7; the main text does not report final accuracy.
What are some points that can be further explored?
The authors note that geometric optimization has additional overhead, and that identifying critical directions relies on approximate signals.
Limitations and Future Directions Noted by the Authors
- Geometry-aware optimization introduces additional computational overhead. The authors list improving the efficiency and scalability of such methods as a future direction, specifically mentioning larger-scale models (Conclusion).
- Identifying alignment-critical directions necessarily relies on approximate signals. The authors also say that even coarse geometric cues can improve safety robustness (Conclusion).
Experimental Coverage
- Aligned backbones are Pythia-2.8B, LLaMA-3.2-3B, LLaMA-3-8B, and Qwen2.5-7B, 4 in total; training data is PKU-SafeRLHF-30K (Section 4.1).
- Evaluation includes in-distribution results on that dataset, plus Do-Not-Answer, HarmBench, HH-RLHF-Safety, and SaladBench. ASR uses MD and NV; WR uses GPT-4.1-mini (Section 4.1, Appendix D).
- Noise flipping is 0% to 40% in the main text; the backbones in Figure 3 are Pythia-2.8B and LLaMA-3.2-3B. The main domain-shift tables are LLaMA-3-8B and Qwen2.5-7B (Table 2); smaller backbones are in Table 8.
- Control strategy, neuron proportion, Hessian, and reward supervision ablations are reported on LLaMA-3-8B (Tables 3–5, Figure 5). Combination with data-side objectives is reported on Pythia-2.8B and LLaMA-3.2-3B (Figure 4). The reward model is beaver-7b-v1.0-cost.
- The paper does not report per-benchmark sample sizes, number of repetitions, the perturbation radius ρ value, or agreement between review and human judgment. Appendix D states β = 0.1, learning rate 5×10^{-7}, τ = 5, β_r = 10.
Summarize the main content of the paper
ShaPO complements data-side robust alignment with selective geometric control and reduces average ASR under distribution shift.
ShaPO is a geometry-aware preference optimization for addressing the fragility of safety alignment under distribution shift and noisy preferences.
- The authors argue that robustness failures do not come entirely from supervision noise: sharp alignment losses amplify small perturbations in preference data. They use a linear probe on the last-layer residual stream to locate safety-related value vectors, take the Top-1%, and perform worst-case perturbation only in that subspace.
- ShaPO-T modifies DPO-type token-likelihood losses; ShaPO-R modifies a preference-probability loss derived from negated beaver-7b-v1.0-cost. The update follows SAM, with a perturbed update every 5 steps in Appendix D.3.
- After training on PKU-SafeRLHF-30K, the average ASR across four out-of-distribution benchmarks for LLaMA-3-8B is 0.70% for ShaPO-R, 2.09% for Dr.DPO, and 22.85% for DPO (Table 2). On Qwen2.5-7B, ShaPO-T is 0.42% and ShaPO-R 0.55%.
- In-distribution, LLaMA-3-8B ShaPO-R WR is 87.45%, with MD/NV of 1.13%/0.13% (Table 1). On this backbone, Max HE goes from 25.2336 for Base to 6.2466 for ShaPO-T (Table 4). Pythia-2.8B out-of-distribution average ASR remains 6.91%–7.71% (Table 8).
- The authors state that optimization geometry is a complementary axis beyond data-side methods, with additional gains when stacked on data-side objectives. The conclusion also notes extra computational overhead and that critical-direction identification relies on approximate signals.