Memory Efficient Neural Processes via Constant Memory Attention Block
Leo Feng, Frederick Tung, Hossein Hajimirsadeghi, Yoshua Bengio, Mohamed Osama Ahmed
TL;DR
The paper tackles the memory burden of attention-based Neural Processes by introducing Constant Memory Attentive Neural Processes (CMANPs). It develops Constant Memory Attention Blocks (CMABs) that ensure constant memory with respect to the context set and provide an exact Cross Attention update to efficiently incorporate new data, enabling scalable conditioning, querying, and updating. The CMANP framework, including an Autoregressive Not-Diagonal extension (CMANP-AND), achieves competitive or state-of-the-art performance on NP benchmarks while using substantially less memory than prior methods. These contributions enable reliable uncertainty estimation in meta-learning under tight resource constraints and offer a pathway to extend constant-memory attention to other modalities and tasks.
Abstract
Neural Processes (NPs) are popular meta-learning methods for efficiently modelling predictive uncertainty. Recent state-of-the-art methods, however, leverage expensive attention mechanisms, limiting their applications, particularly in low-resource settings. In this work, we propose Constant Memory Attentive Neural Processes (CMANPs), an NP variant that only requires constant memory. To do so, we first propose an efficient update operation for Cross Attention. Leveraging the update operation, we propose Constant Memory Attention Block (CMAB), a novel attention block that (i) is permutation invariant, (ii) computes its output in constant memory, and (iii) performs constant computation updates. Finally, building on CMAB, we detail Constant Memory Attentive Neural Processes. Empirically, we show CMANPs achieve state-of-the-art results on popular NP benchmarks while being significantly more memory efficient than prior methods.
