Learning Energy Networks with Generalized Fenchel-Young Losses

Mathieu Blondel, Felipe Llinares-López, Robert Dadashi, Léonard Hussenot, Matthieu Geist

Abstract

Energy-based models, a.k.a. energy networks, perform inference by optimizing an energy function, typically parametrized by a neural network. This allows one to capture potentially complex relationships between inputs and outputs. To learn the parameters of the energy function, the solution to that optimization problem is typically fed into a loss function. The key challenge for training energy networks lies in computing loss gradients, as this typically requires argmin/argmax differentiation. In this paper, building upon a generalized notion of conjugate function, which replaces the usual bilinear pairing with a general energy function, we propose generalized Fenchel-Young losses, a natural loss construction for learning energy networks. Our losses enjoy many desirable properties and their gradients can be computed efficiently without argmin/argmax differentiation. We also prove the calibration of their excess risk in the case of linear-concave energies. We demonstrate our losses on multilabel classification and imitation learning tasks.

Introduction

Energy-based models (EBMs) offer a flexible framework for structured prediction, where the goal is to predict complex objects like sequences or sets of labels. Unlike standard discriminative models that predict outputs directly, EBMs learn an energy function $\Phi(v, p)$ that assigns a scalar compatibility score to an input $v$ and a potential output $p$. Inference involves finding the output that minimizes this energy.

However, training these models is notoriously difficult. Standard gradient-based optimization requires calculating the gradient of the loss with respect to the model parameters. Because the prediction itself is the result of an internal optimization loop, researchers often face a "differentiation nightmare," needing to differentiate through argmin or argmax operations. This typically involves memory-intensive unrolling of optimization steps or numerically sensitive implicit differentiation.

Generalized Fenchel-Young Losses

To address these challenges, this work introduces Generalized Fenchel-Young Losses. This framework extends the classical Fenchel-Young loss—which is restricted to bilinear energy functions—to a much broader class of energy networks using the Fenchel-Moreau conjugate.

The methodology relies on three key pillars:

  1. Regularized Energy Networks: By adding a regularization term $\Omega(p)$ to the energy function, the authors ensure the internal optimization problem has a unique and stable solution.
  2. The Loss Construction: The loss is defined as $L_\Omega^\Phi(v, y) = \Omega^\Phi(v) + \Omega(y) - \Phi(v, y)$, where $\Omega^\Phi(v)$ is the generalized conjugate. Geometrically, this loss represents the vertical gap between the energy function and its conjugate at a given point.
  3. Efficient Gradient Computation: By leveraging the "Envelope Theorem," the authors show that the gradient of the loss with respect to parameters can be computed using only the gradients of the energy function at the predicted and ground-truth points. This eliminates the need to differentiate through the optimization process itself.
Geometric interpretation of the generalized Fenchel-Young loss as the vertical gap between the energy function and its conjugate.

Experimental Evaluation

The researchers evaluated the proposed framework on two distinct structured prediction tasks: multilabel classification and imitation learning.

Multilabel Classification

The method was tested on six public datasets (e.g., Mediamill, Scene, Yeast) that vary in domain and scale. The results demonstrate that "Pairwise" energy models, which explicitly capture interdependencies between labels, consistently outperform standard "Unary" models that treat labels independently.

Performance comparison on multilabel classification datasets, showing the effectiveness of pairwise energy models.

Imitation Learning

In robotic control tasks using MuJoCo environments (e.g., HalfCheetah, Walker), the framework was used to learn policies from expert demonstrations. The pairwise energy models were particularly effective at capturing the complex coordination required for locomotion, significantly beating unary baselines in most tasks.

Key Insights and Theoretical Guarantees

A major contribution of this work is the proof of calibration for linear-concave energies. This theoretical guarantee ensures that minimizing the proposed surrogate loss is mathematically equivalent to minimizing the actual target error (such as Hamming loss). Furthermore, the framework allows for capturing complex output interdependencies—such as how torque in a robot's hip affects its ankle—which are often lost in simpler models.

Conclusion and Future Work

Generalized Fenchel-Young losses provide a principled and efficient way to train energy networks without the computational burden of argmin/argmax differentiation. While the framework is highly effective, challenges remain for non-concave energy functions where finding the global optimum is NP-hard. Future research may explore leveraging Difference of Convex (DC) programming to further optimize these networks and scaling the approach to even higher-dimensional output spaces like high-resolution image generation.

Summary updated

BibTeX
@misc{blondel2022learning,
  author = {Mathieu Blondel and Felipe Llinares-López and Robert Dadashi and Léonard Hussenot and Matthieu Geist},
  title = {{Learning Energy Networks with Generalized Fenchel-Young Losses}},
  year = {2022},
  eprint = {2205.09589},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.09589},
}
Figure