Learning Differentiable Surrogate Losses for Structured Prediction

Junjie Yang, Matthieu Labeau, Florence d'Alché-BucarXiv 2024 · DOI

Abstract

Structured prediction involves mapping inputs to complex, interdependent objects such as molecular graphs or sequences. Traditional surrogate methods often rely on hand-crafted, non-differentiable kernels, which limits inference to searching through pre-defined candidate sets. We propose Explicit Loss Embedding (ELE), a framework that learns a differentiable surrogate loss through contrastive learning. By embedding complex outputs into a continuous vector space, ELE enables a novel inference technique: predicting structures via gradient-based optimization. Evaluated on molecular graph prediction tasks using the QM9 dataset, ELE matches state-of-the-art performance while demonstrating the ability to "hallucinate" novel, valid structures.

Introduction

In standard machine learning, predictions typically involve scalars or categories. Structured prediction is significantly more complex, requiring the output of interdependent objects like social networks or molecular graphs. This field faces two primary challenges: the non-Euclidean geometry of output spaces, which complicates standard calculus-based optimization, and the "decoding problem," where mapping abstract representations back to real-world objects often requires non-differentiable, expert-designed kernels. These limitations often restrict models to selecting from a fixed list of candidates rather than generating truly novel structures.

Methods: Explicit Loss Embedding (ELE)

The ELE framework addresses these challenges by replacing manual kernels with a learned, differentiable surrogate loss. The process consists of three main stages:

  1. Learning the Loss via Contrastive Learning: A neural network ($\psi_\theta$) is trained to embed output objects into a unit sphere. Using contrastive learning (InfoNCE loss), the model learns to place similar structures close together and dissimilar ones far apart. This creates a differentiable "loss landscape."
  2. Surrogate Regression: A backbone network, such as a Transformer, maps input data (e.g., a SMILES string) directly into this learned surrogate vector space.
  3. Projected Gradient-Based Decoding (PGDBD): During inference, the model uses projected gradient descent to refine a candidate structure. By "nudging" features along the gradient of the learned loss, the model can navigate the continuous space to find optimal structures, including those never seen during training.
The Explicit Loss Embedding (ELE) framework, showing the mapping of inputs and outputs into a shared differentiable surrogate space.

For graph-specific tasks, the authors employ Relational Graph Convolutional Networks (R-GCNs) to manage the connectivity of atoms and bonds.

Experimental Setup

The framework was evaluated on chemistry-focused datasets:

  • QM9: Comprising approximately 130,000 small organic molecules, used to predict molecular graphs from SMILES strings.
  • GDB-11: A massive dataset of millions of molecules used for Output Neural Network Pre-Training (ONNPT), allowing the model to learn molecular geometry rules in an unsupervised manner.

Key Results and Insights

ELE was compared against state-of-the-art methods like DSOKR, which utilizes fixed kernels.

  • Performance: ELE achieved a Graph Edit Distance (GED) of 2.252 on the QM9 dataset, matching or outperforming traditional kernel-based approaches.
  • Novelty and Refinement: Unlike search-based methods, the PGDBD strategy successfully generated new, correct molecular structures not present in the initial candidate pool. Refinement consistently improved results, particularly when starting from small candidate sets.
  • Differentiability: By making the surrogate loss differentiable, the framework shifts structured prediction from a discrete search problem to a continuous optimization problem, offering significantly more flexibility.

Conclusion and Future Work

The ELE framework demonstrates that learned, differentiable losses can be as effective as domain-expert kernels while providing the added benefit of gradient-based refinement. A primary limitation is the non-convexity of the learned embedding space, which can lead gradient descent to local minima. Future research will explore more advanced optimization techniques, apply ELE to other domains like 3D shapes, and improve relaxation methods for discrete objects to further enhance gradient flow.

Summary updated

BibTeX
@misc{yang2024learning,
  author = {Junjie Yang and Matthieu Labeau and Florence d'Alché-Buc},
  title = {{Learning Differentiable Surrogate Losses for Structured Prediction}},
  year = {2024},
  eprint = {2411.11682},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.11682},
}
Figure