arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.05564cs.LGcs.AIcs.CLcs.FL
收藏

从Transformer中提取自动机

Automata Extraction from Transformers

Peking University(北京大学)

Yihao Zhang, Zeming Wei, Meng Sun

AI总结:

本文提出一种面向Transformer的自动机提取算法,通过跟踪其内部潜在表示变换并用L*算法将其解释为DFA,揭示了Transformer处理形式语言的机制,提升了模型可解释性。

摘要:

在现代机器学习系统中,基于Transformer的架构已在广泛的任务上取得了里程碑式的成功,然而理解其运行机制仍然是一个悬而未决的问题。为了提高机器学习系统的透明度,自动机提取方法通常通过形式语言将有状态的机器学习模型解释为自动机,已被证明能有效解释循环神经网络(RNN)的机制。然而,将这一范式应用于Transformer模型的工作还很少。特别是,理解Transformer对形式语言的处理方式以及识别其在这一领域的局限性仍未得到探索。在本文中,我们提出了一种专门为Transformer模型设计的自动机提取算法。我们将Transformer模型视为一个黑箱系统,在模型运行过程中跟踪其内部潜在表示的变换过程,然后使用经典的教导式方法(如L*算法)将其解释为确定性有限状态自动机(DFA)。总体而言,我们的研究揭示了Transformer模型如何理解形式语言的结构,这不仅增强了基于Transformer的机器学习系统的可解释性,也标志着朝着更深入理解机器学习系统如何处理形式语言迈出了关键一步。代码和数据可在https://github.com/Zhang-Yihao/Transfomer2DFA获取。

英文摘要:

In modern machine (ML) learning systems, Transformer-based architectures have achieved milestone success across a broad spectrum of tasks, yet understanding their operational mechanisms remains an open problem. To improve the transparency of ML systems, automata extraction methods, which interpret stateful ML models as automata typically through formal languages, have proven effective for explaining the mechanism of recurrent neural networks (RNNs). However, few works have been applied to this paradigm to Transformer models. In particular, understanding their processing of formal languages and identifying their limitations in this area remains unexplored. In this paper, we propose an automata extraction algorithm specifically designed for Transformer models. Treating the Transformer model as a black-box system, we track the model through the transformation process of their internal latent representations during their operations, and then use classical pedagogical approaches like L* algorithm to interpret them as deterministic finite-state automata (DFA). Overall, our study reveals how the Transformer model comprehends the structure of formal languages, which not only enhances the interpretability of the Transformer-based ML systems but also marks a crucial step toward a deeper understanding of how ML systems process formal languages. Code and data are available at https://github.com/Zhang-Yihao/Transfomer2DFA.

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

↑