验证大型模型实现等价性
Verify Implementation Equivalence of Large Models
AI总结:
本文提出Emerge框架,通过e-graph和执行值推断实现等价性验证,解决手动规则难以维护的问题,并发现已知bug和新问题,同时生成高效的块级规则。
摘要:
验证两个相同大型模型的不同实现是否在不同框架下等价是实际中具有挑战性的。即使它们实现了相同的计算,其运算分解、张量布局和融合或不透明内核的使用可能差异显著,使得手动编写重写规则困难。我们提出了Emerge,一个用于检查大型模型实现计算图等价性的框架。而不是手动编写规则,Emerge将两个实现表示为e-graph,从执行值推断候选关系,并在现有规则不足时按需合成重写规则。每个合成的规则都通过最强适用的方法验证,包括基于SMT的符号可处理情况检查和基于约束的随机测试,然后通过e-graph重建传播以建立更大的等价性。我们的当前实现针对来自HuggingFace Transformers和vLLM的推理计算图。我们的评估显示,Emerge在实际成本下能够建立正确实现对的等价性,同时为调试提供有用的结果:它检测了13个已知实现bug中的10个,并发现了8个之前未知的问题,后来由开发者确认。此外,Emerge合成的块级规则在与手动编写规则比较时表现良好。
英文摘要:
Verifying whether two implementations of the same large model are equivalent across frameworks is difficult in practice. Even when they realize the same computation, their graphs may differ substantially in operator decomposition, tensor layout, and the use of fused or opaque kernels, making manual rewrite rules hard to build and maintain. We present Emerge, a framework for checking Implementation Equivalence over computation graphs of large-model implementations. Instead of writing rules manually, Emerge represents the two implementations in an e-graph, infers candidate relations from execution values, and synthesizes rewrite rules on demand when existing rules are insufficient. Each synthesized rule is validated using the strongest applicable method, including SMT- based checking for symbolically tractable cases and constraint-aware randomized testing for opaque kernels, and then propagated through e-graph rebuilding to establish larger equivalences. Our current implementation targets inference computation graphs captured from HuggingFace Transformers and vLLM. Our evaluation shows that Emerge establishes equivalence for correct implementation pairs at practical cost, while also providing useful by-products for debugging: it detects 10 of 13 known implementation bugs and uncovers 8 previously unknown implementation issues that were later confirmed by developers. In addition, Emerge synthesizes block-level rules that compare favorably with manually authored ones.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。