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

通过边剪枝寻找 Transformer 电路

Finding Transformer Circuits with Edge Pruning

Princeton University(普林斯顿大学);Princeton Language and Intelligence (PLI)(普林斯顿语言智能实验室)

Adithya Bhaskar, Alexander Wettig, Dan Friedman, Danqi Chen

AI总结:

本文将自动化电路发现构建为优化问题,提出Edge Pruning方法通过剪除组件间的边来高效发现电路,在忠实度和速度上优于先前方法,并成功扩展至CodeLlama-13B以揭示指令提示与上下文学习机制的相似性。

摘要:

解释语言模型的路径通常通过分析电路来进行——电路是模型的稀疏计算子图,用于捕捉其行为的特定方面。近期的研究已将发现电路的任务自动化。然而,这些方法存在实际局限性,因为它们要么依赖于低效的搜索算法,要么依赖于不准确的近似。在本文中,我们将自动化电路发现构建为一个优化问题,并提出*Edge Pruning*(边剪枝)作为一种有效且可扩展的解决方案。Edge Pruning 利用基于梯度的剪枝技术,但它不是移除神经元或组件,而是剪除组件之间的边。我们的方法在 GPT-2 中发现的电路,其使用的边数不到先前方法发现的电路的一半,同时在标准的电路发现任务中,对完整模型预测的忠实度同样高。即使示例数量多达 100K,Edge Pruning 也很高效,在速度上优于先前的方法,并产生质量大幅提升的电路。它还完美恢复了两个使用 Tracr 编译的模型中的真实电路。得益于其高效性,我们将 Edge Pruning 扩展到了 CodeLlama-13B,该模型的规模是先前方法运行规模的 100 倍以上。我们利用这一设置进行了案例研究,比较了指令提示和上下文学习背后的机制。我们发现了两个稀疏度超过 99.96% 的电路,它们与完整模型的性能相匹配,并揭示了这两种设置下的机制存在大量重叠。我们的案例研究表明,Edge Pruning 是一种实用且可扩展的可解释性工具,并阐明了仅在大模型中才出现的行为。

英文摘要:

The path to interpreting a language model often proceeds via analysis of circuits -- sparse computational subgraphs of the model that capture specific aspects of its behavior. Recent work has automated the task of discovering circuits. Yet, these methods have practical limitations, as they rely either on inefficient search algorithms or inaccurate approximations. In this paper, we frame automated circuit discovery as an optimization problem and propose *Edge Pruning* as an effective and scalable solution. Edge Pruning leverages gradient-based pruning techniques, but instead of removing neurons or components, it prunes the \emph{edges} between components. Our method finds circuits in GPT-2 that use less than half the number of edges compared to circuits found by previous methods while being equally faithful to the full model predictions on standard circuit-finding tasks. Edge Pruning is efficient even with as many as 100K examples, outperforming previous methods in speed and producing substantially better circuits. It also perfectly recovers the ground-truth circuits in two models compiled with Tracr. Thanks to its efficiency, we scale Edge Pruning to CodeLlama-13B, a model over 100x the scale that prior methods operate on. We use this setting for a case study comparing the mechanisms behind instruction prompting and in-context learning. We find two circuits with more than 99.96% sparsity that match the performance of the full model and reveal that the mechanisms in the two settings overlap substantially. Our case study shows that Edge Pruning is a practical and scalable tool for interpretability and sheds light on behaviors that only emerge in large models.

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

↑