arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2506.19686cs.AI
收藏

从记忆到地图:变换器中上下文强化学习的机制

From Memories to Maps: Mechanisms of In-Context Reinforcement Learning in Transformers

Harvard Medical School(哈佛医学院);Harvard University(哈佛大学)

Ching Fang, Kanaka Rajan

AI总结:

研究通过变换器模型探索上下文强化学习的机制,发现记忆在存储经验与缓存计算中扮演关键角色,支持灵活行为。

摘要:

人类和动物表现出显著的学习效率,能够以最少的经验适应新环境。这种能力未被标准强化学习算法充分捕捉,这些算法依赖于增量价值更新。快速适应可能依赖于事件记忆——即检索特定过去经验以指导新情境中的决策的能力。变换器提供了一个研究这些问题的有用设置,因为它们能够快速在上下文中学习,且其键值架构类似于大脑中的事件记忆系统。我们训练了一个变换器在一系列受啮齿类动物行为启发的规划任务中进行上下文强化学习。然后我们表征模型中出现的学习算法。我们首先发现,表示学习由上下文结构学习和跨上下文对齐支持,其中表示在不同感官刺激的环境中被对齐。接下来我们证明,模型开发的强化学习策略不能被标准模型无关或模型基于的规划解释。相反,我们显示上下文强化学习由模型内存标记中的中间计算缓存支持,这些计算在决策时间被访问。总体而言,我们发现记忆可能作为一种计算资源,存储原始经验和缓存的计算以支持灵活的行为。此外,模型中开发的表示类似于大脑海马体-内侧颞叶系统相关的计算,这表明我们的发现可能对自然认知相关。总之,我们的工作为人工和自然环境中快速适应所 underlying 的上下文学习提供了机制假设。

英文摘要:

Humans and animals show remarkable learning efficiency, adapting to new environments with minimal experience. This capability is not well captured by standard reinforcement learning algorithms that rely on incremental value updates. Rapid adaptation likely depends on episodic memory -- the ability to retrieve specific past experiences to guide decisions in novel contexts. Transformers provide a useful setting for studying these questions because of their ability to learn rapidly in-context and because their key-value architecture resembles episodic memory systems in the brain. We train a transformer to in-context reinforcement learn in a distribution of planning tasks inspired by rodent behavior. We then characterize the learning algorithms that emerge in the model. We first find that representation learning is supported by in-context structure learning and cross-context alignment, where representations are aligned across environments with different sensory stimuli. We next demonstrate that the reinforcement learning strategies developed by the model are not interpretable as standard model-free or model-based planning. Instead, we show that in-context reinforcement learning is supported by caching intermediate computations within the model's memory tokens, which are then accessed at decision time. Overall, we find that memory may serve as a computational resource, storing both raw experience and cached computations to support flexible behavior. Furthermore, the representations developed in the model resemble computations associated with the hippocampal-entorhinal system in the brain, suggesting that our findings may be relevant for natural cognition. Taken together, our work offers a mechanistic hypothesis for the rapid adaptation that underlies in-context learning in artificial and natural settings.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