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

从翻译到超集:面向生产AI代理的基准驱动演进:从Rust到Python

From Translation to Superset: Benchmark-Driven Evolution of a Production AI Agent from Rust to Python

Jinhua Wang, Biswa Sengupta

AI总结:

本文提出一种基于LLM的持续代码翻译方法,将Rust生产代码库迁移至Python,通过基准驱动迭代优化,实现功能扩展与性能提升。

摘要:

跨语言迁移大型软件系统是持续的工程挑战,尤其当源代码库快速演变时。我们提出了一种LLM辅助的持续代码翻译方法,将生产Rust代码库(648K LOC,65个crate)翻译成Python(41K LOC,28个模块),以公开代理基准作为目标函数驱动迭代优化。我们的系统是Codex CLI,一个生产AI编码代理。我们证明:(1)Python版本解决了80个SWE-bench验证任务中的59个(73.8%),比Rust的56个(70.0%)更高,且在Terminal-Bench上达到42.5%,接近现实代理任务的平等表现;(2)基于基准的调试揭示了API协议不匹配、环境污染、静默WebSocket故障模式和API 400崩溃等问题,比静态测试更有效;(3)架构支持通过LLM辅助的diff-翻译-测试循环实现持续上游同步;(4)Python版本演变成一个功能超集,包含30个功能标志扩展(多代理编排、语义记忆、守护安全、成本跟踪)等功能,而Rust未包含这些功能,同时保持严格平等模式进行比较。我们的评估表明,对于LLM代理而言,当API延迟主导时,Python的表达性可实现15.9倍的代码减少,性能成本可忽略不计,而基于基准的目标函数方法为从平等到扩展平台的演进提供了原则性框架。

英文摘要:

Cross-language migration of large software systems is a persistent engineering challenge, particularly when the source codebase evolves rapidly. We present a methodology for LLM-assisted continuous code translation in which a large language model translates a production Rust codebase (648K LOC, 65 crates) into Python (41K LOC, 28 modules), with public agent benchmarks as the objective function driving iterative refinement. Our subject system is Codex CLI, a production AI coding agent. We demonstrate that: (1) the Python port resolves 59/80 SWE-bench Verified tasks (73.8%) versus Rust's 56/80 (70.0%), and achieves 42.5% on Terminal-Bench versus Rust's 47.5%, confirming near-parity on real-world agentic tasks; (2) benchmark-driven debugging, revealing API protocol mismatches, environment pollution, a silent WebSocket failure mode, and an API 400 crash, is more effective than static testing alone; (3) the architecture supports continuous upstream synchronisation via an LLM-assisted diff-translate-test loop; and (4) the Python port has evolved into a capability superset with 30 feature-flagged extensions (multi-agent orchestration, semantic memory, guardian safety, cost tracking) absent from Rust, while preserving strict parity mode for comparison. Our evaluation shows that for LLM-based agents where API latency dominates, Python's expressiveness yields a 15.9x code reduction with negligible performance cost, while the benchmark-as-objective-function methodology provides a principled framework for growing a cross-language port from parity into an extended platform.

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

↑