Abstract
Standard recursive Bayesian inference often fails in non-stationary environments because the posterior variance typically decreases over time, leading to overconfidence in outdated models. We present Bayes with Adaptive Memory (BAM), a framework that maintains a memory buffer of past observations and uses Bayesian model selection to selectively activate relevant memories. This allows agents to break the "certainty trap," rapidly adapt to environmental shifts, and instantly recover performance when previously encountered states reappear.
The Challenge of Non-Stationarity
In a stationary world, recursive Bayes is ideal: as evidence accumulates, uncertainty shrinks. However, in a non-stationary world where the underlying rules change, this narrowing certainty becomes a liability. A "naive" Bayesian agent becomes increasingly resistant to new evidence that contradicts its established beliefs. While existing solutions often involve "forgetting" (downweighting old data), this is inefficient; if an environment reverts to a previous state, a forgetting agent must relearn everything from scratch.
Methodology: Bayes with Adaptive Memory
BAM transforms Bayesian inference from an open-loop process into a closed-loop system. Instead of simply using the previous posterior as the current prior, BAM maintains a memory buffer of past observations and performs the following steps:
- Readout Weights: The agent assigns a binary weight $w \in \{0, 1\}$ to every past observation. A weight of 1 includes the observation in the current prior construction, while 0 ignores it.
- Model Selection: BAM treats different combinations of past data as competing "models." It uses Bayesian Model Selection to find the weight set that maximizes the marginal likelihood of the current data batch.
- Complexity Penalty: To prevent overfitting to transient noise, a penalty based on Kullback-Leibler (KL) divergence is added. This encourages the agent to prefer simpler models that stay close to a base prior unless the evidence for a specific memory is strong.
- Greedy Optimization: To handle the exponential search space of memory combinations, BAM employs a greedy bottom-up approach to efficiently select relevant past experiences.
Experimental Evaluation
Breaking the Certainty Trap
In synthetic tracking tasks, such as a 1D sine-wave inference, standard recursive Bayes quickly becomes "confidently wrong" as its variance collapses. BAM, by contrast, maintains an adaptive posterior variance. When the environment shifts, BAM can increase its uncertainty by deactivating irrelevant memories, allowing it to track the signal accurately.
Rapid Recovery in Control
The power of BAM is most evident in tasks with revisited states. In a simulated Cartpole environment where gravity changes (simulating different planets), BAM demonstrates near-instant recovery. When the agent returns to a gravity setting it has seen before, it identifies the relevant past data and restores optimal control immediately, whereas standard Bayes remains stuck and changepoint detection methods must relearn from scratch.
Multi-Armed Bandits and Domain Adaptation
BAM was also evaluated in reinforcement learning and computer vision contexts:
- UCBAM: By combining BAM with the Upper Confidence Bound (UCB) algorithm, the authors achieved significantly lower cumulative regret in non-stationary bandit tasks compared to Thompson Sampling.
- Rotated MNIST: In a domain adaptation task using rotated digits, BAM achieved 71.8% accuracy, far outperforming standard Ordinary Least Squares (55%) by leveraging specific relevant past rotation domains.
Discussion and Future Work
BAM provides a robust meta-framework that can recover standard Bayes, exponential forgetting, or unlearning depending on its weight configuration. However, challenges remain regarding computational complexity as the memory buffer grows. Future research will focus on efficient memory pruning schemes and extending the framework beyond conjugate priors to complex models like Deep Neural Networks using variational approximations.
Summary updated