Deep Sketched Output Kernel Regression for Structured Prediction

Tamim El Ahmad, Junjie Yang, Pierre Laforgue, Florence d'Alché-Buc

Introduction

Structured prediction is a fundamental challenge in machine learning, involving the prediction of outputs with complex internal dependencies, such as molecular graphs, protein sequences, or natural language structures. Traditionally, Output Kernel Regression (OKR) has been a preferred method due to its ability to leverage the "kernel trick" to handle non-Euclidean geometries in the output space. However, OKR faces significant scalability issues: it typically relies on non-parametric models that struggle with high-dimensional inputs and infinite-dimensional feature spaces, making them incompatible with modern deep neural networks (DNNs).

To address these limitations, we present Deep Sketched Output Kernel Regression (DSOKR). This framework bridges the gap between kernel methods and deep learning by using "sketching" to project infinite-dimensional kernel spaces into a manageable, data-dependent finite basis. This allows standard DNN architectures, like Transformers or CNNs, to perform structured prediction using standard gradient-based optimization.

The DSOKR Architecture

The core innovation of DSOKR is the transformation of the neural network's final layer into a functional unit that operates within a sketched kernel space. Instead of predicting the structured output directly, the network is trained to predict the coefficients of a learned basis in the output Reproducing Kernel Hilbert Space (RKHS).

The DSOKR framework maps inputs from space X to a sketched subspace of the output RKHS H, ultimately predicting structured objects in Y.

As illustrated in the diagram above, the mapping $h_{\hat{\theta}}(x)$ decomposes into a trainable feature extractor $g_{\widehat{W}}$ and a fixed, data-dependent basis $g_{\widetilde{E}}$. The sketching process identifies a finite-dimensional subspace that captures the most significant variations in the output data, effectively acting as a mathematical bridge between infinite-dimensional theory and finite neural architectures.

Methods and Training

The DSOKR training pipeline consists of three primary stages:

  1. Sketching the Basis: Using dimensionality reduction techniques (random linear projections), the authors compute the eigenfunctions of a sketched empirical covariance operator to create a finite basis of size $m$.
  2. End-to-End Learning: The network is trained to minimize a kernel-induced squared loss. Because the basis is finite, this loss can be expressed in terms of the predicted coefficients, allowing for standard backpropagation and stochastic gradient descent (SGD).
  3. Inference (The Pre-image Problem): To convert the predicted feature vector back into a structured object (e.g., a molecule), the model solves a "pre-image" problem. This is typically achieved by searching a candidate set for the object whose kernel representation best matches the network's prediction.

Experimental Results and Analysis

DSOKR was evaluated across several benchmarks, including synthetic datasets, molecular graph prediction (SMI2Mol), and text-to-molecule tasks (ChEBI-20). A key finding is the relationship between the sketching size $m$ and model performance.

The impact of sketching size m on the Test DSOKR MSE, showing rapid convergence as the basis size increases.

As shown in the figure above, the Mean Squared Error (MSE) drops sharply as $m$ increases, eventually plateauing. This demonstrates that a relatively small, sketched basis can effectively capture the necessary structure for high-accuracy prediction. In synthetic tests, DSOKR achieved superior results compared to standard multi-output NNs while using 13 times fewer parameters, suggesting that the kernel structure provides a powerful inductive bias and regularization effect.

On real-world tasks, DSOKR significantly outperformed existing state-of-the-art methods. In the SMI2Mol task, it achieved a Graph Edit Distance (GED) of 1.951, nearly doubling the performance of previous kernel-based methods (GED 3.330). On the ChEBI-20 text-to-molecule dataset, a DSOKR ensemble reached a Hits@1 of 51.0%, surpassing specialized cross-modal attention models.

Conclusion

Deep Sketched Output Kernel Regression provides a scalable and flexible framework for structured prediction. By integrating sketching techniques with deep learning, it enables the use of powerful kernel-induced losses within standard DNN pipelines. While the current reliance on candidate sets for the pre-image problem remains a bottleneck, the method's parameter efficiency and robust performance across diverse kernels mark a significant step forward in bridging non-parametric kernel theory with parametric deep learning.

Summary updated

Abstract

By leveraging the kernel trick in the output space, kernel-induced losses provide a principled way to define structured output prediction tasks for a wide variety of output modalities. In particular, they have been successfully used in the context of surrogate non-parametric regression, where the kernel trick is typically exploited in the input space as well. However, when inputs are images or texts, more expressive models such as deep neural networks seem more suited than non-parametric methods. In this work, we tackle the question of how to train neural networks to solve structured output prediction tasks, while still benefiting from the versatility and relevance of kernel-induced losses. We design a novel family of deep neural architectures, whose last layer predicts in a data-dependent finite-dimensional subspace of the infinite-dimensional output feature space deriving from the kernel-induced loss. This subspace is chosen as the span of the eigenfunctions of a randomly-approximated version of the empirical kernel covariance operator. Interestingly, this approach unlocks the use of gradient descent algorithms (and consequently of any neural architecture) for structured prediction. Experiments on synthetic tasks as well as real-world supervised graph prediction problems show the relevance of our method.
BibTeX
@inproceedings{ahmad2024deep,
  author = {Tamim El Ahmad and Junjie Yang and Pierre Laforgue and Florence d'Alché-Buc},
  title = {{Deep Sketched Output Kernel Regression for Structured Prediction}},
  booktitle = {ECML/PKDD},
  year = {2024},
  url = {https://openreview.net/forum?id=HGEw8IMNIB},
}
Figure