Abstract
Neural Processes (NPs) combine the flexibility of neural networks with the probabilistic benefits of Gaussian Processes (GPs). However, standard NPs often struggle with simple linear tasks that traditional Bayesian methods solve with ease. We introduce Residual Neural Processes (RNP), a hybrid architecture that explicitly incorporates a Bayesian Last Layer (BLL) to handle linear statistics. This allows the neural network to focus on modeling complex non-linear "residuals," leading to faster convergence and significantly improved uncertainty estimation.
Introduction
Traditional Gaussian Processes are mathematically elegant but computationally expensive, with $O(n^3)$ complexity. Neural Processes were designed to mimic GPs using neural networks to achieve faster inference ($O(n)$ or $O(n^2)$). Despite their theoretical capacity as universal approximators, NPs rely on attention mechanisms that are surprisingly poor at performing basic linear algebra, such as matrix inversion, required for simple linear regression.
Consequently, even when data follows a simple linear trend, an Attentive Neural Process (ANP) may struggle to fit it perfectly. Residual Neural Processes address this by asking: why force a neural network to poorly approximate a calculation that can be performed exactly using classical Bayesian logic?
Methods
The RNP architecture splits the predictive task into two parallel paths:
- The Linear Path (BLL): The model treats the final layer of its feature extractor as a Bayesian Last Layer. It calculates the exact closed-form posterior (mean and variance) for a linear regression based on the provided context points.
- The Non-Linear Path (Attention): Simultaneously, a standard self-attention mechanism extracts non-linear summaries of the data.
The decoder receives both the exact linear statistics and the non-linear attention summaries. By delegating the "easy" linear components to the BLL, the neural network only needs to learn the residual—the complex, non-linear deviations from the linear baseline. Additionally, a Stochastic Feature Extractor ($z_f$) allows the model to sample different feature spaces, effectively learning a distribution over kernels for more diverse and realistic function sampling.
Key Results
The authors evaluated RNP across 1D synthetic function regression, MNIST image completion, and CelebA face reconstruction. The RNP consistently outperformed both standard NPs and ANPs in accuracy and efficiency.
- Accuracy: In 1D regression, the "Full" RNP achieved a Negative Log-Likelihood (NLL) of 0.021, a significant improvement over the 0.106 achieved by the ANP.
- Convergence Speed: Despite the added overhead of BLL calculations, RNPs reached lower error rates much faster than ANPs in terms of wall-clock time.
- Qualitative Quality: In image completion tasks, RNPs produced smoother reconstructions and avoided the common NP issue of "forgetting" context pixels, ensuring that predictions remained consistent with observed data.
Conclusion
Residual Neural Processes demonstrate that explicitly incorporating classical Bayesian structures into neural architectures can yield substantial gains in both speed and reliability. While the model introduces matrix inversion overhead, its asymptotic complexity remains competitive with ANPs. Future work may explore extending this residual approach to classification and reinforcement learning, or developing attention mechanisms that inherently capture these Bayesian statistics without manual injection.
Summary updated