Papers › Towards mental time travel: a hierarchical memory for reinforcement learning agents

Towards mental time travel: a hierarchical memory for reinforcement learning agents

28 May 2021NeurIPS 2021 12arXiv:2105.14039archive 2025-07-28

Andrew Kyle Lampinen, Stephanie C. Y. Chan, Andrea Banino, Felix Hill

Reinforcement learning agents often forget details of the past, especially after delays or distractor tasks. Agents with common memory architectures struggle to recall and integrate across multiple timesteps of a past event, or even to recall the details of a single timestep that is followed by distractor tasks. To address these limitations, we propose a Hierarchical Chunk Attention Memory (HCAM), which helps agents to remember the past in detail. HCAM stores memories by dividing the past into chunks, and recalls by first performing high-level attention over coarse summaries of the chunks, and then performing detailed attention within only the most relevant chunks. An agent with HCAM can therefore "mentally time-travel" -- remember past events in detail without attending to all intervening events. We show that agents with HCAM substantially outperform agents with other memory architectures at tasks requiring long-term recall, retention, or reasoning over memory. These include recalling where an object is hidden in a 3D environment, rapidly learning to navigate efficiently in a new neighborhood, and rapidly learning and retaining new object names. Agents with HCAM can extrapolate to task sequences much longer than they were trained on, and can even generalize zero-shot from a meta-learning setting to maintaining knowledge across episodes. HCAM improves agent sample efficiency, generalization, and generality (by solving tasks that previously required specialized architectures). Our work is a step towards agents that can learn, interact, and adapt in complex and temporally-extended environments.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2105.14039")

Code

Syntology Ran 3 of 6 code samples harvested from 2 repositories linked to this paper; 3 have no recorded run. Of those that ran: 1 ran · honoured contract; 2 ran with no contract checked.

By repository: official repository: 4 samples from 1 repository, 1 ran; community (archive-listed): 2 samples from 1 repository, 2 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

deepmind/deepmind-research officialmentioned in papertf report
deepmind/dm_fast_mapping officialmentioned in paperApache-2.0 report
lucidrains/HTM-pytorch mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

6 samples harvested; 3 ran; 1 honoured the contract we drafted; 3 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
2ran
3unverified

Licence: 0 of the 6 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

sinusoid_position_encoding deepmind/deepmind-research/hierarchical_transformer_memory/hierarchical_attention/htm_attention.py official repository ran · honoured contract fingerprinted Apache-2.0 (permissive) · 1e8ece086c64bdec · report
HierarchicalMemory deepmind/deepmind-research/hierarchical_transformer_memory/hierarchical_attention/htm_attention.py official repository unverified Apache-2.0 (permissive) · 2edf304a64ef7730 · report
HierarchicalMemoryAttention deepmind/deepmind-research/hierarchical_transformer_memory/hierarchical_attention/htm_attention.py official repository unverified Apache-2.0 (permissive) · 47ba4f0ef6df2621 · report
hk_vmap deepmind/deepmind-research/hierarchical_transformer_memory/hierarchical_attention/htm_attention.py official repository unverified Apache-2.0 (permissive) · f91e2499666b6b69 · report
HTMAttention lucidrains/HTM-pytorch/htm_pytorch/htm_pytorch.py community (archive-listed) ran MIT (permissive) · 4edc3f6c9182d6ba · report
SinusoidalPosition lucidrains/HTM-pytorch/htm_pytorch/htm_pytorch.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · d5ba387dec7cb4ba · report

Tasks

Meta-LearningNavigateReinforcement Learning (RL)reinforcement-learning

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections