TL;DR
The authors introduce PLOT (Preference Learning via Optimal Transport), a novel token-level loss function that aligns Large Language Models (LLMs) with human preferences by modeling the alignment as an Optimal Transport problem. By incorporating token embeddings into a global optimization framework, PLOT achieves superior alignment and robustness against adversarial attacks with minimal computational overhead (~2.67% increase in training time).
What Problem Does This Paper Address?
Aligning LLMs with human preferences (ensuring they are safe, helpful, and logical) typically relies on sequence-level methods like Direct Preference Optimization (DPO) or token-level heuristic losses. However, existing token-level approaches suffer from a "myopic" focus: they optimize individual tokens locally without considering the global distributional structure or the semantic relationships between different tokens. This limitation often leads to modest performance gains, high sensitivity to hyperparameters, and substantial computational costs.
The authors address this gap by proposing a principled framework that bridges token-level granularity with global distribution alignment, ensuring the model internalizes human preferences holistically without destroying its core capabilities.
Methods
PLOT reformulates token-level preference learning as an Optimal Transport (OT) problem. Instead of forcing exact token-by-token matches or using simple penalties (like KL divergence), PLOT minimizes the distance required to transform the model's output probability distribution into a target preference distribution.
Key technical innovations include:
- Semantic-Aware Cost Matrix: Rather than using a default 0-1 cost matrix (where any mismatch costs the same), PLOT utilizes the model's own token embedding table. The transport cost between two tokens is defined by the Euclidean distance ($L_2$ norm) of their normalized embeddings. This ensures that moving probability mass between semantically similar tokens costs less than moving it between unrelated tokens.
- 1D Wasserstein Distance Simplification: Exact OT optimization is notoriously expensive ($O(n^3 \log n)$). To make this practical for LLMs with massive vocabularies, the authors project the distributions into one-dimensional discrete vectors. This allows them to compute the exact solution efficiently using the closed-form 1D Wasserstein distance via Cumulative Distribution Functions (CDFs), introducing negligible training overhead.
The final loss is a simple combination: $\mathcal{L} = \mathcal{L}_{vanilla} + \alpha \mathcal{L}_{PLOT}$, where $\mathcal{L}_{vanilla}$ is a standard alignment loss (like SFT or DPO) and $\alpha$ is a weighting hyperparameter.
Datasets
The method was trained and evaluated across three target preference categories using a variety of open-source datasets:
- Harmlessness (Target Preference I): Trained on the HH-RLHF Harmlessbase subset (42,536 samples enhanced with high-quality ChatGPT responses). Evaluated using HarmBench, which includes 400 behaviors split into Standard, Copyright, and Contextual categories.
- Helpfulness & Humanity (Target Preference II): Trained on the HH-RLHF Helpful subset (118,257 samples). Evaluated using a specialized reward model, GPT-4 scoring, and MT-Bench.
- Logic & Problem Solving (Target Preference III): Trained on the Magpie series subset from INF-ORM-Preference-Magnitude-80K (59,539 samples). Evaluated on GSM8K and MATH benchmarks, alongside MT-Bench categories (Reasoning, Coding, STEM).
- General Capabilities: Evaluated on AlpacaEval 2.0 to measure the Length-controlled (LC) Win Rate.
Key Insights and Ideas
- Global vs. Local Optimization: Traditional token-level methods tweak probabilities locally. OT looks at the entire vocabulary distribution at once, allowing for smoother, more stable updates.
- Leveraging the Semantic Space: By embedding semantic distances directly into the OT cost matrix, the model learns why certain tokens are preferred over others based on context and meaning, rather than just memorizing token frequencies.
- Numerical and Hyperparameter Stability: Unlike KL divergence, which can suffer from infinity errors when dealing with the tiny probabilities common in large vocabularies, the Wasserstein distance provides excellent numerical stability. PLOT proved highly robust across varying hyperparameter scales (50% to 150% of optimal values), a common pain point for alignment algorithms.
Key Results
PLOT was integrated into several base alignment methods (SFT, DPO, PRO, AOT) across multiple model architectures (Llama 3.2-3B, Llama 3.1-8B, Qwen 2.5-7B).
- Adversarial Robustness: PLOT consistently and substantially reduced the Attack Success Rate (ASR) against multiple red-teaming attack methods (e.g., GCG, SFS, GBDA). For instance, on Llama 3.2-3B with DPO, PLOT dropped the SFS attack ASR from 25.75% to 16.92%.
- Multi-Domain Superiority: PLOT achieved higher scores in Helpfulness, Humanity, Mathematics, Reasoning, Coding, and STEM compared to standard DPO and instruction-tuned baselines.
- Preserving General Capabilities: Standard DPO often degrades a model's general conversational win rate (the "alignment tax"). PLOT successfully mitigated this decline, maintaining a higher Length-controlled Win Rate on AlpacaEval 2.0.
- Efficiency: The computational cost of calculating the 1D Wasserstein distance was minimal, resulting in only a 2.67% increase in training time compared to standard DPO.
Limitations and Future Work
The authors acknowledge a few limitations driven by resource constraints:
- The method was not tested on larger-scale models (e.g., 70B+ parameters).
- The training data was restricted to a single randomly sampled set (4,000 instances per task), meaning the paper does not analyze how PLOT scales across varying data volumes.
Future work could explore scaling PLOT to larger architectures and evaluating its performance across broader data distributions.
Summary updated