Beyond Pairs: Your Language Model is Secretly Optimizing a Preference Graph

Ning Liu, Chuanneng Sun, Kristina Lisa Klinkner, Shervin Malmasi

TL;DR

When we train language models on human or automated preferences, we usually chop rich, multi-response feedback into isolated "A is better than B" pairs, or force everything into a strict ranked list. GraphDPO instead models multiple candidate responses as a directed acyclic graph (DAG), naturally preserving ties, partial correctness, and transitive relationships without adding noisy, artificial rankings. The result is a linear-time alignment method that significantly outperforms standard pairwise and listwise techniques on tough math and coding benchmarks.

What Problem Does This Paper Address?

To make Large Language Models (LLMs) helpful and reliable, we align them using preference data. Direct Preference Optimization (DPO) simplified this process by skipping explicit reward models and training directly on pairs of responses (one winner, one loser).

However, in practice—especially in math and coding—we generate many candidate responses ($K$ rollouts) per prompt and grade them using unit tests or answer verifiers. How do we feed $K$ responses into a pairwise algorithm? Usually, we shatter them into $O(K^2)$ independent pairs, which throws away global transitive structure (if $A > B$ and $B > C$, the model loses the unified thread that $A > C$) and creates redundant work.

Recent "listwise" methods try to fix this by ranking all $K$ responses from best to worst. Yet real-world evaluation rarely yields a neat, strict line. What if three math proofs are equally right via different methods? Or two Python scripts pass 50% of unit tests, but fail different ones? Forcing ties or incomparable answers into a strict ranking injects spurious gradient noise, punishing the model for arbitrary tie-breakers.

Methods

Enter Graph Direct Preference Optimization (GraphDPO). Instead of pairs or strict lists, GraphDPO organizes the $K$ sampled responses for a prompt into a preference graph—specifically, a Directed Acyclic Graph (DAG)—where directed edges represent true dominance ($A$ is strictly better than $B$).

The GraphDPO pipeline: candidate rollouts are grouped into equivalence classes, masked to form a preference DAG with an optional ground-truth anchor, and optimized via local groupwise losses.

Here is what makes the engine tick:

  • Equivalence-Class Masking: Responses with identical scores (like two correct math proofs) or incomparable outcomes (same unit-test pass rate on different tests) are placed into the same graph layer with no edges between them. Absent edges contribute zero loss, completely eliminating noisy gradients from arbitrary tie-breaking.
  • Neighborhood Plackett–Luce Loss: Building on standard DPO’s log-probability ratios relative to a frozen reference model, GraphDPO optimizes a choice-model objective over dominated neighborhoods. Each response is pushed to outscore the pool of all responses strictly below it in the graph. When $K=2$ with a strict winner, this mathematically reduces right back to standard DPO.
  • Linear-Time Complexity: Naively evaluating a graph could take $O(K^2)$ operations. Because equivalence classes form neat layers, every node's dominated neighborhood is just the union of all lower layers. Using a clever suffix log-sum-exp trick, GraphDPO computes the exact prompt loss in $O(K)$ linear time.
  • Annealed Ground-Truth Anchoring: Early in training, a weak model might generate $K$ terrible answers, starving the graph of positive signal. When a verified oracle solution exists, GraphDPO inserts it as a top-level "anchor" node with a high initial weight to stabilize early learning, gradually decaying that weight so the policy has freedom to explore its own valid trajectories later on.

Datasets

The authors evaluate GraphDPO on three established benchmarks (no new datasets are introduced) using two distinct 4B-parameter base models (Qwen3-4B-Thinking-2507 for math and Qwen3-4B-Instruct-2507 for coding):

  • GSM8K: Elementary mathematical word problems graded by binary exact-match accuracy.
  • MATH-500: Competition-level, multi-step math problems (also binary exact-match, but with much deeper, error-prone reasoning chains).
  • APPS: Program synthesis evaluated via execution pass rates against hidden unit tests, naturally creating multi-layered partial correctness (a median of 11 achievable preference levels per prompt).

