Self-Supervised Keyframe Discovery for Horizon-Invariant Behavior Cloning
Keyframe Mnemonics (KM) learns what a behavior cloning policy should remember: compact, decision-relevant observations discovered from demonstrations and retained across long horizons.
Method overview. A selector assigns priorities to incoming observations, stores decision-critical keyframes in a buffer, and conditions the BC policy on this compact memory along with the current observation to predict actions.
1 under certain task-structure assumptions
The horizon-invariance property.
Horizon-invariance refers to the ability of a policy to generalize at unseen horizons much longer than the training distribution without performance degradation, where horizon is defined as the time gap between a decision-relevant keyframe observation and the later decision timestep where that information is used.
The robot is shown a red or green cube for 3–5s. The cue is removed, and after a delay two cubes appear 30 cm apart. The robot must reach for the color it was shown. Demonstration data had a cue-to-choice delay of ~5s, but the test delays are 20x longer.
Same training horizon. Much longer tests.
At the training delay $\Delta t=15$, all policies can remember the previously shown color cue and choose the corresponding color. As the cue-to-choice delay grows out of distribution (OOD), baseline memory methods fail, whereas KM retains the observed cue in its mnemonic buffer and continues to act correctly.
Use the arrows below the grid to page through additional delay sets.
Δt=15
Δt=95
Δt=250
The cue disappears. The action still depends on it.
Memory-intensive imitation in partially observable environments often fails because the key observation is no longer visible when the action is needed. Rather than expanding context windows or repeatedly compressing hidden state, KM learns to preserve the few frames that disambiguate future behavior.
In non-Markovian behavior cloning, the current observation $o_t$ is not sufficient, and the policy must instead maintain a belief over the history $h_t$. Recurrent and attention-based models can help, but repeated updates can blur state information, and finite context windows eventually drop earlier evidence.
Keyframe Mnemonics turns memory into a sparse selection problem. If a small set of keyframes carries more action information than rest of the background frames, the policy can act from a fixed-size mnemonic buffer $\mathcal B_t$ instead of the full observation history.
Policy remains robust to distractors.
Objects the policy never saw during training are dropped into the workspace during the rollout.
Both the selector and BC policy remain robust to unseen distractors. The selector correctly chooses the right keyframe to form the mnemonic buffer (orange border) which is then used by the BC policy for decision-making and control.
Memory-intensive robot manipulation tasks.
Successful evaluation rollouts of mnemonic-conditioned BC policies. The top bar in each video shows the mnemonic buffer (orange border) together with the current observation (blue border) used by the policy.
Use the arrows above or below the grid to page through 23 MIKASA-Robo tasks. Bars show mean success rate with +/- 1 std.
Three training stages, one compact memory.
KM first learns a proxy objective from randomly sampled past observations. A selector policy then populates a priority-queue buffer with keyframes that optimize this objective. Finally, the behavior cloning policy is trained on demonstrations augmented with the discovered keyframes, or mnemonics. The discovery process is fully self-supervised and does not use any manual keyframe annotations or privileged information.
Past observations are randomly sampled to build small buffers bounded by the memory budget $k$, and the proxy $f_\theta$ predicts expert actions from these buffers. We refer to this as masked-sampling training, which leverages the simplicity bias of neural networks to encourage action mappings conditioned on true keyframes while discouraging spurious shortcuts.
The frozen proxy loss scores buffer quality. A selector policy $\pi_{\mathrm s}$ emits priorities $p_t$ that determine whether each observation enters the mnemonic buffer. The selector is trained with PPO to minimize the expected proxy objective $J_{\theta^*}(\mathcal{B}_t)$, thereby identifying keyframes informative for the memory task.
A trained selector identifies decision-relevant keyframes which are used to create augmented demonstrations. Finally, the BC policy learns $\pi_{\mathrm{BC}}(a_t \mid o_t,\mathcal B_t)$, using the current observation for local control and the buffer for task context.
Performance stays flat when the horizon grows.
In environments where the task-structure assumptions hold strongly, KM demonstrates guaranteed memory retention up to horizons five orders of magnitude beyond training, as shown across synthetic memory tasks and grid domains.
KM is plotted with the four strongest baselines for each benchmark. Shaded regions show mean +/- 1 std.
Add
Final-step MSE $\downarrow$
Scattered-Copy
Copy success rate $\uparrow$
T-Maze
Episode success rate $\uparrow$
MiniGrid-Memory
Episode success rate $\uparrow$
LTMB-Hallway
Episode success rate $\uparrow$
Mnemonic-conditioned BC policy rollouts in grid domains. The mnemonic buffer (orange border) and the current observation (blue border) are shown at the top center of each video.
BC policy activation maps on mnemonics.
Grad-CAM activation maps show which parts of the mnemonic buffer and current observation drive the behavior cloning policy $\pi_{\mathrm{BC}}$ at decision-critical steps. Hot regions concentrate on task cues stored in discovered keyframes and on matching evidence in the current observation.
Grid domains
Robot domains
Where the policy still breaks.
Representative KM rollouts where the mnemonic-conditioned BC policy fails, highlighting directions for future work.
Spatial OOD
Δt=15The policy struggles to generalize to out-of-distribution spatial scenarios.
Task Failure
Δt=200Even with correct decision-making, the policy fails to execute the task successfully.
Causal Confusion
Δt=250Spurious correlations with the mnemonic buffer lead to incorrect actions, even when the keyframes are correctly retained.
Memory Capacity Failure
Chain Of Colors 3KM struggles with memory-capacity limitations. When multiple frames contain equivalent information, the proxy objective assigns similar reward to several buffer choices, making it difficult for the selector to preserve unique keyframes and retain information reliably.
We observe this failure mode in the Chain Of Colors 3 task, where the policy must remember three colors appearing over multiple timesteps. The policy fails to complete the task successfully because, although the selector retains some keyframes in the buffer, it does not consistently preserve the full mnemonic set of three colors.