arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2511.13371cs.AI
收藏

语言模型中的认知地图:空间规划的机制分析

Cognitive Maps in Language Models: A Mechanistic Analysis of Spatial Planning

University College London(伦敦大学学院);University of Oxford(牛津大学)

Caroline Baumgartner, Eleanor Spens, Neil Burgess, Petru Manescu

AI总结:

本文通过在三类空间任务上训练GPT-2并开展多维度机制分析,发现探索训练催生类认知地图的可泛化空间表征,目标导向训练则形成路径依赖策略,揭示了Transformer空间智能的泛化-优化权衡规律。

摘要:

大语言模型如何解决空间导航任务?我们通过在网格环境的三种空间学习范式上训练GPT-2模型来探究这一问题:被动探索(觅食模型——预测随机游走中的步长)、结构化哈密顿路径上的目标导向规划(生成最优最短路径,即SP-Hamiltonian),以及使用探索数据微调的混合模型(SP-Random Walk)。通过行为分析、表征分析和机制分析,我们发现了两种本质不同的习得算法。觅食模型形成了鲁棒的类地图空间表征,类似于“认知地图”。因果干预显示,该模型学会将空间信息整合为自洽的坐标系,证据是存在一个急剧的相变:到网络中间层时,它对历史方向token的依赖就会消失。该模型还采用了自适应分层推理系统,在短上下文时使用低层启发式,在长上下文时切换为基于地图的推理。相比之下,目标导向模型习得了路径依赖算法,在所有层都始终依赖显式方向输入。混合模型尽管泛化性优于其父模型,却保留了相同的路径依赖策略。这些发现表明,Transformer中的空间智能本质可能处于一个连续谱上,一端是由探索数据塑造的可泛化世界模型,另一端是为目标导向任务优化的启发式方法。我们对这种泛化-优化权衡给出了机制层面的解释,并强调了训练机制的选择如何影响涌现出的策略。

英文摘要:

How do large language models solve spatial navigation tasks? We investigate this by training GPT-2 models on three spatial learning paradigms in grid environments: passive exploration (Foraging Model- predicting steps in random walks), goal-directed planning (generating optimal shortest paths) on structured Hamiltonian paths (SP-Hamiltonian), and a hybrid model fine-tuned with exploratory data (SP-Random Walk). Using behavioural, representational and mechanistic analyses, we uncover two fundamentally different learned algorithms. The Foraging model develops a robust, map-like representation of space, akin to a 'cognitive map'. Causal interventions reveal that it learns to consolidate spatial information into a self-sufficient coordinate system, evidenced by a sharp phase transition where its reliance on historical direction tokens vanishes by the middle layers of the network. The model also adopts an adaptive, hierarchical reasoning system, switching between a low-level heuristic for short contexts and map-based inference for longer ones. In contrast, the goal-directed models learn a path-dependent algorithm, remaining reliant on explicit directional inputs throughout all layers. The hybrid model, despite demonstrating improved generalisation over its parent, retains the same path-dependent strategy. These findings suggest that the nature of spatial intelligence in transformers may lie on a spectrum, ranging from generalisable world models shaped by exploratory data to heuristics optimised for goal-directed tasks. We provide a mechanistic account of this generalisation-optimisation trade-off and highlight how the choice of training regime influences the strategies that emerge.

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

↑