Key Insights and Ideas

  • Letting good ideas coexist: On complex tasks like MATH-500, there are many distinct ways to arrive at a right (or wrong) answer. Listwise baselines stumble because forcing diverse, equally valid reasoning paths into an arbitrary 1st, 2nd, and 3rd place confuses credit assignment. Leaving ties unlinked lets multiple valid reasoning styles thrive simultaneously.
  • Deeper graphs yield bigger wins: While math tasks only induce 2-layer graphs (correct vs. incorrect), coding unit tests in APPS create rich, multi-layered partial orders. As the realized depth of a prompt's preference graph grows from 2 layers to $\ge 4$ layers, GraphDPO's accuracy gain over the base policy climbs monotonically from +16.8% to +36.2%.
  • Anchors are training wheels: Ground-truth anchoring helps immensely when sample budgets are tiny ($K=2$, yielding +3.03% on GSM8K) or tasks are brutally hard (MATH-500). Once $K=8$ on easier tasks, the model generates enough right answers on its own that the rich preference graph largely subsumes the need for an oracle.

Key Results

Using $K=8$ rollouts across all preference-based baselines (including DPO, GRPO, SPIN, MPO, SWEPO, PRO, and LiPO), GraphDPO takes first place across the board:

  • GSM8K: Reaches 92.42% without ground-truth anchoring and 92.75% with it—beating standard DPO (87.05%), strict listwise PRO (88.82%), and the strongest multi-sample baseline, SWEPO (91.29%).
  • MATH-500: Hits 87.40% (no anchor) and 88.87% (with anchor), comfortably clearing the best baseline, LiPO (85.40%), and SFT (54.80%).
  • APPS: Achieves 72.93% (no anchor) and 73.76% (with anchor), opening up its widest lead (+4.80 points) over top contenders LiPO (68.96%) and GRPO (68.67%).

Limitations and Future Work

  • Unexplored noisy/non-layered graphs: All experiments rely on clean, discrete verification signals (math answers and unit tests) that form neat layers. While the math supports fractional edge weights for noisy human judgments or messy, non-layered partial orders, those haven't been tested empirically yet.
  • In-distribution oracles & model scale: Ground-truth anchors were formatted using the model's native <think> tags, which sits close to the model's prior and might make anchoring look smoother than it would with truly out-of-distribution human text. Furthermore, tests were limited to 4B-parameter Qwen3 models.
  • What's next: The authors point toward extending preference graphs to long-horizon, multi-step LLM agent trajectories, where partial progress and branching paths are the norm.

Summary updated

Abstract

Direct Preference Optimization (DPO) aligns language models using pairwise preference comparisons, offering a simple and effective alternative to Reinforcement Learning (RL) from human feedback. However, in many practical settings, training data consists of multiple rollouts per prompt, inducing rich preference structure that pairwise DPO fails to exploit. Collapsing such data into independent pairs discards transitivity, introduces redundant or conflicting supervision, and can lead to unstable optimization. We propose Graph Direct Preference Optimization (GraphDPO), a structured generalization of DPO that operates over directed acyclic preference graphs induced by rollout rankings. GraphDPO encodes dominance relations as edges and optimizes a graph-structured Plackett--Luce-inspired objective that aggregates supervision over dominated neighborhoods, propagating the transitive structure of the input preferences while recovering standard DPO as a special case. GraphDPO naturally handles tied and incomparable responses through an equivalence-class construction: responses with identical preference signals form graph layers, incomparable responses share a layer without an edge, and absent edges contribute zero loss, preventing the spurious gradients that strict total-order objectives incur. Under this layered construction, GraphDPO maintains linear per-prompt complexity via efficient log-sum-exp aggregation. We further incorporate optional ground-truth anchoring by inserting verified solutions as dominant nodes and applying an annealed schedule that stabilizes early training while gradually relaxing oracle supervision. Experiments on reasoning and program synthesis tasks demonstrate superior performance, suggesting that graph-structured preference modeling is a scalable and robust alternative to pairwise and listwise alignment objectives.
BibTeX
@inproceedings{liu2026beyond,
  author = {Ning Liu and Chuanneng Sun and Kristina Lisa Klinkner and Shervin Malmasi},
  title = {{Beyond Pairs: Your Language Model is Secretly Optimizing a Preference Graph}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=eIAc9sNGjK},
}
Figure