通过棋盘游戏研究GPT如何逐层理解世界模型
How GPT learns layer by layer
- 用OthelloGPT在棋盘游戏中分析各层表示的演化
- 深层网络捕捉棋子稳定性等动态策略特征
- 稀疏自编码器比线性探测更有效揭示内在表征
大型语言模型(LLMs)在语言处理、策略游戏和推理任务中表现优异,但在构建可泛化的内部表征方面仍存在不足,这限制了智能体在复杂环境中的适应性决策能力。为实现稳定有效的行为,智能体需建立可靠的环境模型。尽管LLMs在特定基准上表现良好,但其泛化能力差,导致表征脆弱,影响实际应用效果。本文以基于GPT的OthelloGPT模型为实验平台,该模型仅通过预测下一个合法落子进行训练。结果显示,模型各层表现出有意义的渐进式理解:浅层学习棋盘边缘等静态属性,深层则反映棋子变化等动态特征。通过对比稀疏自编码器(SAEs)与线性探测器,发现SAEs能更鲁棒地揭示组合性特征,而线性探测器仅关注分类有用特征。进一步利用SAEs解码出棋子颜色和棋子稳定性(tile stability)等此前未被研究的特征,后者关联于控制力和长期规划等复杂策略概念。通过分析线性探测准确率与特征变化趋势,验证了不同方法对模型学习内容的捕捉效果。本研究虽从较小的OthelloGPT开始,但为理解GPT、Transformer及更大规模模型的内部表示提供了通用框架。代码已开源:https://github.com/ALT-JS/OthelloSAE。
原文摘要 · Abstract (English)
Large Language Models (LLMs) excel at tasks like language processing, strategy games, and reasoning but struggle to build generalizable internal representations essential for adaptive decision-making in agents. For agents to effectively navigate complex environments, they must construct reliable world models. While LLMs perform well on specific benchmarks, they often fail to generalize, leading to brittle representations that limit their real-world effectiveness. Understanding how LLMs build internal world models is key to developing agents capable of consistent, adaptive behavior across tasks. We analyze OthelloGPT, a GPT-based model trained on Othello gameplay, as a controlled testbed for studying representation learning. Despite being trained solely on next-token prediction with random valid moves, OthelloGPT shows meaningful layer-wise progression in understanding board state and gameplay. Early layers capture static attributes like board edges, while deeper layers reflect dynamic tile changes. To interpret these representations, we compare Sparse Autoencoders (SAEs) with linear probes, finding that SAEs offer more robust, disentangled insights into compositional features, whereas linear probes mainly detect features useful for classification. We use SAEs to decode features related to tile color and tile stability, a previously unexamined feature that reflects complex gameplay concepts like board control and long-term planning. We study the progression of linear probe accuracy and tile color using both SAE's and linear probes to compare their effectiveness at capturing what the model is learning. Although we begin with a smaller language model, OthelloGPT, this study establishes a framework for understanding the internal representations learned by GPT models, transformers, and LLMs more broadly. Our code is publicly available: https://github.com/ALT-JS/OthelloSAE.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。