Robots learning from a few dozen human demonstrations need two properties that current theory treats as opposites. They must recover from mistakes: if a push or a glare knocks the robot slightly off the demonstrated path, the error should die out rather than snowball. They must also remember: in a multi-step kitchen task, whether the drawer was already opened two minutes ago changes what to do now, even if the camera image looks the same. The tools that guarantee recovery work by making a policy contractive, meaning any two nearby internal states are pulled together exponentially fast. Contraction erases differences, and a remembered fact is a difference. Known results on recurrent memory say the same thing from the other side: a recurrent network with bounded weights and a Markovian update forgets its inputs exponentially fast.
We propose to stop asking one internal state to do both jobs. The policy's recurrent state is split in two. A motion state is strictly contractive, so perturbations to the robot's continuous behaviour decay. A small latch memory is a set of slots that hold their value exactly, with a gain of one, until a learned binary gate decides to overwrite them, so it does not forget at all between writes. The central claim, which we will prove and then test, is that for this class of gated policies the worst-case deviation from the demonstrations is controlled by the number of memory writes in an episode rather than by the episode length. That gives a horizon-independent recovery guarantee for a policy with genuine long memory. It also turns a tractable slice of the open problem of gated-network theory into something practically useful for robot learning when demonstrations are scarce.
Why the two properties collide, and where the gap is
Three bodies of work frame the problem. On the stability side, Contractive Dynamical Imitation Policies for Efficient Out-of-Sample Recovery builds imitation policies that are contractive by construction and bounds their worst-case deviation from experts. Neural Contractive Dynamical Systems does the same through a learned negative-definite Jacobian. Contractive Diffusion Policies adds a contraction penalty to the denoising process of a diffusion policy, a policy that generates actions by iteratively denoising random noise. All three motivate our recovery objective. All three also lack temporal memory: the first two model fully observed state trajectories, and the third contracts only within a single decision step.
On the memory side, two papers constrain the design. Do RNN and LSTM have Long Memory? proves that standard recurrent networks are geometrically ergodic, so their correlation with past inputs decays exponentially; it restores long memory with a fractional-differencing window over past inputs. Inverse Approximation Theory for Nonlinear Recurrent Neural Networks proves that any target a nonlinear recurrent network approximates stably must have exponentially decaying memory. It also shows that long memory requires weights near the edge of instability, where robustness to perturbation collapses. Those authors explicitly leave gated architectures open.
On the robotics side, the empirical evidence that memory matters is strong. MTIL: Encoding Full History With Mamba for Temporal Imitation Learning uses Mamba-2, a state-space model whose recurrence runs in time linear in sequence length. On a real sequential-insertion task it reports 54% success, against 0% for the history-free Action Chunking Transformer. That work offers no stability or generalization analysis. Recurrent Action Transformer with Memory introduces a memory retention valve between transformer segments, with a retention bound that holds under an assumed alignment condition. It is tested on synthetic tasks such as T-Maze and POPGym, not on visuomotor manipulation.
Our design reads the two negative results as a recipe rather than a wall. Exponential forgetting follows from the forget gate acting as a multiplier strictly below one at every step. Collapse of the stability radius follows from memory directions sitting near instability while continuously driven by inputs. A latch whose hold gain is exactly one breaks geometric ergodicity on purpose. Because the latch is written only at sparse, discrete events, the marginally stable directions are almost never exposed to input noise. The research file contains no prior work that pairs a contractive continuous state with exactly-held, sparsely written memory in a robot policy, or that proves a write-count-dependent deviation bound.
Core Claim
Write the policy state as $z_t = (x_t, m_t)$. Here $x_t$ is the motion state and $m_t$ the latch memory, $o_t$ is the observation, and $a_t$ is the action. The latch updates as
$$m_t = (1 - g_t)\, m_{t-1} + g_t\, w(x_{t-1}, o_t), \qquad g_t \in \{0, 1\},$$
where $g_t$ is a hard gate predicted from $(x_{t-1}, o_t)$ and $w$ is a learned write function. The motion state updates as $x_t = F(x_{t-1}, o_t, m_t)$, with $F$ contractive in $x$ at rate $\rho < 1$ for every fixed latch value, enforced by construction using the recurrent-equilibrium parameterization from the contractive imitation work.
Suppose an episode contains $K$ writes, observations are perturbed by at most $\varepsilon$, and $L_w$ is the Lipschitz constant of the write function. We conjecture, and will prove, a bound of the form
$$\sup_t \|x_t - x_t^\star\| \le \frac{C\,\varepsilon}{1-\rho}\,\big(1 + K L_w\big),$$
conditional on no gate decision flipping relative to the reference trajectory $x^\star$. Between writes the system is a contraction, so errors shrink geometrically and their sum is bounded by a geometric series. Each write can freeze at most one bounded error into memory, and that error then propagates through $F$ with a bounded gain.
The flip condition is the honest crux. We will bound the probability of a gate flip through the gate's margin, the distance of its pre-activation from the decision threshold. On the generalization side, for a fixed $K$ the latch makes the policy behave like a finite-state controller with continuous contractive dynamics inside each mode. We expect a bound in the number of demonstrations $N$ that does not grow with episode length, in the spirit of Length independent PAC-Bayes bounds for Simple RNNs. Such a bound would cover a genuinely multiplicatively gated network. On Generalization Bounds of a Family of Recurrent Neural Networks identifies exactly this setting as the obstacle.
Research Program
The theoretical work has two goals. The first is to prove the deviation bound together with the gate-margin flip lemma. The second is to prove a PAC-Bayes generalization bound for the motion-plus-latch class, with a complexity term that grows with $K$ and the latch width but not with horizon $T$.
We will also state precisely what the design gives up. The latch provably cannot represent smoothly fading memories, and a target functional of that kind would need the edge-of-instability regime analyzed in the inverse approximation work. Our position is that manipulation tasks mostly need discrete memories, such as which stage the task is in or which object was seen, plus contractive motion. The experiments test that position.
The architectural work has two parts. The first is training the hard gate end-to-end with a straight-through estimator. The second is adding a penalty on the expected write count, so that the $K$ in the bound is actually small. The policy sits on a frozen visual encoder, with an action head that predicts short action chunks, so that the comparison with history-free action-chunking policies is fair. Both recurrences are cheap and constant-time per step, so control latency does not grow with history.
Baselines
The naive reference point is a history-free action-chunking policy and a diffusion policy trained on the same demonstrations. The MTIL paper shows these can score 0% on sequential insertion. A second naive point is the same policy fed a stack of the last eight frames, which HAMLET: Switch Your Vision-Language-Action Model into a History-Aware Policy reports costs 3.6 times the memory. Showing that a policy beats these establishes only that memory matters, not that our structure does.
The strongest memory competitor is MTIL's Mamba-2 history encoder, at 54% on real sequential insertion. We will reimplement it on the same visual encoder, demonstrations, and tuning budget. To beat it we must match or exceed its success on ambiguity tasks while showing lower deviation under perturbation.
The strongest combined competitor is the obvious composition of existing pieces: MTIL's Mamba encoder plus the contraction loss from Contractive Diffusion Policies applied to the action head. That loss lifted physical Franka peg-in-hole success from 20% to 65% in that paper. If this composition matches us on both success and recovery, our structural claim fails in practice.
On RoboCasa we also compare against reported points under the same 24-task, 50-demonstrations-per-task protocol. HAMLET reports 66.4%, and GlanceWAM: Sparse Test-Time Imagination for World-Action Models reports 72.2% with a much larger backbone. We treat GlanceWAM as a ceiling on capacity, not a like-for-like competitor. For memory-only behaviour on T-Maze, the recurrent memory transformer reports 100% success up to 9,600 steps, and we must match it.
The contractive dynamical imitation policy without memory isolates the recovery ingredient. Three ablations isolate our key ingredients:
- Soft latch: the gate is continuous and the hold gain is learned below one. This restores geometric ergodicity.
- Unconstrained motion state: the latch is kept but the contraction requirement on the motion state is removed.
- No write penalty: the latch and contraction are kept but the penalty on write count is dropped.
All methods get the same demonstrations, encoder, parameter budget within 10%, and the same number of hyperparameter trials.
Why not just…?
Why not just add a contraction loss to a Mamba policy? This is the most serious threat, and it is the combined baseline above. The theory predicts a specific failure. Contracting the whole state of a state-space model pushes its gates below one everywhere, which by the ergodicity result reintroduces exponential forgetting. Leaving the memory directions uncontracted instead exposes them to continuous input noise near instability. The predicted signature is a trade-off curve as the contraction weight is swept: success on memory tasks falls as recovery improves. Our model should sit above that curve. If it does not, the decomposition adds nothing and we will report that.
Why not just initialize forget gates near one, or use a long-window fractional filter? High forget-gate bias still multiplies memory by a gain below one at every step, so it only delays the exponential decay. The fractional-differencing filter from the long-memory paper decays polynomially but adds a window of about 100 past steps and offers no recovery guarantee. Both appear as soft-latch-style ablations, and we will measure accuracy on stage memory as a function of how long ago the cue occurred.
Why not just keep a buffer of a few salient past frames? A learned keyframe buffer is effectively a latch whose slots hold images. If it pairs with a contractive motion state and performs as well, that confirms the claim: the structure, not the specific slot content, is what matters. We will therefore run a keyframe-latch variant. Our bound applies to it whenever writes are sparse and hard-gated. The open empirical question is whether compact learned slots generalize better from 50 demonstrations than raw frames, which invite spurious visual correlations of the kind HAMLET documents.
Why not just generate more synthetic data? RoboCasa shows that scaling synthetic demonstrations from 50 to 3,000 lifts atomic tasks from 28.8% to 47.6%, while composite tasks often stay below 12%. We test this directly by training every model at both data scales on composite tasks. If more data closes the gap for the history-free baseline, memory is not the bottleneck.
Proposed Experiments
The primary testbed is RoboCasa composite tasks at 50 demonstrations per task, plus the 24-task kitchen suite for comparison with published numbers. We add a Robomimic run at 10% of the data under the contractive diffusion protocol; no exact percentage is reported on Lacuna for that setting, so we will measure all baselines ourselves. T-Maze and POPGym serve as memory sanity checks. A real-robot sequential-insertion task replicates MTIL's ambiguity setting.
The metrics are task success, out-of-sample trajectory deviation under scripted pushes and visual corruption injected mid-episode (following the contractive imitation protocol), control latency, and the realized write count $K$.
Two checks decide the outcome. First, the measured deviation should scale with $K$ and stay flat as episode length doubles, while the Mamba and Mamba-plus-contraction baselines degrade with length. Second, across demonstration counts of 10, 25, and 50, our model's advantage on composite tasks should be largest at the smallest $N$, as the horizon-free generalization bound predicts. If deviation grows with horizon despite a small $K$, the gate-flip lemma is the broken link, and we will report the measured flip rate.
References
- Contractive Dynamical Imitation Policies for Efficient Out-of-Sample Recovery
- Neural Contractive Dynamical Systems
- Contractive Diffusion Policies
- Do RNN and LSTM have Long Memory?
- Inverse Approximation Theory for Nonlinear Recurrent Neural Networks
- MTIL: Encoding Full History With Mamba for Temporal Imitation Learning
- Recurrent Action Transformer with Memory
- Length independent PAC-Bayes bounds for Simple RNNs
- On Generalization Bounds of a Family of Recurrent Neural Networks
- HAMLET: Switch Your Vision-Language-Action Model into a History-Aware Policy
- GlanceWAM: Sparse Test-Time Imagination for World-Action Models