How memory architecture affects learning in a simple POMDP: the two-hypothesis testing problem

Mario Geiger, Christophe Eloy, Matthieu Wyart

TL;DR

Endowing reinforcement learning agents with internal memory helps solve partially observable Markov decision processes (POMDPs), but unconstrained memory makes policy optimization notoriously non-convex and prone to bad local minima. This paper theoretically and empirically investigates the trade-off between flexible Random Access Memory (RAM) and a rigid, sliding-window history ("Memento" memory) in a two-hypothesis bandit task. Surprisingly, rigid history-based memory can match the exponential theoretical performance of RAM while offering an optimization landscape that is vastly easier to train from random initialization.

What Problem Does This Paper Address?

In POMDPs, agents receive noisy or partial observations and must rely on internal memory or past history to infer the state of the world. While giving an agent a flexible finite-state controller (a discrete "RAM" where actions and memory transitions are fully learned) can in theory represent optimal policies, optimizing these policies via gradient descent is non-convex. In practice, training routinely gets trapped in poor local optima.

A common heuristic is to restrict the memory architecture (e.g., keeping only a fixed sliding window of the last $m$ actions and rewards). However, the theoretical cost of this structural restriction has remained poorly understood even in the simplest POMDPs: Does constraining memory sacrifice asymptotic performance, and how much does it actually help optimization?

Methods

The authors analyze a classic two-hypothesis testing POMDP (a two-armed Bernoulli bandit where Arm A is better under hypothesis $H_A$ and Arm B under $H_B$, separated by mean difference $\mu$ and reset rate $r = 1 - \gamma$). They compare two memory paradigms:

  1. Random Access Memory (RAM): The agent has $M$ discrete internal states and complete freedom over state transitions and arm selection.
  2. Theoretical benchmark: The authors design a Column of Confidence Policy (CCP), organizing $M$ states into two parallel columns representing confidence in each arm, switching arms only at the column base.
  3. Memento Memory: The agent cannot directly edit its memory; it only observes a fixed FIFO register of its last $m$ actions and rewards ($M_{\text{eff}} = 4^m$ total memory configurations).
  4. Theoretical benchmark: The authors introduce the Necklace Policy, which exploits combinatorial properties of binary necklaces (equivalence classes of $m$-length strings under cyclic rotation). By default, the agent repeats the oldest action in memory, cycling within a necklace. By leveraging a combinatorial conjecture that binary necklaces can be arranged in a single-bit-flip Gray order, the agent transitions between necklaces only when observing maximally informative reward sequences.
  5. Policy Optimization: Policies are parameterized with softmax logits and optimized directly using exact gradient flow ($\frac{d}{dt} w = \nabla_w G_\pi$) evaluated on the Markov chain's steady-state distribution via automatic differentiation (PyTorch) and the power method.

Datasets

  • Synthetic Benchmark Only: The experiments use a simulated two-hypothesis Bernoulli bandit environment where arm probabilities are $k_A, k_B \in \{(1+\mu)/2, (1-\mu)/2\}$.
  • No empirical real-world datasets were used.

Key Insights and Ideas

  • Actions as Memory Encoders: Even though Memento agents cannot explicitly write to memory, their actions alter future memory states. By cycling through Gray-ordered necklaces, an agent can track confidence across exponentially long horizons, bypassing the apparent limitation of an $m$-step sliding window.
  • Asymptotic Parity Between Rigid and Flexible Memory:
  • RAM achieves an error probability of $q \sim \alpha^{2M}$ (where $\alpha = \frac{1-\mu}{1+\mu} < 1$).
  • Memento memory achieves $q^* \approx \alpha^{2^m}$—exponentially small in $2^m$ (or $\alpha^{\sqrt{M_{\text{eff}}}}$ in terms of effective states $M_{\text{eff}} = 4^m$). This is vastly superior to standard finite-horizon bandit bounds ($q \sim \frac{\ln m}{m}$).
  • The Optimization–Expressivity Paradox: While RAM is theoretically more flexible, its optimization landscape from random initialization is plagued by permutation symmetries and catastrophic local minima. In contrast, the rigid structure of Memento memory constrains the search space, acting as an implicit inductive bias that allows gradient flow to find high-performing policies reliably.

Key Results

  • Theoretical Exploration Rate: For the RAM Column of Confidence Policy, optimizing the exit rate from the highest-confidence states yields an optimal exploration parameter $\epsilon \propto \sqrt{r}$, balancing exploration and exploitation over the discount horizon $1/r$.
  • Failure of RAM under Random Initialization: When optimizing RAM policies ($M=8, 20$) with random parameter initialization, gradient flow consistently gets trapped near chance performance ($q \approx 0.5$). Imposing contiguous/linear transitions improves learning, but still falls short of optimal CCP performance unless initialized artificially close to the ground truth ($\pi_0 \approx \pi_{\text{CCP}} + 10^{-4}$).
  • Superiority of Memento Learning: For identical effective memory capacities ($M_{\text{eff}} = 64$ and $M_{\text{eff}} = 256$), randomly initialized Memento policies consistently converge to much lower error rates ($q \approx 0.15$ to $0.2$) compared to RAM, confirming that memory constraints smooth the loss landscape.

Limitations and Future Work

  • Theoretical Dependency on Conjecture: The closed-form necklace policy relies on the Degni & Drisko (2007) conjecture stating that a Gray ordering exists across all distinct necklaces for prime $m$ (verified only up to $m \le 37$).
  • Simple Task Scope: The theoretical framework is restricted to two-hypothesis, two-action stationary Bernoulli problems. Extending this to continuous reward distributions, non-stationary transitions, or multi-hypothesis testing (e.g., star topologies with multiple branches) remains an open challenge.
  • Timescale Separations: Analytical proofs assume extreme separation of timescales ($r \ll \epsilon_0 \ll \epsilon_1 \ll 1$), which may not hold tightly in realistic, finite-discount RL settings.

Summary updated

BibTeX
@inproceedings{geiger2022how,
  author = {Mario Geiger and Christophe Eloy and Matthieu Wyart},
  title = {{How memory architecture affects learning in a simple POMDP: the two-hypothesis testing problem}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=hxitw01k_Ql},
}
Figure