arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2306.01128cs.LGcs.CL
收藏

学习 Transformer 程序

Learning Transformer Programs

Princeton University(普林斯顿大学)

Dan Friedman, Alexander Wettig, Danqi Chen

AI总结:

本文提出 Transformer Programs,通过训练改进的 Transformer 并自动转换为人类可读程序,在多种任务上达到与标准 Transformer 相当的性能,同时显著提升模型可解释性。

摘要:

近期机制可解释性研究试图通过仔细检查网络权重和激活来逆向工程 Transformer 模型。然而,这些方法需要大量人工努力,并且仍无法提供对底层算法的完整、忠实描述。在本工作中,我们提出了一种训练机制上可解释的 Transformer 的程序。我们基于 RASP [Weiss et al., 2021] 构建,RASP 是一种可编译为 Transformer 权重的编程语言。我们没有将人工编写的程序编译为 Transformer,而是设计了一种改进的 Transformer,它可以使用基于梯度的优化进行训练,然后自动转换为离散的、人类可读的程序。我们将这些模型称为 Transformer Programs。为验证我们的方法,我们针对多种问题学习 Transformer Programs,包括一个上下文学习任务、一组算法问题(例如排序、识别 Dyck 语言),以及包括命名实体识别和文本分类在内的 NLP 任务。Transformer Programs 能够自动找到合理的解决方案,性能与同等规模的标准 Transformer 相当;更重要的是,它们易于解释。为展示这些优势,我们将 Transformer 转换为 Python 程序,并使用现成的代码分析工具来调试模型错误并识别用于解决不同子问题的“电路”。我们希望 Transformer Programs 为实现内在可解释机器学习的目标开辟一条新路径。

英文摘要:

Recent research in mechanistic interpretability has attempted to reverse-engineer Transformer models by carefully inspecting network weights and activations. However, these approaches require considerable manual effort and still fall short of providing complete, faithful descriptions of the underlying algorithms. In this work, we introduce a procedure for training Transformers that are mechanistically interpretable by design. We build on RASP [Weiss et al., 2021], a programming language that can be compiled into Transformer weights. Instead of compiling human-written programs into Transformers, we design a modified Transformer that can be trained using gradient-based optimization and then automatically converted into a discrete, human-readable program. We refer to these models as Transformer Programs. To validate our approach, we learn Transformer Programs for a variety of problems, including an in-context learning task, a suite of algorithmic problems (e.g. sorting, recognizing Dyck languages), and NLP tasks including named entity recognition and text classification. The Transformer Programs can automatically find reasonable solutions, performing on par with standard Transformers of comparable size; and, more importantly, they are easy to interpret. To demonstrate these advantages, we convert Transformers into Python programs and use off-the-shelf code analysis tools to debug model errors and identify the "circuits" used to solve different sub-problems. We hope that Transformer Programs open a new path toward the goal of intrinsically interpretable machine learning.

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

↑