L3Ms — Lagrange Large Language Models

Guneet S. Dhillon, Xingjian Shi, Yee Whye Teh, Alex Smola

Overview

Supervised fine-tuning (SFT) and alignment of large language models (LLMs) are critical for ensuring a safe and useful user experience. However, defining "good" alignment is highly application-dependent. Current alignment methods often rely on heuristic choices—like trial-and-error reward weighting—to drive optimization.

To address this, researchers introduce Lagrange Large Language Models (L3Ms). L3Ms redefine LLM alignment by treating it as a constrained optimization problem. By using logarithmic barriers to enforce specific requirements during fine-tuning, L3Ms eliminate the need for heuristic reward weighting and separate alignment stages, all while maintaining high task performance.

The Flaws in Standard Alignment

The standard LLM training pipeline involves two distinct steps: SFT to teach the model a task, followed by alignment (often via RLHF) to instill properties like helpfulness or brevity. This approach has three major drawbacks:

  1. Heuristic Dependency: Practitioners must manually tune weights to balance competing rewards (e.g., trading "helpfulness" for "harmlessness") through tedious trial and error.
  2. The Alignment Tax: Alignment often degrades the model's original task performance. To prevent this, researchers use heuristic penalties (like KL-divergence) to keep the model from drifting too far from its SFT state, which requires keeping a frozen reference model in memory.
  3. Application Inflexibility: Alignment is subjective. A creative writer might want a model that can be highly imaginative, while a scientist needs strict factuality. Current methods struggle to provide precise, application-specific control.

The L3M Methodology

L3Ms merge SFT and alignment into a single constrained optimization problem. Instead of maximizing a weighted sum of rewards, L3Ms minimize the primary task objective (perplexity) subject to meeting minimum baseline requirements for specific rewards.

Logarithmic Barriers

To solve this constrained problem, the authors employ a "relaxed" logarithmic barrier function. This transforms the constraints into a penalty that remains near zero when requirements are met but approaches infinity as the model nears a violation.

The relaxed logarithmic barrier function. As the barrier parameter $\mu$ decreases, the function more closely approximates a hard constraint.

The barrier parameter ($\mu$) is gradually decreased during training. This dynamic enforcement "nudges" the model to satisfy constraints early on and enforces them strictly by the end of the procedure. Mathematically grounded in the Karush-Kuhn-Tucker (KKT) conditions, this ensures that once a constraint is satisfied, it stops influencing—and potentially degrading—the model's optimization. Standard alignment penalizes the model even if it over-optimizes a reward; L3Ms only apply pressure when the model falls below the user-defined baseline.

Key Results

The researchers evaluated L3Ms using the UltraChat dataset for instruction-following and the Anthropic Helpful and Harmless (HH) dataset for preference rewards.

Precise Length Control

L3Ms demonstrate an exceptional ability to hit specific token-length targets. This framework allows developers to set "hard" targets—such as requiring the average response length to fall between 50 and 75 tokens—and lets the optimization process handle the math. In experiments, when constrained to a [50, 75] token range, the model achieved an average length of 64.4 tokens without significantly increasing perplexity (task error).

Distributions of response lengths for various L3M configurations. The black dashed lines represent the imposed constraints, demonstrating precise length control.

Helpful vs. Harmless Trade-offs

When compared to Minimax (MM) baselines—a common approach for constrained optimization—L3Ms achieved lower perplexity while satisfying the exact same safety and helpfulness constraints. This indicates that the logarithmic barrier approach is significantly more efficient at navigating the complex trade-offs between task performance and alignment.

Limitations and Future Directions

While L3Ms offer a robust mathematical framework for alignment, the authors note a few limitations:

  • Non-Convexity: The non-convex nature of LLM loss functions means that convergence to a global optimum is not theoretically guaranteed, despite strong empirical performance.
  • Average vs. Uniform Constraints: The current formulation enforces constraints on average across a dataset. For high-stakes safety applications, "uniform" constraints (ensuring every single response meets a requirement) might be necessary, presenting a much harder optimization challenge.
  • Hyperparameter Sensitivity: Although L3Ms reduce the need for reward-weight tuning, they introduce new parameters like the $\mu$ decay rate, which still require expert oversight.

Summary updated

BibTeX
@inproceedings{dhillon2025l,
  author = {Guneet S. Dhillon and Xingjian Shi and Yee Whye Teh and Alex Smola},
  title = {{L3Ms — Lagrange Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=ULGbw2URE3},
}
Figure