arXiv:2511.17645cs.LGcs.AI2025-11

给Transformer模型的每一层生成可验证的简化版,并保证误差在可控范围内。

BlockCert: Certified Blockwise Extraction of Transformer Mechanisms

  • 分块提取Transformer各层结构,用数学证明保证误差上限。
  • 在GPT-2等模型上实现高覆盖率与极小残差(<6e-5)。
  • 适合需要可解释性与行为安全验证的研究者。

机制可解释性旨在将神经网络逆向还原为明确算法,而模型编辑则希望在不重新训练的情况下修改特定行为。两者通常依赖非正式证据和临时实验,缺乏对提取或编辑后模型偏离原始行为程度的显式保证。我们提出BlockCert框架,实现Transformer机制的分块可验证提取,并通过轻量扩展支持局部编辑的认证。给定预训练Transformer和提示分布,BlockCert可提取各残差块的结构化代理实现,同时生成机器可验证的证书,用于限制近似误差、记录覆盖度指标并哈希底层产物。我们在Lean 4中形式化一个基于Lipschitz的组合定理,将局部保证推广至全局偏差界。实证上,我们应用于GPT-2 small、TinyLlama-1.1B-Chat和Llama-3.2-3B,在评估提示下获得高每块覆盖率与小残差;在TinyLlama设置中,完整拼接模型在压力提示下的基线困惑度差异约为6e-5。结果表明,带显式证书的分块提取在真实Transformer语言模型中可行,为机制可解释性与模型行为的严格推理提供实用桥梁。

原文摘要 · Abstract (English)

Mechanistic interpretability aspires to reverse-engineer neural networks into explicit algorithms, while model editing seeks to modify specific behaviours without retraining. Both areas are typically evaluated with informal evidence and ad-hoc experiments, with few explicit guarantees about how far an extracted or edited model can drift from the original on relevant inputs. We introduce BlockCert, a framework for certified blockwise extraction of transformer mechanisms, and outline how a lightweight extension can support certified local edits. Given a pre-trained transformer and a prompt distribution, BlockCert extracts structured surrogate implementations for residual blocks together with machine-checkable certificates that bound approximation error, record coverage metrics, and hash the underlying artifacts. We formalize a simple Lipschitz-based composition theorem in Lean 4 that lifts these local guarantees to a global deviation bound. Empirically, we apply the framework to GPT-2 small, TinyLlama-1.1B-Chat, and Llama-3.2-3B. Across these models we obtain high per-block coverage and small residual errors on the evaluated prompts, and in the TinyLlama setting we show that a fully stitched model matches the baseline perplexity within approximately 6e-5 on stress prompts. Our results suggest that blockwise extraction with explicit certificates is feasible for real transformer language models and offers a practical bridge between mechanistic interpretability and formal reasoning about model behaviour.

机制可解释形式化验证Transformer

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。