paper-with-me

Papers

Learning Transformer Programs

2023-06-01 · NeurIPS 2023 11 · Dan Friedman, Alexander Wettig, Danqi Chen

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.

📄 PDF Abstract BibTeX arXiv:2306.01128

Code (1)

princeton-nlp/transformerprograms 공식 구현 pytorch

Tasks

In-Context LearningInterpretable Machine Learningnamed-entity-recognitionNamed Entity Recognitiontext-classificationText Classification

Methods 이 논문이 사용한 방법론

Attention 설명 없음
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Position-Wise Feed-Forward Layer 설명 없음
Multi-Head Attention 설명 없음
Residual Connection 설명 없음
BPE Byte Pair Encoding, or BPE, is a subword segmentation algorithm that encodes rare and unknown words as sequences of subword units. The intuition is that various word…
Label Smoothing Label Smoothing is a regularization technique that introduces noise for the labels. This accounts for the fact that datasets may have mistakes in them, so maximizing the…
Adam 설명 없음

Similar Papers 제목 키워드 기반

Discovering Interpretable Algorithms by Decompiling Transformers to RASP

2026-02-09 · Xinting Huang, Aleksandra Bakalova, Satwik Bhattamishra, William Merrill 외 arxiv

Recent work has shown that the computations of Transformers can be simulated in the RASP family of programming languages. These findings have enabled improved understanding of the expressive capacity and generalization a…

Training Transformers as a Universal Computer

2026-04-28 · Ruize Xu, Chenxiao Yang, Yanhong Li, David McAllester arxiv

We demonstrate that a small transformer can learn to execute programs in MicroPy, a simplified yet computationally universal programming language. Given procedure definitions together with an expression to evaluate, the …

Planning with Large Language Models for Code Generation

2023-03-09 · Shun Zhang, Zhenfang Chen, Yikang Shen, Mingyu Ding 외

Existing large language model-based code generation pipelines typically use beam search or sampling algorithms during the decoding process. Although the programs they generate achieve high token-matching-based scores, th…

Code GenerationLanguage ModellingLarge Language Model

Weights to Code: Extracting Interpretable Algorithms from the Discrete Transformer

2026-01-09 · Yifan Zhang, Wei Bi, Kechi Zhang, Dongming Jin 외 arxiv

Algorithm extraction aims to synthesize executable programs directly from models trained on algorithmic tasks, enabling de novo recovery of executable mechanisms from weights without relying on human-written target progr…

Transformer-based Program Synthesis for Low-Data Environments

2022-05-18 · Jack Roper

Recent advancements in large pre-trained transformer models (GPT2/3, T5) have found use in program synthesis to generate programs that satisfy a set of input/output examples. However, these models perform poorly on long-…

Program Synthesis