Bayesian Context Aggregation for Neural Processes

Michael Volpp, Fabian Flürenbrock, Lukas Grossberger, Christian Daniel, Gerhard NeumannICLR 2021

Overview

Formulating scalable probabilistic regression models with reliable uncertainty estimates is a long-standing challenge in machine learning. While Gaussian Processes (GPs) are the gold standard for uncertainty, they scale poorly. Neural Processes (NPs) bridge this gap by casting probabilistic regression as a multi-task learning problem using conditional latent variable models.

This paper introduces Bayesian Aggregation (BA), a novel mechanism to fuse information in Neural Processes. By treating context aggregation as a formal Bayesian inference problem rather than a simple averaging step, BA enables models to better handle "task ambiguity"—learning which data points are most informative. This leads to significantly better predictions and uncertainty estimates with negligible computational cost.

The Bottleneck: Mean Aggregation in NPs

Standard NPs process a set of "context" data points by encoding each point into a vector and then taking the average (the mean aggregator). This approach assumes every data point is equally important. In reality, some points are much more informative than others (e.g., a pixel in the center of a digit versus a blank corner pixel). Simple averaging washes out this nuance, making it harder for the model to resolve task ambiguity—the uncertainty about which specific function it is currently trying to model.

Method: Aggregation as Inference

The authors propose replacing the mean aggregator with Bayesian Aggregation (BA). Instead of just outputting a representation vector, the encoder now outputs both a latent observation and a corresponding variance for every context point.

Graphical model of Bayesian Aggregation, where context points are treated as noisy observations of a global latent variable.

The core innovation lies in the aggregation step:

  1. Aggregation as Inference: Instead of averaging, the model treats each context point as a noisy observation of a global latent variable $z$.
  2. Gaussian Conditioning: It uses standard Bayesian update rules (Gaussian conditioning) to combine these observations. Points with high predicted variance (low information) are automatically down-weighted, while high-certainty points drive the latent state $z$.
  3. Holistic Mechanism: This merges context aggregation and latent parameter inference into a single, principled mathematical framework.

BA acts as a "drop-in" replacement that works with various NP flavors, including Variational (VI), Monte Carlo (MC), and deterministic/Parameter-Based (PB) versions. Unlike Attentive Neural Processes, which use complex attention mechanisms scaling quadratically ($O(N^2)$), BA scales linearly ($O(N)$) and supports efficient incremental updates as new data arrives.

Experiments and Key Results

The researchers evaluated BA across a diverse suite of benchmarks, including synthetic GP samples (RBF, Matern-5/2, Weakly Periodic kernels), 1D/3D quadratic functions for few-shot learning, the Furuta Pendulum (a non-linear dynamical system), and 2D Image Completion (MNIST).

Performance comparison showing Bayesian Aggregation (blue) consistently outperforming Mean Aggregation (orange) across different GP kernels.
  • Consistent Wins: BA outperformed traditional mean aggregation (MA) across almost every experiment and every likelihood approximation method.
  • Log-Likelihood Gains: On RBF GP samples, BA achieved a log-likelihood of 1.62 compared to 1.07 for MA (using MC-loss).
  • Data Efficiency: BA showed massive improvements in the "low-data" regime. In 1D quadratic tasks with very few training examples, BA reached a log-likelihood of 1.42, while the standard Conditional Neural Process (CNP) struggled at 0.47.
  • Real-World Performance: On the Furuta Pendulum, BA (MC-loss) hit a log-likelihood of 8.25, significantly higher than the MA counterpart (7.55).
  • Superiority of MC over VI: The experiments suggest that the traditional Variational Inference (VI) approach used in many NPs might be suboptimal compared to Monte Carlo (MC) or the authors' proposed deterministic "Parameter-Based" (PB) approach, especially when data is sparse.

Limitations and Future Work

To maintain computational efficiency, the authors assumed a "factorized" (diagonal) Gaussian distribution. While effective, more complex, correlated distributions might capture even richer dependencies. Furthermore, while BA is highly efficient, combining it with Self-Attention (using Attention to inform the Bayesian weights) could be a powerful direction for future research. Finally, the limits of BA in extremely high-dimensional latent spaces remain an open question for future exploration.

Summary updated

BibTeX
@inproceedings{volpp2021bayesian,
  author = {Michael Volpp and Fabian Flürenbrock and Lukas Grossberger and Christian Daniel and Gerhard Neumann},
  title = {{Bayesian Context Aggregation for Neural Processes}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=ufZN2-aehFa},
}

Loading related content...

Figure