arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2608.05521cs.SE

从痕迹中推理:分歧引导的智能体修复WebAssembly差异

Reasoning from Traces: Divergence-Guided Agentic Repair of WebAssembly Discrepancies

Liyan Huang, Kaicheng Wang, Weihang Wang

AI总结:

本文提出WasmMend系统,通过差分痕迹分析定位Wasm与原生执行的分歧函数,引导LLM智能体生成补丁,在真实C/C++项目上修复率达70.0%,优于基线方法。

AI中文摘要:

WebAssembly(Wasm)承诺将C/C++代码库无缝复用为可移植、快速、沙箱化的二进制文件,但实际中这一承诺常未达成:近期研究显示,将同一C/C++源代码交叉编译为Wasm和原生二进制文件时,常因库实现差异或编译器缺陷导致运行时分歧。由于根本原因位于平台级运行时且隐藏在源代码之下,即便是最先进的基于大语言模型(LLM)的修复智能体也常无法修复这些分歧。本文提出WasmMend,首个自动修复原生-Wasm功能差异的系统。WasmMend分两个阶段将无向探索转化为聚焦的推理任务:首先,一种新型差分痕迹分析方法定位Wasm与原生执行最初出现分歧的函数;在该定位引导下,LLM智能体随后推理根本原因并生成消除分歧行为的补丁。在真实C/C++项目上的实验显示,WasmMend的修复率达70.0%,而智能体基线方法的修复率为50.2%,采用修复时LLM插装的方法修复率为54.5%,证明了分歧引导推理对跨平台修复的价值。

英文摘要:

WebAssembly (Wasm) promises seamless reuse of C/C++ codebases as portable, fast, sandboxed binaries. In practice, however, this promise often falls short: recent studies show that cross-compiling the same C/C++ source to Wasm and native binaries frequently leads to runtime discrepancies, owing to library implementation differences or compiler bugs. Since the root causes lie in the platform-level runtime and are hidden beneath the source code, even state-of-the-art LLM-based repair agents often fail to fix these discrepancies. In this paper, we present WasmMend, the first system to automatically repair Native-Wasm functional discrepancies. WasmMend converts the undirected exploration to a focused reasoning task in two stages: First, a novel differential trace analysis approach localizes the function where Wasm and native executions initially diverge; guided by this localization, LLM agents then reason about the root causes and generate patches that eliminate the divergent behavior. Experiments on real-world C/C++ projects show that WasmMend achieves a fix rate of 70.0%, compared to 50.2% for the agentic baseline and 54.5\% for the approach augmented with repair-time LLM-based instrumentation, demonstrating the value of divergence-guided reasoning for cross-platform repair.

↑