Introduction
Reinforcement Learning from Human Feedback (RLHF) is a central approach for aligning the output of modern large models with human preferences when an explicit reward function is difficult to specify ([20 , 101 , 59 , 7 , 15 ] ). In the offline RLHF setting, the learner trains on a pre-collected dataset of pairwise preference comparisons ([85 , 100 ] ), and Direct Preference Optimization (DPO) ([65 ] ) has become especially popular among these approaches. DPO avoids separate reward modeling and RL-based policy optimization, and directly optimizes a preference-based objective over the policy under the Bradley-Terry model ([14 ] ).
However, this dependence on preference pairs of RLHF and DPO also introduces a security risk: corrupted comparisons can systematically mislead the learned policy ([15 ] ). In particular, several recent papers ([83 , 68 , 9 , 61 , 58 , 62 ] (Fu et al. 2025; Wu et al. 2025)) have introduced adversarial preference attacks on offline RLHF. Unlike random preference noise caused by annotation errors and limited expert knowledge ([15 , 89 ] ), the targeted adversarial attacker can strategically flip preference labels or inject poisoned comparisons, to mislead the learner toward an attacker-chosen target output policy. The label flip attack is practically plausible because it does not require injecting a large number of new preference pairs ([58 ] ). Yang et al. [92 ] formalize this threat on DPO and develops efficient adversarial targeted attacks. The above security issue is serious since RLHF is widely used in real-world applications like Large Language Models (LLMs) [7 ] , and a misled output might be biased, toxic, or even harmful [15 , 68 , 62 ] .
To address this serious issue, in this paper, we design DPO algorithms robust to adversarial preference flip attacks. Unlike attacks on bandits or standard RL that manipulate numerical rewards, actions, contexts, or transition dynamics (Jun et al., 2018; Ma et al., 2018; Garcelon et al., 2020; Rakhsha et al., 2020; 2021; Liu & Lai, 2021b; Xu et al., 2022), preference corruption changes the preference order and then the optimized DPO policy. Existing robust RLHF/DPO studies mainly address random noise or distribution shift in preferences (Yan et al., 2024; Cheng et al., 2024; Mandal et al., 2024; Chowdhury et al., 2024; Wu et al., 2024b; Zhou et al., 2025; Kim et al., 2025; Xu et al., 2025). Our challenge is instead to analyze and mitigate strategically chosen label flips and their effect on the learned policy. To the best of our knowledge, this is the first work to design DPO algorithms robust against such adversaries.
Our analysis focuses on the log-linear DPO policy class, which enables us to analyze the problem in gradient space by a key observation Yang et al. [92 ] that, flipping one preference pair shifts its per-sample DPO gradient by a parameter-independent vector. This property makes attack-impact magnitudes pre-computable before training, without knowing the actual attack strategy. Based on this structure, we design robust DPO methods that reduce the influence of samples whose flips would have large impact in the gradient space.
We propose Trim-K K K Robust-DPO , which removes the K K K highest-impact preference pairs and optimizes DPO on the retained set, and Soft-Trim-$K Robust-DPO , which retains all pairs while smoothly downweighting the high-impact region. Both methods use interpretable pre-computed impact-based rules, and control potential flip-induced gradient effects without attempting to identify attacked samples. Soft-Trim-K K K provides a continuous family between standard DPO and Trim-K K K . For both methods, we establish gradient-bias bounds relative to full-data clean DPO uniformly over all fixed attack sets of at most K K K flips, explicitly separating the bias introduced by trimming or reweighting from surviving attack effects. Under the practical assumption that training stays in a bounded region around the reference parameter, these bounds yield time-uniform parameter and policy deviation guarantees for full-batch gradient descent. We also analyze quadratically regularized variants, quantifying the trade-off between increased curvature and additional bias relative to unregularized clean DPO.
We evaluate the methods on Stanford Human Preferences (SHP) [24 ] , HH-RLHF [7 , 28 ] , and UltraFeedback-Binarized [21 ] . The SHP experiments compare our methods and their regularized variants with standard and robust DPO baselines under different attacks (Appendices I and J). Further experiments examine datasets and budgets, matched regularization and score controls, budget misspecification (Appendices K–N), and small nonlinear policies (Appendix O). The results illustrate the trade-offs in our analysis: hard trimming is most helpful when flips concentrate on high-impact pairs, soft trimming offers a smoother robustness–retention trade-off, and regularization can limit attack-induced deviation while introducing bias relative to clean DPO.
Main contributions: (1) We propose Trim-K K K and Soft-Trim-K K K Robust-DPO without attempting to identify the attacked samples. (2) We establish deterministic gradient-bias bounds relative to full-data clean DPO, uniformly over all fixed attack sets of at most K K K flips. (3) Under the stated assumptions, we derive time-uniform parameter and policy deviation guarantees and quantify the curvature gain and bias introduced by quadratic regularization. (4) We evaluate the methods on three preference datasets, with matched controls, score-assignment ablations, and attack-budget and misspecification studies. We also conduct preliminary experiments with small nonlinear policies.
Additional related work: Appendix A summarizes prior works on adversarial attacks and robust learning in bandits, RL, and RLHF.
Problem Formulation
Offline RLHF and Log-linear DPO
Offline RLHF usually combines feedback collection, reward modeling, and policy optimization [20 , 59 , 7 ] . Given a prompt x x x , annotators compare two candidate responses y w y_w y w and y l y_l y l and return a preference y w ≻ y l ∣ x y_w \succ y_l \mid x y w ≻ y l ∣ x , where y w y_w y w is preferred to y l y_l y l . Under Bradley-Terry model [14 ] , the preference probability:
p ∗ ( y w ≻ y l ∣ x ) = exp ( r ∗ ( x , y w ) ) exp ( r ∗ ( x , y w ) ) + exp ( r ∗ ( x , y l ) ) p^*(y_w \succ y_l \mid x) = \frac{\exp(r^*(x,y_w))}{\exp(r^*(x,y_w)) + \exp(r^*(x,y_l))} p ∗ ( y w ≻ y l ∣ x ) = exp ( r ∗ ( x , y w )) + exp ( r ∗ ( x , y l )) exp ( r ∗ ( x , y w ))
where r ∗ ( x , y ) r^*(x,y) r ∗ ( x , y ) is an unknown latent reward. Standard RLHF first learns a reward model from such comparisons and then optimizes a policy against that reward, usually with a KL penalty relative to a reference policy [101 , 74 ] . DPO removes these two stages, and optimizes the policy directly from the same preference pairs [65 ] . Let π r e f \pi_{\mathrm{ref}} π ref be the reference policy and let β > 0 \beta> 0 β > 0 control the strength of KL regularization. For a dataset D = { ( x i , y w i , y l i ) } i = 1 N \mathcal{D} = \{(x^i,y_w^i,y_l^i)\}_{i=1}^N D = {( x i , y w i , y l i ) } i = 1 N , let σ ( z ) = 1 / ( 1 + e − z ) \sigma(z)=1/(1+e^{-z}) σ ( z ) = 1/ ( 1 + e − z ) , the DPO objective is
L D P O ( π θ , π r e f , D ) = − E ( x , y w , y l ) ∼ D [ log σ ( β log π θ ( y w ∣ x ) π r e f ( y w ∣ x ) − β log π θ ( y l ∣ x ) π r e f ( y l ∣ x ) ) ] . (1) \mathcal{L}_{\mathrm{DPO}}(\pi_\theta,\pi_{\mathrm{ref}},\mathcal{D})=-\mathbb{E}_{(x,y_w,y_l)\sim\mathcal{D}}\left[\log\sigma\left(\beta\log\frac{\pi_\theta(y_w\mid x)}{\pi_{\mathrm{ref}}(y_w\mid x)}-\beta\log\frac{\pi_\theta(y_l\mid x)}{\pi_{\mathrm{ref}}(y_l\mid x)}\right)\right]. \tag*{(1)} L DPO ( π θ , π ref , D ) = − E ( x , y w , y l ) ∼ D [ log σ ( β log π ref ( y w ∣ x ) π θ ( y w ∣ x ) − β log π ref ( y l ∣ x ) π θ ( y l ∣ x ) ) ] . (1)
DPO is efficient and stable in practice, and avoids the mismatch that can arise when the reward model is fit in a separate stage [65 ] .
In this paper, we mainly consider a log-linear policy class, following the theoretical setup in the literature [58 , 19 ] (Xu et al. 2025). In Appendix O, we discuss the potential to extend our methods and analysis beyond the log-linear setting, and the associated preliminary nonlinear experiments.
Assumption 2.1 (Log-linear Policy [58 ] ). Let ψ \psi ψ be a d d d -dimensional feature mapping ψ : X × Y → R d \psi:\mathcal{X}\times\mathcal{Y}\to\mathbb{R}^d ψ : X × Y → R d with max x , y ∥ ψ ( x , y ) ∥ 2 ≤ 1 \max_{x,y}\|\psi(x,y)\|_2\le1 max x , y ∥ ψ ( x , y ) ∥ 2 ≤ 1 . We consider the following class of log-linear policies parameterized by θ ∈ R d \theta\in\mathbb{R}^d θ ∈ R d for all ( x , y ) ∈ X × Y (x,y)\in\mathcal{X}\times\mathcal{Y} ( x , y ) ∈ X × Y :
Π log = { π θ : π θ ( y ∣ x ) = exp ( ψ ( x , y ) ⊤ θ ) ∑ y ′ exp ( ψ ( x , y ′ ) ⊤ θ ) } . \Pi^{\log}=\left\{\pi_\theta:\pi_\theta(y\mid x)=\frac{\exp\left(\psi(x,y)^\top\theta\right)}{\sum_{y'}\exp\left(\psi(x,y')^\top\theta\right)}\right\}. Π l o g = { π θ : π θ ( y ∣ x ) = ∑ y ′ exp ( ψ ( x , y ′ ) ⊤ θ ) exp ( ψ ( x , y ) ⊤ θ ) } .
For each preference pair ( x i , y w i , y l i ) (x^i,y_w^i,y_l^i) ( x i , y w i , y l i ) in D \mathcal{D} D , the per-sample DPO loss is
ℓ i ( θ ) : = ℓ D P O ( θ ; x i , y w i , y l i ) = − log σ ( β [ log π θ ( y w i ∣ x i ) π r e f ( y w i ∣ x i ) − log π θ ( y l i ∣ x i ) π r e f ( y l i ∣ x i ) ] ) . (2) \ell_i(\theta):=\ell_{\mathrm{DPO}}(\theta;x^i,y_w^i,y_l^i)=-\log\sigma\left(\beta\left[\log\frac{\pi_\theta(y_w^i\mid x^i)}{\pi_{\mathrm{ref}}(y_w^i\mid x^i)}-\log\frac{\pi_\theta(y_l^i\mid x^i)}{\pi_{\mathrm{ref}}(y_l^i\mid x^i)}\right]\right). \tag*{(2)} ℓ i ( θ ) := ℓ DPO ( θ ; x i , y w i , y l i ) = − log σ ( β [ log π ref ( y w i ∣ x i ) π θ ( y w i ∣ x i ) − log π ref ( y l i ∣ x i ) π θ ( y l i ∣ x i ) ] ) . (2)
Under Assumption 2.1, the normalization constants cancel: log π θ ( y w i ∣ x i ) − log π θ ( y l i ∣ x i ) = ⟨ θ , ψ ( x i , y w i ) − ψ ( x i , y l i ) ⟩ \log\pi_\theta(y_w^i\mid x^i)-\log\pi_\theta(y_l^i\mid x^i)=\langle\theta,\psi(x^i,y_w^i)-\psi(x^i,y_l^i)\rangle log π θ ( y w i ∣ x i ) − log π θ ( y l i ∣ x i ) = ⟨ θ , ψ ( x i , y w i ) − ψ ( x i , y l i )⟩ . Define the feature difference v i v_i v i and reference-policy offset b i b_i b i for each sample, then the DPO logit z i ( θ ) z_i(\theta) z i ( θ ) is affine in θ \theta θ , and ℓ i ( θ ) = − log σ ( z i ( θ ) ) \ell_i(\theta)=-\log\sigma(z_i(\theta)) ℓ i ( θ ) = − log σ ( z i ( θ )) :
v i : = ψ ( x i , y w i ) − ψ ( x i , y l i ) , b i : = log π r e f ( y w i ∣ x i ) π r e f ( y l i ∣ x i ) , z i ( θ ) : = β ( ⟨ θ , v i ⟩ − b i ) . (3) v_i:=\psi(x^i,y_w^i)-\psi(x^i,y_l^i),\qquad b_i:=\log\frac{\pi_{\mathrm{ref}}(y_w^i\mid x^i)}{\pi_{\mathrm{ref}}(y_l^i\mid x^i)},\qquad z_i(\theta):=\beta\left(\langle\theta,v_i\rangle-b_i\right). \tag*{(3)} v i := ψ ( x i , y w i ) − ψ ( x i , y l i ) , b i := log π ref ( y l i ∣ x i ) π ref ( y w i ∣ x i ) , z i ( θ ) := β ( ⟨ θ , v i ⟩ − b i ) . (3)
The corresponding per-sample gradient g i ( θ ) g_i(\theta) g i ( θ ) and its Hessian are
g i ( θ ) : = ∇ ℓ i ( θ ) = β ( σ ( z i ( θ ) ) − 1 ) v i , (4) g_i(\theta):=\nabla\ell_i(\theta)=\beta\left(\sigma(z_i(\theta))-1\right)v_i, \tag*{(4)} g i ( θ ) := ∇ ℓ i ( θ ) = β ( σ ( z i ( θ )) − 1 ) v i , (4)
∇ 2 ℓ i ( θ ) = β 2 σ ( z i ( θ ) ) ( 1 − σ ( z i ( θ ) ) ) v i v i ⊤ ⪰ 0. (5) \nabla^2\ell_i(\theta)=\beta^2\sigma(z_i(\theta))\left(1-\sigma(z_i(\theta))\right)v_iv_i^\top\succeq0. \tag*{(5)} ∇ 2 ℓ i ( θ ) = β 2 σ ( z i ( θ )) ( 1 − σ ( z i ( θ )) ) v i v i ⊤ ⪰ 0. (5)
The following identity comes from the gradient-space analysis of attacks on log-linear DPO in Yang et al. [92 ] . We restate it here as an immediate structural property of the log-linear policy class.
Lemma 2.2 (Constant gradient shift under label swap). Let g i ( θ ) g_i(\theta) g i ( θ ) be the clean per-sample gradient in (4) . Let g i f l i p ( θ ) g_i^{\mathrm{flip}}(\theta) g i flip ( θ ) denote the gradient after swapping ( y w i , y l i ) (y_w^i,y_l^i) ( y w i , y l i ) to ( y l i , y w i ) (y_l^i,y_w^i) ( y l i , y w i ) . Then for all θ ∈ R d \theta\in\mathbb{R}^d θ ∈ R d ,
g i f l i p ( θ ) − g i ( θ ) = β v i , g_i^{\mathrm{flip}}(\theta)-g_i(\theta)=\beta v_i, g i flip ( θ ) − g i ( θ ) = β v i , and hence the flip impact magnitude is ∥ g i f l i p ( θ ) − g i ( θ ) ∥ 2 = β ∥ v i ∥ 2 \|g_i^{\mathrm{flip}}(\theta)-g_i(\theta)\|_2=\beta\|v_i\|_2 ∥ g i flip ( θ ) − g i ( θ ) ∥ 2 = β ∥ v i ∥ 2 .
We assume training stays in a bounded region, motivated by initialization at the reference, finite training horizons, and norm control. Appendix B explains the resulting local curvature, its role in time-uniform stability, and its distinction from quadratic regularization [58 ] .
Assumption 2.3 (Bounded training region). There exists a radius R < ∞ R<\infty R < ∞ such that all clean and attacked gradient-descent iterates considered in our theory remain in B R ( θ r e f ) : = { θ : ∥ θ − θ r e f ∥ 2 ≤ R } B_R(\theta_{\mathrm{ref}}):=\{\theta:\|\theta-\theta_{\mathrm{ref}}\|_2\le R\} B R ( θ ref ) := { θ : ∥ θ − θ ref ∥ 2 ≤ R } , where θ r e f \theta_{\mathrm{ref}} θ ref is the parameter of log-linear reference policy π r e f \pi_{\mathrm{ref}} π ref . Moreover, the feature covariance of each trimmed or weighted objective is positive definite on a common subspace containing all update directions.
Budgeted Adversarial Preference Attack and Robust Defense
Given a clean preference dataset D = { ( x i , y w i , y l i ) } i = 1 N \mathcal{D}=\{(x^i,y_w^i,y_l^i)\}_{i=1}^N D = {( x i , y w i , y l i ) } i = 1 N , a label-flip attacker selects a set A ⊆ [ N ] A\subseteq[N] A ⊆ [ N ] with ∣ A ∣ ≤ K |A|\le K ∣ A ∣ ≤ K and forms the attacked dataset, denoted by D ~ \widetilde{\mathcal{D}} D :
D ~ ( A ) = { ( x i , y ~ w i , y ~ l i ) } i = 1 N , ( y ~ w i , y ~ l i ) = { ( y l i , y w i ) , i ∈ A , ( y w i , y l i ) , i ∉ A . \widetilde{\mathcal{D}}(A)=\{(x^i,\widetilde{y}_w^i,\widetilde{y}_l^i)\}_{i=1}^N,\qquad
(\widetilde{y}_w^i,\widetilde{y}_l^i)=
\begin{cases}
(y_l^i,y_w^i), & i\in A,\\
(y_w^i,y_l^i), & i\notin A.
\end{cases} D ( A ) = {( x i , y w i , y l i ) } i = 1 N , ( y w i , y l i ) = { ( y l i , y w i ) , ( y w i , y l i ) , i ∈ A , i ∈ / A .
A general budgeted label-flip attacker may choose any fixed support A A A . A targeted attacker is the special case that selects A A A to move training toward an attacker-chosen and potentially misaligned target policy π θ † \pi_{\theta^\dagger} π θ † . Our defense algorithms do not rely on the attack methods used by the attacker.
The robust defender observes only: (1) the possibly attacked dataset D ~ ( A ) \widetilde{D}(A) D ( A ) ; (2) an upper-bound K K K on the attack budget. It does not know the attacked index set A A A , has no clean preference orientations, and no clean validation data is assumed. The ground-truth comparison target is the standard DPO objective on the full clean dataset:
F ( θ ) ≡ F D P O ( θ ) : = 1 N ∑ i = 1 N ℓ i ( θ ) . (6) F(\theta) \equiv F_{\mathrm{DPO}}(\theta) := \frac{1}{N}\sum_{i=1}^{N}\ell_i(\theta). \tag*{(6)} F ( θ ) ≡ F DPO ( θ ) := N 1 i = 1 ∑ N ℓ i ( θ ) . (6)
Let R-DPO denote a robust DPO rule, and let F ~ R - D P O , A \widetilde{F}_{\mathrm{R\text{-}DPO},A} F R - DPO , A denote its differentiable training objective constructed from the observed dataset D ~ ( A ) \widetilde{D}(A) D ( A ) and budget upper bound K K K .
Our goal is to design R-DPO so that robust DPO on the attacked data remains close to clean DPO on the full clean data, uniformly over all admissible attack sets. More precisely, for the clean and attacked full-batch iterates
θ t + 1 c l n = θ t c l n − η ∇ F ( θ t c l n ) , θ t + 1 a t k = θ t a t k − η ∇ F ~ R - D P O , A ( θ t a t k ) , \theta^{\mathrm{cln}}_{t+1}=\theta^{\mathrm{cln}}_t-\eta\nabla F(\theta^{\mathrm{cln}}_t), \qquad\theta^{\mathrm{atk}}_{t+1}=\theta^{\mathrm{atk}}_t-\eta\nabla\widetilde{F}_{\mathrm{R\text{-}DPO},A}(\theta^{\mathrm{atk}}_t), θ t + 1 cln = θ t cln − η ∇ F ( θ t cln ) , θ t + 1 atk = θ t atk − η ∇ F R - DPO , A ( θ t atk ) ,
initialized from the same θ 0 \theta_0 θ 0 , we seek deterministic bounds of the form
sup A ⊆ [ N ] , ∣ A ∣ ≤ K sup θ ∈ B R ( θ r e f ) ∥ ∇ F ~ R - D P O , A ( θ ) − ∇ F ( θ ) ∥ 2 ≤ B g ( R - D P O , K ) , \sup_{\substack{A\subseteq[N],|A|\le K}}\ \sup_{\theta\in B_R(\theta_{\mathrm{ref}})}
\left\|\nabla\widetilde{F}_{\mathrm{R\text{-}DPO},A}(\theta)-\nabla F(\theta)\right\|_2
\le B_g(\mathrm{R\text{-}DPO},K), A ⊆ [ N ] , ∣ A ∣ ≤ K sup θ ∈ B R ( θ ref ) sup ∇ F R - DPO , A ( θ ) − ∇ F ( θ ) 2 ≤ B g ( R - DPO , K ) ,
sup A ⊆ [ N ] , ∣ A ∣ ≤ K sup T ≥ 1 ∥ θ T a t k − θ T c l n ∥ 2 ≤ B θ ( R - D P O , K ) , \sup_{\substack{A\subseteq[N],|A|\le K}}\ \sup_{T\ge1}
\left\|\theta_T^{\mathrm{atk}}-\theta_T^{\mathrm{cln}}\right\|_2
\le B_\theta(\mathrm{R\text{-}DPO},K), A ⊆ [ N ] , ∣ A ∣ ≤ K sup T ≥ 1 sup θ T atk − θ T cln 2 ≤ B θ ( R - DPO , K ) ,
sup A ⊆ [ N ] , ∣ A ∣ ≤ K sup T ≥ 1 E x [ D K L ( π θ T a t k ( ⋅ ∣ x ) ∥ π θ T c l n ( ⋅ ∣ x ) ) ] ≤ B π ( R - D P O , K ) . \sup_{\substack{A\subseteq[N],|A|\le K}}\ \sup_{T\ge1}
\mathbb{E}_x\left[D_{\mathrm{KL}}\left(\pi_{\theta_T^{\mathrm{atk}}}(\cdot\mid x)\mathrel{\|}\pi_{\theta_T^{\mathrm{cln}}}(\cdot\mid x)\right)\right]
\le B_\pi(\mathrm{R\text{-}DPO},K). A ⊆ [ N ] , ∣ A ∣ ≤ K sup T ≥ 1 sup E x [ D KL ( π θ T atk ( ⋅ ∣ x ) ∥ π θ T cln ( ⋅ ∣ x ) ) ] ≤ B π ( R - DPO , K ) .
The bounds should depend explicitly on the attack budget K K K , the feature geometry of the preference pairs, the clean bias introduced by the defense rule, and the local curvature of the optimized robust objective on B R ( θ r e f ) B_R(\theta_{\mathrm{ref}}) B R ( θ ref ) . When there is no attack (K = 0 K=0 K = 0 ), the R-DPO should reduce to standard DPO.
Methods
The identity in Lemma 2.2 makes the magnitude of each comparison’s potential label-flip effect pre-computable from the observed pair geometry. For each observed pair, define the flip-impact score
s i : = β ∥ ψ ( x i , y ~ w i ) − ψ ( x i , y ~ l i ) ∥ 2 = β ∥ v i ∥ 2 . (7) s_i:=\beta\left\|\psi(x^i,\widetilde{y}_w^i)-\psi(x^i,\widetilde{y}_l^i)\right\|_2=\beta\|v_i\|_2. \tag*{(7)} s i := β ψ ( x i , y w i ) − ψ ( x i , y l i ) 2 = β ∥ v i ∥ 2 . (7)
Because a label flip only changes the sign of the feature difference, s i s_i s i is invariant to the observed winner and loser. We first develop Trim-K K K Robust-DPO, which removes the K K K largest-score pairs, then introduce Soft-Trim-K K K Robust-DPO as a smooth extension to preserve more clean information. Both methods are static and require only D ~ ( A ) \widetilde{D}(A) D ( A ) and K K K . Yang et al. [92 ] uses the same identity and a known target θ † \theta^\dagger θ † to construct attackers. But we ask a different question: with limited knowledge of the attack, can a defense control the effect of the attack? The analysis below address this question.
Error Decomposition
We distinguish three objectives in the analysis. The comparison target F F F is the full-data clean DPO objective in (6) . For a given robust rule, F ~ R - D P O , A \widetilde{F}_{\mathrm{R\text{-}DPO},A} F R - DPO , A is the objective actually optimized on the attacked dataset, while F R - D P O F_{\mathrm{R\text{-}DPO}} F R - DPO is its auxiliary clean counterpart, obtained by using the clean preference labels while keeping the defense methods fixed. This auxiliary objective is used only for analysis:
∇ F ~ R - D P O , A ( θ ) − ∇ F ( θ ) = ( ∇ F R - D P O ( θ ) − ∇ F ( θ ) ) ⏟ clean defense bias + ( ∇ F ~ R - D P O , A ( θ ) − ∇ F R - D P O ( θ ) ) ⏟ surviving attack bias . (8) \nabla\widetilde{F}_{\mathrm{R\text{-}DPO},A}(\theta)-\nabla F(\theta)
=
\underbrace{\left(\nabla F_{\mathrm{R\text{-}DPO}}(\theta)-\nabla F(\theta)\right)}_{\text{clean defense bias}}
+
\underbrace{\left(\nabla\widetilde{F}_{\mathrm{R\text{-}DPO},A}(\theta)-\nabla F_{\mathrm{R\text{-}DPO}}(\theta)\right)}_{\text{surviving attack bias}}. \tag*{(8)} ∇ F R - DPO , A ( θ ) − ∇ F ( θ ) = clean defense bias ( ∇ F R - DPO ( θ ) − ∇ F ( θ ) ) + surviving attack bias ( ∇ F R - DPO , A ( θ ) − ∇ F R - DPO ( θ ) ) . (8)
The first term measures the error introduced by the defense even on clean labels, and the second measures the residual effect of the label flips under that same defense. The following subsections define these objectives for each robust DPO method and bound the two terms.
Trim-K K K Robust-DPO
Rank the samples by decreasing impact score, and let r ( i ) ∈ [ N ] r(i) \in[N] r ( i ) ∈ [ N ] be the resulting rank, with s ( j ) s_{(j)} s ( j ) denoting the score at rank j j j . For an upper bound K < N K < N K < N , define δ ( K ) : = s ( K + 1 ) \delta(K) := s_{(K+1)} δ ( K ) := s ( K + 1 ) . Trim-K K K Robust-DPO removes the indices with r ( i ) ≤ K r(i) \le K r ( i ) ≤ K and keeps G : = { i ∈ [ N ] : r ( i ) > K } G := \{i \in[N] : r(i) > K\} G := { i ∈ [ N ] : r ( i ) > K } . Thus ∣ G ∣ = N − K |G| = N - K ∣ G ∣ = N − K and max i ∈ G s i = δ ( K ) \max_{i\in G} s_i = \delta(K) max i ∈ G s i = δ ( K ) . The rule is a worst-case safeguard: it removes the pairs whose flips could have the largest attacked gradient effect, without trying to identify the attacked set exactly.
Write ℓ ~ i ( θ ) : = ℓ D P O ( θ ; x i , y ~ w , i , y ~ l , i ) \tilde{\ell}_i(\theta) := \ell_{\mathrm{DPO}}(\theta; x_i, \tilde{y}_{w,i}, \tilde{y}_{l,i}) ℓ ~ i ( θ ) := ℓ DPO ( θ ; x i , y ~ w , i , y ~ l , i ) for the per-sample loss on the observed pair produced by attack set A A A . For the kept set G G G , define the clean trimmed auxiliary objective and the attacked objective actually optimized by the defender:
F G ( θ ) : = 1 ∣ G ∣ ∑ i ∈ G ℓ i ( θ ) , F ~ G , A ( θ ) : = 1 ∣ G ∣ ∑ i ∈ G ℓ ~ i ( θ ) . F_G(\theta) := \frac{1}{|G|}\sum_{i\in G}\ell_i(\theta), \qquad\widetilde{F}_{G,A}(\theta) := \frac{1}{|G|}\sum_{i\in G}\tilde{\ell}_i(\theta). F G ( θ ) := ∣ G ∣ 1 i ∈ G ∑ ℓ i ( θ ) , F G , A ( θ ) := ∣ G ∣ 1 i ∈ G ∑ ℓ ~ i ( θ ) .
In the notation of § 3.1 , F R - D P O = F G F_{\mathrm{R\text{-}DPO}} = F_G F R - DPO = F G and F ~ R - D P O , A = F ~ G , A \widetilde{F}_{\mathrm{R\text{-}DPO},A} = \widetilde{F}_{G,A} F R - DPO , A = F G , A . Both objectives use the same kept set G G G , which is fixed during training and invariant to label flips. Without attack (K = 0 K = 0 K = 0 ), this objective reduces exactly to standard DPO on the full dataset. If A = ∅ A = \varnothing A = ∅ but the supplied upper bound is K > 0 K > 0 K > 0 , trimming can introduce clean-data bias. Algorithm 1 in Appendix § 10 gives the full implementation.
By Lemma 2.2 , only indices in A ∩ G A \cap G A ∩ G contribute a surviving gradient shift, so the gradient difference decomposes as
∇ F ~ G , A ( θ ) − ∇ F ( θ ) = ( ∇ F G ( θ ) − ∇ F ( θ ) ) + 1 ∣ G ∣ ∑ i ∈ A ∩ G β v i . \nabla\widetilde{F}_{G,A}(\theta) - \nabla F(\theta) = \left(\nabla F_G(\theta) - \nabla F(\theta)\right) + \frac{1}{|G|}\sum_{i\in A\cap G}\beta v_i. ∇ F G , A ( θ ) − ∇ F ( θ ) = ( ∇ F G ( θ ) − ∇ F ( θ ) ) + ∣ G ∣ 1 i ∈ A ∩ G ∑ β v i .
Define the clean trimming bias on the bounded training region by
B G c l n ( R ) : = sup θ ∈ B R ( θ r e f ) ∥ ∇ F G ( θ ) − ∇ F ( θ ) ∥ 2 . (9) B_G^{\mathrm{cln}}(R) := \sup_{\theta\in\mathbb{B}_R(\theta_{\mathrm{ref}})} \left\|\nabla F_G(\theta) - \nabla F(\theta)\right\|_2. \tag*{(9)} B G cln ( R ) := θ ∈ B R ( θ ref ) sup ∥ ∇ F G ( θ ) − ∇ F ( θ ) ∥ 2 . (9)
This term is zero only when the trimmed subset has the same average clean gradient as the full dataset, and in particular it is zero in the no-attack control K = 0 K = 0 K = 0 , where G = [ N ] G = [N] G = [ N ] . A closed-form upper bound on B G c l n ( R ) B_G^{\mathrm{cln}}(R) B G cln ( R ) that depends only on the score statistics is proved as Lemma E.3 in Appendix § 12 :
B G c l n ( R ) ≤ K δ ( K ) + ∑ j = 1 K s ( j ) N ≤ 4 β K N . B_G^{\mathrm{cln}}(R) \le\frac{K\delta(K) + \sum_{j=1}^{K}s_{(j)}}{N} \le\frac{4\beta K}{N}. B G cln ( R ) ≤ N K δ ( K ) + ∑ j = 1 K s ( j ) ≤ N 4 β K .
For compact notation, define
Δ G : = B G c l n ( R ) + K δ ( K ) N − K , Δ ‾ G : = K δ ( K ) + ∑ j = 1 K s ( j ) N − K + K δ ( K ) N − K . (10) \Delta_G := B_G^{\mathrm{cln}}(R) + \frac{K\delta(K)}{N-K}, \qquad\overline{\Delta}_G := \frac{K\delta(K) + \sum_{j=1}^{K}s_{(j)}}{N-K} + \frac{K\delta(K)}{N-K}. \tag*{(10)} Δ G := B G cln ( R ) + N − K K δ ( K ) , Δ G := N − K K δ ( K ) + ∑ j = 1 K s ( j ) + N − K K δ ( K ) . (10)
Theorem 3.1 (Worst-case gradient robustness of Trim-K K K Robust-DPO). Let G G G be the kept set after removing the top-K K K largest impact scores, so that ∣ G ∣ = N − K |G| = N - K ∣ G ∣ = N − K and max i ∈ G s i ≤ δ ( K ) \max_{i\in G}s_i \le\delta(K) max i ∈ G s i ≤ δ ( K ) . Then for every attack set A ⊆ [ N ] A \subseteq[N] A ⊆ [ N ] with ∣ A ∣ ≤ K |A| \le K ∣ A ∣ ≤ K and every θ ∈ B R ( θ r e f ) \theta\in\mathbb{B}_R(\theta_{\mathrm{ref}}) θ ∈ B R ( θ ref ) ,
∥ ∇ F ~ G , A ( θ ) − ∇ F ( θ ) ∥ 2 ≤ Δ G ≤ Δ ‾ G . \left\|\nabla\widetilde{F}_{G,A}(\theta) - \nabla F(\theta)\right\|_2 \le\Delta_G \le\overline{\Delta}_G. ∇ F G , A ( θ ) − ∇ F ( θ ) 2 ≤ Δ G ≤ Δ G .
This theorem separates the two effects that determine distance to clean DPO: the deterministic clean trimming bias and the surviving attack bias. The clean-trimming term scales as K / N K/N K / N and is governed by the top-K K K score sum together with the cutoff δ ( K ) \delta(K) δ ( K ) , while the attack-dependent term is controlled by the ( K + 1 ) (K + 1) ( K + 1 ) -st largest score rather than the largest score in the full dataset.
To propagate this gradient-bias bound through training, define the empirical feature covariance and the bounded-region logistic curvature constant
Σ G : = 1 ∣ G ∣ ∑ i ∈ G v i v i T , c G ( R ) : = min θ ∈ B R ( θ r e f ) min i ∈ G σ ( z i ( θ ) ) ( 1 − σ ( z i ( θ ) ) ) . (11) \Sigma_G := \frac{1}{|G|}\sum_{i\in G}v_i v_i^{\mathsf{T}}, \qquad c_G(R) := \min_{\theta\in\mathbb{B}_R(\theta_{\mathrm{ref}})}\min_{i\in G}\sigma(z_i(\theta))\left(1-\sigma(z_i(\theta))\right). \tag*{(11)} Σ G := ∣ G ∣ 1 i ∈ G ∑ v i v i T , c G ( R ) := θ ∈ B R ( θ ref ) min i ∈ G min σ ( z i ( θ )) ( 1 − σ ( z i ( θ )) ) . (11)
Because G G G is finite and B R ( θ r e f ) \mathbb{B}_R(\theta_{\mathrm{ref}}) B R ( θ ref ) is compact, Assumption 2.3 implies c G ( R ) > 0 c_G(R) > 0 c G ( R ) > 0 . Let
μ G : = β 2 c G ( R ) λ min ( Σ G ) > 0. (12) \mu_G := \beta^2 c_G(R)\lambda_{\min}(\Sigma_G) > 0. \tag*{(12)} μ G := β 2 c G ( R ) λ m i n ( Σ G ) > 0. (12)
Here and below, λ min \lambda_{\min} λ m i n denotes the smallest eigenvalue on the common trained subspace of Assumption 2.3 . The supporting smoothness, restricted strong-convexity, and gradient-descent stability lemmas are stated in Appendix § 12 . Proofs of the theoretical results are in Appendix § 13 .
Theorem 3.2 (Time-uniform stability for Trim-K K K Robust-DPO). Under Assumptions 2.1 and 2.3 , suppose the clean DPO iterates and the attacked Trim-K K K iterates remain in B R ( θ r e f ) \mathbb{B}_{R}(\theta_{\mathrm{ref}}) B R ( θ ref ) . Run full-batch gradient descent from the same initialization with step size η ≤ 1 / β 2 \eta\le1/\beta^{2} η ≤ 1/ β 2 : θ t + 1 c l n = θ t c l n − η ∇ F ( θ t c l n ) \theta^{\mathrm{cln}}_{t+1}=\theta^{\mathrm{cln}}_{t}-\eta\nabla F(\theta^{\mathrm{cln}}_{t}) θ t + 1 cln = θ t cln − η ∇ F ( θ t cln ) , θ t + 1 a t k = θ t a t k − η ∇ F ~ G , A ( θ t a t k ) \theta^{\mathrm{atk}}_{t+1}=\theta^{\mathrm{atk}}_{t}-\eta\nabla\widetilde{F}_{G,A}(\theta^{\mathrm{atk}}_{t}) θ t + 1 atk = θ t atk − η ∇ F G , A ( θ t atk ) . Then for every T ≥ 1 T\ge1 T ≥ 1 ,
∥ θ T a t k − θ T c l n ∥ 2 ≤ Δ G ( 1 − ( 1 − η μ G ) T ) μ G ≤ Δ G μ G . \left\|\theta^{\mathrm{atk}}_{T}-\theta^{\mathrm{cln}}_{T}\right\|_{2}
\le\frac{\Delta_{G}\left(1-\left(1-\eta\mu_{G}\right)^{T}\right)}{\mu_{G}}
\le\frac{\Delta_{G}}{\mu_{G}}. θ T atk − θ T cln 2 ≤ μ G Δ G ( 1 − ( 1 − η μ G ) T ) ≤ μ G Δ G . In particular, Lemma E.3 gives ∥ θ T a t k − θ T c l n ∥ 2 ≤ Δ ‾ G / μ G \left\|\theta^{\mathrm{atk}}_{T}-\theta^{\mathrm{cln}}_{T}\right\|_{2}\le\overline{\Delta}_{G}/\mu_{G} θ T atk − θ T cln 2 ≤ Δ G / μ G .
Theorem 3.2 shows that the Trim-K K K objective has a time-uniform robustness guarantee once we restrict attention to the practical training region. This is a deterministic deviation bound for every fixed admissible attack set and every training horizon under the stated assumptions. It does not rank robust DPO methods, or predict their empirical dominance for a particular attack. We note that the constant μ G \mu_{G} μ G can still be small. In § 3.4 , we address this issue and propose regularized variants that can produce tighter behavior.
Corollary 3.3 converts the parameter deviation into policy deviation.
Corollary 3.3 (Trim-K K K policy deviation bound). Under the conditions of Theorem 3.2 , for any fixed context x x x , D K L ( π θ T a t k ( ⋅ ∣ x ) ∥ π θ T c l n ( ⋅ ∣ x ) ) ≤ 1 2 ∥ θ T a t k − θ T c l n ∥ 2 2 D_{\mathrm{KL}}(\pi_{\theta^{\mathrm{atk}}_{T}}(\cdot|x)\mathbin\Vert\pi_{\theta^{\mathrm{cln}}_{T}}(\cdot|x))\le\frac{1}{2}\left\|\theta^{\mathrm{atk}}_{T}-\theta^{\mathrm{cln}}_{T}\right\|_{2}^{2} D KL ( π θ T atk ( ⋅ ∣ x ) ∥ π θ T cln ( ⋅ ∣ x )) ≤ 2 1 θ T atk − θ T cln 2 2 . Consequently,
E x [ D K L ( π θ T a t k ( ⋅ ∣ x ) ∥ π θ T c l n ( ⋅ ∣ x ) ) ] ≤ 1 2 ( Δ ‾ G μ G ) 2 , \mathbb{E}_{x}\left[D_{\mathrm{KL}}\left(\pi_{\theta^{\mathrm{atk}}_{T}}(\cdot|x)\mathbin\Vert\pi_{\theta^{\mathrm{cln}}_{T}}(\cdot|x)\right)\right]\le\frac{1}{2}\left(\frac{\overline{\Delta}_{G}}{\mu_{G}}\right)^{2}, E x [ D KL ( π θ T atk ( ⋅ ∣ x ) ∥ π θ T cln ( ⋅ ∣ x ) ) ] ≤ 2 1 ( μ G Δ G ) 2 , where the final bound follows from Theorem 3.2 and Lemma E.3 .
Soft-Trim-K Robust-DPO
The hard trimming rule of § 3.2 gives the clearest worst-case guarantee, but it can also remove clean high-impact samples. This is desirable when the attacker is concentrated on those samples, but it may discard too much useful information when the true attack pattern is widespread or when the budget upper bound K K K is conservative. To handle this trade-off, we introduce a soft version that downweights the top-impact samples instead of deleting them.
Using the deterministic ranking r ( i ) r(i) r ( i ) introduced in § 3.2 , fix a temperature parameter τ > 0 \tau>0 τ > 0 and assign the exponential weights
w i ( τ ) = { exp ( − ( K + 1 − r ( i ) ) / τ ) , r ( i ) ≤ K , 1 , r ( i ) ≥ K + 1. (13) w_{i}^{(\tau)}=
\begin{cases}
\exp\left(-(K+1-r(i))/\tau\right), & r(i)\le K,\\
1, & r(i)\ge K+1.
\end{cases} \tag*{(13)} w i ( τ ) = { exp ( − ( K + 1 − r ( i )) / τ ) , 1 , r ( i ) ≤ K , r ( i ) ≥ K + 1. (13)
The highest-impact samples receive small positive weights, while samples after the trimming cutoff keep weight one. When K = 0 K=0 K = 0 , Soft-Trim is standard DPO. When K > 0 K>0 K > 0 , τ ↓ 0 \tau\downarrow0 τ ↓ 0 approaches hard trimming and τ → ∞ \tau\to\infty τ → ∞ approaches DPO. The weighting rule is illustrated in Appendix § 11 , Figure 2 .
Figure 2. Left vertical axis: Soft-Trim-K K K weights w i ( τ ) w_i^{(\tau)} w i ( τ ) as a function of the rank r ( i ) r(i) r ( i ) , for different temperatures τ \tau τ . Right vertical axis: the impact scores s i = β ∥ v i ∥ 2 s_i = \beta\lVert v_i\rVert_2 s i = β ∥ v i ∥ 2 as a function of rank, with β = 1 \beta= 1 β = 1 . The trimming cutoff at K = 48,000 K = 48{,}000 K = 48 , 000 is indicated by the vertical dashed line.
Let W τ : = ∑ i = 1 N w i ( τ ) W_{\tau}:=\sum_{i=1}^{N}w_{i}^{(\tau)} W τ := ∑ i = 1 N w i ( τ ) and ϵ τ : = e − 1 / τ \epsilon_{\tau}:=e^{-1/\tau} ϵ τ := e − 1/ τ . Define the clean weighted auxiliary objective and the attacked objective actually optimized by the defender:
F τ ( θ ) : = 1 W τ ∑ i = 1 N w i ( τ ) ℓ i ( θ ) , F ~ τ , A ( θ ) : = 1 W τ ∑ i = 1 N w i ( τ ) ℓ ~ i ( θ ) . F_{\tau}(\theta):=\frac{1}{W_{\tau}}\sum_{i=1}^{N}w_{i}^{(\tau)}\ell_{i}(\theta),\qquad
\widetilde{F}_{\tau,A}(\theta):=\frac{1}{W_{\tau}}\sum_{i=1}^{N}w_{i}^{(\tau)}\widetilde{\ell}_{i}(\theta). F τ ( θ ) := W τ 1 i = 1 ∑ N w i ( τ ) ℓ i ( θ ) , F τ , A ( θ ) := W τ 1 i = 1 ∑ N w i ( τ ) ℓ i ( θ ) .
In the notation of § 3.1 , F R - D P O = F τ F_{\mathrm{R\text{-}DPO}}=F_{\tau} F R - DPO = F τ and F ~ R - D P O , A = F ~ τ , A \widetilde{F}_{\mathrm{R\text{-}DPO},A}=\widetilde{F}_{\tau,A} F R - DPO , A = F τ , A . Both objectives use the same weights w i ( τ ) w_{i}^{(\tau)} w i ( τ ) , which are fixed during training and invariant to label flips. Algorithm 2 in Appendix § 10 gives the implementation.
For each sample, define the weighted impact ρ i ( τ ) : = w i ( τ ) s i \rho_{i}^{(\tau)}:=w_{i}^{(\tau)}s_{i} ρ i ( τ ) := w i ( τ ) s i . Let ρ [ 1 ] ( τ ) ≥ ρ [ 2 ] ( τ ) ≥ ⋯ ≥ ρ [ N ] ( τ ) \rho_{[1]}^{(\tau)}\ge\rho_{[2]}^{(\tau)}\ge\cdots\ge\rho_{[N]}^{(\tau)} ρ [ 1 ] ( τ ) ≥ ρ [ 2 ] ( τ ) ≥ ⋯ ≥ ρ [ N ] ( τ ) be these weighted impacts sorted in descending order, and define
Γ τ ( K ) : = max A ⊆ [ N ] , ∣ A ∣ ≤ K ∑ i ∈ A ρ i ( τ ) = ∑ j = 1 K ρ [ j ] ( τ ) . \Gamma_{\tau}(K):=\max_{A\subseteq[N],\,|A|\le K}\sum_{i\in A}\rho_{i}^{(\tau)}=\sum_{j=1}^{K}\rho_{[j]}^{(\tau)}. Γ τ ( K ) := A ⊆ [ N ] , ∣ A ∣ ≤ K max i ∈ A ∑ ρ i ( τ ) = j = 1 ∑ K ρ [ j ] ( τ ) .
Thus Γ τ ( K ) / W τ \Gamma_{\tau}(K)/W_{\tau} Γ τ ( K ) / W τ is the largest normalized weighted flip-impact mass that any attack set of at most K K K samples can have. Define the clean weighting bias on the bounded training region by
B τ c l n ( R ) : = sup θ ∈ B R ( θ r e f ) ∥ ∇ F τ ( θ ) − ∇ F ( θ ) ∥ 2 . B_{\tau}^{\mathrm{cln}}(R):=\sup_{\theta\in\mathbb{B}_{R}(\theta_{\mathrm{ref}})}\left\|\nabla F_{\tau}(\theta)-\nabla F(\theta)\right\|_{2}. B τ cln ( R ) := θ ∈ B R ( θ ref ) sup ∥ ∇ F τ ( θ ) − ∇ F ( θ ) ∥ 2 .
Let a j ( τ ) : = exp ( − ( K + 1 − j ) / τ ) a_j^{(\tau)} := \exp(-(K+1-j)/\tau) a j ( τ ) := exp ( − ( K + 1 − j ) / τ ) , D τ : = K − ∑ j = 1 K a j ( τ ) D_\tau:= K-\sum_{j=1}^{K}a_j^{(\tau)} D τ := K − ∑ j = 1 K a j ( τ ) , s ˉ : = 1 N ∑ i s i \bar{s} := \frac{1}{N}\sum_{i}s_i s ˉ := N 1 ∑ i s i . A closed-form score-only upper bound is proved as Lemma E.4 in Appendix § 12 :
B τ c l n ( R ) ≤ D τ s ˉ + ∑ j = 1 K ( 1 − a j ( τ ) ) s ( j ) W τ . B_\tau^{\mathrm{cln}}(R) \le\frac{D_\tau\bar{s}+\sum_{j=1}^{K}(1-a_j^{(\tau)})s_{(j)}}{W_\tau}. B τ cln ( R ) ≤ W τ D τ s ˉ + ∑ j = 1 K ( 1 − a j ( τ ) ) s ( j ) .
For compact notation, define
Δ τ : = B τ c l n ( R ) + Γ τ ( K ) W τ , Δ ˉ τ : = D τ s ˉ + ∑ j = 1 K ( 1 − a j ( τ ) ) s ( j ) W τ + ε τ ∑ j = 1 K s ( j ) + K δ ( K ) W τ . \Delta_\tau:= B_\tau^{\mathrm{cln}}(R)+\frac{\Gamma_\tau(K)}{W_\tau}, \qquad\bar{\Delta}_\tau:= \frac{D_\tau\bar{s}+\sum_{j=1}^{K}(1-a_j^{(\tau)})s_{(j)}}{W_\tau}+\frac{\varepsilon_\tau\sum_{j=1}^{K}s_{(j)}+K\delta(K)}{W_\tau}. Δ τ := B τ cln ( R ) + W τ Γ τ ( K ) , Δ ˉ τ := W τ D τ s ˉ + ∑ j = 1 K ( 1 − a j ( τ ) ) s ( j ) + W τ ε τ ∑ j = 1 K s ( j ) + K δ ( K ) .
For K = 0 K=0 K = 0 , all sums above are empty, D τ = Γ τ ( 0 ) = 0 D_\tau=\Gamma_\tau(0)=0 D τ = Γ τ ( 0 ) = 0 , and Δ τ = Δ ˉ τ = 0 \Delta_\tau=\bar{\Delta}_\tau=0 Δ τ = Δ ˉ τ = 0 .
Theorem 3.4 (Worst-case gradient robustness of Soft-Trim-K K K Robust-DPO). For any attack set A ⊆ [ N ] A\subseteq[N] A ⊆ [ N ] with ∣ A ∣ ≤ K |A|\le K ∣ A ∣ ≤ K and every θ ∈ B R ( θ r e f ) \theta\in\mathbb{B}_R(\theta_{\mathrm{ref}}) θ ∈ B R ( θ ref ) ,
∥ ∇ F ~ τ , A ( θ ) − ∇ F ( θ ) ∥ 2 ≤ Δ τ . (14) \left\|\nabla\widetilde{F}_{\tau,A}(\theta)-\nabla F(\theta)\right\|_2\le\Delta_\tau. \tag*{(14)} ∇ F τ , A ( θ ) − ∇ F ( θ ) 2 ≤ Δ τ . (14) Moreover, for the exponential weights in (13) , Γ τ ( K ) ≤ ε τ ∑ j = 1 K s ( j ) + K δ ( K ) \Gamma_\tau(K)\le\varepsilon_\tau\sum_{j=1}^{K}s_{(j)}+K\delta(K) Γ τ ( K ) ≤ ε τ ∑ j = 1 K s ( j ) + K δ ( K ) . Combining with Lemma E.4 ,
∥ ∇ F ~ τ , A ( θ ) − ∇ F ( θ ) ∥ 2 ≤ Δ ˉ τ . (15) \left\|\nabla\widetilde{F}_{\tau,A}(\theta)-\nabla F(\theta)\right\|_2\le\bar{\Delta}_\tau. \tag*{(15)} ∇ F τ , A ( θ ) − ∇ F ( θ ) 2 ≤ Δ ˉ τ . (15)
As τ ↓ 0 \tau\downarrow0 τ ↓ 0 , we have W τ → N − K W_\tau\to N-K W τ → N − K and the exact attack term converges to the largest total score among at most K K K samples that survive hard Trim-K K K :
Γ τ ( K ) W τ ⟶ 1 N − K max A ⊆ G , ∣ A ∣ ≤ K ∑ i ∈ A s i ≤ K N − K δ ( K ) . \frac{\Gamma_\tau(K)}{W_\tau}\longrightarrow\frac{1}{N-K}\max_{\substack{A\subseteq G,\,|A|\le K}}\sum_{i\in A}s_i\le\frac{K}{N-K}\delta(K). W τ Γ τ ( K ) ⟶ N − K 1 A ⊆ G , ∣ A ∣ ≤ K max i ∈ A ∑ s i ≤ N − K K δ ( K ) .
Thus the Soft-Trim objective approaches hard Trim-K K K , and its exact surviving-attack bound approaches a quantity no larger than the hard-trim term K δ ( K ) / ( N − K ) K\delta(K)/(N-K) K δ ( K ) / ( N − K ) , while B τ c l n ( R ) B_\tau^{\mathrm{cln}}(R) B τ cln ( R ) approaches B G c l n ( R ) B_G^{\mathrm{cln}}(R) B G cln ( R ) .
Define the weighted feature covariance and bounded-region curvature constant
Σ τ : = 1 W τ ∑ i = 1 N w i ( τ ) v i v i T , c τ ( R ) : = min θ ∈ B R ( θ r e f ) min i : w i ( τ ) > 0 σ ( z i ( θ ) ) ( 1 − σ ( z i ( θ ) ) ) , (16) \Sigma_\tau:=\frac{1}{W_\tau}\sum_{i=1}^{N}w_i^{(\tau)}v_i v_i^{\mathsf{T}},\qquad c_\tau(R):=\min_{\theta\in\mathbb{B}_R(\theta_{\mathrm{ref}})}\min_{i:w_i^{(\tau)}>0}\sigma(z_i(\theta))(1-\sigma(z_i(\theta))), \tag*{(16)} Σ τ := W τ 1 i = 1 ∑ N w i ( τ ) v i v i T , c τ ( R ) := θ ∈ B R ( θ ref ) min i : w i ( τ ) > 0 min σ ( z i ( θ )) ( 1 − σ ( z i ( θ ))) , (16)
and let μ τ : = β 2 c τ ( R ) λ min ( Σ τ ) > 0 \mu_\tau:=\beta^2c_\tau(R)\lambda_{\min}(\Sigma_\tau)>0 μ τ := β 2 c τ ( R ) λ m i n ( Σ τ ) > 0 . By the same argument as Lemma E.2 , the clean weighted objective F τ F_\tau F τ is μ τ \mu_\tau μ τ -strongly convex on B R ( θ r e f ) \mathbb{B}_R(\theta_{\mathrm{ref}}) B R ( θ ref ) and β 2 \beta^2 β 2 -smooth.
Then we can propagate the gradient-bias bound to time-uniform parameter and policy deviation bounds in Theorem 3.5 and Corollary 3.6.
Theorem 3.5 (Time-uniform stability for Soft-Trim-K K K Robust-DPO). Under Assumptions 2.1 and 2.3, suppose the clean DPO iterates and the attacked Soft-Trim-K K K iterates remain in B R ( θ r e f ) \mathbb{B}_R(\theta_{\mathrm{ref}}) B R ( θ ref ) and gradient descent is run with step size η ≤ 1 / β 2 \eta\le1/\beta^2 η ≤ 1/ β 2 from the same initialization: θ t + 1 c l n = θ t c l n − η ∇ F ( θ t c l n ) \theta_{t+1}^{\mathrm{cln}}=\theta_t^{\mathrm{cln}}-\eta\nabla F(\theta_t^{\mathrm{cln}}) θ t + 1 cln = θ t cln − η ∇ F ( θ t cln ) , θ t + 1 a t k = θ t a t k − η ∇ F ~ τ , A ( θ t a t k ) \theta_{t+1}^{\mathrm{atk}}=\theta_t^{\mathrm{atk}}-\eta\nabla\widetilde{F}_{\tau,A}(\theta_t^{\mathrm{atk}}) θ t + 1 atk = θ t atk − η ∇ F τ , A ( θ t atk ) . Then for every T ≥ 1 T\ge1 T ≥ 1 ,
∥ θ T a t k − θ T c l n ∥ 2 ≤ Δ τ ( 1 − ( 1 − η μ τ ) T ) μ τ ≤ Δ τ μ τ . \left\|\theta_T^{\mathrm{atk}}-\theta_T^{\mathrm{cln}}\right\|_2\le\frac{\Delta_\tau(1-(1-\eta\mu_\tau)^T)}{\mu_\tau}\le\frac{\Delta_\tau}{\mu_\tau}. θ T atk − θ T cln 2 ≤ μ τ Δ τ ( 1 − ( 1 − η μ τ ) T ) ≤ μ τ Δ τ . In particular, Theorem 3.4 and Lemma E.4 give ∥ θ T a t k − θ T c l n ∥ 2 ≤ Δ ˉ τ / μ τ \left\|\theta_T^{\mathrm{atk}}-\theta_T^{\mathrm{cln}}\right\|_2\le\bar{\Delta}_\tau/\mu_\tau θ T atk − θ T cln 2 ≤ Δ ˉ τ / μ τ .
Corollary 3.6 (Soft-Trim-K K K policy deviation bound). Under the conditions of Theorem 3.5,
E x [ D K L ( π θ T a t k ( ⋅ ∣ x ) ∥ π θ T c l n ( ⋅ ∣ x ) ) ] ≤ 1 2 ( Δ ˉ τ μ τ ) 2 . \mathbb{E}_x\left[D_{\mathrm{KL}}\left(\pi_{\theta_T^{\mathrm{atk}}}(\cdot|x)\,\|\,\pi_{\theta_T^{\mathrm{cln}}}(\cdot|x)\right)\right]\le\frac{1}{2}\left(\frac{\bar{\Delta}_\tau}{\mu_\tau}\right)^2. E x [ D KL ( π θ T atk ( ⋅ ∣ x ) ∥ π θ T cln ( ⋅ ∣ x ) ) ] ≤ 2 1 ( μ τ Δ ˉ τ ) 2 .
Soft-Trim preserves more clean information than hard trimming, offering a smoother robustness–retention trade-off without uniformly improving its worst-case bias.
The guarantee requires the defender’s K K K to upper-bound the true number of flips. Underestimating K K K invalidates the guarantee, while overestimating it removes or downweights more clean data. Appendix § 21 studies budget selection and misspecified K K K .
Regularized Trim-K K K and Soft-Trim-K K K Robust-DPO
Write R ∈ { G , τ } \mathfrak{R} \in\{G,\tau\} R ∈ { G , τ } for the above two instances of the generic R-DPO: G G G for Trim-K K K and τ \tau τ for Soft-Trim-K K K . We use the same convention for F R F_{\mathfrak{R}} F R , F ~ R , A \widetilde{F}_{\mathfrak{R},A} F R , A , B R c l ( R ) B^{\mathrm{cl}}_{\mathfrak{R}}(R) B R cl ( R ) , μ R \mu_{\mathfrak{R}} μ R , Δ R \Delta_{\mathfrak{R}} Δ R , and Δ ‾ R \overline{\Delta}_{\mathfrak{R}} Δ R . The bounded-region curvature constants μ G \mu_G μ G and μ τ \mu_\tau μ τ are positive, but they can be small. A simple way to increase the curvature of the optimized robust objective F ~ R , A \widetilde{F}_{\mathfrak{R},A} F R , A is to keep the same trimming or soft-weighting rule and add a quadratic regularization λ \lambda λ around the reference parameter:
F R , λ ( θ ) : = F R ( θ ) + λ 2 ∥ θ − θ r e f ∥ 2 2 , F ~ R , λ , A ( θ ) : = F ~ R , A ( θ ) + λ 2 ∥ θ − θ r e f ∥ 2 2 . F_{\mathfrak{R},\lambda}(\theta) := F_{\mathfrak{R}}(\theta) + \frac{\lambda}{2}\lVert\theta-\theta_{\mathrm{ref}}\rVert_2^2,\qquad\widetilde{F}_{\mathfrak{R},\lambda,A}(\theta) := \widetilde{F}_{\mathfrak{R},A}(\theta) + \frac{\lambda}{2}\lVert\theta-\theta_{\mathrm{ref}}\rVert_2^2. F R , λ ( θ ) := F R ( θ ) + 2 λ ∥ θ − θ ref ∥ 2 2 , F R , λ , A ( θ ) := F R , A ( θ ) + 2 λ ∥ θ − θ ref ∥ 2 2 .
Since the reference objective remains the unregularized clean DPO objective F F F , regularization also creates a deterministic bias. Let
B R , λ c l ( R ) : = sup θ ∈ B R ( θ r e f ) ∥ ∇ F R ( θ ) + λ ( θ − θ r e f ) − ∇ F ( θ ) ∥ 2 ≤ B R c l ( R ) + λ R . B^{\mathrm{cl}}_{\mathfrak{R},\lambda}(R) := \sup_{\theta\in B_{\mathfrak{R}}(\theta_{\mathrm{ref}})} \lVert\nabla F_{\mathfrak{R}}(\theta)+\lambda(\theta-\theta_{\mathrm{ref}})-\nabla F(\theta)\rVert_2 \le B^{\mathrm{cl}}_{\mathfrak{R}}(R)+\lambda R. B R , λ cl ( R ) := θ ∈ B R ( θ ref ) sup ∥ ∇ F R ( θ ) + λ ( θ − θ ref ) − ∇ F ( θ ) ∥ 2 ≤ B R cl ( R ) + λ R .
Thus the surviving-attack term is unchanged, the clean-bias term gains at most λ R \lambda R λ R , and the curvature denominator becomes μ R + λ \mu_{\mathfrak{R}}+\lambda μ R + λ .
Proposition 3.7 (Quadratic regularization improves curvature). For R ∈ { G , τ } \mathfrak{R}\in\{G,\tau\} R ∈ { G , τ } , suppose F R F_{\mathfrak{R}} F R is μ R \mu_{\mathfrak{R}} μ R -strongly convex on B R ( θ r e f ) B_{\mathfrak{R}}(\theta_{\mathrm{ref}}) B R ( θ ref ) and β 2 \beta^2 β 2 -smooth . Then F R , λ F_{\mathfrak{R},\lambda} F R , λ is ( μ R + λ ) (\mu_{\mathfrak{R}}+\lambda) ( μ R + λ ) -strongly convex on B R ( θ r e f ) B_{\mathfrak{R}}(\theta_{\mathrm{ref}}) B R ( θ ref ) and ( β 2 + λ ) (\beta^2+\lambda) ( β 2 + λ ) -smooth .
Thus K K K controls trimming/downweighting and λ \lambda λ controls explicit curvature; at K = 0 K=0 K = 0 , the regularized variants reduce to regularized DPO and retain only the regularization bias relative to clean DPO.
Corollary 3.8 (Time-uniform stability for regularized Robust-DPO). Under Assumptions 2.1 and 2.3, fix R ∈ { G , τ } \mathfrak{R}\in\{G,\tau\} R ∈ { G , τ } , λ > 0 \lambda>0 λ > 0 , and an attack set A ⊆ [ N ] A\subseteq[N] A ⊆ [ N ] with ∣ A ∣ ≤ K |A|\le K ∣ A ∣ ≤ K . Run full-batch gradient descent on F ~ R , λ , A \widetilde{F}_{\mathfrak{R},\lambda,A} F R , λ , A and clean DPO on F F F with the same step size 0 < η ≤ 1 / ( β 2 + λ ) 0<\eta\le1/(\beta^2+\lambda) 0 < η ≤ 1/ ( β 2 + λ ) and initialization θ 0 \theta_0 θ 0 . Then for every T ≥ 1 T\ge1 T ≥ 1 ,
∥ θ T a t k − θ T c l ∥ 2 ≤ B R , λ c l ( R ) + Δ R − B R c l ( R ) μ R + λ ≤ Δ ‾ R + λ R μ R + λ . \lVert\theta_T^{\mathrm{atk}}-\theta_T^{\mathrm{cl}}\rVert_2 \le\frac{B^{\mathrm{cl}}_{\mathfrak{R},\lambda}(R)+\Delta_{\mathfrak{R}}-B^{\mathrm{cl}}_{\mathfrak{R}}(R)}{\mu_{\mathfrak{R}}+\lambda}\le\frac{\overline{\Delta}_{\mathfrak{R}}+\lambda R}{\mu_{\mathfrak{R}}+\lambda}. ∥ θ T atk − θ T cl ∥ 2 ≤ μ R + λ B R , λ cl ( R ) + Δ R − B R cl ( R ) ≤ μ R + λ Δ R + λ R . Here Δ R − B R c l ( R ) \Delta_{\mathfrak{R}}-B^{\mathrm{cl}}_{\mathfrak{R}}(R) Δ R − B R cl ( R ) is the previously derived surviving-attack bound: K δ ( K ) / ( N − K ) K\delta(K)/(N-K) K δ ( K ) / ( N − K ) for R = G \mathfrak{R}=G R = G and Γ τ ( K ) / W τ \Gamma_\tau(K)/W_\tau Γ τ ( K ) / W τ for R = τ \mathfrak{R}=\tau R = τ .
Corollary 3.9 (Policy deviation for regularized Robust-DPO). Under the conditions of Corollary 3.8 , for either R ∈ { G , τ } \mathfrak{R}\in\{G,\tau\} R ∈ { G , τ } and every T ≥ 1 T\ge1 T ≥ 1 ,
E x [ D K L ( π θ T a t k ( ⋅ ∣ x ) ∥ π θ T c l ( ⋅ ∣ x ) ) ] ≤ 1 2 ( Δ ‾ R + λ R μ R + λ ) 2 . (17) \mathbb{E}_x\left[D_{\mathrm{KL}}\left(\pi_{\theta_T^{\mathrm{atk}}}(\cdot\mid x)\,\middle\|\,\pi_{\theta_T^{\mathrm{cl}}}(\cdot\mid x)\right)\right]\le\frac{1}{2}\left(\frac{\overline{\Delta}_{\mathfrak{R}}+\lambda R}{\mu_{\mathfrak{R}}+\lambda}\right)^2. \tag*{(17)} E x [ D KL ( π θ T atk ( ⋅ ∣ x ) π θ T cl ( ⋅ ∣ x ) ) ] ≤ 2 1 ( μ R + λ Δ R + λ R ) 2 . (17)
Corollary 3.8 makes the regularization trade-off explicit: the surviving-attack term is divided by μ R + λ \mu_{\mathfrak{R}}+\lambda μ R + λ , but the comparison to unregularized clean DPO pays an additional bias of at most λ R \lambda R λ R . Thus regularization is most useful when this curvature gain dominates the clean bias, for example when targeted flips are not concentrated among the highest-impact samples, which is observed in the targeted attack experiment below. When K = 0 K=0 K = 0 , the bound measures only the regularization offset.
Experiments
Setup. We evaluate on SHP [24 ] with 160,000 training and 40,000 test pairs, using ℓ 2 \ell_2 ℓ 2 -normalized all-MiniLM-L6-v2 pairwise features (d = 384 d=384 d = 384 , β = 1 \beta=1 β = 1 , and SGD initialized at an independently trained θ r e f \theta_{\mathrm{ref}} θ ref ). The four scenarios are no attack, random corruption, top-impact attack, and targeted BMP-A attack [92 ] . Corrupted scenarios flip 30% of the training data (K = 48 , 000 K=48,000 K = 48 , 000 ), while the no-attack control uses K = 0 K=0 K = 0 . The 30% setting is a severe stress test, not an estimate of real-world attack prevalence. We compare DPO, Trim-K K K (TRIM), Soft-Trim-K K K (SOFT_TRIM), and their regularized variants (_REG), with τ = 20 , 000 \tau=20,000 τ = 20 , 000 and λ = 10 − 3 \lambda=10^{-3} λ = 1 0 − 3 . The matched full-data DPO_REG control uses the same attacked data and quadratic penalty λ ∥ θ − θ r e f ∥ 2 2 / 2 \lambda\lVert\theta-\theta_{\mathrm{ref}}\rVert_2^2/2 λ ∥ θ − θ ref ∥ 2 2 /2 , without trimming or downweighting. Full constructions are in Appendices § 14 –§ 15 .
Metric. Let θ ⋆ \theta^\star θ ⋆ be the final standard DPO parameter trained on the full clean set, and write π ⋆ = π θ ⋆ \pi^\star=\pi_{\theta^\star} π ⋆ = π θ ⋆ . The primary metric is candidate-set KL (candKL), the KL from π ⋆ \pi^\star π ⋆ to the evaluated policy on held-out prompt-specific candidate sets of size 100, so candKL ( θ ⋆ ) = 0 \operatorname{candKL}(\theta^\star)=0 candKL ( θ ⋆ ) = 0 . Appendix § 14 discusses the interpretation of this metric.
Top-impact attack. Figure 1 a shows that TRIM and SOFT_TRIM reduce candKL from 0.155 for DPO to 0.018 and 0.064, respectively. Both unregularized defenses outperform their REG counterparts in this setting: directly controlling the high-impact pairs is effective, while regularization introduces additional bias.
Figure 1. (a) Top-impact attack. (b) BMP-A attack. Candidate-set KL ( π ⋆ ∥ ⋅ ) \operatorname{KL}(\pi^\star\Vert\cdot) KL ( π ⋆ ∥ ⋅ ) under two fixed 30% label-flip attacks. Solid curves: our proposed methods. Dashed curves: DPO (left) and matched DPO_REG (right). λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 . Lower is better.
BMP-A attack. Figure 1 b shows that TRIM_REG and SOFT_TRIM_REG attain candKL 0.1176 and 0.1232, compared with 0.1296 for matched full-data DPO_REG. These reductions of 9.3% and 4.9% demonstrate an additional benefit from impact-based trimming beyond the shared quadratic regularizer in this targeted-attack setting.
Additional experiments. We include comprehensive additional experiments in Appendices I–O. In particular, appendices I–J report no-attack/random-corruption controls, clean-data retention costs, parameter-distance curves, and comparisons with existing robust-DPO baselines. Matched-regularization controls and score-assignment ablations further separate the effects of trimming and regularization in Appendices K–L. Sweeps on SHP, HH-RLHF, and UltraFeedback-Binarized in Appendix M show lower KL than DPO for both REG variants at 20%–30% attack budgets, while at smaller budgets retention and regularization bias can outweigh the realized attack effect. A fixed-attack study examines sensitivity to the defender’s assumed K K K and budget selection in Appendix N. A separate preliminary nonlinear-policy extension study is reported in Appendix O.
Conclusion
We have designed DPO methods robust to budgeted label-flip attacks in the log-linear setting. Building on the parameter-independent gradient shift property, we have proposed Trim-K K K Robust-DPO and Soft-Trim-K K K Robust-DPO, as well as their regularized variants. For all these methods, we have derived explicit worst-case bounds relative to the true clean DPO objective, separating the clean bias of the defense rule from the surviving adversarial bias, and translated these bounds into guarantees on parameter and policy deviation. Under a bounded training region, the optimized robust objective admits a positive curvature constant, which leads to time-uniform robustness guarantees. Regularization increases this curvature term, while its deterministic bias relative to unregularized clean DPO must also be accounted for. These results provide a principled robustness characterization of trimmed DPO objectives uniformly over all fixed budgeted label-flip attacks. Experiments on SHP, HH-RLHF, and UltraFeedback-Binarized are consistent with our analysis and support the behavior of the proposed methods: trimming is strong for top-impact attacks, while regularization helps control deviation in the targeted BMP-A experiment. Establishing robustness guarantees beyond the log-linear model remains a future direction, and the preliminary results are discussed in Appendix O.
AI Use Statement
In this work, we used generative AI tools for aid and polish the writing of this manuscript, including improving clarity, grammar, and consistency of notation. We have not used generative AI tools for other tasks with required disclosure. Additionally, we used generative AI tools for cross-checking of experimental descriptions against the implementation and saved results. We have reviewed all AI-assisted work. We checked LLM-polished grammar and verified the experimental descriptions against our code. We take responsibility for the final content of this work, including text, claims or artifacts produced with the aid of generative AI.
Reproducibility Statement
The policy class, attack model, and training assumptions are specified in § 2 , with further discussion of the bounded training region in Appendix § 9 . Appendix § 10 gives algorithm pseudocode, and Appendices § 12 –§ 13 provide supporting lemmas and complete proofs for the log-linear analysis. Appendices § 14 –§ 15 describe the main SHP experiment’s data processing, feature construction, reference-policy training, SGD hyperparameters, compute resources, evaluation metrics, and attack construction. Appendices § 16 –§ 19 document the additional attack scenarios, baseline methods, matched regularization controls, and score-assignment ablation. Appendices § 20 –§ 21 specify data splits, seed protocols, hyperparameters, and evaluation procedures for the three-dataset budget sweep and budget-misspecification study. Appendix § 22 presents the nonlinear flip-gradient identity and its proof, together with the preliminary nonlinear-policy experiments’ architecture, training and evaluation settings, and results.
Introduction: Additional Related Work
Bandit Problems: Adversarial Attacks and Robust Defenses
Adversarial attacks have been studied in several bandit settings, including multi-armed bandits (MAB) [44 , 45 , 52 , 90 ] (Jun et al. 2018), linear contextual bandits [29 , 46 ] (Ma et al. 2018), and dueling bandits [27 , 2 ] (Sha et al. 2021). These works show that bandit algorithms can be sensitive to adversarially corrupted feedback or interaction signals.
In MAB, the learner chooses one arm in each round and observes the corresponding reward [70 , 4 , 5 ] . An adversary may corrupt rewards [52 , 44 ] (Jun et al. 2018), or manipulate the selected actions [45 ] to force the learner to pull a target arm more often. Most existing studies focus on stochastic rewards, where each arm has a fixed reward distribution. Other works consider adversarial rewards, where rewards are chosen arbitrarily [5 , 102 ] , or non-stationary rewards, where reward distributions change over time within some extent [90 , 30 , 11 , 6 , 12 , 18 ] .
In linear contextual bandits, the expected reward is assumed to be linear in the context features [1 ] (Auer 2002; Li et al. 2010). Existing attacks include reward poisoning [29 ] (Ma et al. 2018), context poisoning [29 ] , and action poisoning [46 ] .
Dueling bandits are closer to RLHF, in which the learner selects a pair of arms and observes only which one is preferred [95 , 103 , 75 ] . Prior work studies stochastic dueling bandits with corrupted pairs [2 ] , as well as adversarial preference models [27 , 72 , 50 ] .
Adversarial attacks naturally motivate robust bandit algorithms. Existing robust defenses have been studied for stochastic bandits [49 , 33 , 32 , 13 ] , adversarial bandits [93 ] , stochastic linear contextual bandits [22 ] , strategic manipulation in stochastic bandits [25 ] , stochastic Lipschitz bandits [37 ] , and non-stationary bandits [90 ] . These defenses are important in real applications, where corrupted feedback can lead to harmful decisions such as unfair recommendations or unsafe medical treatments.
Standard Reinforcement Learning: Adversarial Attacks and Robust Defenses
Adversarial attacks on standard RL have also been widely studied, in which the attacker corrupts multiple aspects of the learning process so that the learned policy is misled. Common poisoning models include reward/cost poisoning [35 , 97 , 66 , 67 , 8 ] (Xu et al. 2022; Li et al. 2025); action poisoning [47 ] ; and more general environment or transition dynamics poisoning [66 ] (Xu et al. 2021). Poisoning attacks are also studied in batch settings (Ma et al., 2019), and in dynamics-agnostic settings [77 , 47 , 67 ] (Xu et al. 2022; Li et al. 2025).
Beyond single-agent RL, adversarial attacks have also been considered in multi-agent RL [48 ] (Wu et al. 2023), and in federated RL (Ma et al., 2024). Other works characterize the limits of reward-only or action-only poisoning in episodic RL [69 ] , or formulate the optimal attack through the attacker’s own Markov decision process [57 ] . In deep RL, the policies are neural networks and the attackers modify the high-dimensional observations [34 , 39 , 43 , 63 , 56 , 60 , 31 , 76 ] .
Existing works have proposed defense strategies in RL algorithms [78 , 98 ] (Ye et al. 2023). Related robustness ideas have also been developed in broader machine learning settings [23 , 64 ] (Li et al. 2021). These works show that defense mechanisms are necessary when corrupted interactions can push the learner toward undesirable behaviors.
Reinforcement Learning from Human Feedback: Adversarial Attacks and Robust Defenses
RLHF is different from bandit and standard RL because it learns policies from pairwise discrete preference data rather than a numerical reward from the environment. Depending on whether the training is on a pre-collected dataset or through real-time interaction with human annotators [85 ] , RLHF can be categorized into offline RLHF [20 , 59 , 7 , 100 , 65 ] and online RLHF [16 , 73 , 79 , 96 , 83 ] . It has been shown that offline RLHF is vulnerable to preference poisoning, such as data injection attack and label flipping attack, through experiments [68 , 83 , 9 , 61 , 62 ] (Fu et al. 2025; Wu et al. 2025), and theoretical analysis [58 ] . Nika et al. [58 ] proves that a large poisoned preference set may be needed to mislead offline RLHF for data injection attack. Meanwhile, Yang et al. (2026) proposes efficient label flipping attacks that strategically select a small subset of preference pairs to flip and mislead offline RLHF toward a target policy. In online RLHF, preferences can also be attacked to manipulate the learning process [91 ] .
Other than the adversarial attack described above, RLHF is also sensitive to the random noise in preference data, which is caused by annotation errors, limited expert involvement, and other non-adversarial sources [15 , 89 ] . This noise may lead to unpredictable or biased aligned model behavior.
Motivated by these reliability issues of preference data, existing works propose robust online RLHF against adversarial attacks [91 ] and robust offline RLHF against random noise [89 , 17 , 55 , 19 , 83 ] and distribution shift (Xu et al., 2025). In the offline setting, there is a gap in the literature on robust RLHF against adversarial attacks, especially for specifically designed attacks leading to a target policy. This paper aims to fill this gap by proposing robust DPO methods against budgeted preference label flips, including adversarial flips.
Problem Formulation: Why the Bounded Training Region Matters
we have q ( z ) > 0 q(z)>0 q ( z ) > 0 for every finite z z z , but q ( z ) → 0 q(z)\to0 q ( z ) → 0 as z → ± ∞ z\to\pm\infty z → ± ∞ . Therefore, along a direction where some sample logit diverges, the corresponding logistic curvature factor vanishes, and the global infimum of C v C_v C v is zero. This is why the unregularized objective need not admit a uniform global strong-convexity constant.
The quadratic regularizer in Nika et al. [58 ] gives a different source of curvature. It adds λ I \lambda I λ I to the Hessian, so the regularized objective can obtain an additional global curvature term even when the logistic curvature factor is small. This is the same mechanism used by our regularized variants in § 3.4 : the denominator improves by λ \lambda λ , while comparison to the unregularized clean DPO target also introduces the deterministic regularization bias term λ R \lambda R λ R .
Proposition B.2 (Linear-in-T T T deviation under convex smoothness alone). For any L ˉ ∈ ( 0 , β 2 ] \bar{L}\in(0,\beta^2] L ˉ ∈ ( 0 , β 2 ] , there exist a convex L ˉ \bar{L} L ˉ -smooth function F F F , a constant bias vector b ≠ 0 b\ne0 b = 0 , and a step size 0 < η ≤ 2 / L ˉ 0<\eta\le2/\bar{L} 0 < η ≤ 2/ L ˉ such that, when clean and attacked gradient descent are run from the same initialization,
θ t + 1 c l n = θ t c l n − η ∇ F ( θ t c l n ) , θ t + 1 a t k = θ t a t k − η ( ∇ F ( θ t a t k ) + b ) , \theta^{\mathrm{cln}}_{t+1}=\theta^{\mathrm{cln}}_t-\eta\nabla F(\theta^{\mathrm{cln}}_t),\qquad
\theta^{\mathrm{atk}}_{t+1}=\theta^{\mathrm{atk}}_t-\eta\left(\nabla F(\theta^{\mathrm{atk}}_t)+b\right), θ t + 1 cln = θ t cln − η ∇ F ( θ t cln ) , θ t + 1 atk = θ t atk − η ( ∇ F ( θ t atk ) + b ) , the iterate deviation satisfies
∥ θ T a t k − θ T c l n ∥ 2 = η T ∥ b ∥ 2 for all T ≥ 1. \left\|\theta^{\mathrm{atk}}_T-\theta^{\mathrm{cln}}_T\right\|_2=\eta T\|b\|_2\qquad\text{for all }T\ge1. θ T atk − θ T cln 2 = η T ∥ b ∥ 2 for all T ≥ 1. Thus, convex smoothness plus a uniform gradient-bias bound is not enough to imply a time-uniform deviation bound.
Proof of Proposition B.2. Choose any nonzero vector b b b and any 0 < η ≤ 2 / L ˉ 0<\eta\le2/\bar{L} 0 < η ≤ 2/ L ˉ . Take F ( θ ) ≡ 0 F(\theta)\equiv0 F ( θ ) ≡ 0 for all θ \theta θ . Then F F F is convex and L ˉ \bar{L} L ˉ -smooth for every L ˉ > 0 \bar{L}>0 L ˉ > 0 , and ∇ F ( θ ) = 0 \nabla F(\theta)=0 ∇ F ( θ ) = 0 for all θ \theta θ . The clean GD iterates are constant:
θ t + 1 c l n = θ t c l n . \theta^{\mathrm{cln}}_{t+1}=\theta^{\mathrm{cln}}_t. θ t + 1 cln = θ t cln .
The attacked GD iterates satisfy
θ t + 1 a t k = θ t a t k − η b . \theta^{\mathrm{atk}}_{t+1}=\theta^{\mathrm{atk}}_t-\eta b. θ t + 1 atk = θ t atk − η b .
Starting from the same initialization θ 0 a t k = θ 0 c l n \theta^{\mathrm{atk}}_0=\theta^{\mathrm{cln}}_0 θ 0 atk = θ 0 cln , we obtain by induction
θ T a t k − θ T c l n = − η T b , \theta^{\mathrm{atk}}_T-\theta^{\mathrm{cln}}_T=-\eta T b, θ T atk − θ T cln = − η T b ,
and hence ∥ θ T a t k − θ T c l n ∥ 2 = η T ∥ b ∥ 2 \|\theta^{\mathrm{atk}}_T-\theta^{\mathrm{cln}}_T\|_2=\eta T\|b\|_2 ∥ θ T atk − θ T cln ∥ 2 = η T ∥ b ∥ 2 .
Proposition B.2 explains why Assumption 2.3 is important for time-uniform robustness. Without a bounded training region, the DPO objective may not have a uniform curvature lower bound, so the stability argument would fall back to the accumulated-bias recursion over gradient steps, leading to a deviation that grows linearly in T T T , illustrated by the proposition. The bounded-region assumption prevents this failure mode by keeping the logistic curvature uniformly positive along training. For the regularized variants, the quadratic regularizer provides an additional curvature term, but its additional bias means that it need not improve the complete deviation bound.
Methods: Algorithm Details
Algorithms 1 and 2 give the implementation details for applying the objective-level defenses described in the main text to the observed dataset. In the log-linear setting, the score s i = β ∥ v i ∥ 2 s_i=\beta\|v_i\|_2 s i = β ∥ v i ∥ 2 is the exact magnitude of a pair’s potential flip-induced gradient change. It does not estimate whether the pair is corrupted. Because ∥ ψ ( x , y w ) − ψ ( x , y l ) ∥ 2 \|\psi(x,y_w)-\psi(x,y_l)\|_2 ∥ ψ ( x , y w ) − ψ ( x , y l ) ∥ 2 is invariant to swapping the two responses, this score can be computed directly from the observed pair even if it has been flipped. Given precomputed d d d -dimensional features, computing all N N N scores costs O ( N d ) O(Nd) O ( N d ) and sorting them costs O ( N log N ) O(N\log N) O ( N log N ) , once before training. Training then uses standard DPO updates on the fixed retained set or with fixed scalar weights on the per-example losses. The REG variants additionally evaluate the quadratic penalty and its gradient, requiring O ( d ) O(d) O ( d ) arithmetic per update.
Algorithm 1 Trim-K K K Robust-DPO
Require: Observed preference dataset D ~ ( A ) = { ( x i , y ~ w i , y ~ l i ) } i = 1 N \widetilde{\mathcal{D}}(A)=\{(x^i,\widetilde{y}_w^i,\widetilde{y}_l^i)\}_{i=1}^N D ( A ) = {( x i , y w i , y l i ) } i = 1 N , budget upper bound K K K , reference policy π r e f \pi_{\mathrm{ref}} π ref , inverse-temperature β \beta β , optimizer, training horizon T T T
for i = 1 , … , N i=1,\ldots,N i = 1 , … , N do
Compute observed direction v ~ i ← ψ ( x i , y ~ w i ) − ψ ( x i , y ~ l i ) \widetilde{v}_i \leftarrow\psi(x^i,\widetilde{y}_w^i)-\psi(x^i,\widetilde{y}_l^i) v i ← ψ ( x i , y w i ) − ψ ( x i , y l i )
Compute score s i ← β ∥ v ~ i ∥ 2 s_i\leftarrow\beta\lVert\widetilde{v}_i\rVert_2 s i ← β ∥ v i ∥ 2
end for
Sort { s i } i = 1 N \{s_i\}_{i=1}^N { s i } i = 1 N in descending order and keep the N − K N-K N − K smallest-score indices G G G
Initialize parameter θ 0 \theta_0 θ 0
for t = 0 , 1 , … , T − 1 t=0,1,\ldots,T-1 t = 0 , 1 , … , T − 1 do
Compute the observed trimmed DPO objective
F ~ G , A ( θ t ) = 1 N − K ∑ i ∈ G ℓ D P O ( θ t ; x i , y ~ w i , y ~ l i ) \widetilde{F}_{G,A}(\theta_t)=\frac{1}{N-K}\sum_{i\in G}\ell_{\mathrm{DPO}}(\theta_t;x^i,\widetilde{y}_w^i,\widetilde{y}_l^i) F G , A ( θ t ) = N − K 1 i ∈ G ∑ ℓ DPO ( θ t ; x i , y w i , y l i )
Update θ t + 1 ← θ t − η ∇ F ~ G , A ( θ t ) \theta_{t+1}\leftarrow\theta_t-\eta\nabla\widetilde{F}_{G,A}(\theta_t) θ t + 1 ← θ t − η ∇ F G , A ( θ t )
end for
return θ T \theta_T θ T
Algorithm 2 Soft-Trim-K K K Robust-DPO
Require: Observed preference dataset D ~ ( A ) = { ( x i , y ~ w i , y ~ l i ) } i = 1 N \widetilde{\mathcal{D}}(A)=\{(x^i,\widetilde{y}_w^i,\widetilde{y}_l^i)\}_{i=1}^N D ( A ) = {( x i , y w i , y l i ) } i = 1 N , budget upper bound K K K , temperature τ \tau τ , reference policy π r e f \pi_{\mathrm{ref}} π ref , inverse-temperature β \beta β , optimizer, training horizon T T T
for i = 1 , … , N i=1,\ldots,N i = 1 , … , N do
Compute observed direction v ~ i ← ψ ( x i , y ~ w i ) − ψ ( x i , y ~ l i ) \widetilde{v}_i \leftarrow\psi(x^i,\widetilde{y}_w^i)-\psi(x^i,\widetilde{y}_l^i) v i ← ψ ( x i , y w i ) − ψ ( x i , y l i )
Compute score s i ← β ∥ v ~ i ∥ 2 s_i\leftarrow\beta\lVert\widetilde{v}_i\rVert_2 s i ← β ∥ v i ∥ 2
end for
Rank the scores in descending order and assign weights w i ( τ ) w_i^{(\tau)} w i ( τ ) by (13)
Initialize parameter θ 0 \theta_0 θ 0
for t = 0 , 1 , … , T − 1 t=0,1,\ldots,T-1 t = 0 , 1 , … , T − 1 do
Compute the observed weighted DPO objective
F ~ τ , A ( θ t ) = 1 W τ ∑ i = 1 N w i ( τ ) ℓ D P O ( θ t ; x i , y ~ w i , y ~ l i ) \widetilde{F}_{\tau,A}(\theta_t)=\frac{1}{W_\tau}\sum_{i=1}^{N}w_i^{(\tau)}\ell_{\mathrm{DPO}}(\theta_t;x^i,\widetilde{y}_w^i,\widetilde{y}_l^i) F τ , A ( θ t ) = W τ 1 i = 1 ∑ N w i ( τ ) ℓ DPO ( θ t ; x i , y w i , y l i )
Update θ t + 1 ← θ t − η ∇ F ~ τ , A ( θ t ) \theta_{t+1}\leftarrow\theta_t-\eta\nabla\widetilde{F}_{\tau,A}(\theta_t) θ t + 1 ← θ t − η ∇ F τ , A ( θ t )
end for
return θ T \theta_T θ T
Methods: Soft-Trim Weight Visualization
Figure 2 visualizes the rank-based weights used by Soft-Trim-K K K Robust-DPO. Smaller values of τ \tau τ more aggressively downweight the highest-score samples and approach Trim-K K K Robust-DPO, while larger values of τ \tau τ keep the weights closer to one and approach standard DPO.
Methods: Supporting Lemmas for the Main Analysis
This appendix collects the standard smoothness, curvature, and optimization facts used in § 3 .
Lemma E.1 (Smoothness of per-sample and normalized log-linear DPO objectives). Under Assumption 2.1 , for every sample i i i , the clean per-sample loss ℓ i \ell_i ℓ i defined in (2) is convex and L i L_i L i -smooth, where
L i ≤ β 2 4 ∥ v i ∥ 2 2 ≤ β 2 . L_i\le\frac{\beta^2}{4}\lVert v_i\rVert_2^2\le\beta^2. L i ≤ 4 β 2 ∥ v i ∥ 2 2 ≤ β 2 . In particular, for all θ , θ ′ \theta,\theta' θ , θ ′ ,
∥ ∇ ℓ i ( θ ) − ∇ ℓ i ( θ ′ ) ∥ 2 ≤ β 2 ∥ θ − θ ′ ∥ 2 . \lVert\nabla\ell_i(\theta)-\nabla\ell_i(\theta')\rVert_2\le\beta^2\lVert\theta-\theta'\rVert_2. ∥ ∇ ℓ i ( θ ) − ∇ ℓ i ( θ ′ ) ∥ 2 ≤ β 2 ∥ θ − θ ′ ∥ 2 .
The same conclusion holds for the observed loss ℓ ~ i \tilde{\ell}_i ℓ ~ i , because swapping the preference orientation replaces v i v_i v i by − v i -v_i − v i and preserves its norm. Consequently, for any fixed weights a i ≥ 0 a_i \ge0 a i ≥ 0 with ∑ i a i = 1 \sum_i a_i = 1 ∑ i a i = 1 , both normalized objectives
F a ( θ ) : = ∑ i a i ℓ i ( θ ) , F ~ a ( θ ) : = ∑ i a i ℓ ~ i ( θ ) F_a(\theta) := \sum_i a_i\ell_i(\theta), \qquad\widetilde{F}_a(\theta) := \sum_i a_i\tilde{\ell}_i(\theta) F a ( θ ) := i ∑ a i ℓ i ( θ ) , F a ( θ ) := i ∑ a i ℓ ~ i ( θ )
are convex and β 2 \beta^2 β 2 -smooth. In particular, this applies to F F F , F G F_G F G , F ~ G , A \widetilde{F}_{G,A} F G , A , F τ F_\tau F τ , and F ~ τ , A \widetilde{F}_{\tau,A} F τ , A .
Lemma E.2 (Restricted strong convexity of the trimmed DPO objective). Under Assumptions 2.1 and 2.3, the clean trimmed objective F G F_G F G introduced in § 3.2 is μ G \mu_G μ G -strongly convex on B R ( θ r e f ) B_R(\theta_{\mathrm{ref}}) B R ( θ ref ) and β 2 \beta^2 β 2 -smooth, where μ G \mu_G μ G is defined in (12) .
Lemma E.3 (Closed-form bound on the clean Trim-K K K bias). Under Assumption 2.1, for every θ ∈ R d \theta\in\mathbb{R}^d θ ∈ R d ,
∥ ∇ F G ( θ ) − ∇ F ( θ ) ∥ 2 ≤ 1 N ( K δ ( K ) + ∑ j = 1 K s ( j ) ) . \lVert\nabla F_G(\theta) - \nabla F(\theta)\rVert_2 \le\frac{1}{N}\left(K\delta(K) + \sum_{j=1}^{K}s_{(j)}\right). ∥ ∇ F G ( θ ) − ∇ F ( θ ) ∥ 2 ≤ N 1 ( K δ ( K ) + j = 1 ∑ K s ( j ) ) . Consequently,
B G c l n ( R ) ≤ K δ ( K ) + ∑ j = 1 K s ( j ) N ≤ 2 N ∑ j = 1 K s ( j ) ≤ 4 β K N . B_G^{\mathrm{cln}}(R) \le\frac{K\delta(K) + \sum_{j=1}^{K}s_{(j)}}{N} \le\frac{2}{N}\sum_{j=1}^{K}s_{(j)} \le\frac{4\beta K}{N}. B G cln ( R ) ≤ N K δ ( K ) + ∑ j = 1 K s ( j ) ≤ N 2 j = 1 ∑ K s ( j ) ≤ N 4 β K . Moreover, for the regularized clean bias B G , λ c l n ( R ) B_{G,\lambda}^{\mathrm{cln}}(R) B G , λ cln ( R ) ,
B G , λ c l n ( R ) ≤ K δ ( K ) + ∑ j = 1 K s ( j ) N + λ R . B_{G,\lambda}^{\mathrm{cln}}(R) \le\frac{K\delta(K) + \sum_{j=1}^{K}s_{(j)}}{N} + \lambda R. B G , λ cln ( R ) ≤ N K δ ( K ) + ∑ j = 1 K s ( j ) + λ R .
Lemma E.4 (Closed-form bound on the clean Soft-Trim-K K K bias). Define
C τ : = 1 N W τ [ ∑ j = 1 K ( D τ − N ( 1 − a j ( τ ) ) ) s ( j ) + D τ ∑ j = K + 1 N s ( j ) ] . (19) C_\tau:= \frac{1}{NW_\tau}\left[\sum_{j=1}^{K}\left(D_\tau- N\left(1-a_j^{(\tau)}\right)\right)s_{(j)} + D_\tau\sum_{j=K+1}^{N}s_{(j)}\right]. \tag*{(19)} C τ := N W τ 1 j = 1 ∑ K ( D τ − N ( 1 − a j ( τ ) ) ) s ( j ) + D τ j = K + 1 ∑ N s ( j ) . (19) Under Assumption 2.1, for every θ ∈ R d \theta\in\mathbb{R}^d θ ∈ R d ,
∥ ∇ F τ ( θ ) − ∇ F ( θ ) ∥ 2 ≤ C τ . \lVert\nabla F_\tau(\theta) - \nabla F(\theta)\rVert_2 \le C_\tau. ∥ ∇ F τ ( θ ) − ∇ F ( θ ) ∥ 2 ≤ C τ .
Consequently,
B τ c l n ( R ) ≤ C τ ≤ D τ s ˉ + ∑ j = 1 K ( 1 − a j ( τ ) ) s ( j ) W τ ≤ 4 β K W τ . B_{\tau}^{\mathrm{cln}}(R) \le C_{\tau} \le\frac{D_{\tau}\bar{s}+\sum_{j=1}^{K}(1-a_{j}^{(\tau)})s_{(j)}}{W_{\tau}} \le\frac{4\beta K}{W_{\tau}}. B τ cln ( R ) ≤ C τ ≤ W τ D τ s ˉ + ∑ j = 1 K ( 1 − a j ( τ ) ) s ( j ) ≤ W τ 4 β K .
Moreover, for the regularized clean bias B τ , λ c l n ( R ) B_{\tau,\lambda}^{\mathrm{cln}}(R) B τ , λ cln ( R ) ,
B τ , λ c l n ( R ) ≤ C τ + λ R . B_{\tau,\lambda}^{\mathrm{cln}}(R) \le C_{\tau}+\lambda R. B τ , λ cln ( R ) ≤ C τ + λ R .
As τ ↓ 0 \tau\downarrow0 τ ↓ 0 , C τ C_{\tau} C τ reduces to the exact hard-trim type bound
1 N ( N − K ) [ ( N − K ) ∑ j = 1 K s ( j ) + K ∑ j = K + 1 N s ( j ) ] , \frac{1}{N(N-K)}\left[(N-K)\sum_{j=1}^{K}s_{(j)}+K\sum_{j=K+1}^{N}s_{(j)}\right], N ( N − K ) 1 ( N − K ) j = 1 ∑ K s ( j ) + K j = K + 1 ∑ N s ( j ) ,
which is at most ( K δ ( K ) + ∑ j = 1 K s ( j ) ) / N (K\delta(K)+\sum_{j=1}^{K}s_{(j)})/N ( K δ ( K ) + ∑ j = 1 K s ( j ) ) / N . As τ → ∞ \tau\to\infty τ → ∞ , all weights converge to one, D τ → 0 D_{\tau}\to0 D τ → 0 , and C τ → 0 C_{\tau}\to0 C τ → 0 .
Lemma E.5 (Non-expansiveness of gradient descent for convex smooth objectives). Let F : R d → R F:\mathbb{R}^{d}\to\mathbb{R} F : R d → R be convex and L L L -smooth. Define T ( θ ) : = θ − η ∇ F ( θ ) T(\theta):=\theta-\eta\nabla F(\theta) T ( θ ) := θ − η ∇ F ( θ ) . If 0 < η ≤ 2 / L 0<\eta\le2/L 0 < η ≤ 2/ L , then T T T is non-expansive:
∥ T ( x ) − T ( y ) ∥ 2 ≤ ∥ x − y ∥ 2 , ∀ x , y ∈ R d . \lVert T(x)-T(y)\rVert_{2}\le\lVert x-y\rVert_{2},\qquad\forall x,y\in\mathbb{R}^{d}. ∥ T ( x ) − T ( y ) ∥ 2 ≤ ∥ x − y ∥ 2 , ∀ x , y ∈ R d .
Lemma E.6 (Time-uniform stability under objective perturbation). Let F 0 : R d → R F_{0}:\mathbb{R}^{d}\to\mathbb{R} F 0 : R d → R be the target objective and let H : R d → R H:\mathbb{R}^{d}\to\mathbb{R} H : R d → R be the objective optimized by the attacked run. Assume H H H is μ \mu μ -strongly convex and L L L -smooth on a convex region containing the clean and attacked iterates, and assume
sup θ i n t h e r e g i o n ∥ ∇ H ( θ ) − ∇ F 0 ( θ ) ∥ 2 ≤ B . \sup_{\theta\ \mathrm{in\ the\ region}}\lVert\nabla H(\theta)-\nabla F_{0}(\theta)\rVert_{2}\le B. θ in the region sup ∥ ∇ H ( θ ) − ∇ F 0 ( θ ) ∥ 2 ≤ B . Run full-batch gradient descent from the same initialization with step size 0 < η ≤ 1 / L 0<\eta\le1/L 0 < η ≤ 1/ L :
θ t + 1 c l n = θ t c l n − η ∇ F 0 ( θ t c l n ) , θ t + 1 a t k = θ t a t k − η ∇ H ( θ t a t k ) . \theta_{t+1}^{\mathrm{cln}}=\theta_{t}^{\mathrm{cln}}-\eta\nabla F_{0}(\theta_{t}^{\mathrm{cln}}),\qquad
\theta_{t+1}^{\mathrm{atk}}=\theta_{t}^{\mathrm{atk}}-\eta\nabla H(\theta_{t}^{\mathrm{atk}}). θ t + 1 cln = θ t cln − η ∇ F 0 ( θ t cln ) , θ t + 1 atk = θ t atk − η ∇ H ( θ t atk ) . Then for every T ≥ 1 T\ge1 T ≥ 1 ,
∥ θ T a t k − θ T c l n ∥ 2 ≤ B μ ( 1 − ( 1 − η μ ) T ) ≤ B μ . \lVert\theta_{T}^{\mathrm{atk}}-\theta_{T}^{\mathrm{cln}}\rVert_{2}
\le\frac{B}{\mu}\left(1-(1-\eta\mu)^{T}\right)
\le\frac{B}{\mu}. ∥ θ T atk − θ T cln ∥ 2 ≤ μ B ( 1 − ( 1 − η μ ) T ) ≤ μ B .
Methods: Proofs of Theoretical Results
Proof of Lemma E.1
Proof. Fix a sample i i i . Since b i b_i b i does not depend on θ \theta θ , ∇ θ z i ( θ ) = β v i \nabla_{\theta}z_i(\theta)=\beta v_i ∇ θ z i ( θ ) = β v i . Differentiating,
∇ ℓ i ( θ ) = − ( 1 − σ ( z i ( θ ) ) ) β v i , ∇ 2 ℓ i ( θ ) = β 2 σ ( z i ( θ ) ) ( 1 − σ ( z i ( θ ) ) ) v i v i T . \nabla\ell_i(\theta)=-(1-\sigma(z_i(\theta)))\beta v_i,\qquad
\nabla^{2}\ell_i(\theta)=\beta^{2}\sigma(z_i(\theta))(1-\sigma(z_i(\theta)))v_i v_i^{\mathsf{T}}. ∇ ℓ i ( θ ) = − ( 1 − σ ( z i ( θ ))) β v i , ∇ 2 ℓ i ( θ ) = β 2 σ ( z i ( θ )) ( 1 − σ ( z i ( θ ))) v i v i T .
Thus, using σ ( z i ( θ ) ) ( 1 − σ ( z i ( θ ) ) ) ≤ 1 / 4 \sigma(z_i(\theta))(1-\sigma(z_i(\theta)))\le1/4 σ ( z i ( θ )) ( 1 − σ ( z i ( θ ))) ≤ 1/4 and ∥ v i v i T ∥ o p = ∥ v i ∥ 2 2 \lVert v_i v_i^{\mathsf{T}}\rVert_{\mathrm{op}}=\lVert v_i\rVert_{2}^{2} ∥ v i v i T ∥ op = ∥ v i ∥ 2 2 ,
∥ ∇ 2 ℓ i ( θ ) ∥ o p ≤ β 2 4 ∥ v i ∥ 2 2 . \lVert\nabla^{2}\ell_i(\theta)\rVert_{\mathrm{op}}\le\frac{\beta^{2}}{4}\lVert v_i\rVert_{2}^{2}. ∥ ∇ 2 ℓ i ( θ ) ∥ op ≤ 4 β 2 ∥ v i ∥ 2 2 .
Under Assumption 2.1, ∥ v i ∥ 2 ≤ ∥ ψ ( x i , y i w ) ∥ 2 + ∥ ψ ( x i , y i l ) ∥ 2 ≤ 2 \lVert v_i\rVert_{2}\le\lVert\psi(x^{i},y_{i}^{w})\rVert_{2}+\lVert\psi(x^{i},y_{i}^{l})\rVert_{2}\le2 ∥ v i ∥ 2 ≤ ∥ ψ ( x i , y i w ) ∥ 2 + ∥ ψ ( x i , y i l ) ∥ 2 ≤ 2 , hence ∥ ∇ 2 ℓ i ( θ ) ∥ o p ≤ β 2 \lVert\nabla^{2}\ell_i(\theta)\rVert_{\mathrm{op}}\le\beta^{2} ∥ ∇ 2 ℓ i ( θ ) ∥ op ≤ β 2 for all θ \theta θ . A uniform Hessian bound implies gradient Lipschitzness:
∥ ∇ ℓ i ( θ ) − ∇ ℓ i ( θ ′ ) ∥ 2 ≤ sup ξ ∥ ∇ 2 ℓ i ( ξ ) ∥ o p ∥ θ − θ ′ ∥ 2 ≤ β 2 ∥ θ − θ ′ ∥ 2 . \lVert\nabla\ell_i(\theta)-\nabla\ell_i(\theta')\rVert_{2}
\le\sup_{\xi}\lVert\nabla^{2}\ell_i(\xi)\rVert_{\mathrm{op}}\lVert\theta-\theta'\rVert_{2}
\le\beta^{2}\lVert\theta-\theta'\rVert_{2}. ∥ ∇ ℓ i ( θ ) − ∇ ℓ i ( θ ′ ) ∥ 2 ≤ ξ sup ∥ ∇ 2 ℓ i ( ξ ) ∥ op ∥ θ − θ ′ ∥ 2 ≤ β 2 ∥ θ − θ ′ ∥ 2 .
The Hessian is positive semidefinite, so ℓ i \ell_i ℓ i is convex. For the observed orientation, either the pair is unchanged or ( v i , b i , z i ) (v_i,b_i,z_i) ( v i , b i , z i ) becomes ( − v i , − b i , − z i ) (-v_i,-b_i,-z_i) ( − v i , − b i , − z i ) . The same Hessian bound and convexity conclusion therefore hold for ℓ ~ i \tilde{\ell}_i ℓ ~ i .
Finally, for any fixed normalized nonnegative weighted average F a ( θ ) = ∑ i a i ℓ i ( θ ) F_a(\theta)=\sum_i a_i\ell_i(\theta) F a ( θ ) = ∑ i a i ℓ i ( θ ) ,
∥ ∇ 2 F a ( θ ) ∥ o p = ∥ ∑ i a i ∇ 2 ℓ i ( θ ) ∥ o p ≤ ∑ i a i ∥ ∇ 2 ℓ i ( θ ) ∥ o p ≤ β 2 , \lVert\nabla^{2}F_a(\theta)\rVert_{\mathrm{op}}
=\left\lVert\sum_i a_i\nabla^{2}\ell_i(\theta)\right\rVert_{\mathrm{op}}
\le\sum_i a_i\lVert\nabla^{2}\ell_i(\theta)\rVert_{\mathrm{op}}
\le\beta^{2}, ∥ ∇ 2 F a ( θ ) ∥ op = i ∑ a i ∇ 2 ℓ i ( θ ) op ≤ i ∑ a i ∥ ∇ 2 ℓ i ( θ ) ∥ op ≤ β 2 ,
and ∇ 2 F a ( θ ) ⪰ 0 \nabla^{2}F_a(\theta)\succeq0 ∇ 2 F a ( θ ) ⪰ 0 . The identical argument applies to F ~ a \widetilde{F}_a F a using the observed losses ℓ ~ i \tilde{\ell}_i ℓ ~ i . This proves the stated claims for the fixed normalized clean and attacked empirical objectives.
Proof of Lemma E.2
Proof. For θ ∈ B R ( θ r e f ) \theta\in\mathbb{B}_{R}(\theta_{\mathrm{ref}}) θ ∈ B R ( θ ref ) , the Hessian of the clean trimmed objective is
∇ 2 F G ( θ ) = 1 ∣ G ∣ ∑ i ∈ G β 2 σ ( z i ( θ ) ) ( 1 − σ ( z i ( θ ) ) ) v i v i T . \nabla^{2}F_G(\theta)=\frac{1}{|G|}\sum_{i\in G}\beta^{2}\sigma(z_i(\theta))(1-\sigma(z_i(\theta)))v_i v_i^{\mathsf{T}}. ∇ 2 F G ( θ ) = ∣ G ∣ 1 i ∈ G ∑ β 2 σ ( z i ( θ )) ( 1 − σ ( z i ( θ ))) v i v i T .
By the definition of c G ( R ) c_G(R) c G ( R ) ,
∇ 2 F G ( θ ) ⪰ β 2 c G ( R ) 1 ∣ G ∣ ∑ i ∈ G v i v i T = β 2 c G ( R ) Σ G ⪰ μ G I . \nabla^{2}F_G(\theta)\succeq\beta^{2}c_G(R)\frac{1}{|G|}\sum_{i\in G}v_i v_i^{\mathsf{T}}=\beta^{2}c_G(R)\Sigma_G\succeq\mu_GI. ∇ 2 F G ( θ ) ⪰ β 2 c G ( R ) ∣ G ∣ 1 i ∈ G ∑ v i v i T = β 2 c G ( R ) Σ G ⪰ μ G I .
Therefore F G F_G F G is μ G \mu_G μ G -strongly convex on the bounded region. Its β 2 \beta^{2} β 2 -smoothness follows from Lemma E.1.
Proof of Lemma E.3
Proof. Let T : = [ N ] ∖ G T:=[N]\setminus G T := [ N ] ∖ G denote the trimmed set, so ∣ T ∣ = K |T|=K ∣ T ∣ = K and ∣ G ∣ = N − K |G|=N-K ∣ G ∣ = N − K . Splitting ∑ i = 1 N g i ( θ ) = ∑ i ∈ G g i ( θ ) + ∑ i ∈ T g i ( θ ) \sum_{i=1}^{N}g_i(\theta)=\sum_{i\in G}g_i(\theta)+\sum_{i\in T}g_i(\theta) ∑ i = 1 N g i ( θ ) = ∑ i ∈ G g i ( θ ) + ∑ i ∈ T g i ( θ ) , we obtain
∇ F G ( θ ) − ∇ F ( θ ) = 1 N − K ∑ i ∈ G g i ( θ ) − 1 N ∑ i = 1 N g i ( θ ) = ( 1 N − K − 1 N ) ∑ i ∈ G g i ( θ ) − 1 N ∑ i ∈ T g i ( θ ) = K N ( N − K ) ∑ i ∈ G g i ( θ ) − 1 N ∑ i ∈ T g i ( θ ) . \begin{aligned}
\nabla F_G(\theta)-\nabla F(\theta)=\frac{1}{N-K}\sum_{i\in G}g_i(\theta)-\frac{1}{N}\sum_{i=1}^{N}g_i(\theta) \\
&=\left(\frac{1}{N-K}-\frac{1}{N}\right)\sum_{i\in G}g_i(\theta)-\frac{1}{N}\sum_{i\in T}g_i(\theta) \\
&=\frac{K}{N(N-K)}\sum_{i\in G}g_i(\theta)-\frac{1}{N}\sum_{i\in T}g_i(\theta).
\end{aligned} ∇ F G ( θ ) − ∇ F ( θ ) = N − K 1 i ∈ G ∑ g i ( θ ) − N 1 i = 1 ∑ N g i ( θ ) = ( N − K 1 − N 1 ) i ∈ G ∑ g i ( θ ) − N 1 i ∈ T ∑ g i ( θ ) = N ( N − K ) K i ∈ G ∑ g i ( θ ) − N 1 i ∈ T ∑ g i ( θ ) .
By the closed-form gradient (4) and ∣ σ ( z ) − 1 ∣ ≤ 1 |\sigma(z)-1|\leq1 ∣ σ ( z ) − 1∣ ≤ 1 , we have ∥ g i ( θ ) ∥ 2 ≤ β ∥ v i ∥ 2 = s i \lVert g_i(\theta)\rVert_2\leq\beta\lVert v_i\rVert_2=s_i ∥ g i ( θ ) ∥ 2 ≤ β ∥ v i ∥ 2 = s i for every θ \theta θ . Triangle inequality gives
∥ ∇ F G ( θ ) − ∇ F ( θ ) ∥ 2 ≤ K N ( N − K ) ∑ i ∈ G s i + 1 N ∑ i ∈ T s i . \lVert\nabla F_G(\theta)-\nabla F(\theta)\rVert_2\leq\frac{K}{N(N-K)}\sum_{i\in G}s_i+\frac{1}{N}\sum_{i\in T}s_i. ∥ ∇ F G ( θ ) − ∇ F ( θ ) ∥ 2 ≤ N ( N − K ) K i ∈ G ∑ s i + N 1 i ∈ T ∑ s i .
By construction of G G G , every i ∈ G i\in G i ∈ G satisfies s i ≤ δ ( K ) s_i\leq\delta(K) s i ≤ δ ( K ) , hence ∑ i ∈ G s i ≤ ( N − K ) δ ( K ) \sum_{i\in G}s_i\leq(N-K)\delta(K) ∑ i ∈ G s i ≤ ( N − K ) δ ( K ) . Also, T T T contains exactly the K K K largest scores, so ∑ i ∈ T s i = ∑ j = 1 K s ( j ) \sum_{i\in T}s_i=\sum_{j=1}^{K}s_{(j)} ∑ i ∈ T s i = ∑ j = 1 K s ( j ) . Substituting,
∥ ∇ F G ( θ ) − ∇ F ( θ ) ∥ 2 ≤ K δ ( K ) N + 1 N ∑ j = 1 K s ( j ) = K δ ( K ) + ∑ j = 1 K s ( j ) N . \lVert\nabla F_G(\theta)-\nabla F(\theta)\rVert_2\leq\frac{K\delta(K)}{N}+\frac{1}{N}\sum_{j=1}^{K}s_{(j)}=\frac{K\delta(K)+\sum_{j=1}^{K}s_{(j)}}{N}. ∥ ∇ F G ( θ ) − ∇ F ( θ ) ∥ 2 ≤ N K δ ( K ) + N 1 j = 1 ∑ K s ( j ) = N K δ ( K ) + ∑ j = 1 K s ( j ) .
Taking the supremum over θ ∈ B R ( θ r e f ) \theta\in\mathbb{B}_{R}(\theta_{\mathrm{ref}}) θ ∈ B R ( θ ref ) gives the bound on B G c l n ( R ) B_G^{\mathrm{cln}}(R) B G cln ( R ) . Since δ ( K ) = s ( K + 1 ) ≤ s ( j ) \delta(K)=s_{(K+1)}\leq s_{(j)} δ ( K ) = s ( K + 1 ) ≤ s ( j ) for j ≤ K j\leq K j ≤ K , K δ ( K ) ≤ ∑ j = 1 K s ( j ) K\delta(K)\leq\sum_{j=1}^{K}s_{(j)} K δ ( K ) ≤ ∑ j = 1 K s ( j ) , yielding the simplified 2 N ∑ j = 1 K s ( j ) \frac{2}{N}\sum_{j=1}^{K}s_{(j)} N 2 ∑ j = 1 K s ( j ) . Each s i = β ∥ v i ∥ 2 ≤ 2 β s_i=\beta\lVert v_i\rVert_2\leq2\beta s i = β ∥ v i ∥ 2 ≤ 2 β under Assumption 2.1, hence ∑ j = 1 K s ( j ) ≤ 2 β K \sum_{j=1}^{K}s_{(j)}\leq2\beta K ∑ j = 1 K s ( j ) ≤ 2 β K , giving the universal bound 4 β K N \frac{4\beta K}{N} N 4 β K . For the regularized bias, note
∇ F G ( θ ) + λ ( θ − θ r e f ) − ∇ F ( θ ) = ( ∇ F G ( θ ) − ∇ F ( θ ) ) + λ ( θ − θ r e f ) , \nabla F_G(\theta)+\lambda(\theta-\theta_{\mathrm{ref}})-\nabla F(\theta)=(\nabla F_G(\theta)-\nabla F(\theta))+\lambda(\theta-\theta_{\mathrm{ref}}), ∇ F G ( θ ) + λ ( θ − θ ref ) − ∇ F ( θ ) = ( ∇ F G ( θ ) − ∇ F ( θ )) + λ ( θ − θ ref ) ,
and ∥ θ − θ r e f ∥ 2 ≤ R \lVert\theta-\theta_{\mathrm{ref}}\rVert_2\leq R ∥ θ − θ ref ∥ 2 ≤ R on B R ( θ r e f ) \mathbb{B}_{R}(\theta_{\mathrm{ref}}) B R ( θ ref ) , so the regularized bound follows by the triangle inequality.
Proof of Lemma E.4
Proof. Write the samples in descending score order, so that the top-K K K weights are a j ( τ ) a_j^{(\tau)} a j ( τ ) for j ≤ K j\leq K j ≤ K and the remaining weights are one. Recall from Section 3.3 that D τ = K − ∑ j = 1 K a j ( τ ) = N − W τ D_\tau=K-\sum_{j=1}^{K}a_j^{(\tau)}=N-W_\tau D τ = K − ∑ j = 1 K a j ( τ ) = N − W τ . Since
∇ F τ ( θ ) − ∇ F ( θ ) = ∑ i = 1 N ( w i ( τ ) W τ − 1 N ) g i ( θ ) , \nabla F_\tau(\theta)-\nabla F(\theta)=\sum_{i=1}^{N}\left(\frac{w_i^{(\tau)}}{W_\tau}-\frac{1}{N}\right)g_i(\theta), ∇ F τ ( θ ) − ∇ F ( θ ) = i = 1 ∑ N ( W τ w i ( τ ) − N 1 ) g i ( θ ) ,
and ∥ g i ( θ ) ∥ 2 ≤ s i \lVert g_i(\theta)\rVert_2\leq s_i ∥ g i ( θ ) ∥ 2 ≤ s i , the triangle inequality gives
∥ ∇ F τ ( θ ) − ∇ F ( θ ) ∥ 2 ≤ ∑ i = 1 N ∣ w i ( τ ) W τ − 1 N ∣ s i . \lVert\nabla F_\tau(\theta)-\nabla F(\theta)\rVert_2\leq\sum_{i=1}^{N}\left|\frac{w_i^{(\tau)}}{W_\tau}-\frac{1}{N}\right|s_i. ∥ ∇ F τ ( θ ) − ∇ F ( θ ) ∥ 2 ≤ i = 1 ∑ N W τ w i ( τ ) − N 1 s i .
For a top-K K K sample with rank j j j , the absolute coefficient is
∣ a j ( τ ) W τ − 1 N ∣ = ∣ N a j ( τ ) − W τ ∣ N W τ = ∣ D τ − N ( 1 − a j ( τ ) ) ∣ N W τ . \left|\frac{a_j^{(\tau)}}{W_\tau}-\frac{1}{N}\right|=\frac{|Na_j^{(\tau)}-W_\tau|}{NW_\tau}=\frac{|D_\tau-N(1-a_j^{(\tau)})|}{NW_\tau}. W τ a j ( τ ) − N 1 = N W τ ∣ N a j ( τ ) − W τ ∣ = N W τ ∣ D τ − N ( 1 − a j ( τ ) ) ∣ .
For a sample with rank j > K j>K j > K , the coefficient is
∣ 1 W τ − 1 N ∣ = D τ N W τ . \left|\frac{1}{W_\tau}-\frac{1}{N}\right|=\frac{D_\tau}{NW_\tau}. W τ 1 − N 1 = N W τ D τ .
Combining these two displays proves
∥ ∇ F τ ( θ ) − ∇ F ( θ ) ∥ 2 ≤ C τ . \|\nabla F_\tau(\theta)-\nabla F(\theta)\|_2\le C_\tau. ∥∇ F τ ( θ ) − ∇ F ( θ ) ∥ 2 ≤ C τ .
Taking the supremum over θ ∈ B R ( θ r e f ) \theta\in\mathbb{B}_R(\theta_{\mathrm{ref}}) θ ∈ B R ( θ ref ) gives B τ c l n ( R ) ≤ C τ B_\tau^{\mathrm{cln}}(R)\le C_\tau B τ cln ( R ) ≤ C τ . Also, for every j ≤ K j\le K j ≤ K ,
∣ D τ − N ( 1 − a j ( τ ) ) ∣ ≤ D τ + N ( 1 − a j ( τ ) ) , |D_\tau-N(1-a_j^{(\tau)})|\le D_\tau+N(1-a_j^{(\tau)}), ∣ D τ − N ( 1 − a j ( τ ) ) ∣ ≤ D τ + N ( 1 − a j ( τ ) ) ,
which implies
C τ ≤ D τ s ˉ + ∑ j = 1 K ( 1 − a j ( τ ) ) s ( j ) W τ . C_\tau\le\frac{D_\tau\bar{s}+\sum_{j=1}^{K}(1-a_j^{(\tau)})s_{(j)}}{W_\tau}. C τ ≤ W τ D τ s ˉ + ∑ j = 1 K ( 1 − a j ( τ ) ) s ( j ) .
The same simpler upper bound also follows directly from the alternative decomposition
∇ F τ ( θ ) − ∇ F ( θ ) = 1 W τ [ D τ ∇ F ( θ ) − ∑ j = 1 K ( 1 − a j ( τ ) ) g ( j ) ( θ ) ] , \nabla F_\tau(\theta)-\nabla F(\theta)=\frac{1}{W_\tau}\left[D_\tau\nabla F(\theta)-\sum_{j=1}^{K}(1-a_j^{(\tau)})g_{(j)}(\theta)\right], ∇ F τ ( θ ) − ∇ F ( θ ) = W τ 1 [ D τ ∇ F ( θ ) − j = 1 ∑ K ( 1 − a j ( τ ) ) g ( j ) ( θ ) ] ,
where g ( j ) g_{(j)} g ( j ) denotes the gradient of the sample with the j j j -th largest score. Using ∥ ∇ F ( θ ) ∥ 2 ≤ s ˉ \|\nabla F(\theta)\|_2\le\bar{s} ∥∇ F ( θ ) ∥ 2 ≤ s ˉ and ∥ g ( j ) ( θ ) ∥ 2 ≤ s ( j ) \|g_{(j)}(\theta)\|_2\le s_{(j)} ∥ g ( j ) ( θ ) ∥ 2 ≤ s ( j ) gives
B τ c l n ( R ) ≤ D τ s ˉ + ∑ j = 1 K ( 1 − a j ( τ ) ) s ( j ) W τ . B_\tau^{\mathrm{cln}}(R)\le\frac{D_\tau\bar{s}+\sum_{j=1}^{K}(1-a_j^{(\tau)})s_{(j)}}{W_\tau}. B τ cln ( R ) ≤ W τ D τ s ˉ + ∑ j = 1 K ( 1 − a j ( τ ) ) s ( j ) .
Finally, s ˉ ≤ 2 β \bar{s}\le2\beta s ˉ ≤ 2 β , D τ = ∑ j = 1 K ( 1 − a j ( τ ) ) ≤ K D_\tau=\sum_{j=1}^{K}(1-a_j^{(\tau)})\le K D τ = ∑ j = 1 K ( 1 − a j ( τ ) ) ≤ K , and s ( j ) ≤ 2 β s_{(j)}\le2\beta s ( j ) ≤ 2 β imply the universal bound 4 β K / W τ 4\beta K/W_\tau 4 β K / W τ . The regularized bound follows by adding λ ( θ − θ r e f ) \lambda(\theta-\theta_{\mathrm{ref}}) λ ( θ − θ ref ) and using ∥ θ − θ r e f ∥ 2 ≤ R \|\theta-\theta_{\mathrm{ref}}\|_2\le R ∥ θ − θ ref ∥ 2 ≤ R . The two limiting statements follow by taking a j ( τ ) → 0 a_j^{(\tau)}\to0 a j ( τ ) → 0 as τ ↓ 0 \tau\downarrow0 τ ↓ 0 and a j ( τ ) → 1 a_j^{(\tau)}\to1 a j ( τ ) → 1 as τ → ∞ \tau\to\infty τ → ∞ in the definition of C τ C_\tau C τ . □ \square □
Proof of Lemma E.5
Proof. Let d : = x − y d:=x-y d := x − y and Δ g : = ∇ F ( x ) − ∇ F ( y ) \Delta g:=\nabla F(x)-\nabla F(y) Δ g := ∇ F ( x ) − ∇ F ( y ) . We first recall that for convex L L L -smooth F F F , ∇ F \nabla F ∇ F is 1 / L 1/L 1/ L -cocoercive [10 ] :
⟨ d , Δ g ⟩ ≥ 1 L ∥ Δ g ∥ 2 2 . (20) \langle d,\Delta g\rangle\ge\frac{1}{L}\|\Delta g\|_2^2. \tag*{(20)} ⟨ d , Δ g ⟩ ≥ L 1 ∥Δ g ∥ 2 2 . (20)
Now expand the distance after one GD step:
∥ T ( x ) − T ( y ) ∥ 2 2 = ∥ d − η Δ g ∥ 2 2 = ∥ d ∥ 2 2 − 2 η ⟨ d , Δ g ⟩ + η 2 ∥ Δ g ∥ 2 2 . \|T(x)-T(y)\|_2^2=\|d-\eta\Delta g\|_2^2=\|d\|_2^2-2\eta\langle d,\Delta g\rangle+\eta^2\|\Delta g\|_2^2. ∥ T ( x ) − T ( y ) ∥ 2 2 = ∥ d − η Δ g ∥ 2 2 = ∥ d ∥ 2 2 − 2 η ⟨ d , Δ g ⟩ + η 2 ∥Δ g ∥ 2 2 .
Applying (20) yields
∥ T ( x ) − T ( y ) ∥ 2 2 ≤ ∥ d ∥ 2 2 + ( η 2 − 2 η L ) ∥ Δ g ∥ 2 2 . \|T(x)-T(y)\|_2^2\le\|d\|_2^2+\left(\eta^2-\frac{2\eta}{L}\right)\|\Delta g\|_2^2. ∥ T ( x ) − T ( y ) ∥ 2 2 ≤ ∥ d ∥ 2 2 + ( η 2 − L 2 η ) ∥Δ g ∥ 2 2 .
If 0 < η ≤ 2 / L 0<\eta\le2/L 0 < η ≤ 2/ L , then η 2 − 2 η L ≤ 0 \eta^2-\frac{2\eta}{L}\le0 η 2 − L 2 η ≤ 0 , hence ∥ T ( x ) − T ( y ) ∥ 2 2 ≤ ∥ d ∥ 2 2 \|T(x)-T(y)\|_2^2\le\|d\|_2^2 ∥ T ( x ) − T ( y ) ∥ 2 2 ≤ ∥ d ∥ 2 2 , which implies ∥ T ( x ) − T ( y ) ∥ 2 ≤ ∥ x − y ∥ 2 \|T(x)-T(y)\|_2\le\|x-y\|_2 ∥ T ( x ) − T ( y ) ∥ 2 ≤ ∥ x − y ∥ 2 . □ \square □
Proof of Lemma E.6
Proof. Let T H ( θ ) : = θ − η ∇ H ( θ ) T_H(\theta) := \theta- \eta\nabla H(\theta) T H ( θ ) := θ − η ∇ H ( θ ) and T 0 ( θ ) : = θ − η ∇ F 0 ( θ ) T_0(\theta) := \theta- \eta\nabla F_0(\theta) T 0 ( θ ) := θ − η ∇ F 0 ( θ ) . Since H H H is μ \mu μ -strongly convex and L L L -smooth, and 0 < η ≤ 1 / L 0 < \eta\le1/L 0 < η ≤ 1/ L , the gradient-descent map T H T_H T H is a contraction [71 ] :
∥ T H ( x ) − T H ( y ) ∥ 2 ≤ ( 1 − η μ ) ∥ x − y ∥ 2 . \lVert T_H(x) - T_H(y) \rVert_2 \le(1-\eta\mu)\lVert x-y\rVert_2. ∥ T H ( x ) − T H ( y ) ∥ 2 ≤ ( 1 − η μ ) ∥ x − y ∥ 2 .
Therefore, with Θ t : = θ t a t k − θ t c l n \Theta_t := \theta_t^{\mathrm{atk}}-\theta_t^{\mathrm{cln}} Θ t := θ t atk − θ t cln ,
∥ Θ t + 1 ∥ 2 = ∥ T H ( θ t a t k ) − T 0 ( θ t c l n ) ∥ 2 ≤ ∥ T H ( θ t a t k ) − T H ( θ t c l n ) ∥ 2 + η ∥ ∇ H ( θ t c l n ) − ∇ F 0 ( θ t c l n ) ∥ 2 ≤ ( 1 − η μ ) ∥ Θ t ∥ 2 + η B . \begin{aligned}
\lVert\Theta_{t+1}\rVert_2 &= \lVert T_H(\theta_t^{\mathrm{atk}})-T_0(\theta_t^{\mathrm{cln}})\rVert_2\\
&\le\lVert T_H(\theta_t^{\mathrm{atk}})-T_H(\theta_t^{\mathrm{cln}})\rVert_2+\eta\lVert\nabla H(\theta_t^{\mathrm{cln}})-\nabla F_0(\theta_t^{\mathrm{cln}})\rVert_2\\
&\le(1-\eta\mu)\lVert\Theta_t\rVert_2+\eta B.
\end{aligned} ∥ Θ t + 1 ∥ 2 = ∥ T H ( θ t atk ) − T 0 ( θ t cln ) ∥ 2 ≤ ∥ T H ( θ t atk ) − T H ( θ t cln ) ∥ 2 + η ∥ ∇ H ( θ t cln ) − ∇ F 0 ( θ t cln ) ∥ 2 ≤ ( 1 − η μ ) ∥ Θ t ∥ 2 + η B .
Unrolling this recursion from Θ 0 = 0 \Theta_0=0 Θ 0 = 0 gives
∥ Θ T ∥ 2 ≤ η B ∑ t = 0 T − 1 ( 1 − η μ ) T − 1 − t = B μ ( 1 − ( 1 − η μ ) T ) ≤ B μ . \lVert\Theta_T\rVert_2 \le\eta B\sum_{t=0}^{T-1}(1-\eta\mu)^{T-1-t}=\frac{B}{\mu}\left(1-(1-\eta\mu)^T\right)\le\frac{B}{\mu}. ∥ Θ T ∥ 2 ≤ η B t = 0 ∑ T − 1 ( 1 − η μ ) T − 1 − t = μ B ( 1 − ( 1 − η μ ) T ) ≤ μ B .
Proof of Lemma 2.2
We include the proof in our notation, following the gradient-shift analysis in Yang et al. [92 ] .
Proof. For sample i i i , swapping ( y w i , y l i ) (y_w^i,y_l^i) ( y w i , y l i ) changes ( v i , b i ) (v_i,b_i) ( v i , b i ) to ( − v i , − b i ) (-v_i,-b_i) ( − v i , − b i ) and changes the logit to z i f l i p ( θ ) = − z i ( θ ) z_i^{\mathrm{flip}}(\theta)=-z_i(\theta) z i flip ( θ ) = − z i ( θ ) . Using σ ( − z ) = 1 − σ ( z ) \sigma(-z)=1-\sigma(z) σ ( − z ) = 1 − σ ( z ) and g i ( θ ) = β ( σ ( z i ( θ ) ) − 1 ) v i g_i(\theta)=\beta(\sigma(z_i(\theta))-1)v_i g i ( θ ) = β ( σ ( z i ( θ )) − 1 ) v i , we obtain
g i f l i p ( θ ) = β ( σ ( − z i ( θ ) ) − 1 ) ( − v i ) = β σ ( z i ( θ ) ) v i . g_i^{\mathrm{flip}}(\theta)=\beta(\sigma(-z_i(\theta))-1)(-v_i)=\beta\sigma(z_i(\theta))v_i. g i flip ( θ ) = β ( σ ( − z i ( θ )) − 1 ) ( − v i ) = β σ ( z i ( θ )) v i .
Therefore g i f l i p ( θ ) − g i ( θ ) = β v i g_i^{\mathrm{flip}}(\theta)-g_i(\theta)=\beta v_i g i flip ( θ ) − g i ( θ ) = β v i .
Proof of Theorem 3.1
Proof. By the decomposition before the theorem,
∇ F ~ G , A ( θ ) − ∇ F ( θ ) = ( ∇ F G ( θ ) − ∇ F ( θ ) ) + 1 ∣ G ∣ ∑ i ∈ A ∩ G β v i . \nabla\widetilde{F}_{G,A}(\theta)-\nabla F(\theta)=\left(\nabla F_G(\theta)-\nabla F(\theta)\right)+\frac{1}{\lvert G\rvert}\sum_{i\in A\cap G}\beta v_i. ∇ F G , A ( θ ) − ∇ F ( θ ) = ( ∇ F G ( θ ) − ∇ F ( θ ) ) + ∣ G ∣ 1 i ∈ A ∩ G ∑ β v i .
The first term is bounded by B G c l n ( R ) B_G^{\mathrm{cln}}(R) B G cln ( R ) by definition. For the second term,
∥ 1 ∣ G ∣ ∑ i ∈ A ∩ G β v i ∥ 2 ≤ 1 ∣ G ∣ ∑ i ∈ A ∩ G ∥ β v i ∥ 2 = 1 ∣ G ∣ ∑ i ∈ A ∩ G s i ≤ ∣ A ∩ G ∣ ∣ G ∣ max i ∈ G s i ≤ K N − K δ ( K ) . \left\lVert\frac{1}{\lvert G\rvert}\sum_{i\in A\cap G}\beta v_i\right\rVert_2\le\frac{1}{\lvert G\rvert}\sum_{i\in A\cap G}\lVert\beta v_i\rVert_2=\frac{1}{\lvert G\rvert}\sum_{i\in A\cap G}s_i\le\frac{\lvert A\cap G\rvert}{\lvert G\rvert}\max_{i\in G}s_i\le\frac{K}{N-K}\delta(K). ∣ G ∣ 1 i ∈ A ∩ G ∑ β v i 2 ≤ ∣ G ∣ 1 i ∈ A ∩ G ∑ ∥ β v i ∥ 2 = ∣ G ∣ 1 i ∈ A ∩ G ∑ s i ≤ ∣ G ∣ ∣ A ∩ G ∣ i ∈ G max s i ≤ N − K K δ ( K ) .
Combining the two bounds proves the claim.
Proof of Theorem 3.2
Proof. The Hessian of F ~ G , A \widetilde{F}_{G,A} F G , A is the same as the Hessian of F G F_G F G , because label swaps replace ( v i , z i ) (v_i,z_i) ( v i , z i ) by ( − v i , − z i ) (-v_i,-z_i) ( − v i , − z i ) and leave σ ( z i ) ( 1 − σ ( z i ) ) v i v i T \sigma(z_i)(1-\sigma(z_i))v_iv_i^{\mathsf T} σ ( z i ) ( 1 − σ ( z i )) v i v i T unchanged. Thus, by Lemma E.2, F ~ G , A \widetilde{F}_{G,A} F G , A is μ G \mu_G μ G -strongly convex and β 2 \beta^2 β 2 -smooth on the bounded region. Theorem 3.1 gives the uniform perturbation bound
sup θ ∈ B R ( θ r e f ) ∥ ∇ F ~ G , A ( θ ) − ∇ F ( θ ) ∥ 2 ≤ B G c l n ( R ) + K N − K δ ( K ) . \sup_{\theta\in B_R(\theta_{\mathrm{ref}})}\lVert\nabla\widetilde{F}_{G,A}(\theta)-\nabla F(\theta)\rVert_2\le B_G^{\mathrm{cln}}(R)+\frac{K}{N-K}\delta(K). θ ∈ B R ( θ ref ) sup ∥ ∇ F G , A ( θ ) − ∇ F ( θ ) ∥ 2 ≤ B G cln ( R ) + N − K K δ ( K ) .
Applying Lemma E.6 with F 0 = F F_0=F F 0 = F , H = F ~ G , A H=\widetilde{F}_{G,A} H = F G , A , μ = μ G \mu=\mu_G μ = μ G , L = β 2 L=\beta^2 L = β 2 , and
B = B G c l n ( R ) + K N − K δ ( K ) B=B_G^{\mathrm{cln}}(R)+\frac{K}{N-K}\delta(K) B = B G cln ( R ) + N − K K δ ( K )
proves the stated bound.
Proof of Corollary 3.3
Proof. Fix x x x and define the log-partition
A x ( θ ) : = log ∑ y exp ( ⟨ θ , ψ ( x , y ) ⟩ ) . A_x(\theta) := \log\sum_y \exp\left(\langle\theta,\psi(x,y)\rangle\right). A x ( θ ) := log y ∑ exp ( ⟨ θ , ψ ( x , y )⟩ ) .
Under Assumption 2.1 (∥ ψ ( x , y ) ∥ 2 ≤ 1 \|\psi(x,y)\|_2 \le1 ∥ ψ ( x , y ) ∥ 2 ≤ 1 ), we have ∥ ∇ 2 A x ( θ ) ∥ o p ≤ 1 \|\nabla^2 A_x(\theta)\|_{\mathrm{op}} \le1 ∥ ∇ 2 A x ( θ ) ∥ op ≤ 1 for all θ \theta θ , hence A x A_x A x is 1-smooth. Moreover, π θ ( ⋅ ∣ x ) \pi_\theta(\cdot|x) π θ ( ⋅ ∣ x ) is the exponential family induced by A x A_x A x , and the conditional KL admits the standard Bregman form
D K L ( π θ ( ⋅ ∣ x ) ∥ π θ ′ ( ⋅ ∣ x ) ) = A x ( θ ′ ) − A x ( θ ) − ⟨ ∇ A x ( θ ) , θ ′ − θ ⟩ . D_{\mathrm{KL}}\left(\pi_\theta(\cdot|x)\mathrel{\|}\pi_{\theta'}(\cdot|x)\right) = A_x(\theta') - A_x(\theta) - \langle\nabla A_x(\theta),\theta' - \theta\rangle. D KL ( π θ ( ⋅ ∣ x ) ∥ π θ ′ ( ⋅ ∣ x ) ) = A x ( θ ′ ) − A x ( θ ) − ⟨ ∇ A x ( θ ) , θ ′ − θ ⟩ .
By 1-smoothness of A x A_x A x , the descent inequality implies that for all θ , θ ′ \theta,\theta' θ , θ ′ ,
A x ( θ ′ ) ≤ A x ( θ ) + ⟨ ∇ A x ( θ ) , θ ′ − θ ⟩ + 1 2 ∥ θ ′ − θ ∥ 2 2 . A_x(\theta') \le A_x(\theta) + \langle\nabla A_x(\theta),\theta' - \theta\rangle+ \frac{1}{2}\|\theta' - \theta\|_2^2. A x ( θ ′ ) ≤ A x ( θ ) + ⟨ ∇ A x ( θ ) , θ ′ − θ ⟩ + 2 1 ∥ θ ′ − θ ∥ 2 2 .
Rearranging yields the Bregman bound
A x ( θ ′ ) − A x ( θ ) − ⟨ ∇ A x ( θ ) , θ ′ − θ ⟩ ≤ 1 2 ∥ θ ′ − θ ∥ 2 2 . A_x(\theta') - A_x(\theta) - \langle\nabla A_x(\theta),\theta' - \theta\rangle\le\frac{1}{2}\|\theta' - \theta\|_2^2. A x ( θ ′ ) − A x ( θ ) − ⟨ ∇ A x ( θ ) , θ ′ − θ ⟩ ≤ 2 1 ∥ θ ′ − θ ∥ 2 2 .
Thus
D K L ( π θ ( ⋅ ∣ x ) ∥ π θ ′ ( ⋅ ∣ x ) ) ≤ 1 2 ∥ θ − θ ′ ∥ 2 2 . D_{\mathrm{KL}}\left(\pi_\theta(\cdot|x)\mathrel{\|}\pi_{\theta'}(\cdot|x)\right) \le\frac{1}{2}\|\theta-\theta'\|_2^2. D KL ( π θ ( ⋅ ∣ x ) ∥ π θ ′ ( ⋅ ∣ x ) ) ≤ 2 1 ∥ θ − θ ′ ∥ 2 2 .
Substituting ( θ , θ ′ ) = ( θ T a t k , θ T c l n ) (\theta,\theta') = (\theta_T^{\mathrm{atk}},\theta_T^{\mathrm{cln}}) ( θ , θ ′ ) = ( θ T atk , θ T cln ) proves the first claim, and taking expectation over x x x preserves the inequality. Finally, apply Theorem 3.2 to bound ∥ θ T a t k − θ T c l n ∥ 2 \|\theta_T^{\mathrm{atk}}-\theta_T^{\mathrm{cln}}\|_2 ∥ θ T atk − θ T cln ∥ 2 . □
Proof of Theorem 3.4
Proof. For any attack set A A A with ∣ A ∣ ≤ K |A| \le K ∣ A ∣ ≤ K ,
∇ F ~ τ , A ( θ ) − ∇ F ( θ ) = ( ∇ F τ ( θ ) − ∇ F ( θ ) ) + 1 W τ ∑ i ∈ A w i ( τ ) β v i . \nabla\widetilde{F}_{\tau,A}(\theta)-\nabla F(\theta) = \left(\nabla F_\tau(\theta)-\nabla F(\theta)\right) + \frac{1}{W_\tau}\sum_{i\in A}w_i^{(\tau)}\beta v_i. ∇ F τ , A ( θ ) − ∇ F ( θ ) = ( ∇ F τ ( θ ) − ∇ F ( θ ) ) + W τ 1 i ∈ A ∑ w i ( τ ) β v i .
The first term is bounded by B τ c l n ( R ) B_\tau^{\mathrm{cln}}(R) B τ cln ( R ) by definition. For the second term, using ∥ β v i ∥ 2 = s i \|\beta v_i\|_2=s_i ∥ β v i ∥ 2 = s i gives
∥ 1 W τ ∑ i ∈ A w i ( τ ) β v i ∥ 2 ≤ 1 W τ ∑ i ∈ A w i ( τ ) s i = 1 W τ ∑ i ∈ A ρ i ( τ ) ≤ Γ τ ( K ) W τ , \left\|\frac{1}{W_\tau}\sum_{i\in A}w_i^{(\tau)}\beta v_i\right\|_2 \le\frac{1}{W_\tau}\sum_{i\in A}w_i^{(\tau)}s_i = \frac{1}{W_\tau}\sum_{i\in A}\rho_i^{(\tau)} \le\frac{\Gamma_\tau(K)}{W_\tau}, W τ 1 i ∈ A ∑ w i ( τ ) β v i 2 ≤ W τ 1 i ∈ A ∑ w i ( τ ) s i = W τ 1 i ∈ A ∑ ρ i ( τ ) ≤ W τ Γ τ ( K ) ,
where the last inequality follows from the definition of Γ τ ( K ) \Gamma_\tau(K) Γ τ ( K ) as the largest possible sum of K K K weighted impacts. This proves (14) .
For the exponential weights, every original top-K K K sample has weight at most ε τ = e − 1 / τ \varepsilon_\tau=e^{-1/\tau} ε τ = e − 1/ τ , and every sample outside the original top-K K K has score at most δ ( K ) \delta(K) δ ( K ) . Therefore, for any A A A with ∣ A ∣ ≤ K |A| \le K ∣ A ∣ ≤ K ,
∑ i ∈ A ρ i ( τ ) ≤ ε τ ∑ j = 1 K s ( j ) + K δ ( K ) . \sum_{i\in A}\rho_i^{(\tau)} \le\varepsilon_\tau\sum_{j=1}^{K}s_{(j)} + K\delta(K). i ∈ A ∑ ρ i ( τ ) ≤ ε τ j = 1 ∑ K s ( j ) + K δ ( K ) .
Taking the maximum over A A A proves the upper-bound for Γ τ ( K ) \Gamma_\tau(K) Γ τ ( K ) . □
Proof of Theorem 3.5
Proof. The Hessian of F ~ τ , A \widetilde{F}_{\tau,A} F τ , A is the same as the Hessian of F τ F_\tau F τ , because label swaps leave each matrix σ ( z i ) ( 1 − σ ( z i ) ) v i v i T \sigma(z_i)(1-\sigma(z_i))v_i v_i^\mathsf{T} σ ( z i ) ( 1 − σ ( z i )) v i v i T unchanged. The weighted clean objective satisfies
∇ 2 F τ ( θ ) = 1 W τ ∑ i = 1 N w i ( τ ) β 2 σ ( z i ( θ ) ) ( 1 − σ ( z i ( θ ) ) ) v i v i T . \nabla^2 F_\tau(\theta) = \frac{1}{W_\tau}\sum_{i=1}^{N}w_i^{(\tau)}\beta^2\sigma(z_i(\theta))(1-\sigma(z_i(\theta)))v_i v_i^\mathsf{T}. ∇ 2 F τ ( θ ) = W τ 1 i = 1 ∑ N w i ( τ ) β 2 σ ( z i ( θ )) ( 1 − σ ( z i ( θ ))) v i v i T .
By the definitions of c τ ( R ) c_\tau(R) c τ ( R ) and Σ τ \Sigma_\tau Σ τ ,
∇ 2 F τ ( θ ) ⪰ β 2 c τ ( R ) Σ τ ⪰ μ τ I \nabla^2 F_\tau(\theta) \succeq\beta^2 c_\tau(R)\Sigma_\tau\succeq\mu_\tau I ∇ 2 F τ ( θ ) ⪰ β 2 c τ ( R ) Σ τ ⪰ μ τ I
for all θ ∈ B R ( θ r e f ) \theta\in\mathbb{B}_R(\theta_{\mathrm{ref}}) θ ∈ B R ( θ ref ) . Thus F ~ τ , A \widetilde{F}_{\tau,A} F τ , A is μ τ \mu_\tau μ τ -strongly convex on the bounded region and is β 2 \beta^2 β 2 -smooth by Lemma E.1 . Theorem 3.4 gives
sup θ ∈ B R ( θ r e f ) ∥ ∇ F ~ τ , A ( θ ) − ∇ F ( θ ) ∥ 2 ≤ B τ c l n ( R ) + Γ τ ( K ) W τ . \sup_{\theta\in\mathbb{B}_R(\theta_{\mathrm{ref}})} \left\|\nabla\widetilde{F}_{\tau,A}(\theta)-\nabla F(\theta)\right\|_2 \le B_{\tau}^{\mathrm{cln}}(R)+\frac{\Gamma_\tau(K)}{W_\tau}. θ ∈ B R ( θ ref ) sup ∇ F τ , A ( θ ) − ∇ F ( θ ) 2 ≤ B τ cln ( R ) + W τ Γ τ ( K ) .
Applying Lemma E.6 with F 0 = F F_0=F F 0 = F , H = F ~ τ , A H=\widetilde{F}_{\tau,A} H = F τ , A , μ = μ τ \mu=\mu_\tau μ = μ τ , L = β 2 L=\beta^2 L = β 2 , and
B = B τ c l n ( R ) + Γ τ ( K ) W τ B=B_{\tau}^{\mathrm{cln}}(R)+\frac{\Gamma_\tau(K)}{W_\tau} B = B τ cln ( R ) + W τ Γ τ ( K )
proves the first displayed bound. The second follows by substituting the coarse bound (15).
Proof of Corollary 3.6
Proof. The KL-to-parameter conversion is the same as in the proof of Corollary 3.3 . Applying Theorem 3.5 gives the stated bound.
Proof of Proposition 3.7
Proof. On the bounded region, F R F_{\mathfrak{R}} F R is μ R \mu_{\mathfrak{R}} μ R -strongly convex and β 2 \beta^2 β 2 -smooth by assumption. Adding the quadratic regularizer adds Hessian λ I \lambda I λ I . Hence
∇ 2 F R , λ ( θ ) = ∇ 2 F R ( θ ) + λ I ⪰ ( μ R + λ ) I , \nabla^2 F_{\mathfrak{R},\lambda}(\theta)=\nabla^2 F_{\mathfrak{R}}(\theta)+\lambda I \succeq(\mu_{\mathfrak{R}}+\lambda)I, ∇ 2 F R , λ ( θ ) = ∇ 2 F R ( θ ) + λ I ⪰ ( μ R + λ ) I ,
and
∥ ∇ 2 F R , λ ( θ ) ∥ o p ≤ ∥ ∇ 2 F R ( θ ) ∥ o p + λ ≤ β 2 + λ . \left\|\nabla^2 F_{\mathfrak{R},\lambda}(\theta)\right\|_{\mathrm{op}}\leq\left\|\nabla^2 F_{\mathfrak{R}}(\theta)\right\|_{\mathrm{op}}+\lambda\leq\beta^2+\lambda. ∇ 2 F R , λ ( θ ) op ≤ ∇ 2 F R ( θ ) op + λ ≤ β 2 + λ .
This proves ( μ R + λ ) (\mu_{\mathfrak{R}}+\lambda) ( μ R + λ ) -strong convexity and ( β 2 + λ ) (\beta^2+\lambda) ( β 2 + λ ) -smoothness.
Proof of Corollary 3.8
Proof. Fix R ∈ { G , τ } \mathfrak{R}\in\{G,\tau\} R ∈ { G , τ } and an admissible attack set A A A . Assumption 2.3 supplies the bounded training region and curvature on the directions updated by both runs. By Lemma 2.2 , label flips change the gradient of either fixed robust objective by a constant vector. Consequently, F ~ R , λ , A \widetilde{F}_{\mathfrak{R},\lambda,A} F R , λ , A has the same Hessian as F R , λ F_{\mathfrak{R},\lambda} F R , λ and, by Proposition 3.7 , is ( μ R + λ ) (\mu_{\mathfrak{R}}+\lambda) ( μ R + λ ) -strongly convex and ( β 2 + λ ) (\beta^2+\lambda) ( β 2 + λ ) -smooth on that region, in the trained coordinates of Assumption 2.3. The regularizer cancels from the attacked-to-clean robust difference, giving
∇ F ~ R , λ , A ( θ ) − ∇ F ( θ ) = ( ∇ F R , λ ( θ ) − ∇ F ( θ ) ) + ( ∇ F ~ R , λ , A ( θ ) − ∇ F R , λ ( θ ) ) . \nabla\widetilde{F}_{\mathfrak{R},\lambda,A}(\theta)-\nabla F(\theta)=\left(\nabla F_{\mathfrak{R},\lambda}(\theta)-\nabla F(\theta)\right)+\left(\nabla\widetilde{F}_{\mathfrak{R},\lambda,A}(\theta)-\nabla F_{\mathfrak{R},\lambda}(\theta)\right). ∇ F R , λ , A ( θ ) − ∇ F ( θ ) = ( ∇ F R , λ ( θ ) − ∇ F ( θ ) ) + ( ∇ F R , λ , A ( θ ) − ∇ F R , λ ( θ ) ) .
The first term has norm at most B R , λ c l n ( R ) B_{\mathfrak{R},\lambda}^{\mathrm{cln}}(R) B R , λ cln ( R ) . The second has norm at most Δ R − B R c l n ( R ) \Delta_{\mathfrak{R}}-B_{\mathfrak{R}}^{\mathrm{cln}}(R) Δ R − B R cln ( R ) : this is K δ ( K ) / ( N − K ) K\delta(K)/(N-K) K δ ( K ) / ( N − K ) by the proof of Theorem 3.1 when R = G \mathfrak{R}=G R = G , and Γ τ ( K ) / W τ \Gamma_\tau(K)/W_\tau Γ τ ( K ) / W τ by the proof of Theorem 3.4 when R = τ \mathfrak{R}=\tau R = τ . The common initialization and Assumption 2.3 place both trajectories in the same affine training space. Restricting to its coordinates preserves the updates and cannot increase the gradient-perturbation bound. Apply Lemma E.6 in those coordinates with F 0 = F F_0=F F 0 = F , H = F ~ R , λ , A H=\widetilde{F}_{\mathfrak{R},\lambda,A} H = F R , λ , A , μ = μ R + λ \mu=\mu_{\mathfrak{R}}+\lambda μ = μ R + λ , L = β 2 + λ L=\beta^2+\lambda L = β 2 + λ , and
B = B R , λ c l n ( R ) + Δ R − B R c l n ( R ) B=B_{\mathfrak{R},\lambda}^{\mathrm{cln}}(R)+\Delta_{\mathfrak{R}}-B_{\mathfrak{R}}^{\mathrm{cln}}(R) B = B R , λ cln ( R ) + Δ R − B R cln ( R )
to obtain the first inequality. For the second, use B R , λ c l n ( R ) ≤ B R c l n ( R ) + λ R B_{\mathfrak{R},\lambda}^{\mathrm{cln}}(R)\leq B_{\mathfrak{R}}^{\mathrm{cln}}(R)+\lambda R B R , λ cln ( R ) ≤ B R cln ( R ) + λ R and Δ R ≤ Δ ‾ R \Delta_{\mathfrak{R}}\leq\overline{\Delta}_{\mathfrak{R}} Δ R ≤ Δ R . The latter follows from Lemma E.3 for G G G , and Theorem 3.4 together with Lemma E.4 for τ \tau τ .
Proof of Corollary 3.9
Proof. Fix either R ∈ { G , τ } \mathfrak{R}\in\{G,\tau\} R ∈ { G , τ } . As in the proof of Corollary 3.6, Assumption 2.1 implies that the log-partition function is 1-smooth. Its Bregman-divergence representation of conditional KL therefore gives, for every prompt x x x ,
D K L ( π θ T a t k ( ⋅ ∣ x ) ∥ π θ T c l n ( ⋅ ∣ x ) ) ≤ 1 2 ∥ θ T a t k − θ T c l n ∥ 2 2 . D_{\mathrm{KL}}\left(\pi_{\theta_T^{\mathrm{atk}}}(\cdot\mid x)\,\|\,\pi_{\theta_T^{\mathrm{cln}}}(\cdot\mid x)\right)\leq\frac{1}{2}\left\|\theta_T^{\mathrm{atk}}-\theta_T^{\mathrm{cln}}\right\|_2^2. D KL ( π θ T atk ( ⋅ ∣ x ) ∥ π θ T cln ( ⋅ ∣ x ) ) ≤ 2 1 θ T atk − θ T cln 2 2 .
The parameter-distance term is independent of x x x . Taking expectation over prompts and applying Corollary 3.8 yields
E x [ D K L ( π θ T a t k ( ⋅ ∣ x ) ∥ π θ T c l n ( ⋅ ∣ x ) ) ] ≤ 1 2 ∥ θ T a t k − θ T c l n ∥ 2 2 ≤ 1 2 ( Δ ‾ R + λ R μ R + λ ) 2 , \mathbb{E}_x\left[D_{\mathrm{KL}}\left(\pi_{\theta_T^{\mathrm{atk}}}(\cdot\mid x)\,\|\,\pi_{\theta_T^{\mathrm{cln}}}(\cdot\mid x)\right)\right]\leq\frac{1}{2}\left\|\theta_T^{\mathrm{atk}}-\theta_T^{\mathrm{cln}}\right\|_2^2\leq\frac{1}{2}\left(\frac{\overline{\Delta}_{\mathfrak{R}}+\lambda R}{\mu_{\mathfrak{R}}+\lambda}\right)^2, E x [ D KL ( π θ T atk ( ⋅ ∣ x ) ∥ π θ T cln ( ⋅ ∣ x ) ) ] ≤ 2 1 θ T atk − θ T cln 2 2 ≤ 2 1 ( μ R + λ Δ R + λ R ) 2 ,
which proves (17).
Experiments: Additional details for the SHP simulation
Data and feature construction. The SHP simulation uses 200,000 decoded preference pairs from the SHP training split (seed 0), followed by an 80/20 train/test split that yields 160,000 training pairs and 40,000 held-out test pairs. For each example, we use the feature difference v i v_i v i defined in (3) . We concatenate the prompt and response with two newline characters, tokenize with a maximum length of 256 tokens, and extract the final-layer CLS representation from sentence-transformers/all-MiniLM-L6-v2. We ℓ 2 \ell_2 ℓ 2 -normalize this vector to obtain ψ ( x , y ) ∈ R 384 \psi(x,y) \in\mathbb{R}^{384} ψ ( x , y ) ∈ R 384 , so ∥ v i ∥ 2 ≤ 2 \lVert v_i\rVert_2 \le2 ∥ v i ∥ 2 ≤ 2 . This instantiates the log-linear DPO parameterization. SHP is a public Reddit-derived preference dataset. We cite its associated paper and follow the dataset-card terms. The embedding model sentence-transformers/all-MiniLM-L6-v2 is released under the Apache-2.0 license.
Reference policy. The reference parameter θ r e f ∈ R 384 \theta_{\mathrm{ref}} \in\mathbb{R}^{384} θ ref ∈ R 384 is trained independently of the DPO runs on the same training split using a pairwise logistic ranking loss
L r e f ( θ ) = E i [ log ( 1 + exp ( − ⟨ θ , v i ⟩ ) ) ] + λ r e f 2 ∥ θ ∥ 2 2 \mathcal{L}_{\mathrm{ref}}(\theta) = \mathbb{E}_i \left[\log(1+\exp(-\langle\theta,v_i\rangle))\right] + \frac{\lambda_{\mathrm{ref}}}{2}\lVert\theta\rVert_2^2 L ref ( θ ) = E i [ log ( 1 + exp ( − ⟨ θ , v i ⟩)) ] + 2 λ ref ∥ θ ∥ 2 2
with λ r e f = 10 − 3 \lambda_{\mathrm{ref}} = 10^{-3} λ ref = 1 0 − 3 , 5,000 mini-batch SGD steps, learning rate 0.25, and batch size 100,000. The resulting parameter has ∥ θ r e f ∥ 2 ≈ 2.26 \lVert\theta_{\mathrm{ref}}\rVert_2 \approx2.26 ∥ θ ref ∥ 2 ≈ 2.26 . The reference parameter defines the reference-policy log-ratio in the DPO loss, provides the common initialization, and anchors the quadratic regularizer. It is not treated as a near-optimal policy. All DPO and robust-DPO runs are initialized at θ 0 = θ r e f \theta_0 = \theta_{\mathrm{ref}} θ 0 = θ ref .
Optimization and attack configuration. All models are trained by SGD with learning rate 0.25, batch size 25,600, and 100,000 optimization steps, with full-batch evaluation every 100 steps. We set β = 1 \beta= 1 β = 1 and attack fraction 0.3, giving a nominal attacked-scenario budget of K = ⌊ 0.3 ⋅ 160,000 ⌋ = 48,000 K = \lfloor0.3 \cdot160{,}000\rfloor= 48{,}000 K = ⌊ 0.3 ⋅ 160 , 000 ⌋ = 48 , 000 flipped training pairs. Four attack settings are considered:
No attack: the training data is clean.
Random corruption: K K K training pairs are randomly selected and flipped.
Top-impact attack: K K K training pairs with the largest impact scores s i = β ∥ v i ∥ 2 s_i = \beta\lVert v_i\rVert_2 s i = β ∥ v i ∥ 2 are flipped.
Targeted BMP-A attack ([92 ] ): K K K training pairs are selected by BMP-A, a gradient-space label-flip attack that drives DPO toward the target policy θ † = 2 θ r e f − θ ⋆ \theta^\dagger= 2\theta_{\mathrm{ref}} - \theta^\star θ † = 2 θ ref − θ ⋆ . The detailed procedure and construction of this adversarial attack are provided in Appendix § 15 .
For the attacked scenarios, TRIM and TRIM_REG remove the top-K K K examples under the observed impact ranking (K = 48,000 K = 48{,}000 K = 48 , 000 , leaving 112,000 training pairs). The REG variants use λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 . For the no-attack control, we set K = 0 K = 0 K = 0 while keeping λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 for the REG controls. The unregularized proposed defenses then reduce to standard DPO, and the REG variants reduce to full-data regularized DPO. For SOFT_TRIM and SOFT_TRIM_REG, the full training set is retained with exponential weights at τ = 20,000 \tau= 20{,}000 τ = 20 , 000 . When K = 0 K = 0 K = 0 , all weights are one. We also run a clean-data wrong-K K K stress test in which the realized attack budget is zero but the defender uses the nominal attacked-scenario budget K = 48,000 K = 48{,}000 K = 48 , 000 . This measures the clean-data cost of overestimating K K K .
Compute resources. The reported runs used Apple Silicon M4 Max with MPS for sequential preprocessing, clean-reference training, and targeted-attack construction. The remaining algorithm cases were dispatched to CPU worker processes. The logged run used 64GB unified memory, 12 performance cores, 4 efficiency cores, 14 parallel workers, and finished the full no-attack, random, top-impact, and targeted-BMP-A sweep in about two hours.
Compared models and legend names. We use the shorthand defined in § 4 : DPO, DPO_REG, TRIM, TRIM_REG, SOFT_TRIM, and SOFT_TRIM_REG. The additional baselines are DR_DPO, NR_DPO, WDPO, and KL_DPO (Appendix § 17 ). In the conservative wrong-K K K scenario, “DPO (trimmed data)” denotes DPO trained on the retained clean subset. In the ordinary no-attack scenario (K = 0 K = 0 K = 0 ), no pairs are removed and the legend uses DPO. The matched full-data DPO_REG control uses the same observed labels and λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 without trimming or downweighting (Appendix § 18 ). The clean full-set DPO reference is displayed as π ⋆ \pi^\star π ⋆ in policy KL and as θ ⋆ \theta^\star θ ⋆ in parameter L 2 L_2 L 2 plots.
Evaluation metrics. Our primary metric is the candidate-set policy distance , defined as the average categorical KL between two induced finite-action policies on held-out prompts. For each evaluation prompt x x x , we construct an indexed candidate list of size M = 100 M = 100 M = 100 :
Y ( x ) = ( y w , y l , y n e g ( 1 ) , … , y n e g ( M − 2 ) ) . \mathcal{Y}(x) = (y_w, y_l, y_{\mathrm{neg}}^{(1)}, \ldots, y_{\mathrm{neg}}^{(M-2)}). Y ( x ) = ( y w , y l , y neg ( 1 ) , … , y neg ( M − 2 ) ) .
The response pool contains both responses from each of the 160,000 training pairs, with duplicate and empty strings removed. We sample M − 2 = 98 M - 2 = 98 M − 2 = 98 additional responses with replacement using seed 123, excluding strings equal to y w y_w y w or y l y_l y l . Repeated sampled responses remain separate candidate entries. Writing Y j ( x ) \mathcal{Y}_j(x) Y j ( x ) for entry j j j , the evaluated categorical policy is
π θ ( j ∣ x ; Y ( x ) ) = exp ( ⟨ θ , ψ ( x , Y j ( x ) ) ⟩ ) ∑ k = 1 M exp ( ⟨ θ , ψ ( x , Y k ( x ) ) ⟩ ) . \pi_\theta(j \mid x;\mathcal{Y}(x)) = \frac{\exp(\langle\theta, \psi(x,\mathcal{Y}_j(x))\rangle)}{\sum_{k=1}^{M} \exp(\langle\theta, \psi(x,\mathcal{Y}_k(x))\rangle)}. π θ ( j ∣ x ; Y ( x )) = ∑ k = 1 M exp (⟨ θ , ψ ( x , Y k ( x ))⟩) exp (⟨ θ , ψ ( x , Y j ( x ))⟩) .
The same candidate lists are fixed across all compared methods and checkpoints. We then report
candKL ( θ ) : = E x [ KL ( π ⋆ ( ⋅ ∣ x ; Y ( x ) ) ∥ π θ ( ⋅ ∣ x ; Y ( x ) ) ) ] . \operatorname{candKL}(\theta) := \mathbb{E}_x\left[\operatorname{KL}\left(\pi^\star(\cdot\mid x;\mathcal{Y}(x)) \,\|\, \pi_\theta(\cdot\mid x;\mathcal{Y}(x))\right)\right]. candKL ( θ ) := E x [ KL ( π ⋆ ( ⋅ ∣ x ; Y ( x )) ∥ π θ ( ⋅ ∣ x ; Y ( x )) ) ] .
averaged over 5,000 held-out prompts. We also record parameter distance ∥ θ − θ ⋆ ∥ 2 \lVert\theta- \theta^\star\rVert_2 ∥ θ − θ ⋆ ∥ 2 , but candKL is the primary metric as it measures the downstream policy deviation on a richer action space, and it reflects the effect of attack and defense more directly.
Candidate-set KL measures deviation from the clean-DPO policy on the fixed evaluation candidates. It does not directly measure absolute response quality.
Experiments: BMP-A Targeted Attack: Full Construction
This appendix explains how we instantiate the Binary Matching Pursuit Attack (BMP-A) from Yang et al. [92 ] in our robust DPO experiments. BMP-A is used only to generate the attacked training set. All robust defense methods then train on this same attacked dataset or on the corresponding trimmed subset. BMP-A selects flips to match an attacker-chosen target gradient, whereas top-impact selects by magnitude and random corruption selects uniformly. Their realized policy effects depend on the target, budget, and data geometry.
Gradient-space reduction. Recall the feature difference v i v_i v i and affine logit z i ( θ ) z_i(\theta) z i ( θ ) from (3) . In our SHP simulation, the reference policy is parameterized by θ r e f \theta_{\mathrm{ref}} θ ref , so b i = ⟨ θ r e f , v i ⟩ b_i = \langle\theta_{\mathrm{ref}}, v_i\rangle b i = ⟨ θ ref , v i ⟩ and the logit specializes to
z i ( θ ) = β ⟨ θ − θ r e f , v i ⟩ . z_i(\theta) = \beta\langle\theta- \theta_{\mathrm{ref}}, v_i\rangle. z i ( θ ) = β ⟨ θ − θ ref , v i ⟩ .
By Lemma 2.2 , flipping pair i i i changes the clean per-sample gradient g i ( θ ) g_i(\theta) g i ( θ ) by the fixed vector β v i \beta v_i β v i . Thus a support A A A changes the unnormalized gradient sum by ∑ i ∈ A β v i \sum_{i\in A}\beta v_i ∑ i ∈ A β v i , or the gradient of the averaged objective F F F by N − 1 ∑ i ∈ A β v i N^{-1}\sum_{i\in A}\beta v_i N − 1 ∑ i ∈ A β v i . This is the key observation used in Yang et al. [92 ] : targeted label flipping can be formulated as a sparse binary approximation problem in gradient space.
Target policy. We choose the adversarial target as the reflection of the clean DPO solution across the reference parameter,
θ † = 2 θ r e f − θ ⋆ . \theta^\dagger= 2\theta_{\mathrm{ref}} - \theta^\star. θ † = 2 θ ref − θ ⋆ .
This target asks the attacked optimizer to move away from θ r e f \theta_{\mathrm{ref}} θ ref by roughly the same distance as the clean optimizer, but in the opposite direction. Define the unnormalized clean-gradient sum and its cancelling target vector by
g † : = ∑ i = 1 N g i ( θ † ) , y : = − g † . g^\dagger:= \sum_{i=1}^{N} g_i(\theta^\dagger), \qquad y := -g^\dagger. g † := i = 1 ∑ N g i ( θ † ) , y := − g † .
If the attacker can find a flip set A A A such that ∑ i ∈ A β v i ≈ y \sum_{i\in A}\beta v_i \approx y ∑ i ∈ A β v i ≈ y , then the attacked DPO gradient at θ † \theta^\dagger θ † is close to zero. Thus θ † \theta^\dagger θ † becomes an approximate stationary point of the attacked objective.
Sparse binary attack problem. Let
V a t k : = [ β v 1 , … , β v N ] ∈ R d × N . V_{\mathrm{atk}} := [\beta v_1,\ldots,\beta v_N] \in\mathbb{R}^{d\times N}. V atk := [ β v 1 , … , β v N ] ∈ R d × N .
The attacker seeks a binary selector x ∈ { 0 , 1 } N x \in\{0,1\}^N x ∈ { 0 , 1 } N with ∥ x ∥ 0 ≤ K \lVert x\rVert_0 \le K ∥ x ∥ 0 ≤ K such that
V a t k x ≈ y . (21) V_{\mathrm{atk}}x \approx y. \tag*{(21)} V atk x ≈ y . (21)
Here x i = 1 x_i = 1 x i = 1 means that pair i i i is flipped. This is the same gradient-space attack formulation as in Yang et al. [92 ] , specialized to the target θ † \theta^\dagger θ † used in our experiments.
BMP-A selection rule. BMP-A is a greedy solver for (21) . Starting from residual r = y r = y r = y and empty support A A A , it repeatedly selects an unflipped pair whose normalized column direction has the largest correlation with the current residual:
i t ∈ arg max i ∈ [ N ] ∖ A ∣ ⟨ V a t k , i , r ⟩ ∣ max { ∥ V a t k , i ∥ 2 , 10 − 12 } . i_t \in\arg\max_{i\in[N]\setminus A}\frac{\left|\left\langle V_{\mathrm{atk},i},r\right\rangle\right|}{\max\left\{\left\|V_{\mathrm{atk},i}\right\|_2,10^{-12}\right\}}. i t ∈ arg i ∈ [ N ] ∖ A max max { ∥ V atk , i ∥ 2 , 1 0 − 12 } ∣ ⟨ V atk , i , r ⟩ ∣ .
The normalization is important because the columns β v i \beta v_i β v i are not unit-norm. The numerical floor matches the implementation and gives zero score to zero-impact columns. After choosing i t i_t i t , BMP-A sets x i t = 1 x_{i_t}=1 x i t = 1 and updates
r ← r − V a t k , i t , r \leftarrow r - V_{\mathrm{atk},i_t}, r ← r − V atk , i t ,
so that the invariant r = y − V a t k x r = y - V_{\mathrm{atk}}x r = y − V atk x is maintained. The procedure stops when the budget K K K is exhausted or when the residual norm is below the tolerance. Algorithm 3 gives the exact procedure used in our experiments.
Algorithm 3 Binary Matching Pursuit Attack (BMP-A) used for targeted label flipping
Require: Attack matrix V a t k = [ β v 1 , … , β v N ] V_{\mathrm{atk}}=[\beta v_1,\ldots,\beta v_N] V atk = [ β v 1 , … , β v N ] , target y = − g † y=-g^\dagger y = − g † , budget K K K , tolerance ϵ \epsilon ϵ
Ensure: Binary flip vector x ∈ { 0 , 1 } N x\in\{0,1\}^N x ∈ { 0 , 1 } N , flip set A A A
r ← y , x ← 0 , A ← ∅ r\leftarrow y,\quad x\leftarrow0,\quad A\leftarrow\varnothing r ← y , x ← 0 , A ← ∅
for t = 1 , 2 , … , K t=1,2,\ldots,K t = 1 , 2 , … , K do
i t ∈ arg max i ∈ [ N ] ∖ A ∣ ⟨ V a t k , i , r ⟩ ∣ ∥ V a t k , i ∥ 2 i_t\in\arg\max_{i\in[N]\setminus A}\frac{\left|\left\langle V_{\mathrm{atk},i},r\right\rangle\right|}{\left\|V_{\mathrm{atk},i}\right\|_2} i t ∈ arg max i ∈ [ N ] ∖ A ∥ V atk , i ∥ 2 ∣ ⟨ V atk , i , r ⟩ ∣
A ← A ∪ { i t } , x i t ← 1 A\leftarrow A\cup\{i_t\},\quad x_{i_t}\leftarrow1 A ← A ∪ { i t } , x i t ← 1
r ← r − V a t k , i t r\leftarrow r-V_{\mathrm{atk},i_t} r ← r − V atk , i t
if ∥ r ∥ 2 ≤ ϵ \|r\|_2\le\epsilon ∥ r ∥ 2 ≤ ϵ then
break
end if
end for
Forming the attacked dataset. After BMP-A returns the support A A A , we form D ~ ( A ) \widetilde{D}(A) D ( A ) using the label-flip rule in § 2.2 . This attacked dataset is fixed before defense training and shared by all methods.
Target-strength line search. A fixed budget may not be sufficient to reach the full opposite target. Therefore, our implementation also considers intermediate targets
θ † ( α ) = θ r e f + α ( θ † − θ r e f ) , α ∈ ( 0 , 1 ] . \theta^\dagger(\alpha)=\theta_{\mathrm{ref}}+\alpha(\theta^\dagger-\theta_{\mathrm{ref}}),\qquad\alpha\in(0,1]. θ † ( α ) = θ ref + α ( θ † − θ ref ) , α ∈ ( 0 , 1 ] .
For each α \alpha α , we compute g † ( α ) = ∑ i g i ( θ † ( α ) ) g^\dagger(\alpha)=\sum_i g_i(\theta^\dagger(\alpha)) g † ( α ) = ∑ i g i ( θ † ( α )) , set y ( α ) = − g † ( α ) y(\alpha)=-g^\dagger(\alpha) y ( α ) = − g † ( α ) , and run BMP-A with budget K K K . We scan α \alpha α from large to small over { 1.0 , 0.9 , … , 0.1 } \{1.0,0.9,\ldots,0.1\} { 1.0 , 0.9 , … , 0.1 } and use the first value satisfying
∥ y ( α ) − V a t k x ∥ 2 ∥ y ( α ) ∥ 2 ≤ 0.15. \frac{\left\|y(\alpha)-V_{\mathrm{atk}}x\right\|_2}{\left\|y(\alpha)\right\|_2}\le0.15. ∥ y ( α ) ∥ 2 ∥ y ( α ) − V atk x ∥ 2 ≤ 0.15.
If no value meets this criterion, we use the α \alpha α with the smallest relative residual. This selects the largest tested α \alpha α meeting the residual criterion when one is available.
Realized BMP-A instance. In our SHP experiment, N = 160,000 N=160{,}000 N = 160 , 000 , d = 384 d=384 d = 384 , K = 48,000 K=48{,}000 K = 48 , 000 , β = 1 \beta=1 β = 1 , and the residual tolerance is ϵ = 10 − 3 \epsilon=10^{-3} ϵ = 1 0 − 3 . The line search accepts α = 1.0 \alpha=1.0 α = 1.0 , so the full target θ † = 2 θ r e f − θ ⋆ \theta^\dagger=2\theta_{\mathrm{ref}}-\theta^\star θ † = 2 θ ref − θ ⋆ is used. The final BMP-A support has size 48,000, the relative gradient-space residual is 0.094, and
∥ θ † − θ ⋆ ∥ 2 ≈ 40.3. \left\|\theta^\dagger-\theta^\star\right\|_2\approx40.3. θ † − θ ⋆ 2 ≈ 40.3.
Training standard DPO on this attacked dataset yields a final parameter distance around 30.7 from θ ⋆ \theta^\star θ ⋆ . The constructed attack therefore causes a substantial deviation from clean DPO, providing a targeted-attack setting for evaluating the defenses.
Experiments: No-Attack and Random-Corruption Results
This appendix reports results for the no-attack, clean-data wrong-K K K , and random-corruption scenarios, and provides parameter-distance (∥ θ − θ ⋆ ∥ 2 \|\theta-\theta^\star\|_2 ∥ θ − θ ⋆ ∥ 2 ) curves for all four attack scenarios. The figures in this section compare standard DPO with the four proposed defenses (TRIM, TRIM_REG, SOFT_TRIM, and SOFT_TRIM_REG). Comparisons with the four additional baselines appear in Appendix § 17 .
No-attack scenario
When the training data are clean, the realized attack budget is K = 0 K = 0 K = 0 . With no samples to trim and all soft-trim weights equal to one, TRIM and SOFT_TRIM reduce exactly to standard DPO. The _REG controls keep λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 , so TRIM_REG and SOFT_TRIM_REG reduce to full-data regularized DPO and retain a clean-data offset from the unregularized reference π ⋆ \pi^\star π ⋆ . Figure 3 confirms that both unregularized defenses retain the clean-DPO solution when K = 0 K = 0 K = 0 , with final candKL = 0 up to numerical tolerance. The REG controls isolate the deviation introduced by the quadratic regularizer.
Figure 3. No-attack scenario. candKL, plotted as KL ( π ⋆ ∥ ⋅ ) \operatorname{KL}(\pi^\star\mathbin{\|} \cdot) KL ( π ⋆ ∥ ⋅ ) (left), and ∥ θ − θ ⋆ ∥ 2 \lVert\theta- \theta^\star\rVert_2 ∥ θ − θ ⋆ ∥ 2 (right). The unregularized proposed defenses use K = 0 K = 0 K = 0 , while the REG variants keep λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 .
No-attack scenario with conservative wrong K
We also train on clean data while setting the trimming budget to K = 48,000 K = 48{,}000 K = 48 , 000 . Hard trimming removes 30% of the clean training set, giving final candKL 0.018 for TRIM. Soft trimming retains all pairs and reaches candKL 0.007.
Figure 4 illustrates the clean-data cost of overestimating K K K . SOFT_TRIM incurs a smaller deviation than TRIM in this setting, consistent with its less aggressive downweighting rule.
Figure 4. No-attack scenario with conservative wrong K K K . candKL, plotted as KL ( π ⋆ ∥ ⋅ ) \operatorname{KL}(\pi^\star\mathbin{\|} \cdot) KL ( π ⋆ ∥ ⋅ ) (left), and ∥ θ − θ ⋆ ∥ 2 \lVert\theta- \theta^\star\rVert_2 ∥ θ − θ ⋆ ∥ 2 (right). The true attack budget is zero, but the defender uses K = 48,000 K = 48{,}000 K = 48 , 000 , so hard trimming discards clean high-impact pairs and soft trimming keeps a smaller clean-data bias.
Random-corruption scenario
Under 30% random label flips, only ≈ 30 % \approx30\% ≈ 30% of the top-K K K impact samples are actually corrupted, so TRIM’s precision and recall for identifying attacked samples are both ≈ 0.30 \approx0.30 ≈ 0.30 . Across ten random seeds, standard DPO reaches candKL = 0.041 ± 0.001 = 0.041 \pm0.001 = 0.041 ± 0.001 , compared with 0.039 ± 0.003 0.039 \pm0.003 0.039 ± 0.003 for TRIM and 0.037 ± 0.002 0.037 \pm0.002 0.037 ± 0.002 for SOFT TRIM. The regularized variants have higher final candKL, with 0.0918 ± 0.0004 0.0918 \pm0.0004 0.0918 ± 0.0004 for TRIM REG and 0.0892 ± 0.0003 0.0892 \pm0.0003 0.0892 ± 0.0003 for SOFT TRIM REG. The ± \pm ± values are empirical standard deviations across random attack seeds. Figure 5 shows modest reductions in mean candKL for the unregularized defenses, even though the impact ranking does not preferentially select randomly flipped pairs. Regularization does not improve this comparison, consistent with the clean-data offset observed in the no-attack control.
Figure 5. Random-corruption scenario (30% of pairs flipped uniformly at random), averaged over ten seeds. Left: candKL from clean DPO. Right: parameter distance from θ ⋆ \theta^\star θ ⋆ .
Parameter-distance curves for top-impact and targeted attacks
For completeness, Figures 6 and 7 show the ∥ θ − θ ⋆ ∥ 2 \lVert\theta- \theta^\star\rVert_2 ∥ θ − θ ⋆ ∥ 2 trajectories for the top-impact and targeted attacks. Under the top-impact attack, TRIM drives θ \theta θ -distance to 8.25 (identical to TRIM on clean data with the same K K K ), while attacked DPO reaches 25.2. Under the targeted BMP-A attack, TRIM REG (∥ θ − θ ⋆ ∥ 2 = 21.2 \lVert\theta- \theta^\star\rVert_2 = 21.2 ∥ θ − θ ⋆ ∥ 2 = 21.2 ) and SOFT TRIM REG (21.5) are substantially less deflected than unregularized TRIM (32.3) and DPO (30.7), consistent with the candKL results.
The parameter-distance comparisons support the same conclusions as candKL: hard trimming is effective against the top-impact attack, while the REG variants reduce deviation from clean DPO under BMP-A.
Figure 6. Top-impact attack. candKL, plotted as KL ( π ⋆ ∥ ⋅ ) \operatorname{KL}(\pi^\star\Vert\cdot) KL ( π ⋆ ∥ ⋅ ) (left), and ∥ θ − θ ⋆ ∥ 2 \lVert\theta- \theta^\star\rVert_2 ∥ θ − θ ⋆ ∥ 2 (right). TRIM matches its clean-data counterpart with the same K K K .
Figure 7. Targeted BMP-A attack. candKL, plotted as KL ( π ⋆ ∥ ⋅ ) \operatorname{KL}(\pi^\star\Vert\cdot) KL ( π ⋆ ∥ ⋅ ) (left), and ∥ θ − θ ⋆ ∥ 2 \lVert\theta-\theta^\star\rVert_2 ∥ θ − θ ⋆ ∥ 2 (right). Both REG variants reduce deviation from clean DPO.
Experiments: Comparison with DR_DPO, NR_DPO, WDPO, and KLDPO Baselines
We compare our proposed defenses against four existing robust DPO baselines designed for random noise or distributional shift.
Baseline methods
DR_DPO (Wu et al. [83 ] ). DR_DPO applies an entropic aggregation to the DPO log-likelihood over preference pairs. In our positive-loss notation, the implemented objective is
L D R ( π θ ) = − β ′ log E [ exp ( − ℓ ~ i ( θ ) / β ′ ) ] . \mathcal{L}_{\mathrm{DR}}(\pi_\theta)=-\beta^\prime\log\mathbb{E}\left[\exp\left(-\widetilde{\ell}_i(\theta)/\beta^\prime\right)\right]. L DR ( π θ ) = − β ′ log E [ exp ( − ℓ i ( θ ) / β ′ ) ] .
where β ′ > 0 \beta^\prime>0 β ′ > 0 is a tunable temperature. We use β ′ = 1.0 \beta^\prime=1.0 β ′ = 1.0 . The original DR_DPO objective applies the entropic transform to h i = − ℓ ~ i h_i=-\widetilde{\ell}_i h i = − ℓ i , the DPO log-likelihood, following Appendix § 11 of Wu et al. [83 ] . In positive-loss notation, this gives a soft-minimum rather than the KL-DRO worst-case risk β ′ log E [ exp ( ℓ ~ i / β ′ ) ] \beta^\prime\log\mathbb{E}[\exp(\widetilde{\ell}_i/\beta^\prime)] β ′ log E [ exp ( ℓ i / β ′ )] . The induced per-sample gradient weight is exp ( − ℓ ~ i / β ′ ) / Z \exp(-\widetilde{\ell}_i/\beta^\prime)/Z exp ( − ℓ i / β ′ ) / Z , which downweights pairs with high observed loss. This weighting can reduce the influence of high-loss noisy pairs, but high loss can also reflect a clean, difficult comparison. Under targeted corruption, fitting attacked labels can make opposing clean comparisons harder, so this weighting need not suppress the poisoned signal.
NR_DPO (Chowdhury et al. [19 ] ). NR_DPO (called rDPO in the original paper) applies the symmetric-flip unbiased correction:
ℓ N R ( θ ; z ) = ( 1 − ϵ ) ℓ ( z ) − ϵ ℓ ( − z ) 1 − 2 ϵ . \ell_{\mathrm{NR}}(\theta;z)=\frac{(1-\epsilon)\ell(z)-\epsilon\ell(-z)}{1-2\epsilon}. ℓ NR ( θ ; z ) = 1 − 2 ϵ ( 1 − ϵ ) ℓ ( z ) − ϵ ℓ ( − z ) .
where z z z is the chosen-rejected logit and ϵ ∈ [ 0 , 1 / 2 ) \epsilon\in[0,1/2) ϵ ∈ [ 0 , 1/2 ) is the assumed flip rate. We set ϵ \epsilon ϵ equal to the true attack fraction = 0.3 in attack scenarios, and to 0 in the no-attack scenario, which recovers standard DPO. This correction is unbiased for the clean DPO loss under i.i.d. symmetric label flips, and would work well when corruption matches that model.
WDPO (Xu et al. (2025)). WDPO targets distributional shift in preference data, e.g. across demographic or temporal subpopulations, via a Wasserstein-DRO formulation min θ sup P : W p ( P , P o ) ≤ ρ E ξ ∼ P [ ℓ ( ξ ; θ ) ] \min_\theta\sup_{P:W_p(P,P_o)\leq\rho}\mathbb{E}_{\xi\sim P}[\ell(\xi;\theta)] min θ sup P : W p ( P , P o ) ≤ ρ E ξ ∼ P [ ℓ ( ξ ; θ )] . Following Algorithm 1 of Xu et al. (2025), we tractably approximate this by adding an input-gradient penalty to the empirical DPO loss. In the SHP simulator, the observed pair has v ~ i = ψ ( x i , y ~ w i ) − ψ ( x i , y ~ l i ) \widetilde{v}_i=\psi(x_i,\widetilde{y}_w^i)-\psi(x_i,\widetilde{y}_l^i) v i = ψ ( x i , y w i ) − ψ ( x i , y l i ) and logit z ~ i ( θ ) = β ⟨ θ − θ r e f , v ~ i ⟩ \widetilde{z}_i(\theta)=\beta\langle\theta-\theta_{\mathrm{ref}},\widetilde{v}_i\rangle z i ( θ ) = β ⟨ θ − θ ref , v i ⟩ . The implementation adds 2 ρ ⋅ E [ β 2 σ ( − z ~ i ( θ ) ) 2 ∥ θ − θ r e f ∥ 2 ] 2\rho\cdot\mathbb{E}[\beta^2\sigma(-\widetilde{z}_i(\theta))^2\lVert\theta-\theta_{\mathrm{ref}}\rVert^2] 2 ρ ⋅ E [ β 2 σ ( − z i ( θ ) ) 2 ∥ θ − θ ref ∥ 2 ] to the empirical loss. The factor 2 accounts for the sum of squared gradient norms with respect to the chosen and rejected feature vectors, since their difference is v ~ i \widetilde{v}_i v i . This is the log-linear analogue of the embedding-gradient penalty in WDPO. We set ρ = 10 − 2 \rho=10^{-2} ρ = 1 0 − 2 for our simulator. KLDPO (Xu et al., 2025). KLDPO targets the same distributional-shift setting as WDPO but with a KL-divergence uncertainty set, leading to a worst-case kernel that upweights samples with above-average loss. Our minibatch implementation uses w i = min { 10 , exp ( ( ℓ ~ i − ℓ ~ ) / τ k l ) } w_i = \min\{10, \exp((\tilde{\ell}_i-\tilde{\ell})/\tau_{\mathrm{kl}})\} w i = min { 10 , exp (( ℓ ~ i − ℓ ~ ) / τ kl )} with temperature τ k l = 0.05 \tau_{\mathrm{kl}} = 0.05 τ kl = 0.05 , where ℓ ~ \tilde{\ell} ℓ ~ is the current minibatch mean loss. These clipped weights are held fixed when differentiating the minibatch mean of w i ℓ ~ i w_i\tilde{\ell}_i w i ℓ ~ i . This is the approximate reweighting update used in our comparison with Algorithm 2 of Xu et al. (2025).
Results and discussion
We evaluate all four robust-DPO baselines together with our four proposed defenses (TRIM, TRIM_REG, SOFT_TRIM, SOFT_TRIM_REG) on the no-attack, random-corruption, top-impact, and targeted-BMP-A scenarios introduced in § 4 . Per-step candKL and parameter-distance trajectories for each scenario are shown in Figure 8 –Figure 11 . The final-step candKL values are summarized in Table 1 . For the random-corruption column, all methods are averaged over the same ten random attack seeds. The proposed-method means and standard deviations are reported separately in Appendix I.
Figure 8. No-attack scenario with all baselines. Left: candKL from clean DPO. Right: parameter distance from θ ∗ \theta^* θ ∗ . The proposed defenses use K = 0 K = 0 K = 0 , and the REG variants keep λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 . NR_DPO (with ϵ = 0 \epsilon= 0 ϵ = 0 ) and DR_DPO also converge to near-zero candKL. WDPO and KLDPO converge to a moderately different solution (candKL ≈ 0.09 \approx0.09 ≈ 0.09 –0.10 0.10 0.10 ).
Figure 11. Targeted BMP-A attack with all baselines. Left: candKL from clean DPO. Right: parameter distance from θ ⋆ \theta^{\star} θ ⋆ .
Table 1. Final-step candKL across all four baseline-comparison scenarios. The random-corruption column reports ten-seed means for all methods. Appendix I reports the corresponding mean and standard deviation for the proposed methods. In the no-attack control, the unregularized proposed defenses use K = 0 K = 0 K = 0 and the regularized ones keep λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 . NR_DPO uses ϵ = 0 \epsilon= 0 ϵ = 0 without attacks and ϵ = 0.3 \epsilon= 0.3 ϵ = 0.3 in attacked scenarios.
No-attack scenario (Figure 8). When the training data are clean, the proposed TRIM and SOFT_TRIM defenses are evaluated with K = 0 K = 0 K = 0 , so the unregularized variants coincide with standard DPO and have final candKL = 0 = 0 = 0 . The REG variants keep λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 and therefore report the clean-data offset of full-data regularized DPO. NR_DPO (with ϵ = 0 \epsilon= 0 ϵ = 0 , recovering standard DPO) and DR_DPO also converge to near-zero candKL. WDPO (candKL = 0.096 = 0.096 = 0.096 ) and KLDPO (candKL = 0.089 = 0.089 = 0.089 ) remain farther from the full-data clean-DPO reference. Their penalty and reweighting rules change the training updates even when no corruption is present.
Thus, the unregularized TRIM and SOFT_TRIM methods preserve clean-DPO training when the defender sets K = 0 K = 0 K = 0 . The REG controls retain the bias introduced by their quadratic penalty.
Random corruption (Figure 9). Under 30% uniformly random label flips, the corruption setting is closest to the noise model used by NR_DPO. NR_DPO (noise rate ϵ = 0.3 \epsilon= 0.3 ϵ = 0.3 ) reaches the lowest average candKL among the compared methods under random flips: candKL = 0.010 = 0.010 = 0.010 , approximately one quarter of standard DPO’s 0.041. This is consistent with its random-noise correction. DR_DPO (0.082), WDPO (0.098), and KLDPO (0.096) have higher candKL than standard DPO.
The unregularized proposed methods give modest improvements over DPO: the ten-seed mean candKL values are 0.039 for TRIM and 0.037 for SOFT_TRIM, compared with 0.041 for DPO.
Top-impact attack (Figure 10). Under the top-impact attack, DR_DPO (candKL = 0.423 = 0.423 = 0.423 ) and NR_DPO (0.304) deviate more than attacked DPO (0.155). WDPO and KLDPO have lower candKL than DPO (0.101 and 0.102), but remain above TRIM (0.018). SOFT_TRIM also has lower candKL (0.064) than these baselines.
Figure 9. Random-corruption scenario with all baselines, averaged over ten seeds. Left: candKL from clean DPO. Right: parameter distance from θ ∗ \theta^* θ ∗ .
Both unregularized proposed methods outperform the compared baselines in this setting. Hard trimming removes all flipped pairs and matches TRIM trained on clean data with the same K K K , leaving only the deviation due to discarding clean training information.
Figure 10. Top-impact attack with all baselines. Left: candKL from clean DPO. Right: parameter distance from θ ∗ \theta^* θ ∗ .
Targeted BMP-A attack (Figure 11 ). Under the targeted BMP-A attack, NR_DPO (candKL = 1.079) and DR_DPO (1.066) have larger deviations than standard DPO (0.289). Their parameter distances are 54–58, compared with 30.7 for DPO. WDPO (candKL = 0.103) and KLDPO (candKL = 0.107) have smaller deviations than DPO in this fixed BMP-A instance. TRIM (candKL = 0.335) and SOFT_TRIM (candKL = 0.320) are worse than standard DPO in this instance. Their top-K K K intervention region overlaps only 42% of the corrupted support: hard trimming removes those pairs, while soft trimming downweights them. Both rules also suppress clean high-impact samples. The regularized variants are closer to full-data clean DPO, with candKL 0.118 for TRIM_REG and 0.123 for SOFT_TRIM_REG, both below matched full-data DPO_REG (0.130).
Here regularization helps the proposed defenses reduce policy deviation under BMP-A, while unregularized trimming alone is insufficient. Both proposed REG variants improve over DPO, but WDPO and KLDPO achieve lower candKL in this instance. Appendix § 18 quantifies the additional benefit of trimming beyond the shared regularizer.
Table 1 summarizes the final-step candKL across all four scenarios.
For NR_DPO, the strong performance under random flips does not carry over to targeted BMP-A. The independent random-noise model required for NR_DPO’s cancellation is violated by this fixed targeted support. DR_DPO weights easy observed pairs more strongly. If those are attacked, the weighting can favor the poisoned signal. These mechanisms explain why their respective robustness assumptions need not hold here.
WDPO and KLDPO stay in a narrow range (candKL ∈ [ 0.09 , 0.11 ] \in[0.09, 0.11] ∈ [ 0.09 , 0.11 ] in these runs). This makes them relatively stable under the targeted BMP-A attack, where WDPO has the lowest final candKL in this run. Their no-attack deviations also show that the modified training rules do not recover the full-data clean-DPO reference in these runs. Their design addresses distribution shift rather than identifying and removing a label-flipped subset.
These comparisons support the effectiveness of the proposed defenses in the tested settings without establishing universal empirical superiority. The empirical ordering depends on the attack setting and may also depend on the feature map, attack budget, and regularization strength. The feature map determines impact magnitudes and gradient directions. Changing it may change the attacked/trimmed-set overlap and the relative performance of the defenses. The differences across attacks, together with the clean-data and random-flip controls, illustrate why our analysis separates clean defense bias from surviving attack effects. Building on the constant flip-gradient shift in Lemma 2.2, the resulting gradient-deviation bounds yield time-uniform parameter stability and then policy-level KL guarantees under the stated log-linear, bounded-region, and curvature assumptions. These guarantees hold uniformly over all fixed attack sets containing at most K K K flips, including top-impact attack, random attack, targeted attack, or even attacks with knowledge of the defenses.
Experiments: Matched Regularization Controls
We compare TRIM_REG and SOFT_TRIM_REG with full-data DPO_REG on the same attacked data. All three methods use the quadratic penalty λ ∥ θ − θ r e f ∥ 2 2 / 2 \lambda\lVert\theta-\theta_{\mathrm{ref}}\rVert_2^2/2 λ ∥ θ − θ ref ∥ 2 2 /2 with λ = 10 − 3 \lambda=10^{-3} λ = 1 0 − 3 . DPO_REG does not trim or downweight pairs, allowing us to separate the effect of trimming from the shared quadratic regularizer and measure the additional effect of the impact-score rule.
Table 2 : Final SGD candidate-set KL from full-data clean DPO in the 160,000-pair SHP setting. Percentages are computed from unrounded values relative to matched full-data DPO_REG.
Table 2. Final SGD candidate-set KL from full-data clean DPO in the 160,000-pair SHP setting. Percentages are computed from unrounded values relative to matched full-data DPO_REG.
Table 2 shows lower candKL for both proposed REG variants than for DPO_REG under both attacks. The reductions are larger for top-impact than for BMP-A. Figure 1 b shows the corresponding BMP-A trajectories. Together, these comparisons show that impact-based trimming and downweighting provide an additional benefit beyond the shared quadratic regularizer in these two attack settings.
Experiments: Score Assignment and BMP-A Magnitude Geometry
To test the effect of score assignment, Random TRIM_REG removes the same number of pairs as TRIM_REG, while Permuted SOFT_TRIM_REG randomly reassigns the SOFT_TRIM_REG weights, preserving their multiset and normalization. These are separate randomized controls, not aliases for the impact-based methods. Both controls randomize only among pairs with nonzero flip impact. The 35,256 zero-impact pairs remain untrimmed and have weight one. Within each paired comparison, the attacked set, candidate set, clean-DPO reference, K K K , and λ \lambda λ are fixed.
We use the SGD setup of Appendix G: 100,000 updates, learning rate 0.25, batch size 25,600, and candKL evaluation every 100 updates. We reuse the original SGD trajectories for DPO_REG, TRIM_REG, and SOFT_TRIM_REG. Hard-trim methods sample uniformly with replacement from their retained subsets. Soft-trim methods sample all pairs and normalize by the global mean weight. Each proposed method and its randomized control use the same initialization and minibatch seed.
We repeat each comparison for ten randomized assignments, holding the minibatch seed fixed. Random-flip trials also use different attacks. Under top-impact and BMP-A, both impact-based methods have lower candKL than their randomized controls in all ten trials. The randomized controls have lower candKL in the clean-data and random-flip settings.
For BMP-A, the top-30% impact region contains 20,232 of the 48,000 flipped pairs (42.15%). These pairs account for 58.88% of the summed impact and 72.76% of the summed squared impact over the attacked set.
Figure 12 shows the candKL for the top-impact and BMP-A attacks. The gains over matched randomized controls show that the impact-score assignment matters for these attacks, beyond the number of retained pairs or the distribution of weights. In contrast, random flips do not preferentially affect high-impact pairs, and the clean-data control contains no attacked pairs to remove. The mixed results in Table 3 actually reflect the distinction between our uniform perturbation bounds and a claim that impact-based selection is best for every corruption pattern.
Table 3 : Nonzero-conditioned control candKL minus impact-score candKL after 100,000 SGD updates. Positive values favor the impact score. Mean ± \pm ± sample standard deviation is over ten paired trials.
Table 3. Nonzero-conditioned control candKL minus impact-score candKL after 100,000 SGD updates. Positive values favor the impact score. Mean ± \pm ± sample standard deviation is over ten paired trials.
Figure 12. (a) Top-impact attack. (b) BMP-A attack. Score-assignment ablation: candKL versus SGD steps, with the same quadratic regularizer for every method. Random TRIM_REG and Permuted SOFT_TRIM_REG are the nonzero-conditioned controls. Lines show means and shaded bands show ± one sample standard deviation over ten random assignments with fixed minibatch seeds. The impact-based methods and DPO_REG use one fixed SGD run for each attack.
Experiments: Three-Dataset BMP-A Budget Sweep
We evaluate SHP [24 ] , HH-RLHF [7 , 28 ] , and UltraFeedback-Binarized [21 ] . Each dataset uses 6,000 training and 1,500 held-out pairs for seeds 0, 1, 2.
Data and features. SHP reuses the cached features and seed-0 80/20 split from Appendix § 14 . HH-RLHF uses Anthropic/hh-rlhf, with its train and test splits. UltraFeedback-Binarized uses HuggingFaceH4/ultrafeedback_binarized, with its train_prefs and test_prefs splits. We retain the last human prompt and final assistant response for HH-RLHF, and the prompt and final assistant response for UltraFeedback-Binarized. Empty or identical response pairs are excluded, as are UltraFeedback pairs with tied preference scores. We construct pools of 10,000 training and 1,600 held-out pairs per external dataset, excluding held-out prompts that occur in the sampled training pool, and subsample the experimental pairs independently for each seed.
External-dataset features are the ℓ 2 \ell_2 ℓ 2 -normalized 384-dimensional [CLS] outputs of frozen all-MiniLM-L6-v2. The input concatenates the last 800 prompt characters with the first 5,000 response characters, separated by Assistant:, and is truncated to 256 tokens. Feature differences are not normalized, preserving the variation in flip-impact scores.
Optimization and attack. All methods start at θ 0 = θ r e f = 0 \theta_0 = \theta_{\mathrm{ref}} = 0 θ 0 = θ ref = 0 and use β = 1 \beta= 1 β = 1 , 100,000 SGD steps, batch size 1,024, learning rate 0.25, λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 for REG, and τ = 5 K / 12 \tau= 5K/12 τ = 5 K /12 . Seeds vary data subsampling and SGD. Within each seed, methods use the same data, attack, and minibatch seed. Following Appendix § 15 , the target is the reflection θ † = 2 θ r e f − θ ⋆ = − θ ⋆ \theta^\dagger= 2\theta_{\mathrm{ref}} - \theta^\star= -\theta^\star θ † = 2 θ ref − θ ⋆ = − θ ⋆ of the final clean-DPO parameter. We run BMP-A once to the largest budget and use nested prefixes for the 5%, 10%, 20%, 30% attacks. Each attacked set remains fixed during training.
Metric. Table 4 and Figure 13 report held-out two-candidate D K L ( π c l e a n ∥ π m e t h o d ) D_{\mathrm{KL}}(\pi_{\mathrm{clean}}\Vert\pi_{\mathrm{method}}) D KL ( π clean ∥ π method ) , with each candidate set consisting of the held-out preferred and rejected responses. This metric is not directly comparable to the main paper’s 100-candidate candKL.
Table 4. Three-seed mean two-candidate policy KL under nested BMP-A budgets. Residual is BMP-A’s relative target-gradient residual.
Figure 13. (a) SHP. (b) HH-RLHF. (c) UltraFeedback-Binarized. Three-dataset log-linear BMP-A budget sweep. Lines show means and shaded bands show ± one sample standard deviation over three seeds.
At 20% and 30%, both proposed REG variants have lower KL than DPO on all three datasets. Their differences from DPO_REG are smaller, and both have slightly higher KL than DPO_REG on HH-RLHF at 20% before rounding. At 5%, all REG methods have higher KL than DPO. The smaller-budget attacks also have larger relative target-gradient residuals, ranging from 0.674 to 0.698 at 5% and from 0.478 to 0.520 at 10%. These residuals indicate that BMP-A less closely matches the target gradient at smaller budgets, and attacked DPO remains closer to the clean policy than at the larger budgets.
Overall, the regularized defenses are effective against the larger-budget BMP-A attacks across all three datasets. At smaller budgets, defense-induced bias can outweigh the reduction in the surviving-attack effect. This is the tradeoff captured by our bounds, which do not assert that a defense improves on DPO for every attacked set.
Experiments: Budget Selection and Misspecified K K K
Our bounds assume that K K K is an upper bound on the number of flips. Here we examine sensitivity to the assumed budget and select K K K using held-out policy KL to the clean-DPO reference available in the experiment.
We use the datasets, preprocessing, initialization, optimizer, and reflected-target construction of Appendix M. For each dataset and seed, one fixed 20% true BMP-A attacked set on 6,000 training pairs is reused while the defender’s assumed budget varies over K / N ∈ { 0 % , 1 % , 2 % , 4 % , 8 % , 16 % , 32 % } K/N \in\{0\%, 1\%, 2\%, 4\%, 8\%, 16\%, 32\% \} K / N ∈ { 0% , 1% , 2% , 4% , 8% , 16% , 32% } . For each method and seed, we select the budget with the lowest two-candidate KL on the first 500 held-out pairs, breaking ties toward smaller K K K . We evaluate the selected method on the remaining 1,000 pairs. There are three seeds, 100,000 SGD steps, λ = 10 − 3 \lambda= 10^{-3} λ = 1 0 − 3 , and τ = 5 K / 12 \tau= 5K/12 τ = 5 K /12 for K > 0 K > 0 K > 0 . When K = 0 K = 0 K = 0 , all soft weights are set to one, so the unregularized and REG methods reduce to DPO and DPO_REG, respectively.
Figure 14 shows the held-out test curves as the assumed budget varies. Both proposed REG variants have lower mean test KL than DPO across the entire grid on all three datasets, while unregularized trimming generally increases the deviation. Validation selects the test-grid minimizer in 31 of 36 cases. Only 15 of the 36 selected budgets satisfy K ^ / N ≥ 20 % \hat{K}/N \ge20\% K ^ / N ≥ 20% .
(a) SHP.
(b) HH-RLHF.
(c) UltraFeedback-Binarized.
Figure 14. Held-out test KL for a fixed-20% BMP-A support with a varied defender budget. Lines show means and shaded bands show ± \pm ± one sample standard deviation over three seeds. The vertical dashed line marks the true attack fraction.
Thus, the REG variants retain their advantage over attacked DPO in this experiment even when the assumed budget differs from the true budget. A clean-policy reference also helps select K K K for policy proximity, but the selected budget is not an estimate of the number of attacked pairs. The uniform guarantees apply when the chosen K K K is an upper bound on that number.
Table 5. Mean test two-candidate KL for a fixed true 20% attack while assumed K K K changes. Each entry is unregularized / regularized methods.
Table 6. Validation-selected assumed K / N K/N K / N for seeds 0/1/2. The true attack fraction is 20% in every run.
Extension to Nonlinear DPO Policies
We discuss the difficulties in extending the analysis beyond log-linear policies and report preliminary experiments with a small nonlinear policy over frozen representations.
Flip-gradient identity for differentiable DPO policies
We restate the flip-gradient identity of Yang et al. [92 ] in our notation and include its proof for completeness.
Lemma O.1 (Flip-gradient identity for differentiable DPO policies). For any differentiable policy π θ \pi_\theta π θ and a flipped pair i ∈ A i \in A i ∈ A , let ℓ i \ell_i ℓ i be the DPO loss on the clean pair ( x i , y w i , y l i ) (x^i, y_w^i, y_l^i) ( x i , y w i , y l i ) and let ℓ ~ i \tilde{\ell}_i ℓ ~ i be the observed loss after swapping the two responses. Wherever the log-policy gradients exist,
∇ ℓ ~ i ( θ ) − ∇ ℓ i ( θ ) = β [ ∇ log π θ ( y w i ∣ x i ) − ∇ log π θ ( y l i ∣ x i ) ] . (22) \nabla\tilde{\ell}_i(\theta)-\nabla\ell_i(\theta)=\beta\left[\nabla\log\pi_\theta(y_w^i\mid x^i)-\nabla\log\pi_\theta(y_l^i\mid x^i)\right]. \tag*{(22)} ∇ ℓ ~ i ( θ ) − ∇ ℓ i ( θ ) = β [ ∇ log π θ ( y w i ∣ x i ) − ∇ log π θ ( y l i ∣ x i ) ] . (22) At a fixed θ \theta θ , reversing the pair orientation negates the vector on the right-hand side and therefore preserves its norm. Unlike Lemma 2.2, however, this vector generally depends on θ \theta θ .
Proof. Let z i ( θ ) z_i(\theta) z i ( θ ) be the DPO logit of the clean pair, so that ℓ i ( θ ) = − log σ ( z i ( θ ) ) \ell_i(\theta)=-\log\sigma(z_i(\theta)) ℓ i ( θ ) = − log σ ( z i ( θ )) and ℓ ~ i ( θ ) = − log σ ( − z i ( θ ) ) \tilde{\ell}_i(\theta)=-\log\sigma(-z_i(\theta)) ℓ ~ i ( θ ) = − log σ ( − z i ( θ )) . Differentiation gives ∇ ℓ ~ i ( θ ) − ∇ ℓ i ( θ ) = ∇ z i ( θ ) \nabla\tilde{\ell}_i(\theta)-\nabla\ell_i(\theta)=\nabla z_i(\theta) ∇ ℓ ~ i ( θ ) − ∇ ℓ i ( θ ) = ∇ z i ( θ ) . The reference-policy terms in z i ( θ ) z_i(\theta) z i ( θ ) are constant in θ \theta θ , leaving exactly (22).
Why the log-linear robustness analysis does not directly extend
In the log-linear class, each flip contributes the fixed gradient shift β v i \beta v_i β v i , so the impact ranking and attack-induced gradient shift do not change during training. For a nonlinear policy, the flip-gradient vector in Lemma O.1 depends on θ \theta θ . Extending our analysis would require control of these vectors and their variation over the training region, rather than only at initialization. Recomputing scores can also change the retained set or weights during training.
The nonlinear objective is generally nonconvex, so the covariance argument used in Theorems 3.2 and 3.5 does not directly provide the required curvature and contraction. A nonlinear extension would also need a suitable parameter-to-policy bound and, for refreshed scores, an analysis of the changing objective.
Nonlinear preliminary experiments setup
We use SHP with seeds 0, 1, 2, subsampling 6,000 training pairs and 2,000 held-out pairs from the split in Appendix G. A seed-specific Gaussian projection followed by ℓ 2 \ell_2 ℓ 2 normalization maps frozen 384-dimensional MiniLM representations to ψ ˉ ∈ R 32 \bar{\psi} \in\mathbb{R}^{32} ψ ˉ ∈ R 32 . The policy uses the nonlinear energy head
f θ ( ψ ˉ ) = a ⊤ tanh ( W ψ ˉ + b ) , π θ ( j ∣ x ; Y ) ∝ exp ( f θ ( ψ ˉ ( x , Y j ( x ) ) ) ) , (23) f_\theta(\bar{\psi})=a^\top\tanh(W\bar{\psi}+b), \qquad\pi_\theta(j\mid x;\mathcal{Y})\propto\exp\left(f_\theta\left(\bar{\psi}(x,\mathcal{Y}_j(x))\right)\right), \tag*{(23)} f θ ( ψ ˉ ) = a ⊤ tanh ( W ψ ˉ + b ) , π θ ( j ∣ x ; Y ) ∝ exp ( f θ ( ψ ˉ ( x , Y j ( x )) ) ) , (23)
with hidden width 8. Seeds vary data subsampling, the projection, initialization, and SGD. Within each seed, all methods share the same randomly initialized frozen reference, starting parameters, and minibatch seed. We run 10,000 SGD steps with batch size 512, learning rate 1, β = 1 \beta=1 β = 1 , λ = 10 − 3 \lambda=10^{-3} λ = 1 0 − 3 for REG, and τ = 5 K / 12 \tau=5K/12 τ = 5 K /12 .
The attack target is trained from the reference for 10,000 steps with all preference labels reversed. Neural BMP-A uses the exact flip-gradient vectors at that target and constructs nested attack sets for 5%, 10%, 20%, 30% budgets. Each set is fixed during the corresponding training run. The defender does not observe the target or attacked set and computes the static impact scores once at the common reference initialization. At 30% (K = 1 , 800 K=1,800 K = 1 , 800 ), the mean BMP-A relative target residual is 0.097, and the static top-K K K set contains 40.9% of the attacked pairs. We also train on clean data using the same assumed budgets to measure the clean defense bias.
The 2,000 held-out pairs are used for pairwise diagnostics. The reported candKL instead uses 500 fixed held-out SHP prompts from the candidate cache of Appendix G, with 100 candidates per prompt, shared across methods. The clean-DPO nonlinear policy trained for the same number of steps is the comparator.
Static impact-score results
At the 30% attack budget, TRIM_REG and SOFT_TRIM_REG have 18.7% and 9.6% lower mean candKL than DPO_REG, respectively (Table 7 ). Without regularization, TRIM and SOFT_TRIM have higher candKL than DPO.
Table 7. Mean ± sample standard deviation candidate-set D K L ( π c l e a n ∥ π m e t h o d ) D_{\mathrm{KL}}(\pi_{\mathrm{clean}}\Vert\pi_{\mathrm{method}}) D KL ( π clean ∥ π method ) over three nonlinear-head seeds under the fixed 30% neural BMP-A setting.
Figure 15 shows the budget sweep and clean-data controls. At 5%, all REG methods, including full-data DPO_REG, have higher candKL than DPO, while unregularized TRIM and SOFT_TRIM slightly improve on DPO. On clean data, candKL increases with the assumed budget for unregularized TRIM and SOFT_TRIM. At 30%, their candKL values are 0.0494 and 0.0132, respectively.
Figure 15. Small nonlinear-head sweep over frozen SHP representations. Left: nested 5%, 10%, 20%, 30% neural BMP-A attacks. Right: clean data with the same assumed budgets. Lines show means and shaded bands show ± one sample standard deviation over three seeds.
These preliminary results show a benefit from combining impact-based trimming with regularization under the larger nonlinear BMP-A attack. At smaller budgets, the regularization bias can outweigh this benefit, as also seen for full-data DPO_REG. Extending the robustness guarantees to this policy class requires the additional analysis discussed in Appendix § 22 .§ 2 .
Periodic impact-score refresh
We keep the 30% attacked set fixed and recompute the parameter-dependent impact scores every 500 optimization steps. This gives 20 score evaluations at steps 0, 500, . . . , 9,500.
Table 8 shows lower mean candKL for all four methods after score refresh. At the last refresh, the top-K K K set contains 43.6% of the attacked pairs for TRIM and 45.8% for SOFT_TRIM, compared with 40.9% at initialization. The corresponding fractions for TRIM_REG and SOFT_TRIM_REG are 41.5% and 41.9%. TRIM removes these pairs, while SOFT_TRIM downweights them.
Table 8. Static versus periodically refreshed candidate-set KL, averaged over three nonlinear-head seeds.
Refreshing the impact scores therefore gives a further improvement in this nonlinear experiment, with TRIM_REG attaining the lowest mean candKL among the compared methods. The unregularized variants still have higher candKL than DPO, so score refresh alone does not resolve the tradeoff between removing attacked pairs and changing the clean objective.