Skip to content
ImagineWorld

Token-weighted Direct Preference Optimization with Attention

node_idnode-paper_arxiv-2605.21883_token-weighted-direct-preference-optimization-with-attention
node_typenode-paper
schema_profileworld.node_paper.v1
alternate_namesarxiv-2605.21883
statusactive
orthogonal_scopemanifold, entropy, authority, state
manifoldworld
entropymedium
authorityguides
stateexternal
domainimagineworld.net
node_interiorrosetta_contract
unisonone evidence claim read five ways: seated in the preference-optimization field, the work weights tokens in DPO by attention, so the preference update concentrates on the tokens the model itself was attending to when the preferred and rejected outputs diverged — its framework, regime, and stance agreeing on what it is
governed_byWORLD-MANIFOLD, CORPUS
constitutional_citationCONSTITUTION
evidence_bundleworld-bundle-paper
publication_classarxiv_preprint
paper_titleToken-weighted Direct Preference Optimization with Attention
paper_authorsChengyu Huang, Zhuohang Li, Sheng-Yen Chou, Claire Cardie
arxiv_id2605.21883
arxiv_urlhttps://arxiv.org/abs/2605.21883
arxiv_categories{"primary":"cs.CL","secondary":[]}
arxiv_v3
arxiv_submitted_at2026-05-21
arxiv_updated_at2026-08-25
ocr_sourcearxiv_html
ocr_quality_classverbatim_latexml_html
extraction_toolarxiv-nodepaper-transpose
extraction_pipeline_versionworld-ingest-arxiv-html-v1.0
extracted_at2026-10-13T06:51:09Z
math_preserved_as_latextrue
figures_extractedtrue
references_structurally_parsedfalse
created_at2026-10-13T06:51:09Z
updated_at2026-10-14T05:10:36Z
local graph

Token-weighted Direct Preference Optimization with Attention

Section titled “Token-weighted Direct Preference Optimization with Attention”

Authors: Chengyu Huang, Zhuohang Li, Sheng-Yen Chou, Claire Cardie

arxiv: 2605.21883

Converted to markdown on 2026-10-13 from the arXiv HTML (LaTeXML) rendering; figures embedded from the same source.


Direct Preference Optimization (DPO) aligns Large Language Models with human preferences without the need for a separate reward model. However, DPO treats all tokens in responses equally, neglecting the differing importance of individual tokens. Existing token-level PO methods compute the token weights using either token-position-based heuristic functions or probability estimates given by a separately trained model, which lacks robustness and incurs extra training cost. In contrast, we propose Token-weighted DPO (TwDPO)—a novel training objective grounded on token-weighted RL—and AttentionPO—an instantiation of TwDPO that uses attention from the LLM itself to estimate token weights. AttentionPO prompts the LLM to serve as a pairwise judge and check where the model attends when comparing the responses. This design makes AttentionPO content-aware, adjusting weights based on response content, and efficient, incurring only two extra forward passes per example. Experiment results show that AttentionPO significantly improves performance on AlpacaEval, MT-Bench, and ArenaHard, surpassing existing Preference Optimization methods. GitHub: https://github.com/HCY123902/AttentionPO

The alignment of Large Language Models (LLMs) with human preferences and values is critical for ensuring the quality and safety of generated outputs. Early efforts in this domain utilized policy-gradient reinforcement learning (RL) algorithms like Proximal Policy Optimization (PPO) Schulman et al. (2017a); Ouyang et al. (2022). However, these traditional RL methods require training a separate reward model on annotated preference pairs to provide feedback during training Ouyang et al. (2022). To address this complexity, Preference Optimization (PO) methods such as Direct Preference Optimization (DPO) Rafailov et al. (2023) have emerged. DPO’s training objective is derived from the policy gradient, but it learns the reward landscape directly from preference pairs, avoiding the need for an external reward model.

Figure 1: AttentionPO weighs each token by attention, surpassing DPO and various other baselines.

Figure 1: AttentionPO weighs each token by attention, surpassing DPO and various other baselines.

Despite the advancements introduced by DPO and its variants—including IPO Azar et al. (2024), KTO Ethayarajh et al. (2024), and SimPO Meng et al. (2024)—these methods generally treat every token within a response as equally important Meng et al. (2024). This uniform weighting neglects the fact that different tokens contribute variably to the overall quality of a response Meng et al. (2024). Consequently, traditional PO methods fail to provide the fine-grained credit assignment necessary to account for the specific importance of individual tokens to human preference.

Recent research has attempted to enable token-level credit assignment through various estimation techniques. Grounded in token-level policy gradient methods, TDPO adds sequence KL terms to the DPO objective Zeng et al. (2024). Other approaches, such as TIS-DPO Liu et al. (2025), SePO Yang et al. (2025), and cDPO Lin et al. (2024), estimate token importance by contrasting probabilities between different policies or models. Alternatively, TI-DPO utilizes gradient norms and Gaussian priors Yang et al. (2026), while D2PO employs heuristic temporal decay functions that prioritize earlier tokens Shao et al. (2025). However, many of these methods either require the training of additional models to estimate weights Yang et al. (2025); Liu et al. (2025); Lin et al. (2024) or rely on heuristic functions based on token positions rather than the specific semantic content of the tokens Yang et al. (2026); Shao et al. (2025).

In this work, we propose Token-weighted DPO (TwDPO), a training objective that is theoretically-grounded on token-weighted RL, and AttentionPO, an instantiation of TwDPO that utilizes the attentions from the LLM itself to estimate token weights. By obtaining attention weights for response tokens from a pairwise judge prompt, AttentionPO provides a content-aware importance metric. These weights are then normalized and applied during the credit assignment process to better align the model with human preferences.

Experimental results demonstrate the effectiveness of our proposed approach. AttentionPO achieves significant performance improvements across several models and standard benchmarks. On LLaMA-3-8B-Base-SFT Grattafiori et al. (2024); Meng et al. (2024), AttentionPO improves performance by 12% (win rate against GPT-4-1106-preview Hurst et al. (2023)) on AlpacaEval Li et al. (2023); Dubois et al. (2024), 1.05 (LLM-judged score) on MT-Bench Zheng et al. (2023), and 40% (win rate against GPT-4-0314) on ArenaHard Li et al. (2024); Li et al. (2025b). On LLaMA-3-8B-Insturct, AttentionPO improves performance by 27% on AlpacaEval, 1.41 on MT-Bench, and 14% on ArenaHard. AttentionPO also surpasses strong baselines such as SimPO (up to 4% on AlpacaEval; 0.20 on MT-Bench). AttentionPO highlights the value of using intrinsic model attentions for precise, token-level preference optimization.

Figure 2: Workflow of AttentionPO. First, we prompt π r ​ e ​ f \pi_{ref} to act as a pairwise judge and indicate which response is better in a single output token y v ​ e ​ r ​ d ​ i ​ c ​ t y_{verdict} . We extract π r ​ e ​ f \pi_{ref} ’s attentions at layer ℒ \mathcal{L} that attend from y v ​ e ​ r ​ d ​ i ​ c ​ t y_{verdict} to the response tokens of both y w y_{w} and y l y_{l} . Prompting and weight extraction are repeated two times with the position of y w y_{w} and y l y_{l} swapped, and the final attention weights A w A_{w} and A l A_{l} are averaged over the two rounds. Second, we post-process the weights by applying normalization and fixing the attention sink. Finally, we apply TwDPO with the post-processed attention weights.

We first introduce the notations (§ 2.1) and preliminaries (§ 2.2), then present our TwDPO objective (§ 2.3) and its math derivations (§ 2.4). Finally, we discuss an instantiation of the TwDPO, AttentionPO, which uses attentions as weights. AttentionPO takes three steps: (1) First, we prompt the initial LLM to act as a pairwise judge to extract the attention weights (§ 2.5); (2) We post-process the attention weights to obtain a weight distribution (§ 2.6); (3) We apply TwDPO using the attention weight distribution. See Figure 2 for visualization.

We initialize our main policy π_θ\pi\_{\theta} with a reference model π_ref\pi\_{ref}. We train π_θ\pi\_{\theta} on a preference dataset D={x(i),y_w(i),y_l(i)}_i=1N\mathcal{D}=\{x^{(i)},y\_{w}^{(i)},y\_{l}^{(i)}\}\_{i=1}^{N}, where each example contains a prompt x(i)x^{(i)}, a preferred response y_w(i)y\_{w}^{(i)} and a dispreferred response y_l(i)y\_{l}^{(i)}. Each response yy consists of tokens {y1,⋯ ,y∣y∣}\{y^{1},\cdots,y^{|y|}\}.

Direct Preference Optimization is an offline variant of traditional policy gradient methods to align LLMs with human preferences. It avoids the need for a separate reward model. Instead, it trains LLMs as reward models themselves, on the annotated preference pairs. In particular, DPO maximizes the model’s predicted probability of y_wy\_{w} being preferred over y_ly\_{l}. Formally, given the preference dataset D\mathcal{D}, DPO trains π_θ\pi\_{\theta} using the following objective:

$$\begin{split}\mathcal{L}=-\mathbb{E}_{(x,y_{w},y_{l})\sim\mathcal{D}}\biggl[log\biggl(p_{\theta}(y_{w}\succ y_{l}x)\biggr)\biggr].\end{split}$$

where p_θ(y_w≻y_l∣x)p\_{\theta}(y\_{w}\succ y\_{l}|x) is the model’s predicted preference probability. Following the Bradley-Terry model Bradley and Terry (1952),

$$\begin{split}p_{\theta}(y_{w}\succ y_{l}x)&=\frac{\exp(r(x,y_{w}))}{\exp(r(x,y_{w}))+\exp(r(x,y_{l}))}\ &=\sigma(r_{\theta}(x,y_{w})-r_{\theta}(x,y_{l})).\end{split}$$

where r_θ(x,y_w)r\_{\theta}(x,y\_{w}) is model’s predicted reward and σ\sigma is the sigmoid function. Further, DPO derives the model’s predicted reward to be r_θ(x,y)=βlogπ_θ(y∣x)π_ref(y∣x)+βlog(Z(x))r\_{\theta}(x,y)=\beta log\frac{\pi\_{\theta}(y|x)}{\pi\_{ref}(y|x)}+\beta log(Z(x)), where Z(x)Z(x) is a partition function depending only on xx. Thus, the final DPO objective is to minimize

