Spectral Convolutional Conditional Neural Processes

Peiman Mohseni, Nick Duffield

Introduction

Convolutional Conditional Neural Processes (ConvCNPs) are powerful meta-learning models designed to predict stochastic processes. By embedding data into a continuous spatial grid and processing it with Convolutional Neural Networks (CNNs), they brilliantly preserve translation equivariance—meaning if you shift the input, the output shifts by the exact same amount.

However, their reliance on local CNN kernels makes capturing long-range dependencies computationally expensive. To address this, researchers have introduced Spectral ConvCNPs (SConvCNPs), which swap standard spatial convolutions for Fourier Neural Operators (FNOs) to perform global convolutions in the frequency domain. This approach grants the model a global receptive field with linear computational scaling, allowing it to match or outperform state-of-the-art models on both synthetic and real-world benchmarks.

The Locality Problem

Neural Processes (NPs) learn to approximate functions and quantify uncertainty from sets of observed data points. While ConvCNPs are a highly effective variant, they have a major blind spot: long-range dependencies.

Because CNNs use small, localized spatial kernels (e.g., a 3x3 window), they struggle to connect data points that are far apart in time or space. Increasing the kernel size causes the parameter count and computational cost to explode. Alternatively, Transformer-based architectures can look at all points globally, but their computational cost scales quadratically $\mathcal{O}(N^2)$ with the number of data points, making them too slow and memory-hungry for large datasets. SConvCNPs were designed to find a "best of both worlds" solution: achieving a global receptive field without the quadratic price tag.

Spectral Convolutions via Fourier Neural Operators

To solve the locality problem, SConvCNPs borrow a technique from physics and partial differential equation (PDE) solving: the Fourier Neural Operator (FNO).

Instead of sliding a local kernel over the data in the spatial domain, the method works as follows:

  1. Transform: It takes the spatial grid data and applies a Fast Fourier Transform (FFT) to convert it into the frequency domain.
  2. Parameterize: It parameterizes the convolution kernels directly in this frequency space as learned weights.
  3. Multiply and Invert: It multiplies the frequency data by these weights, and then uses an inverse FFT to transform the data back to the spatial domain.

Thanks to the Convolution Theorem, a simple pointwise multiplication in the frequency domain is mathematically equivalent to a global convolution in the spatial domain. This gives the model an infinite receptive field while keeping computational complexity nearly linear $\mathcal{O}(|G| \log |G|)$, where $|G|$ is the grid size. The architecture is implemented using a U-shaped FNO and injects positional encodings to help the model orient itself.

Experiments and Results

SConvCNPs were evaluated across a mix of 1D and 2D tasks, including synthetic 1D regression (Matérn-5/2, Periodic, Sawtooth, and Square waves), simulated predator-prey dynamics, real-world California traffic flow, and 2D image completion.

Qualitative comparison on 1D synthetic regression tasks, showing SConvCNP's superior ability to capture sharp transitions like Sawtooth waves.

Key Insights

  • Efficiency of Frequency Domains: Many natural processes are "band-limited," meaning most of their important information lives in low frequencies. By operating in the Fourier domain, the model captures the global structure of a signal using a surprisingly compact set of parameters.
  • Overcoming Spectral Bias: In synthetic experiments, Transformer-based NPs completely collapsed (predicted zero) when trying to learn the sawtooth wave, likely struggling with high-frequency, discontinuous structures. SConvCNP handled these sharp transitions easily.
  • Operator Learning in Probabilistic Modeling: FNOs were originally designed to solve complex PDEs. This work proves that the core mechanics of operator learning can be seamlessly integrated into Bayesian and probabilistic frameworks like Neural Processes.
Quantitative results on 1D synthetic datasets. SConvCNP significantly outperforms baselines on the Sawtooth dataset.

Performance Highlights

  • Synthetic Waves: On the difficult sawtooth dataset, SConvCNP achieved a log-likelihood of 0.82, vastly outperforming the standard ConvCNP (0.10) and Transformer models (which failed entirely).
  • Real-World Traffic: On the California traffic dataset, SConvCNP achieved the highest log-likelihood (2.05 vs. ConvCNP's 1.98) and the lowest error (RMSE of 0.04) among all tested models.
  • Image Completion: SConvCNP outperformed ConvCNP in log-likelihood (1.50 vs 1.48) and matched its RMSE (0.08). Transformer baselines couldn't even be run on this task due to their massive $\mathcal{O}(N^2)$ memory requirements for large images.
  • Speed: The forward-pass runtime of SConvCNP is practically identical to a standard ConvCNP, proving that the global receptive field does not incur a latency penalty.

Limitations and Future Work

While highly effective, SConvCNPs have a few notable limitations:

  • Discretization Sensitivity: The Discrete Fourier Transform (DFT) is highly sensitive to the grid it operates on. Training on a specific grid resolution and evaluating on a larger or denser grid at test time will misalign the learned frequencies and degrade performance.
  • Curse of Dimensionality: Because the method relies on a uniform grid, the grid size grows exponentially with the number of input dimensions. This restricts SConvCNPs to low-dimensional data (like 1D time series or 2D images).
  • Loss of Strict Equivariance: To maximize performance, positional encodings were added, which explicitly breaks the strict translation equivariance that ConvCNPs are known for.

Future work may explore relative positional encodings to restore translation equivariance, as well as patch-based spectral convolutions to handle varying domain sizes without breaking the underlying FFT mathematics.

Summary updated

BibTeX
@inproceedings{mohseni2025spectral,
  author = {Peiman Mohseni and Nick Duffield},
  title = {{Spectral Convolutional Conditional Neural Processes}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=6hidr8PJ8F},
}
Figure