NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

End-to-end kernel learning via generative random Fourier features

Kun Fang, Fanghui Liu, Xiaolin Huang, Jie Yang

Abstract

Traditional kernel learning methods often rely on a sub-optimal two-stage process: first aligning a feature map with a proxy target kernel, and then training a classifier. This paper introduces Generative Random Fourier Features (GRFFs), a framework that collapses these stages into a single end-to-end optimization. By employing a generative neural network to learn the optimal spectral distribution for the kernel, the model discovers task-specific features that improve generalization. Furthermore, the multi-layer extension (ML-GRFF) enables deep kernel architectures, while the inherent non-determinism of the sampling process provides a robust defense against adversarial attacks.

Introduction

Kernel methods are fundamental to machine learning, providing a robust framework for identifying non-linear patterns by mapping input data into high-dimensional feature spaces. To scale these methods to large datasets, Random Fourier Features (RFFs) are commonly used to approximate kernels by sampling random weights from a spectral distribution. However, conventional RFF-based learning is typically a two-stage process. First, a feature map is learned by aligning it with a pre-defined "ideal" target kernel. Second, a linear classifier is trained on these fixed features.

This decoupled approach has two primary drawbacks: the proxy kernel used for alignment may not be optimal for the specific classification task, and the fixed nature of the features makes it difficult to construct deep, multi-layer kernel architectures. This paper proposes Generative Random Fourier Features (GRFFs) to address these limitations through end-to-end generative modeling.

The GRFF Framework

Generative Sampler

Instead of sampling weights from a fixed distribution (such as a Gaussian), GRFF utilizes a neural network—the "Generator"—to learn the optimal distribution. This generator takes simple noise as input and outputs the spectral weights used to construct the Fourier feature map.

End-to-End Training

By integrating the generator directly into the learning pipeline, the model can be trained using Empirical Risk Minimization (ERM). The generator and the final linear classifier are optimized simultaneously, allowing the model to discover the specific kernel distribution that minimizes classification error rather than a mathematical proxy.

Multi-layer Structure (ML-GRFF)

The end-to-end nature of GRFF allows for the stacking of multiple layers. In an ML-GRFF architecture, each layer learns a kernel distribution based on the features produced by the preceding layer. To ensure convergence in these deep stacks, the authors employ a progressive training strategy: the model is trained layer-by-layer in reverse order, starting with the classifier and the final feature layer before gradually unfreezing and optimizing earlier layers.

Adversarial Robustness

A unique advantage of the GRFF framework is its inherent defense against adversarial attacks. Because the feature weights are sampled from the learned generative distribution at inference time, the model is non-deterministic. Even if an attacker crafts a successful adversarial example for a specific set of weights, the model may resample different weights during the next inference pass, effectively "dodging" the attack. This stochasticity makes it significantly harder for gradient-based attacks to find a consistent weakness.

Experimental Results

Performance and Stability

The authors evaluated ML-GRFF against vanilla RFFs, optimized RFFs (OPT-RFF), and Improved Kernel Learning (IKL) across synthetic and real-world datasets (UCI/LIBSVM). ML-GRFF consistently demonstrated superior accuracy. Notably, on synthetic datasets where the dimensionality $d$ varied from 2 to 24, traditional RFF methods showed a sharp decline in performance as dimensions increased, whereas ML-GRFF remained stable.

Image Classification and Robustness

On the MNIST dataset, ML-GRFF was tested against the Iterative Least-Likely (Iter.L.L.) attack. The model maintained significantly higher accuracy than a standard CNN. In instances where an attack successfully fooled the model using its initial weights, the resampling mechanism allowed the model to correctly re-identify nearly 40% of those adversarial examples upon a second pass.

Discussion and Limitations

While GRFF offers significant improvements in accuracy and robustness, it introduces new challenges. Training generative networks for each layer increases computational complexity and memory requirements, particularly for high-resolution image data. Additionally, the multi-layer structure increases the number of hyperparameters, such as noise distributions and epoch counts per training phase, requiring more intensive tuning.

Conclusion

Generative Random Fourier Features represent a significant step forward in kernel learning, moving from fixed approximations to learned, task-specific distributions. By enabling deep architectures and providing a built-in stochastic defense against adversarial threats, GRFF bridges the gap between traditional kernel methods and the flexibility of deep learning.

Summary updated

BibTeX
@article{fang2020end,
  author = {Kun Fang and Fanghui Liu and Xiaolin Huang and Jie Yang},
  title = {{End-to-end kernel learning via generative random Fourier features}},
  journal = {Pattern Recognition},
  year = {2020},
  doi = {10.1016/j.patcog.2022.109057},
}
Figure