From Data to Rewards: a Bilevel Optimization Perspective on Maximum Likelihood Estimation

Abdelhakim Benechehab, Gabriel Singer, Corentin Léger, Youssef Attia El Hili, Giuseppe Paolo, Albert Thomas, Maurizio Filippone, Balázs Kégl · DOI

Abstract

This paper introduces a novel framework that reframes Maximum Likelihood Estimation (MLE) as a bilevel optimization problem. By treating the reward function in a Reinforcement Learning (RL) context as a learnable parameter, the authors bridge the gap between probabilistic modeling and policy gradients. This approach enables the training of generative models using RL techniques even in the absence of explicit rewards, resulting in improved generalization, faster convergence, and superior performance in tabular classification and model-based RL tasks.

Introduction

Traditional generative modeling, particularly for Large Language Models (LLMs), relies heavily on Maximum Likelihood Estimation (MLE). While robust, MLE is susceptible to exposure bias—where errors compound during sequential generation—and catastrophic forgetting. In contrast, Reinforcement Learning (RL) methods like Policy Gradients (PG) are often more effective at aligning models with specific objectives. However, PG methods typically require an explicit reward function, which is often unavailable for high-quality unlabeled datasets.

This research addresses this gap by asking: Can we learn an implicit reward function directly from unlabeled data to unlock the benefits of RL-style training? The authors demonstrate that MLE can be viewed as a specific instance of a broader RL problem, where the reward function is data-dependent.

Methods: A Bilevel Optimization Framework

The authors propose a Bilevel Optimization (Bi-O) framework to unify these paradigms:

  1. Inner Level: A "policy" (the generative model) is optimized to maximize a reward function using Policy Gradients.
  2. Outer Level: The reward function itself is optimized so that the resulting policy maximizes the likelihood of the observed data.

Theoretical Foundations and Algorithms

Theoretical analysis in a tractable Gaussian setting reveals that the optimal reward function is the negative squared Mahalanobis distance. This implies that the reward should penalize deviations from the data mean, scaled inversely by the data's covariance (noise).

Visualization of the policy distribution at epoch 25, demonstrating the progression of mode-seeking behavior as the model aligns with the target data distribution.

To implement this, the authors introduce two primary algorithms:

  • Heuristic Reward ($U^*_{he}$): A practical approach where the covariance matrix is estimated from the training data to define a fixed reward function.
  • Implicit Differentiation: A more general method utilizing the Implicit Function Theorem. This allows the reward parameters to be learned through the inner optimization loop, making the framework applicable to complex, non-Gaussian data distributions without requiring massive computational memory.

Key Results

The framework was evaluated across synthetic data, tabular classification (UCI Credit and Poker datasets), and Model-Based RL (D4RL HalfCheetah tasks).

Comparison of training metrics over 100 epochs. The plots show negative log-likelihood (left), mean error (center), and variance error (right) for various Policy Gradient (PG) configurations compared to standard MLE and NLL baselines.

Performance Gains

  • Tabular Classification: On the Poker dataset, the PG-based method with the heuristic reward improved classification accuracy from 48.6% (MLE) to 52.4%.
  • Model-Based RL: In HalfCheetah "expert" tasks, the PG methods achieved a significantly lower Mean Squared Error (MSE) of 176, compared to 539 for standard MLE, while maintaining competitive log-likelihood scores.
  • Convergence and Stability: Unlike vanilla Euclidean rewards which can lead to variance collapse, the derived "optimal" reward proved highly stable. The PG-based approach induces mode-seeking behavior, allowing the model to focus on high-density regions of the distribution, leading to faster convergence than traditional MLE.

Conclusion and Future Work

By formalizing the link between MLE and RL through bilevel optimization, this work provides a scalable path for training robust generative models. The "noise-aware" nature of the optimal reward provides a principled way to handle data uncertainty.

While currently tested on tabular and robotics data, the authors acknowledge that scaling to high-resolution images and LLMs is the next frontier. Future research will explore how this framework can mitigate catastrophic forgetting during LLM fine-tuning and improve performance in structured prediction tasks like machine translation.

Summary updated

BibTeX
@misc{benechehab2025from,
  author = {Abdelhakim Benechehab and Gabriel Singer and Corentin Léger and Youssef Attia El Hili and Giuseppe Paolo and Albert Thomas and Maurizio Filippone and Balázs Kégl},
  title = {{From Data to Rewards: a Bilevel Optimization Perspective on Maximum Likelihood Estimation}},
  year = {2025},
  eprint = {2510.07624},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.07624},
}
Figure