$$\begin{split}\mathcal{L}=-\mathbb{E}_{(x,y_{w},y_{l})\sim\mathcal{D}}\biggl[log\sigma\biggl(\beta log\frac{\pi_{\theta}(y_{w}x)}{\pi_{ref}(y_{w}x)}-\ \beta log\frac{\pi_{\theta}(y_{l}

Equation 3 can be rewritten into the token-level form:

$$\begin{split}\mathcal{L}=-\mathbb{E}_{(x,y_{w},y_{l})\sim\mathcal{D}}\biggl[log\sigma\biggl(\beta\sum_{t=1}^{y_{w}}\log\frac{\pi_{\theta}(y_{w}^{t}

Note that DPO assigns an equal weight of 1 to all the π_θ(yt∣x,y<t)π_ref(yt∣x,y<t)\frac{\pi\_{\theta}(y^{t}|x,y^{<t})}{\pi\_{ref}(y^{t}|x,y^{<t})} terms. This does not consider the varying degrees of importance of different tokens to the final response quality.

Instead, our objective multiplies each probability ratio term in Equation 4 with a token weight ata^{t}:

$$\begin{split}\mathcal{L}=-\mathbb{E}_{\mathcal{D}}\biggl[log\sigma\biggl(&\betay_{w}\sum_{t=1}^{

We closely follow the proof of Rafailov et al. (2023) to derive the token-weighted DPO objective from a token-weighted RL objective. First, we find the closed-form expression of the near-optimal policy π\*\pi^{\*} and reward function r\*r^{\*} attained by the token-weighted RL objective (§ 2.4.1). Next, we derive the token-weighted DPO objective (§ 2.4.2).

2.4.1 Deriving the Near Optimum of the Token-weighted Objective

Section titled “2.4.1 Deriving the Near Optimum of the Token-weighted Objective”

DPO Rafailov et al. (2023) derives the equivalence between their optimal policy and the one attained by a sequence-level RL objective, which maximizes response reward with KL constraints:

$$\begin{split}&\max_{\pi}\mathbb{E}_{x\sim\mathcal{D},y\sim\pi(\cdotx)}\left[r(x,y)\right]-\beta\mathbb{D_{KL}}(\pi_{\theta}(yx)

Instead, we show that our objective 5 gives a model equivalent to the near-optimal policy produced by a token-weighted RL objective. We start by reformulating objective 6. For a given prompt xx, a policy π\pi, and a reference model π_ref\pi\_{ref}, our objective is to find an optimal policy that maximizes the reward under a token-weighted KL penalty. As we will show in § 2.4.3, this objective naturally induces a token-weighted reward function rr. Our KL penalty weighs the log-probability ratios at each token step tt by the weight ata^{t}:

$$\begin{split}&\max_{\pi}\mathbb{E}_{x\sim\mathcal{D},y\sim\pi(\cdotx)}\biggl[r(x,y)-\ &~~~~~~~~~~\betay

Note that ata^{t} is a proper distribution and sums up to 1. In light of this, we scale the KL term by the sequence length ∣y∣|y| so that the total weight of the logprob ratio terms ∣y∣∑_t=1∣y∣at|y|\sum\_{t=1}^{|y|}a^{t} equals ∣y∣|y|, which is consistent with the DPO objective 6.

To solve this mathematically, we define a sequence-level “weighted” log-probability11 1 π~(y∣x)\tilde{\pi}(y|x) and π~(y∣x)_ref\tilde{\pi}(y|x)\_{ref} do not need to be proper distribution, but can be normalized to be one. See Appendix D. for both the policy and the reference model:

$$\begin{split}\log\tilde{\pi}(yx)&=y

Substituting these into our objective, we can follow the standard derivation steps:

$$\begin{split}&\max_{\pi}\mathbb{E}_{x\sim\mathcal{D}}\mathbb{E}_{y\sim\pi(\cdotx)}\left[r(x,y)-\beta\log\frac{\tilde{\pi}(y

where Z(x)=∑_yπ~_ref(y∣x)exp⁡(1βr(x,y))Z(x)=\sum\_{y}\tilde{\pi}\_{ref}(y|x)\exp(\frac{1}{\beta}r(x,y)) is the partition function.

The near optimal weighted policy π~\*\tilde{\pi}^{\*} (we analyze the error bounds between π~\*\tilde{\pi}^{\*} and the intractable true optimal policy in Appendix B) that minimizes this expression satisfies:

$$\tilde{\pi}^{*}(yx)=\frac{1}{Z(x)}\tilde{\pi}_{ref}(yx)\exp\left(\frac{1}{\beta}r(x,y)\right).$$

By taking the logarithm of both sides and rearranging the terms, we can express the true reward r\*(x,y)r^{\*}(x,y) entirely in terms of the optimal policy:

$$r^{*}(x,y)=\beta\log\frac{\tilde{\pi}^{*}(yx)}{\tilde{\pi}_{ref}(yx)}+\beta\log Z(x).$$

Substituting the expanded definition of our weighted log-probabilities back into this reward expression yields:

$$r^{*}(x,y)=\betay\sum_{t=1}^{

2.4.2 Deriving the Objective Under the Bradley-Terry Model

Section titled “2.4.2 Deriving the Objective Under the Bradley-Terry Model”

We substitute our token-weighted reparameterization of r\*(x,y)r^{\*}(x,y) into the Bradley-Terry preference model (Equation 2):

$$\begin{split}&p^{*}(y_{w}\succ y_{l}x)=\sigma(r^{*}(x,y_{w})-r^{*}{\theta}(x,y_{l}))\ &=\sigma\Bigg(\left(\beta

Crucially, the partition function terms βlog⁡Z(x)\beta\log Z(x) cancel out, leaving:

$$\begin{split}p^{*}(y_{w}\succ y_{l}x)=\sigma\biggl(\betay_{w}

To frame this as a maximum likelihood objective for training a parameterized policy π_θ\pi\_{\theta}, we take the negative log-likelihood over the preference dataset D\mathcal{D}. This leads to our final objective in Equation 5.

Equation 10 shows that rr weighs tokens by ata^{t}. For tokens with higher ata^{t}, their logprob ratio between π\*(yt∣x,y<t)\pi^{\*}(y^{t}|x,y^{<t}) and π_ref(yt∣x,y<t)\pi\_{ref}(y^{t}|x,y^{<t}) significantly affect rr, while tokens with lower ata^{t} affect rr less.

Token-weighted KL penalty enables locally-adaptive trust region.
Section titled “Token-weighted KL penalty enables locally-adaptive trust region.”

Our KL penalty in objective 7 scales the KL divergence at the token level via ata^{t}. Consequently, the model is granted greater freedom to deviate from the reference policy on low-importance tokens, while being strictly constrained on high-importance ones. While restricting the most critical tokens may seem counterintuitive, this adaptive weighting is essential because important tokens dominate the implicitly derived reward function, and thus are highly susceptible to reward hacking and over-optimization. The token-weighted KL term acts as a locally adaptive regulator: for high-weight tokens, the massive incentives to deviate are safely balanced by proportionally stricter penalties, ensuring the model only updates when the expected reward justifies the risk.

The above suggests that objective 7 is indeed a token-weighted RL objective in terms of both the reward function and KL penalty. Consequently, both its derived policy and the near-optimal policy derived from objective 5 learn more signals from important tokens, which is what we desire. We further provide an analysis on the gradient in Appendix C. While we use attention as the weights, there are no assumptions about how the weights are derived, and AttentionPO is only one possible instantiation.

2.5 Token Weights Extraction Through Attention Scores

Section titled “2.5 Token Weights Extraction Through Attention Scores”

We hypothesize that if we ask the LLM to judge the response quality, the tokens that get more attention are more important. As such, we prompt π_ref\pi\_{ref} with a general pairwise judge prompt (See Appendix 6) that asks it to predict which of y_wy\_{w} and y_ly\_{l} has better quality. We explicitly require π_ref\pi\_{ref} to output the identifier (“A” or “B”) of the better response, and we denote this single token as y_verdicty\_{verdict}. To avoid bias, we hide the preference labels in the prompt and call π_ref\pi\_{ref} two rounds, each round with the positions of y_wy\_{w} and y_ly\_{l} swapped. For each round, we do a single forward pass and obtain the attention weights at a fixed layer LL. We extract the attention weights from y_verdicty\_{verdict} to all the tokens in y_wy\_{w} and denote them as A_wroundr=[a_w1,⋯ ,a_w∣y_w∣]A\_{w}^{round\\_r}=[a\_{w}^{1},\cdots,a\_{w}^{|y\_{w}|}]. Similarly, we extract the attention weights from y_verdicty\_{verdict} to all the tokens in y_ly\_{l} as A_lroundr=[a_l1,⋯ ,a_l∣y_l∣]A\_{l}^{round\\_r}=[a\_{l}^{1},\cdots,a\_{l}^{|y\_{l}|}]. For simplicity, we compute the final attention weight of each token as the mean attention weight for that token across attention heads.

For rounds r∈{1,2}r\in\{1,2\} ,This produces A_wround1A\_{w}^{round\\_1}, A_wround2A\_{w}^{round\\_2}, A_lround1A\_{l}^{round\\_1}, A_lround2A\_{l}^{round\\_2}. The final attention is the average of the two rounds:

\begin{split}a\_{w}^{t}&=\frac{1}{2}a\_{w}^{t,round\\_1}+\frac{1}{2}a\_{w}^{t,round\\_2},\\ a\_{l}^{t}&=\frac{1}{2}a\_{l}^{t,round\\_1}+\frac{1}{2}a\_{l}^{t,round\\_2}.\end{split}(13)

π_ref\pi\_{ref} also attends to other tokens in the pairwise judge prompt and so neither A_wA\_{w} nor A_lA\_{l} form a proper distribution (i.e., it does not sum up to 1.0). Therefore, we normalize the attention weights A_wA\_{w} and A_lA\_{l}: a_wt←a_wt/(∑_q=1∣y_w∣a_wq)a\_{w}^{t}\leftarrow a\_{w}^{t}/(\sum\_{q=1}^{|y\_{w}|}a\_{w}^{q}), a_lt←a_lt/(∑_q=1∣y_l∣a_lq)a\_{l}^{t}\leftarrow a\_{l}^{t}/(\sum\_{q=1}^{|y\_{l}|}a\_{l}^{q}).

Attention sink is a phenomenon where the LLMs predominantly attend to the initial tokens Xiao et al. (2024). Manual inspection on our dataset D\mathcal{D} suggests that these initial tokens are usually of low importance, consisting of starting phrases. As such, for any response with at least K′K^{\prime} tokens, we reset the attention weights of the first KK tokens of each response yy to the average weight 1/∣y∣1/|y| and renormalize the remaining tokens:

$$\begin{split}\forall t\in{K+1,\cdots,y_{w}},a_{w}^{t}&\leftarrow a_{w}^{t}\frac{1-\frac{K}{

We follow the settings from Meng et al. (2024). For the initial model π_ref\pi\_{ref}, we experiment with Llama-3-8B-Base-SFT from Meng et al. (2024) (princeton-nlp/Llama-3-Base-8B-SFT), which is supervised-finetuned from the pretrained model LLaMA-3-8B Grattafiori et al. (2024) on UltraChat-200K Ding et al. (2023); and LLaMA-3-8B-Instruct Grattafiori et al. (2024) (meta-llama/Meta-Llama-3-8B-Instruct).

For the SFT model (Llama-3-8B-Base-SFT), we apply AttentionPO on the UltraFeedback binarized dataset Cui et al. (2024) (HuggingFaceH4/ultrafeedback_binarized). This dataset contains 61,135/2,000 training/validation examples covering diverse instruction-following tasks such as creative writing, document-assisted writing, and open-ended QA. Each query is accompanied by four responses generated by diverse LLMs and graded by GPT-4 in terms of instruction-following, helpfulness, honesty, and truthfulness. y_wy\_{w} is set to the response with the highest overall score, and y_ly\_{l} is chosen randomly from the remaining three.

For the Instruction-Tuned model (LLaMA-3-8B-Instruct), we use the dataset produced by Meng et al. (2024) (princeton-nlp/llama3-ultrafeedback). It contains 59,876/1,961 training/validation examples. The questions are subsampled from the binarized datasets, but for each question, five responses are sampled from π_ref\pi\_{ref} and then scored by a reward model PairRM Jiang et al. (2023b). y_wy\_{w} is set to the response with the highest score and y_ly\_{l} is set to the one with the lowest score.

π_ref\pi\_{ref}=LLaMA-3-8B-Base-SFTπ_ref\pi\_{ref}=LLaMA-3-8B-Instruct
StdMaxLenStdMaxLen
y_wy\_{w}0.01770.1242269.08950.01260.0915356.9848
y_ly\_{l}0.01750.1202235.39780.01370.0959365.8176

Table 1: Statistics of the attention weights after post-processing in § 2.6. Std: Standard deviation of token weights within a response. Max: Maximum weights; Len: Response length; Metrics are averaged across the training set.

π_ref\pi\_{ref}=LLaMA-3-8B-Base-SFTπ_ref\pi\_{ref}=LLaMA-3-8B-Instruct
y_wy\_{w}y_ly\_{l}y_wy\_{w}y_ly\_{l}
TokenWeightTokenWeightTokenWeightTokenWeight
True0.1237Ye0.8212(Note0.1269(Note0.1276
idence0.1227Neutral0.1213YES0.0918Yes0.0853
Neutral0.1184ye0.1065“What0.0844“What0.0673
POS0.1148Completion0.0987doesn0.0643doesn0.0618
False0.1016idence0.0886wouldn0.0606No0.0598
Completion0.0997No0.0845False0.0572!ĊĊ0.0529
No0.0990True0.0796Yes0.0563didn0.0528
Negative0.0788Ent0.0721No0.0556wouldn0.0510
Positive0.0668Negative0.0692Explanation0.0505don0.0497
Yes0.0591False0.0686don0.0492“The0.0447

Table 2: Most weighted tokens after post-processing in § 2.6. Weight: Weights averaged across all occurrences of the token in the training set. We only keep tokens that occur at least 100 times.

We set LL to the index of the last layer for every model (i.e., we take the attention weights from the last layer). To fix the attention sink issue, we use K=1K=1 and K′=5K^{\prime}=5. That is, for response yy that has at least 5 tokens, we set the attention weight of its first token to 1/∣y∣1/|y|. The rationale is that for our models, the attention sink primarily concentrates on the first token. For LLaMA3-8B-Base-SFT, significant attention weights are on the first token (12.55%), whereas the weights on the second (3.35%) and third (2.55%) tokens are much smaller. For LLaMA-3-8B-Instruct, the proportion is 8.25%/2.11%/1.55% for the first, second, and third tokens, respectively.

We show detailed statistics of the attention weights in Table 1. The standard deviation of the weights from both SFT and Instruct models is above 0.01, suggesting that the weights vary across tokens. We also show the ten most weighted tokens in Table 2. For the SFT model, 7/10 tokens are related to binary judgment words (e.g., “Yes”, “True”) for both y_wy\_{w} and y_ly\_{l}. The highly weighted tokens of the Instruct model not only include these but also negation words (e.g., “doesn”).

We set learning rate to 1e−61e-6 with a cosine scheduler and a warmup ratio of 0.1. We use the AdamW optimizer Loshchilov and Hutter (2019). The KL regularizer β\beta is set to 0.0050.005. See more details in Appendix F.

We compare AttentionPO against the initial model π_ref\pi\_{ref} and models trained with common PO methods, including RRHF Yuan et al. (2023), SLiC-HF Zhao et al. (2023), DPO Rafailov et al. (2023), TDPO Zeng et al. (2024), TI-DPO Yang et al. (2026), OTPO Li et al. (2025a), IPO Azar et al. (2024), CPO Xu et al. (2024), KTO Ethayarajh et al. (2024), ORPO Hong et al. (2024), R-DPO Park et al. (2024), and SimPO Meng et al. (2024). Except TDPO, TI-DPO, and OTPO, we adopt the training hyperparameters from Meng et al. (2024), which have been separately searched to be optimal.

Following prior work Meng et al. (2024); Yang et al. (2025); Huang and Goyal (2025), we evaluate the models on AlpacaEval Li et al. (2023), MT-Bench Zheng et al. (2023), and ArenaHard Li et al. (2024). For AlpacaEval, we report the raw and length-controlled win rate of our model against GPT-4-1106-preview. For MT-Bench, we report the LLM-judged quality score of our model’s generated response on a scale of 1 to 10. For ArenaHard, we report the win rate of our model against GPT4-0314. We use GPT-4o-mini Achiam et al. (2024) as the judge model for these benchmarks. See more evaluation details in Appendix F.

We first present the main results (§ 4.1), followed by comparing our method with other choices of token weights (§ 4.2), and finally conducting an ablation study (§ 4.3).

π_ref\pi\_{ref}=LLaMA-3-8B-Base-SFTπ_ref\pi\_{ref}=LLaMA-3-8B-Instruct
AlpacaEvalMTArenaHardAvg Rank ↓\downarrowAlpacaEvalMTArenaHardAvg Rank ↓\downarrow
LR ↑\uparrowWR ↑\uparrowScore ↑\uparrowWR ↑\uparrowLR ↑\uparrowWR ↑\uparrowScore ↑\uparrowWR ↑\uparrow
Base9.204.635.479.9213.7533.6032.606.7837.5712.25
+RRHF11.296.636.1826.009.2543.7537.656.6341.9110.00
+SLiC-HF16.7312.085.9513.0810.0038.3837.036.7642.7610.13
+DPO22.8817.706.5438.543.2549.0244.726.7353.986.00
+TDPO11.966.185.6812.0911.7537.7437.346.6441.0011.50
+TI-DPO9.944.775.2910.1413.2535.4134.576.8038.7310.75
+OTPO24.2414.436.2246.314.5051.2644.656.9152.604.50
+IPO20.6919.736.2334.564.7548.9447.476.9950.504.50
+CPO18.9424.565.3836.044.8841.2645.136.6752.077.50
+KTO18.2415.055.9318.288.7543.1039.736.7948.987.38
+ORPO19.3613.475.7217.329.2540.9236.956.7644.649.88
+R-DPO20.9415.576.3328.725.2552.1146.986.7954.983.38
+SimPO32.2629.116.1347.013.6356.7947.736.5154.945.00
+AttentionPO21.5520.236.5249.722.2560.7758.297.1952.062.25

Table 3: Main results. Base: π_ref\pi\_{ref}; MT: MT-Bench; AlpacaEval: LR is the length-controlled win rate and WR is the raw win rate against GPT-4-1106-Preview; MT-Bench: LLM-judged quality score of the model’s responses, on a scale of 1 to 10; ArenaHard: Win rate against GPT-4-0314. Avg Rank: arithmetic mean of the method’s ranks across all individual metrics. AttentionPO achieves the best overall ranking across both Base-SFT and Instruct settings. See Table 10 for results with multiple evaluation runs.

As shown in Table 3, AttentionPO significantly improves the performance over the base model π_ref\pi\_{ref} in all settings. On LLaMA-3-8B-Base-SFT, performance increases by 12% on AlpacaEval, 1.05 on MT-Bench, 40% on ArenaHard. On LLaMA-3-8B-Instruct, performance increases by 27% on AlpacaEval, 0.41 on MT-Bench, and 14% on ArenaHard. Furthermore, AttentionPO outperforms the baselines in most settings. For the SFT model, AttentionPO ranks first on ArenaHard, second on MT-Bench, and third on AlpacaEval. For the Instruct model, AttentionPO outperforms all baselines on AlpacaEval and MT-Bench. Across the benchmarks, AttentionPO achieves the best overall rank for both models.

There are alternative ways to obtain token-level weights. Prior work Lin et al. (2024); Yang et al. (2025); Liu et al. (2025); Shao et al. (2025); Yang et al. (2026) either requires training a separate model to estimate weights or relies on strong heuristics. Instead, we stick to our setting where the weights are attained through self-judging, but we experiment with various changes to the current design. This includes (1) Extracting the attention weights from a different hidden layer LL of π_ref\pi\_{ref}; (2) Using attention rollout Abnar and Zuidema (2020) to aggregate the weights across different hidden layers; (3) Prompting π_ref\pi\_{ref} to verbally assign a weight for each token. For these experiments, we use LLaMA-3-8B-Instruct as an example.

Figure 3: Results for different layers. x-axis: index of the layer from which attention weights are extracted; y-axis: benchmark performance.

LLaMA-3-8B-Instruct consists of 32 hidden layers. We use L=32L=32 for our main experiments. Here, we experiment with L∈{1,8,16,24,32}L\in\{1,8,16,24,32\} and present the results in Figure 3. We find that the first and last layers perform better than the middle ones, with the last layer achieving the best results. We leave more investigation on this to future work.

Attention rollout aggregates the attentions across all the layers to estimate the total attentions from tokens in the final output layer to tokens in the initial input layer. Table 4 shows that using their aggregated weights underperforms our method. This is potentially associated with our previous observation that middle-layer attentions are not suitable for AttentionPO, since attention rollout incorporates attentions from these layers into the final weights.

Verbalized self-judged weights (w/ verbal w).
Section titled “Verbalized self-judged weights (w/ verbal w).”

Instead of using attention, we ask π_ref\pi\_{ref} to verbally assign an importance score on a scale of 1 to 5 to each token in the response. We observe that it is difficult for the model to precisely give a score for every token (e.g., malformed scoring report; not being able to recall every token in the response). Therefore, we adapt a coarser granularity and ask the model to first partition the response into parts and then assign a score for each part (See prompts in Appendix J). Even with a coarser granularity, π_ref\pi\_{ref} still cannot perfectly recall the response tokens. We filter out examples where fewer than 90% of the tokens are matched with a verbalized weight for either y_wy\_{w} or y_ly\_{l}. After filtering, we get 10,111/343 train/validation examples. To compensate for a smaller dataset, we increase the number of training epochs from 1 to 5 and validate at each epoch.

π_ref\pi\_{ref}=LLaMA-3-8B-Instruct
AlpacaEvalMTArenaHard
LR ↑\uparrowWR ↑\uparrowScore ↑\uparrowWR ↑\uparrow
Base33.6032.606.7837.57
+DPO49.0244.726.7353.98
+AttentionPO60.7758.297.1952.06
w/ attn rollout54.8454.876.7148.23
w/ verbal w57.9557.766.8961.41

Table 4: Results with different weight sources.

Table 4 shows that this method outperforms ours on ArenaHard but underperforms on AlpacaEval and MT-Bench. A potential reason is the use of a coarser granularity. We leave more investigation on the viability of this approach to future work.

Restoring the attention sink (w/ attn sink).
Section titled “Restoring the attention sink (w/ attn sink).”

We restore the attention sink, in which case the first token occupies roughly 8.25% of the total weights. Table 5 shows that this variant underperforms our method on all benchmarks, indicating the benefits of averaging out the attention sink.

Adding length normalization (w/ len norm).
Section titled “Adding length normalization (w/ len norm).”

Prior work Yang et al. (2025); Meng et al. (2024) argues that DPO is biased toward lengthy responses (i.e., lengthy responses receive more gradient updates than concise ones). They add a length normalizer to the objective. Similarly, we remove the ∣y∣|y| multiplier in front of the logprob ratio term for y_wy\_{w} and y_ly\_{l}, giving a weighted, length-normalized variant:

$$\begin{split}\mathcal{L^{\prime}}=-\mathbb{E}_{\mathcal{D}}\biggl[log\sigma\biggl(&\beta\sum_{t=1}^{y_{w}}a_{w}^{t}\log\frac{\pi_{\theta}(y_{w}^{t}

Adding the length normalization effectively reduces the KL regularization constant β\beta. Therefore, we increase β\beta to 2.0 for this baseline. For these experiments, we use LLaMA-3-8B-Instruct as an example.

π_ref\pi\_{ref}=LLaMA-3-8B-Instruct
AlpacaEvalMTArenaHard
LR ↑\uparrowWR ↑\uparrowScore ↑\uparrowWR ↑\uparrow
Base33.6032.606.7837.57
+DPO49.0244.726.7353.98
+AttentionPO60.7758.297.1952.06
w/ attn sink61.1457.276.9351.64
w/ len norm62.0055.696.7944.59

Table 5: Ablation Results.

Table 5 shows that applying length normalization significantly hurts performance on MT-Bench and AreaHard. One speculated reason for this is the misalignment with the original RL objective. Instead of maximizing the total rewards of the entire rollout yy, the dual-RL objective of objective 15 (which is the same as objective 7 but with ∣y∣|y| removed in both the reward function and the KL penalty) maximizes the average per-token reward of yy, undermining the total rewards.

Aligning LLMs with human preferences originally relied on RLHF via PPO Ouyang et al. (2022); Schulman et al. (2017a), which requires a separate reward model. Modern Preference Optimization (PO) methods bypass this by training the policy directly on preference pairs (y_w,y_l)(y\_{w},y\_{l}) using contrastive objectives. For instance, RRHF Yuan et al. (2023) and SLiC-HF Zhao et al. (2023) apply ranking losses, while DPO Rafailov et al. (2023) derives a reference-normalized objective from policy gradients. Subsequent variants introduce bounded objectives (IPO Azar et al. (2024)), pointwise formulations (KTO Ethayarajh et al. (2024)), auxiliary SFT objectives (CPO Xu et al. (2024), ORPO Hong et al. (2024)), length penalties (R-DPO Park et al. (2024)), or reference-free length normalization with reward margins (SimPO Meng et al. (2024)). However, these methods weight all response tokens equally, failing to capture token-level importance.

To enable fine-grained credit assignment, recent work explores token-level weighting. TDPO Zeng et al. (2024) incorporates token-level sequential KL terms. TIS-DPO Liu et al. (2025), SePO Yang et al. (2025), and cDPO Lin et al. (2024) estimate token importance by contrasting probabilities between reference/negative models and oracle/positive models. TI-DPO Yang et al. (2026) combines Gaussian priors with logit gradient norms. Alternatively, heuristic approaches like D2PO Shao et al. (2025) decay weights based on token position. OTPO Li et al. (2025a) uses the euclidean distances between token hidden states to estimate token weights. Nonetheless, most of these methods either demand expensive auxiliary models Liu et al. (2025); Yang et al. (2025); Lin et al. (2024) or rely on rigid, position-based heuristics Shao et al. (2025) rather than semantic content. Among the methods Zeng et al. (2024); Yang et al. (2026); Li et al. (2025a) that share the same advantage as ours, which do not require an extra model for weight estimation and are adaptive to context, our method exhibits higher performance than theirs across models and benchmarks.

The idea of using attentions for fine-grained credit assignment has been explored in the context of reward shaping and found to work well. Prior work Ferret et al. (2020); Holmes and Chi (2025) uses the reward model’s attentions for reward shaping, which densifies the rewards and boosts training efficiency in various RL environments. Attention-Based Credit Chan et al. (2024) uses a similar approach to obtain dense rewards in the LLM RLHF (PPO (Schulman et al., 2017b)) setting, which boosts efficiency and effectiveness. Our design choice of attention-based weights draws inspiration from these. The high-level motivation is that we use LLM as a pairwise judge (reward) model and use the attentions from the final verdict token (predicted reward) as the token weights.

We propose TwDPO—a token-weighted DPO objective, theoretically grounded on token-weighted RL—and AttentionPO—an instantiation of TwDPO that prompts the model to judge the response qualities and extract attentions from the model itself to weigh the response tokens. Experiment results show that AttentionPO significantly improves the performance of the base model across AlpacaEval, MT-Bench, and ArenaHard, outperforming various prior PO methods. We hope AttentionPO paves the way for highly-performant and efficient preference alignment with humans.

Due to computational constraints, we do not experiment with our method on larger models. In addition, our training and evaluation focus on the instruction-following task, but it can be applied to other more specialized domains such as reasoning or knowledge-based QA. Analysing the performance and generalizability of AttentionPO on other models and tasks is an important future direction.

Moreover, the search space for the optimal choice of attention weights for TwDPO is large. For example, while we simply take the mean across attention heads, future work could investigate selecting a specific head or group of heads for weight extraction. However, we argue that such a choice of attention heads is likely model-dependent and may not transfer across settings.

  • Abnar and Zuidema (2020) S. Abnar and W. Zuidema Quantifying attention flow in transformers. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Cited by: Appendix A, §4.2.
  • Achiam et al. (2024) J. Achiam, S. Adler, S. Agarwal, L. Ahmad, I. Akkaya, F. L. Aleman, D. Almeida, J. Altenschmidt, S. Altman, and S. A. et al. GPT-4o system card. arXiv preprint arXiv:2410.21276. Cited by: §3.
  • Azar et al. (2024) M. G. Azar, M. Rowland, B. Piot, D. Guo, D. Calandriello, M. Valko, and R. Munos A general theoretical paradigm to understand learning from human preferences. In Proceedings of the 27th International Conference on Artificial Intelligence and Statistics, Cited by: Appendix A, §1, §3, §5.
  • Bradley and Terry (1952) R. A. Bradley and M. E. Terry Rank analysis of incomplete block designs: i. the method of paired comparisons. Biometrika 39, pp. 324–345. External Links: Document Cited by: §2.2.
  • Chan et al. (2024) A. J. Chan, H. Sun, S. Holt, and M. van der Schaar Dense reward for free in reinforcement learning from human feedback. In Proceedings of International Conference on Machine Learning, Cited by: §5.
  • Clark et al. (2019) K. Clark, U. Khandelwal, O. Levy, and C. D. Manning What does bert look at?. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, Cited by: Appendix A.
  • Cui et al. (2024) G. Cui, L. Yuan, N. Ding, G. Yao, B. He, W. Zhu, Y. Ni, G. Xie, R. Xie, Y. Lin, Z. Liu, and M. Sun UltraFeedback: boosting language models with scaled ai feedback. In Proceedings of International Conference on Machine Learning, Cited by: §G.2, §3.
  • Ding et al. (2023) N. Ding, Y. Chen, B. Xu, Y. Qin, S. Hu, Z. Liu, M. Sun, and B. Zhou Enhancing chat language models by scaling high-quality instructional conversations. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, Cited by: §G.2, §3.
  • Dubois et al. (2024) Y. Dubois, B. Galambosi, P. Liang, and T. B. Hashimoto Length-controlled alpacaeval: a simple way to debias automatic evaluators. In Proceedings of Conference on Language Modeling, Cited by: §1.
  • Ethayarajh et al. (2024) K. Ethayarajh, W. Xu, N. Muennighoff, D. Jurafsky, and D. Kiela KTO: model alignment as prospect theoretic optimization. In Proceedings of International Conference on Machine Learning, Cited by: Appendix A, §1, §3, §5.
  • Ferret et al. (2020) J. Ferret, R. Marinier, M. Geist, and O. Pietquin Self-attentional credit assignment for transfer in reinforcement learning. In Proceedings of International Joint Conferences on Artificial Intelligence, Cited by: §5.
  • Grattafiori et al. (2024) A. Grattafiori, A. Dubey, A. Jauhri, A. Pandey, A. Kadian, A. Al-Dahle, A. Letman, A. Mathur, A. Schelten, and A. V. et al. The llama 3 herd of models. arXiv preprint arXiv:2407.21783. Cited by: §1, §3.
  • Holmes and Chi (2025) I. Holmes and M. Chi Attention-based reward shaping for sparse and delayed rewards. arXiv preprint arXiv:2505.10802. Cited by: §5.
  • Hong et al. (2024) J. Hong, N. Lee, and J. Thorne ORPO: monolithic preference optimization without reference model. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, Cited by: Appendix A, §3, §5.
  • Huang and Goyal (2025) C. Huang and T. Goyal DCRM: a heuristic to measure response pair quality in preference optimization. In Findings of the Association for Computational Linguistics: EMNLP 2025, Cited by: §3.
  • Hurst et al. (2023) A. Hurst, A. Lerer, A. P. Goucher, A. Perelman, A. Ramesh, A. Clark, A. Ostrow, A. Welihinda, A. Hayes, and A. R. et al. GPT-4 technical report. arXiv preprint arXiv:2303.08774. Cited by: §1.
  • Jain and Wallace (2019) Jain and Wallace Attention is not explanation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), Cited by: Appendix A.
  • Jiang et al. (2023a) A. Q. Jiang, A. Sablayrolles, A. Mensch, C. Bamford, D. S. Chaplot, D. de las Casas, F. Bressand, G. Lengyel, G. Lample, L. Saulnier, L. R. Lavaud, M. Lachaux, P. Stock, T. L. Scao, T. Lavril, T. Wang, T. Lacroix, and W. E. Sayed Mistral 7b. arXiv preprint arXiv:2310.06825. Cited by: §G.2.
  • Jiang et al. (2023b) D. Jiang, X. Ren, and B. Y. Lin LLM-blender: ensembling large language models with pairwise ranking and generative fusion. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Cited by: §3.
  • Li et al. (2025a) M. Li, G. Huzhang, H. Zhang, X. Wang, and A. Zeng Optimal transport-based token weighting scheme for enhanced preference optimization. In Proceedings of the 63th Annual Meeting of the Association for Computational Linguistics, Cited by: §3, §5.
  • Li et al. (2025b) T. Li, W. Chiang, E. Frick, L. Dunlap, T. Wu, B. Zhu, J. E. Gonzalez, and I. Stoica From crowdsourced data to high-quality benchmarks: arena-hard and benchbuilder pipeline. In Proceedings of International Conference on Machine Learning, Cited by: §1.
  • Li et al. (2024) T. Li, W. Chiang, E. Frick, L. Dunlap, B. Zhu, J. E. Gonzalez, and I. Stoica From live data to high-quality benchmarks: the arena-hard pipeline. External Links: Link Cited by: §1, §3.
  • Li et al. (2023) X. Li, T. Zhang, Y. Dubois, R. Taori, I. Gulrajani, C. Guestrin, P. Liang, and T. B. Hashimoto AlpacaEval: an automatic evaluator of instruction-following models. GitHub. Note: https://github.com/tatsu-lab/alpaca_eval Cited by: §1, §3.
  • Lin et al. (2024) Z. Lin, T. Liang, J. Xu, Q. Lin, X. Wang, R. Luo, C. Shi, S. Li, Y. Yang, and Z. Tu Critical tokens matter: token-level contrastive estimation enhances llm’s reasoning capability. arXiv preprint arXiv:2411.19943. Cited by: Appendix A, §1, §4.2, §5.
  • Liu et al. (2025) A. Liu, H. Bai, Z. Lu, Y. Sun, X. Kong, S. Wang, J. Shan, A. M. Jose, X. Liu, L. Wen, P. S. Yu, and M. Cao TIS-dpo: token-level importance sampling for direct preference optimization with estimated weights. In Proceedings of International Conference on Learning Representations, Cited by: Appendix A, §1, §4.2, §5.
  • Loshchilov and Hutter (2019) I. Loshchilov and F. Hutter Decoupled weight decay regularization. In Proceedings of International Conference on Learning Representations, Cited by: §3.
  • McCoy et al. (2019) R. T. McCoy, E. Pavlick, and T. Linzen Right for the wrong reasons: diagnosing syntactic heuristics in natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Cited by: Appendix A.
  • Meng et al. (2024) Y. Meng, M. Xia, and D. Chen SimPO: simple preference optimization with a reference-free reward. In Advances in Neural Information Processing Systems, Cited by: Appendix A, Appendix F, §1, §1, §3, §3, §3, §3, §4.3, §5.
  • Ouyang et al. (2022) L. Ouyang, J. Wu, X. Jiang, D. Almeida, C. L. Wainwright, P. Mishkin, C. Zhang, S. Agarwal, K. Slama, A. Ray, J. Schulman, J. Hilton, F. Kelton, L. Miller, M. Simens, A. Askell, P. Welinder, P. Christiano, J. Leike, and R. Lowe Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155. Cited by: Appendix A, §1, §5.
  • Park et al. (2024) R. Park, R. Rafailov, S. Ermon, and C. Finn Disentangling length from quality in direct preference optimization. In Proceedings of Findings of the Association for Computational Linguistics, Cited by: Appendix A, §3, §5.
  • Rafailov et al. (2023) R. Rafailov, A. Sharma, E. Mitchell, S. Ermon, C. D. Manning, and C. Finn Direct preference optimization: your language model is secretly a reward model. In Advances in Neural Information Processing Systems, Cited by: Appendix A, Appendix B, §1, §2.4.1, §2.4, §3, §5.
  • Schulman et al. (2017a) J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347. Cited by: Appendix A, §1, §5.
  • Schulman et al. (2017b) J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347. Cited by: §5.
  • Serrano and Smith (2019) S. Serrano and N. A. Smith Is attention interpretable?. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Cited by: Appendix A.
  • Shao et al. (2025) R. Shao, B. Li, G. Liu, Y. Chen, X. Zhou, J. Wang, X. Cai, and P. Li Earlier tokens contribute more: learning direct preference optimization from temporal decay perspective. In Proceedings of International Conference on Learning Representations, Cited by: Appendix A, §1, §4.2, §5.
  • Tunstall et al. (2023) L. Tunstall, E. Beeching, N. Lambert, N. Rajani, K. Rasul, Y. Belkada, S. Huang, L. von Werra, C. Fourrier, and e. a. Nathan Habib Zephyr: direct distillation of lm alignment.. arXiv preprint arXiv:2310.16944. Cited by: §G.2.
  • Vaswani et al. (2017) A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin Attention is all you need. In Advances in Neural Information Processing Systems, Cited by: Appendix A.
  • Vig (2019) J. Vig A multiscale visualization of attention in the transformer model. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, Cited by: Appendix A.
  • Wiedemann et al. (2019) G. Wiedemann, S. Remus, A. Chawla, and C. Biemann Does bert make any sense? interpretable word sense disambiguation with contextualized embeddings. In Conference on Natural Language Processing, Cited by: Appendix A.
  • Xiao et al. (2024) G. Xiao, Y. Tian, B. Chen, S. Han, and M. Lewis Efficient streaming language models with attention sinks. In Proceedings of International Conference on Machine Learning, Cited by: §2.6.
  • Xu et al. (2024) H. Xu, A. Sharaf, Y. Chen, W. Tan, L. Shen, B. V. Durme, K. Murray, and Y. J. Kim Contrastive preference optimization: pushing the boundaries of llm performance in machine translation. In Proceedings of International Conference on Machine Learning, Cited by: Appendix A, §3, §5.
  • Yang et al. (2025) K. Yang, Z. Liu, Q. Xie, J. Huang, E. Min, and S. Ananiadou Selective preference optimization via token-level reward function estimation. In Proceedings of Empirical Methods in Natural Language Processing, Cited by: Appendix A, §1, §3, §4.2, §4.3, §5.
  • Yang et al. (2026) N. Yang, H. Lin, Y. Liu, B. Tian, G. Liu, and H. Zhang Token-importance guided direct preference optimization. In Proceedings of International Conference on Learning Representations, Cited by: Appendix A, §1, §3, §4.2, §5.
  • Yuan et al. (2023) Z. Yuan, H. Yuan, C. Tan, W. Wang, S. Huang, and F. Huang RRHF: rank responses to align language models with human feedback without tears. In Advances in Neural Information Processing Systems, Cited by: Appendix A, §3, §5.
  • Zeng et al. (2024) Y. Zeng, G. Liu, W. Ma, N. Yang, H. Zhang, and J. Wang Token-level direct preference optimization. In Proceedings of International Conference on Machine Learning, Cited by: Appendix A, §1, §3, §5.
  • Zhao et al. (2023) Y. Zhao, R. Joshi, T. Liu, M. Khalman, M. Saleh, and P. J. Liu SLiC-hf: sequence likelihood calibration with human feedback. arXiv preprint arXiv:2305.10425. Cited by: Appendix A, §3, §5.
  • Zheng et al. (2023) L. Zheng, W. Chiang, Y. Sheng, S. Zhuang, Z. Wu, Y. Zhuang, Z. Lin, Z. Li, D. Li, E. P. Xing, H. Zhang, J. E. Gonzalez, and I. Stoica Judging llm-as-a-judge with mt-bench and chatbot arena. In Advances in Neural Information Processing Systems, Datasets and Benchmarks Track, Cited by: §1, §3.

The alignment with human preferences and values is critical for LLM-generated output. Early work Ouyang et al. (2022) trains LLM using policy-gradient RL-algorithm such as PPO Schulman et al. (2017a). However, these methods require training a separate reward model on annotated preference pairs to provide RL rewards. Preference Optimization (PO) methods avoid the need for an extra reward model and train the main policy directly on the preference pairs to learn the reward landscape. On a high level, PO methods use a contrastive learning objective between a preferred response y_wy\_{w} and a dispreferred response y_ly\_{l}. For example, RRHF Yuan et al. (2023) and SLiC-HF Zhao et al. (2023) use ranking losses. DPO Rafailov et al. (2023) drives its training objective from policy gradient, which normalizes the model’s probability with the reference model’s probability. IPO Azar et al. (2024) uses a bounded objective in contrast to DPO. KTO Ethayarajh et al. (2024) avoids the pairwise assumption and uses a pointwise formulation. CPO Xu et al. (2024) and ORPO Hong et al. (2024) add an SFT term in addition to the contrastive term. R-DPO Park et al. (2024) adds an extra term to the original DPO objective to avoid the length exploitation. SimPO Meng et al. (2024) modifies DPO by removing dependencies on the reference model, incorporating length normalization, and adding a reward margin term. However, all the methods above assign equal weights to every response token, which cannot account for the fine-grained importance of each token to the overall response quality.

Various attempts are made to enable fine-grained, token-level credit assignment during PO training. TDPO Zeng et al. (2024) is grounded on token-level policy gradient methods. It adds two sequence KL terms to the original DPO objective. TIS-DPO Liu et al. (2025) and cDPO Lin et al. (2024) estimate the token importance via contrasting the probability to produce the token from a positive policy with the one from a negative policy, given the same prefix. The positive and negative policies are induced either from prompts or training. SePO Yang et al. (2025) takes a similar approach, but it trains an oracle model with DPO on a subset of the original training set and contrasts the probability from the oracle against the one from the reference model. TI-DPO Yang et al. (2026) estimates the token weights by combining a pre-defined Gaussian prior distribution with the gradient norm of the last token’s maximum logit with respect to each token. Certain methods use heuristics to assign weights. For example, D2PO Shao et al. (2025) gives earlier tokens more weight than later ones. However, many of these methods require training extra models to estimate weights. The rest compute weights using heuristic functions, which are purely based on token positions rather than the tokens themselves.

Early studies on transformers Vaswani et al. (2017) indicate that specific attention heads capture linguistic properties like coreference resolution, framing attention weights as transparent windows into model reasoning Clark et al. (2019). However, subsequent research challenges this notion by demonstrating that attention distributions can be manipulated without altering model predictions, implying that attention correlates with but does not cause model outputs Jain and Wallace (2019); Serrano and Smith (2019). Counter-counter-arguments suggest attention remains a useful, albeit incomplete, diagnostic signal when contextualized Wiedemann et al. (2019). While individual attention heads specialize Vig (2019), they operate redundantly. Furthermore, attention patterns are frequently associated with superficial heuristics rather than deep semantic understanding McCoy et al. (2019). When aggregated across multiple layers with residual connections, the aggregated attentions show a higher correlation with gold token importance scores, compared with raw attentions Abnar and Zuidema (2020). These findings suggest that attention could potentially provide a complementary view of information flow. In summary, whether attention is interpretable is still under debate. As such, in this work, we do not explicitly assume the interpretability of attentions.

Appendix B Theoretical Analysis and Error Bounds

Section titled “Appendix B Theoretical Analysis and Error Bounds”

Because the sequence-level expectation E_y∼π\mathbb{E}\_{y\sim\pi} in the TwDPO objective is coupled with token-weighted log-probabilities, deriving an exact analytical closed-form solution for the optimal policy is intractable without invoking complex token-level dynamic programming. In this section, we establish a formal theoretical guarantee for TwDPO by framing it as a bounded perturbation around the standard Direct Preference Optimization (DPO) objective (Rafailov et al., 2023). We first bound the divergence between the true, intractable TwDPO optimal policy π_opt\pi\_{\text{opt}} and the standard DPO optimal policy π_DPO\pi\_{\text{DPO}}. We then bound the distance between our empirical autoregressive heuristic policy π~\*\tilde{\pi}^{\*} and π_DPO\pi\_{\text{DPO}}, concluding with a unified Total Variation (TV) distance bound between the empirical heuristic and the true optimum.

B.1 Objective Formulation and Perturbation Setup

Section titled “B.1 Objective Formulation and Perturbation Setup”

Let D\mathcal{D} denote the dataset of prompts xx, and let y=(y1,y2,…,y∣y∣)y=(y^{1},y^{2},\dots,y^{|y|}) represent a generated sequence of length ∣y∣|y|. For a given prompt xx, policy π\pi, and reference policy π_ref\pi\_{\text{ref}}, the TwDPO objective J_TwDPO(π)J\_{\text{TwDPO}}(\pi) modifies the standard sequence-level KL penalty by weighting individual token steps using attention weights ata^{t}:

$$\begin{split}&J_{\text{TwDPO}}(\pi)=\mathbb{E}_{x\sim\mathcal{D}}\mathbb{E}_{y\sim\pi(\cdotx)}\ &~~~~~~~~~~\left[r(x,y)-\betay

where β>0\beta>0 is the global scaling parameter. By definition, the token attention weights are normalized such that ∑_t=1∣y∣at=1\sum\_{t=1}^{|y|}a^{t}=1. Let us define the effective token weights as wt=∣y∣atw^{t}=|y|a^{t}, satisfying 1∣y∣∑_t=1∣y∣wt=1\frac{1}{|y|}\sum\_{t=1}^{|y|}w^{t}=1.

We parameterize the deviation of these attention weights from a uniform distribution as a perturbation vector ϵt\epsilon^{t}:

$$w^{t}=1+\epsilon^{t},\quad\text{where}\quad\sum_{t=1}^{y}\epsilon^{t}=0.$$
Assumption 1 (Bounded Attention Deviation).
Section titled “Assumption 1 (Bounded Attention Deviation).”

There exists a constant δ≥0\delta\geq 0 such that the maximum token-level attention perturbation is strictly bounded for all sequences:

$$\max_{t}\epsilon^{t}\leq\delta.$$
Assumption 2 (Bounded Trust Region Log-Ratios).
Section titled “Assumption 2 (Bounded Trust Region Log-Ratios).”

The log-probability ratio between any valid policy π\pi under consideration and the reference policy π_ref\pi\_{\text{ref}} is bounded at the token level by a finite constant C>0C>0:

$$\max_{t}\left\log\frac{\pi(y^{t}\mid x,y^{<t})}{\pi_{\text{ref}}(y^{t}\mid x,y^{<t})}\right\leq C.$$

Using this formulation, we decompose the TwDPO objective into the standard DPO objective J_DPO(π)J\_{\text{DPO}}(\pi) and a descriptive perturbation term:

$$\begin{split}J_{\text{TwDPO}}(\pi)&=\mathbb{E}_{x\sim\mathcal{D}}\mathbb{E}_{y\sim\pi(\cdotx)}\ &\left[r(x,y)-\beta\sum_{t=1}^{

where the point-wise sequence perturbation R_ϵ(π;x,y)R\_{\epsilon}(\pi;x,y) is defined as:

$$R_{\epsilon}(\pi;x,y)=\sum_{t=1}^{y}\epsilon^{t}\log\frac{\pi(y^{t}\mid x,y^{<t})}{\pi_{\text{ref}}(y^{t}\mid x,y^{<t})}.$$

We now bound the magnitude of the expected perturbation term. Under Assumptions 1 and 2, the sequence-level perturbation can be upper-bounded via the triangle inequality:

$$\begin{split}R_{\epsilon}(\pi;x,y)&\leq\sum_{t=1}^{

Taking the expectation over the prompt and sequence distributions, the discrepancy between the two objectives is strictly bounded by:

$$\leftJ_{\text{TwDPO}}(\pi)-J_{\text{DPO}}(\pi)\right\leq\beta\delta C\mathbb{E}_{x\sim\mathcal{D}}\mathbb{E}_{y\sim\pi(\cdot

For ease of notation, let B(π)=βδCE_π[∣y∣]B(\pi)=\beta\delta C\mathbb{E}\_{\pi}[|y|] denote the policy-dependent bound constraint.

Let π_opt=arg⁡max⁡_πJ_TwDPO(π)\pi\_{\text{opt}}=\arg\max\_{\pi}J\_{\text{TwDPO}}(\pi) be the true, intractable optimal policy under the token-weighted framework, and let π_DPO=arg⁡max⁡_πJ_DPO(π)\pi\_{\text{DPO}}=\arg\max\_{\pi}J\_{\text{DPO}}(\pi) be the analytical optimal policy for the standard DPO objective.

From the exact mathematical properties of KL-constrained reinforcement learning objectives, the suboptimality gap of any arbitrary policy π\pi evaluated under J_DPOJ\_{\text{DPO}} is exactly equal to its generalized KL divergence from the optimal DPO policy:

\begin{split}&J\_{\text{DPO}}(\pi\_{\text{DPO}})-J\_{\text{DPO}}(\pi)\\ &=\beta\mathbb{E}\_{x\sim\mathcal{D}}\left[D\_{\text{KL}}(\pi(\cdot\mid x)\parallel\pi\_{\text{DPO}}(\cdot\mid x))\right].\end{split}(23)

Evaluating the true optimal policy π_opt\pi\_{\text{opt}} using the identity in Equation 23 yields:

\begin{split}&J\_{\text{DPO}}(\pi\_{\text{DPO}})-J\_{\text{DPO}}(\pi\_{\text{opt}})\\ &=\beta\mathbb{E}\_{x\sim\mathcal{D}}\left[D\_{\text{KL}}(\pi\_{\text{opt}}(\cdot\mid x)\parallel\pi\_{\text{DPO}}(\cdot\mid x))\right].\end{split}(24)

By the definition of functional optimality, π_opt\pi\_{\text{opt}} maximizes J_TwDPOJ\_{\text{TwDPO}}, meaning J_TwDPO(π_opt)≥J_TwDPO(π_DPO)J\_{\text{TwDPO}}(\pi\_{\text{opt}})\geq J\_{\text{TwDPO}}(\pi\_{\text{DPO}}). We construct a double inequality chain by introducing the objective boundaries B(π_opt)B(\pi\_{\text{opt}}) and B(π_DPO)B(\pi\_{\text{DPO}}):

\begin{split}J\_{\text{DPO}}(\pi\_{\text{opt}})+B(\pi\_{\text{opt}})&\geq J\_{\text{TwDPO}}(\pi\_{\text{opt}})\\ &\geq J\_{\text{TwDPO}}(\pi\_{\text{DPO}})\\ &\geq J\_{\text{DPO}}(\pi\_{\text{DPO}})-B(\pi\_{\text{DPO}}).\end{split}(25)

Rearranging the outermost components of this inequality gives an upper bound on the DPO objective gap:

J_DPO(π_DPO)−J_DPO(π_opt)≤B(π_DPO)+B(π_opt).J\_{\text{DPO}}(\pi\_{\text{DPO}})-J\_{\text{DPO}}(\pi\_{\text{opt}})\leq B(\pi\_{\text{DPO}})+B(\pi\_{\text{opt}}).(26)

Substituting this directly back into the identity in Equation 24, we obtain:

$$\begin{split}\beta\mathbb{E}_{x\sim\mathcal{D}}\left[D_{\text{KL}}(\pi_{\text{opt}}(\cdot\mid x)\parallel\pi_{\text{DPO}}(\cdot\mid x))\right]\ \leq\beta\delta C\left(\mathbb{E}_{\pi_{\text{DPO}}}[y]+\mathbb{E}_{\pi_{\text{opt}}}[

Dividing both sides by the regularization parameter β\beta establishes our first localized distance guarantee.

The expected KL divergence between the true optimal token-weighted policy π_opt\pi\_{\text{opt}} and the standard DPO policy π_DPO\pi\_{\text{DPO}} is linearly bounded by the maximum attention perturbation δ\delta:

$$\begin{split}\mathbb{E}_{x\sim\mathcal{D}}\left[D_{\text{KL}}(\pi_{\text{opt}}(\cdot\mid x)\parallel\pi_{\text{DPO}}(\cdot\mid x))\right]\ \leq\delta C\left(\mathbb{E}_{\pi_{\text{DPO}}}[y]+\mathbb{E}_{\pi_{\text{opt}}}[

B.4 Bounding the Autoregressive Heuristic Policy

Section titled “B.4 Bounding the Autoregressive Heuristic Policy”

We now address our empirical heuristic policy, denoted as π~\*\tilde{\pi}^{\*}. While π~\*\tilde{\pi}^{\*} is derived via a localized parameterization mapping, it is generated sequentially in an autoregressive fashion, ensuring that π~\*(y∣x)=∏_t=1∣y∣π~\*(yt∣x,y<t)\tilde{\pi}^{\*}(y\mid x)=\prod\_{t=1}^{|y|}\tilde{\pi}^{\*}(y^{t}\mid x,y^{<t}) constitutes a mathematically proper, normalized probability distribution over sequence space (∑_yπ~\*(y∣x)=1\sum\_{y}\tilde{\pi}^{\*}(y\mid x)=1).

By definition, our empirical token-weighted optimal parameterization satisfies the equality:

$$\sum_{t=1}^{y}w^{t}\log\frac{\tilde{\pi}^{*}(y^{t}\mid x,y^{<t})}{\pi_{\text{ref}}(y^{t}\mid x,y^{<t})}=\frac{1}{\beta}r(x,y)-\log Z(x).$$

Expanding wt=1+ϵtw^{t}=1+\epsilon^{t} yields:

log⁡π~\*(y∣x)π_ref(y∣x)+R_ϵ(π~\*;x,y)=1βr(x,y)−log⁡Z(x).\log\frac{\tilde{\pi}^{\*}(y\mid x)}{\pi\_{\text{ref}}(y\mid x)}+R\_{\epsilon}(\tilde{\pi}^{\*};x,y)=\frac{1}{\beta}r(x,y)-\log Z(x).(30)

Recall that the standard sequence-level DPO optimal policy satisfies:

log⁡π_DPO(y∣x)π_ref(y∣x)=1βr(x,y)−log⁡Z_DPO(x).\log\frac{\pi\_{\text{DPO}}(y\mid x)}{\pi\_{\text{ref}}(y\mid x)}=\frac{1}{\beta}r(x,y)-\log Z\_{\text{DPO}}(x).(31)

Subtracting Equation 31 from Equation 30 isolates the log-ratio between our heuristic policy and the standard DPO policy:

log⁡π~\*(y∣x)π_DPO(y∣x)=log⁡Z_DPO(x)−log⁡Z(x)−R_ϵ(π~\*;x,y).\log\frac{\tilde{\pi}^{\*}(y\mid x)}{\pi\_{\text{DPO}}(y\mid x)}=\log Z\_{\text{DPO}}(x)-\log Z(x)-R\_{\epsilon}(\tilde{\pi}^{\*};x,y).(32)

Let ΔZ(x)=log⁡Z_DPO(x)−log⁡Z(x)\Delta Z(x)=\log Z\_{\text{DPO}}(x)-\log Z(x). Taking the expectation of Equation 32 under π~\*\tilde{\pi}^{\*} yields the forward KL divergence:

D_KL(π~\*∥π_DPO)=ΔZ(x)−E_y∼π~\*[R_ϵ(π~\*;x,y)].D\_{\text{KL}}(\tilde{\pi}^{\*}\parallel\pi\_{\text{DPO}})=\Delta Z(x)-\mathbb{E}\_{y\sim\tilde{\pi}^{\*}}\left[R\_{\epsilon}(\tilde{\pi}^{\*};x,y)\right].(33)

Similarly, taking the expectation of Equation 32 under the standard DPO policy yields the reverse KL divergence:

−D_KL(π_DPO∥π~\*)=ΔZ(x)−E_y∼π_DPO[R_ϵ(π~\*;x,y)].-D\_{\text{KL}}(\pi\_{\text{DPO}}\parallel\tilde{\pi}^{\*})=\Delta Z(x)-\mathbb{E}\_{y\sim\pi\_{\text{DPO}}}\left[R\_{\epsilon}(\tilde{\pi}^{\*};x,y)\right].(34)

Subtracting Equation 34 from Equation 33 cancels the intractable partition scaling term ΔZ(x)\Delta Z(x):

\begin{split}&D\_{\text{KL}}(\tilde{\pi}^{\*}\parallel\pi\_{\text{DPO}})+D\_{\text{KL}}(\pi\_{\text{DPO}}\parallel\tilde{\pi}^{\*})\\ &=\mathbb{E}\_{y\sim\pi\_{\text{DPO}}}\left[R\_{\epsilon}(\tilde{\pi}^{\*};x,y)\right]-\mathbb{E}\_{y\sim\tilde{\pi}^{\*}}\left[R\_{\epsilon}(\tilde{\pi}^{\*};x,y)\right].\end{split}(35)

Since the reverse KL divergence is strictly non-negative (D_KL(π_DPO∥π~\*)≥0D\_{\text{KL}}(\pi\_{\text{DPO}}\parallel\tilde{\pi}^{\*})\geq 0), we drop it to establish an upper bound, and apply the triangle inequality across expectations:

$$\begin{split}D_{\text{KL}}(\tilde{\pi}^{*}\parallel\pi_{\text{DPO}})&\leq\left\mathbb{E}_{y\sim\pi_{\text{DPO}}}\left[R_{\epsilon}(\tilde{\pi}^{*};x,y)\right]\right

Taking the expectation across the entire prompt distribution D\mathcal{D} establishes our second localization lemma.

The expected KL divergence between the empirical autoregressive heuristic policy π~\*\tilde{\pi}^{\*} and the closed-form standard DPO policy π_DPO\pi\_{\text{DPO}} is strictly bounded by:

$$\begin{split}\mathbb{E}_{x\sim\mathcal{D}}\left[D_{\text{KL}}(\tilde{\pi}^{*}(\cdot\mid x)\parallel\pi_{\text{DPO}}(\cdot\mid x))\right]\ \leq\delta C\left(\mathbb{E}_{\pi_{\text{DPO}}}[y]+\mathbb{E}_{\tilde{\pi}^{*}}[

B.5 Unified Suboptimality Guarantee via Total Variation Distance

Section titled “B.5 Unified Suboptimality Guarantee via Total Variation Distance”

We now unify Lemma 1 and Lemma 2 to bound the final distance between our empirical heuristic policy π~\*\tilde{\pi}^{\*} and the true intractable optimal policy π_opt\pi\_{\text{opt}}. We map our KL bounds to Total Variation (TV) distance using Pinsker’s inequality, which states that for any distributions PP and QQ, D_TV(P,Q)≤12D_KL(P∥Q)D\_{\text{TV}}(P,Q)\leq\sqrt{\frac{1}{2}D\_{\text{KL}}(P\parallel Q)}.

Applying Pinsker’s inequality to Lemma 1 and Lemma 2 gives:

$$\begin{split}&\mathbb{E}_{x\sim\mathcal{D}}[D_{\text{TV}}(\pi_{\text{opt}},\pi_{\text{DPO}})]\ &\leq\mathbb{E}_{x\sim\mathcal{D}}\biggl[\sqrt{\frac{1}{2}D_{\text{KL}}\left(\pi_{\text{opt}}(\cdot\mid x)\parallel\pi_{\text{DPO}}(\cdot\mid x)\right)}\biggr]\ &\leq\mathbb{E}_{x\sim\mathcal{D}}\biggl[\sqrt{\frac{\delta C}{2}\left(\mathbb{E}_{y\sim\pi_{\text{DPO}}}[y]+\mathbb{E}_{y\sim\pi_{\text{opt}}}[

where the first inequality comes from Pinsker’s inequality, the second comes from equation 28 with D\mathcal{D} containing only a single query xx, the third comes from Jensen’s inequality.

Similarly, applying Pinsker’s inequality, equation 36 with D\mathcal{D} containing only a single query xx, and Jensen’s inequality, we get

$$\begin{split}&\mathbb{E}_{x\sim\mathcal{D}}[D_{\text{TV}}(\tilde{\pi}^{*},\pi_{\text{DPO}})]\leq\sqrt{\frac{\delta C}{2}\left(\mathbb{E}_{\pi_{\text{DPO}}}[y]+\mathbb{E}_{\tilde{\pi}^{*}}[

Finally, by utilizing the triangle inequality property of Total Variation distances, we bound the direct distance between the empirical heuristic and the true functional optimum:

D_TV(π_opt,π~\*)≤D_TV(π_opt,π_DPO)+D_TV(π~\*,π_DPO).D\_{\text{TV}}(\pi\_{\text{opt}},\tilde{\pi}^{\*})\leq D\_{\text{TV}}(\pi\_{\text{opt}},\pi\_{\text{DPO}})+D\_{\text{TV}}(\tilde{\pi}^{\*},\pi\_{\text{DPO}}).(39)

Taking expectations over D\mathcal{D} and substituting Equations 37 and 38 leads directly to our main result.

Theorem 1 (TwDPO Suboptimality Consistancy).
Section titled “Theorem 1 (TwDPO Suboptimality Consistancy).”

Under Assumptions 1 and 2, the expected Total Variation distance between the empirical autoregressive heuristic policy π~\*\tilde{\pi}^{\*} and the true, intractable token-weighted optimal policy π_opt\pi\_{\text{opt}} is strictly bounded by O(δ)\mathcal{O}(\sqrt{\delta}):

$$\begin{split}&\mathbb{E}_{x\sim\mathcal{D}}[D_{\text{TV}}(\pi_{\text{opt}}(\cdot\mid x),\tilde{\pi}^{*}(\cdot\mid x))]\leq\sqrt{\frac{\delta C}{2}}\ &~~~~\left(\sqrt{\mathbb{E}_{\pi_{\text{DPO}}}[y]+\mathbb{E}_{\pi_{\text{opt}}}[

This theorem provides a rigorous theoretical safety net for TwDPO. It demonstrates that while a clean closed-form sequence-level derivation is structurally impossible due to token-weight expectation coupling, the empirical objective remains mathematically consistent. As long as the attention variance deviation from uniform is controlled (δ→0\delta\to 0), the empirical policy behaves predictably and stays bounded within a localized neighborhood of the true mathematical optimum.

The gradient of objective 5 is:

$$\begin{split}\nabla_{\theta}\mathcal{L}&=-\beta\mathbb{E}_{(x,y_{w},y_{l})\sim\mathcal{D}}\biggl[\sigma\biggl(r^{\prime}_{\theta}(x,y_{l})-r^{\prime}_{\theta}(x,y_{w})\biggr)\ &\biggl(y_{w}\sum_{t=1}^{

where r′_θ(x,y)=β∣y∣∑_t=1∣y∣atlog⁡π_θ(yt∣x,y<t)π_ref(yt∣x,y<t)r^{\prime}\_{\theta}(x,y)=\beta|y|\sum\_{t=1}^{|y|}a^{t}\log\frac{\pi\_{\theta}(y^{t}|x,y^{<t})}{\pi\_{ref}(y^{t}|x,y^{<t})}.

Similar to DPO, the σ(r′_θ(x,y_l)−r′_θ(x,y_w))\sigma(r^{\prime}\_{\theta}(x,y\_{l})-r^{\prime}\_{\theta}(x,y\_{w})) term scales up our combined gradient when the reward margin between y_wy\_{w} and y_ly\_{l} is smaller or negative. The main difference from DPO is that we weigh the gradient of each token at position tt by ata^{t}, so that higher-weighted tokens get more gradient updates and the model learns more on these tokens.

Appendix D Note on the weighted log probability term

Section titled “Appendix D Note on the weighted log probability term”

Despite the use of notation π~\tilde{\pi}, our original derivation does not require the weighted probability terms π~\tilde{\pi} and π~_ref\tilde{\pi}\_{ref} to be proper distributions. Nonetheless, we can normalize the weighted likelihood to form a proper distribution, and the near-optimal policy, as well as its error bound, remains the same. The true optimal policy remains intractable because, in contrast to the original RL objective, the token-weighted RL objective cannot be expressed as a proper KL divergence between the sampling policy and the optimal policy.

In the following, we show how to make the weighted log-likelihood a proper distribution.

Define log⁡πˉ(y∣x)=log⁡π~(y∣x)−log⁡C1(x)\log\bar{\pi}(y|x)=\log\tilde{\pi}(y|x)-\log C^{1}(x). Then πˉ(y∣x)=π~(y∣x)/C1(x)\bar{\pi}(y|x)=\tilde{\pi}(y|x)/C^{1}(x). Setting C1(x)=∑_yπ~(y∣x)C^{1}(x)=\sum\_{y}\tilde{\pi}(y|x) makes πˉ(y∣x)\bar{\pi}(y|x) a proper distribution. We can define πˉ_ref(y∣x)\bar{\pi}\_{ref}(y|x) in a similar way. Setting C2(x)=∑_yπ~_ref(y∣x)C^{2}(x)=\sum\_{y}\tilde{\pi}\_{ref}(y|x) makes it a proper distribution.

Now denote Q~=log⁡π~(y∣x)/π~_ref(y∣x)\tilde{Q}=\log\tilde{\pi}(y|x)/\tilde{\pi}\_{ref}(y|x) and Qˉ=log⁡πˉ(y∣x)/πˉ_ref(y∣x)\bar{Q}=\log\bar{\pi}(y|x)/\bar{\pi}\_{ref}(y|x). Then the TwDPO objective in equation 7 is equivalent to

$$\begin{split}&\max_{\pi}\mathbb{E}_{x\sim\mathcal{D},y\sim\pi(\cdotx)}\biggl[r(x,y)-\beta\tilde{Q}\biggr]\ &=\max_{\pi}\mathbb{E}_{x\sim\mathcal{D},y\sim\pi(\cdot

where

$$\begin{split}\bar{\pi}^{*}(yx)=\frac{\bar{\pi}_{ref}(y

and

$$\begin{split}\bar{Z}(x)=\sum_{y}\bar{\pi}_{ref}(yx)exp(\frac{1}{\beta}r(x,y))\end{split}$$

Note that, for every y, πˉ_ref(y∣x)\bar{\pi}\_{ref}(y|x) is just the original π~_ref(y∣x)\tilde{\pi}\_{ref}(y|x) multiplied by C2(x)C^{2}(x). Expanding it makes the C2(x)C^{2}(x) in the numerator and denominator in (2)\*(2)^{\*} cancel out.

Therefore, the new near-optimum policy πˉ\*(y∣x)\bar{\pi}^{\*}(y|x) is equivalent to the original near-optimum policy in Equation 9 and has the same error bound. The new reward is the same as in Equation 11, but there is an extra −log⁡C1(x)−log⁡C2(x)-\log C^{1}(x)-\log C^{2}(x) term, which cancels out in pairwise subtraction, and leads to the same optimization objective 12.

So we can make the weighted likelihood a proper distribution and it leads to the exact same final objective, but we argue that the true optimal solution is still intractable because the expectation in (1)\*(1)^{\*} is over the original policy y∼π(⋅∣x)y\sim\pi(\cdot|x), not the new distribution y∼πˉ(⋅∣x)y\sim\bar{\pi}(\cdot|x), and so (1)\*(1)^{\*} is not a proper KL divergence.

We note that certain attention scores may not be matched to any tokens, and certain tokens may not be assigned an attention weight. This is because when we extract the attention weights in § 2.5, the response yy is tokenized with the pairwise judge prompt as the surrounding context. During training, yy is tokenized with a different surrounding context, and consequently, the first and last several tokens do not match the original tokens extracted from the pairwise judge prompt. In case no perfect match is found, we use the “edit_distance” Python library to match the attention weight to the response tokens during training. For tokens without a match, we assign a weight of 0. We observe that in most cases, more than 95% of the tokens are matched to attention weights.

ParameterValue
Max Context Length2048
Max Prompt Length1800
Learning Rate1e-6
β\beta5e-3
Batch Size32
# Epochs1
# Train Examples∼\sim60K
# Validation Examples∼\sim2K
SchedulerCosine
Warmup Ratio0.1
OptimizerAdamW

Table 6: Training Hyperparameters

We tune our training β\beta in the range {1e-3, 5e-3, 1e-2, 2e-2}\{\text{1e-3, 5e-3, 1e-2, 2e-2}\} and show the final training hyperparameters for AttentionPOfor both LLaMA-3-8B-Base-SFT and LLaMA-3-8B-Instruct in Figure 6. We train for around 2K steps and validate every 500 steps to pick the best checkpoint for evaluation. For the baselines except TDPO and TI-DPO, we take the existing checkpoints from Meng et al. (2024) and use their hyperparameters.

For TDPO and TI-DPO, since the original method is applied on different task and training datasets, we retrain new checkpoints on our datasets. For TDPO, we use the TDPO2 variant due to its superior performance over TPO1, as reported in the original paper. We tune β\beta in the range {1e-2,1e-1}\{\text{1e-2},\text{1e-1}\} and adopt the default for other hyperparameters. The final hyperparameters are β=1e-2,α=0.5,Learning Rate=5e-6\beta=\text{1e-2},\alpha=0.5,\text{Learning Rate}=\text{5e-6}. For TI-DPO, we try different mixed-precision training setups. The original TIDPO implementation uses float32 for the main model and float16 for the reference model. We found that it worked much worse than our current setup, so we experiment with fp16 and bf16 and finally discover that bf16 works the best. We also tune β\beta in the range {1e-2,1e-1}\{\text{1e-2},\text{1e-1}\} and Learning Rate in the range {1e-6,5e-6,1e-5}\{\text{1e-6},\text{5e-6},\text{1e-5}\}. We adopt the default for the other hyperparameters. The final hyperparameters are β=1e-2,α=0.5,α_triplet=1e-3,γ=0.1,λ=0.7,Learning Rate=1e-6\beta=\text{1e-2},\alpha=0.5,\alpha\_{\text{triplet}}=\text{1e-3},\gamma=0.1,\lambda=0.7,\text{Learning Rate}=\text{1e-6}.

There could be multiple reasons for the suboptimal results of TDPO and TIDPO in our setting. Qualitatively, we inspect and compare their outputs with DPO’s on the ArenaHard benchmark, for LLaMA-3-8B-Instruct. For TDPO, we find that the model’s outputs are more hallucinatory than DPO’s on math and coding questions, and its outputs are more generic than DPO’s on technical writing questions. For TIDPO, across different types of queries, the model tends to produce outputs that are simpler and less comprehensive than DPO’s, and only addresses the core part of the user’s queries, despite having longer responses. For instance, for coding questions, TDPO’s programs have fewer explanatory comments. The fundamental causes of these behavioral differences need to be investigated further.

For OTPO, the authors use β=1e-2,Learning Rate=5e-7\beta=\text{1e-2},\text{Learning Rate}=\text{5e-7} for their training of LLaMA-3-8B-Instruct on UltraFeedback. We adopt their hyperparameters for our experiments.

ParameterValue
Max New Tokens4096
Temperature0.7
Top K50
Top P0.9
Presence Penalty0.1
Frequency Penalty0.1
Judge Max New Tokens1
Judge Temperature1.0
Baseline ModelGPT4-1106-preview

Table 7: Hyperparameters for AlpacaEval

ParameterValue
Max New Tokens1024
Temperaturevaries
Judge Max New Tokens2048
Judge Temperature0

Table 8: Hyperparameters for MT-Bench. We use the default temperature, which varies between different task subsets.

ParameterValue
Max New Tokens2048
Temperature0
Judge Max New Tokens16000
Judge Temperature0
Baseline ModelGPT-4-0314

Table 9: Hyperparameters for ArenaHard

The default hyperparameters are used whenever they are available. See the details in Figure 7, 8, and  9.

We run three rounds of independent evaluations for all the checkpoints and report the mean and 95% confidence interval in Table 10.

π_ref\pi\_{ref}=LLaMA-3-8B-Base-SFTπ_ref\pi\_{ref}=LLaMA-3-8B-Instruct
AlpacaEvalMTArenaHardAvg Rank ↓\downarrowAlpacaEvalMTArenaHardAvg Rank ↓\downarrow
LR ↑\uparrowWR ↑\uparrowScore ↑\uparrowWR ↑\uparrowLR ↑\uparrowWR ↑\uparrowScore ↑\uparrowWR ↑\uparrow
Base8.61±1.944.15±0.895.49±0.059.72±0.5613.5033.86±1.0933.22±1.246.76±0.0236.88±0.8012.50
+RRHF11.68±0.606.75±0.266.18±0.0525.71±0.409.0044.31±1.1837.92±0.556.67±0.0641.80±0.619.63
+SLiC-HF16.83±0.3511.98±0.245.93±0.0313.31±1.1210.2538.75±1.2637.45±0.836.77±0.0242.73±0.829.38
+DPO21.90±1.5717.02±0.916.58±0.0538.31±0.403.5049.02±0.0044.98±0.296.72±0.0155.32±1.585.75
+TDPO10.67±1.445.49±0.765.71±0.0313.24±1.1411.8836.98±1.0336.74±0.996.63±0.0239.35±1.6112.00
+TIDPO8.33±1.744.23±0.705.32±0.039.79±0.3713.5034.98±0.4534.10±0.506.78±0.0237.51±1.2111.00
+OTPO22.44±1.7913.58±1.066.22±0.0045.57±0.944.5052.26±1.1044.95±0.516.89±0.0252.49±0.114.25
+IPO19.87±1.1819.42±0.916.27±0.0533.65±0.895.0049.12±0.3247.00±0.856.98±0.0251.80±1.654.00
+CPO19.14±19.1424.40±0.316.13±0.0036.82±0.925.2542.04±0.7845.80±0.766.67±0.0150.59±1.757.88
+KTO18.92±18.9215.58±0.705.95±0.0217.61±0.688.2543.66±1.7040.15±1.416.77±0.0247.01±1.957.63
+ORPO18.08±1.4112.79±0.805.71±0.0417.04±0.489.8840.49±0.9436.48±0.836.69±0.0744.07±1.2410.25
+RDPO22.23±1.9815.94±1.116.32±0.0428.12±0.794.7550.48±1.6945.61±1.376.84±0.0554.18±1.154.00
+SimPO29.78±2.5427.23±1.996.10±0.0446.03±1.323.0057.00±0.4548.16±0.466.52±0.0255.86±1.064.75
+AttentionPO21.74±0.3620.53±0.416.54±0.0250.79±1.862.7560.20±0.5757.68±0.607.14±0.0952.30±0.702.00

Table 10: Main results from three rounds of independent evaluations on the same checkpoints. We report the mean and 95% Confidence Interval across the evaluation runs.

We additionally experiment with zephyr-7b-sft-full Tunstall et al. (2023), which is a model supervised-finetuned from Mistral-7B-v0.1 Jiang et al. (2023a) on UltraChat-200K Ding et al. (2023). We denote this model as Mistral-7B-Base-SFT. We use the same UltraFeedback binarized dataset Cui et al. (2024) (HuggingFaceH4/ultrafeedback_binarized) and the same hyperparameters to train it. The results are shown in Table 11.

π_ref\pi\_{ref}=Mistral-7B-Base-SFT
AlpacaEvalMTArenaHard
LR ↑\uparrowWR ↑\uparrowScore ↑\uparrowWR ↑\uparrow
Base8.774.204.542.26
+DPO18.5614.625.8512.45
+AttentionPO22.3919.475.3613.88

Table 11: Results on Mistral-7B-Base-SFT.

Compared with π_ref\pi\_{ref}, AttentionPO significantly enhances performances across different benchmarks. We observe a 14% increase on AlpacaEval, a 0.82 increase on MT-Bench, and a 12% increase on ArenaHard. In addition, AttentionPO outperforms DPO in terms of AlpacaEval and ArenaHard, but DPO has a higher MT-Bench score.

π_ref\pi\_{ref}=LLaMA-3-8B-Base-SFTπ_ref\pi\_{ref}=LLaMA-3-8B-Instruct
AlpacaEvalMTArenaHardAlpacaEvalMTArenaHard
LR ↑\uparrowWR ↑\uparrowScore ↑\uparrowWR ↑\uparrowLR ↑\uparrowWR ↑\uparrowScore ↑\uparrowWR ↑\uparrow
Base9.204.635.479.9233.6032.606.7837.57
+DPO22.8817.706.5438.5449.0244.726.7353.98
+AttentionPO21.5520.236.5249.7260.7758.297.1952.06
w/ attn from sft----48.5444.676.9945.71
w/ attn from inst26.9727.746.4458.21----

Table 12: Results of using attentions from other models.

We investigate whether attention weights from one model can be used to train another model. In particular, we use the attentions from LLaMA-3-8B-Base-SFT to train LLaMA-3-8B-Instruct (w/ attn from sft) and vice versa (w/ attn from inst). The results are shown in Table 12.

Training the SFT model with attentions from the stronger Instruct model (w/ attn from inst) leads to a further increase in performance on AlpacaEval and ArenaHard on top of the original AttentionPO results. In contrast, training the instruction model with attentions from the SFT model (w/ attn from sft) gives worse performance than the original AttentionPO, but the results are nonetheless better than π_ref\pi\_{ref} by a significant margin across benchmarks. This suggests that attentions from a stronger model gives stronger performance. AttentionPO can still deliver performance gains even with attentions from a model weaker than π_ref\pi\_{ref}, but to a lesser extent.

π_ref\pi\_{ref}=SFTπ_ref\pi\_{ref}=Instruct
WR ↑\uparrow#TokensWR ↑\uparrow#Tokens
Base9.92125437.57580
+RRHF26.00150641.91506
+SLiC-HF13.0855642.76575
+DPO38.5492153.98533
+TDPO12.09123341.00565
+TI-DPO10.14123838.73585
+IPO34.5667550.50546
+CPO36.04158852.07631
+KTO18.2851648.98535
+ORPO17.3259444.64540
+R-DPO28.7273154.98524
+SimPO47.0179654.94505
+AttentionPO49.72115752.06553

Table 13: ArenaHard Results. WR: Win Rate against GPT-4-0314. #Tokens: Number of response tokens.

We report the length of generated responses on ArenaHard in Table 13. For both the SFT and Instruct model, responses produced by AttentionPO are not longer than those from either the base model or other baseline methods. This shows that the performance boost does not come from verbosity.

We show an example of attention weights for LLaMA-3-8B-Base-SFT in Figure 4 and LLaMA-3-8B-Instruct in Figure 5.

Figure 4: An example for LLaMA-3-8B-Base-SFT.

Figure 4: An example for LLaMA-3-8B-Base-SFT.

Figure 5: An example for LLaMA-3-8B-Instruct.

Figure 5: An example for LLaMA-3-8B-Instruct.

We run all experiments on a single node with 40 CPU cores, 256 GB of memory, and 2 Nvidia A100 80 GB GPUs.

Figure 6: Pairwise Judge Prompt

Figure 7: Verbalized Self-judge System Prompt

Figure 8: Verbalized Self-judge User Prompt