Skip to main content
QUICK REVIEW

[论文解读] SolAgent: A Specialized Multi-Agent Framework for Solidity Code Generation

Wei Chen, Zhiyuan Peng|arXiv (Cornell University)|Jan 30, 2026
Blockchain Technology Applications and Security被引用 0
一句话总结

SolAgent 是一个结合工具的多代理框架,利用 Forge 保证正确性、Slither 提升安全性,在内外循环中生成安全、正确的 Solidity 代码,在 SolEval+ 基准测试中超越基线。

ABSTRACT

Smart contracts are the backbone of the decentralized web, yet ensuring their functional correctness and security remains a critical challenge. While Large Language Models (LLMs) have shown promise in code generation, they often struggle with the rigorous requirements of smart contracts, frequently producing code that is buggy or vulnerable. To address this, we propose SolAgent, a novel tool-augmented multi-agent framework that mimics the workflow of human experts. SolAgent integrates a extbf{dual-loop refinement mechanism}: an inner loop using the extit{Forge} compiler to ensure functional correctness, and an outer loop leveraging the extit{Slither} static analyzer to eliminate security vulnerabilities. Additionally, the agent is equipped with file system capabilities to resolve complex project dependencies. Experiments on the SolEval+ Benchmark, a rigorous suite derived from high-quality real-world projects, demonstrate that SolAgent achieves a Pass@1 rate of up to extbf{64.39\%}, significantly outperforming state-of-the-art LLMs ($\sim$25\%), AI IDEs (e.g., GitHub Copilot), and existing agent frameworks. Moreover, it reduces security vulnerabilities by up to extbf{39.77\%} compared to human-written baselines. Finally, we demonstrate that the high-quality trajectories generated by SolAgent can be used to distill smaller, open-source models, democratizing access to secure smart contract generation. We release our data and code at https://github.com/openpaperz/SolAgent.

研究动机与目标

  • 在高风险的智能合约背景下,阐明对可靠、可安全生成 Solidity 代码的需求。
  • 引入一个将领域工具集成到生成工作流中的专门双循环 refinement 框架。
  • 通过严格基准测试证明 SolAgent 在正确性和安全性方面优于通用大模型与现有代理框架。

提出的方法

  • 提出一个两代理系统(Coding Agent 与 Refining Agent),通过迭代对 Solidity 代码进行 refinement。
  • 整合 Forge 进行正确性与 gas 效率反馈。
  • 整合 Slither 进行静态安全分析反馈。
  • 为代理提供文件系统工具,以理解项目结构与依赖关系。
  • 实现动态停止机制,在收敛、停滞或循环时终止 refinement。
  • 通过收集高质量的代理轨迹进行工作流蒸馏,以训练一个更小的模型(Qwen3-8B)。
Figure 1 . Overview of SolAgent
Figure 1 . Overview of SolAgent

实验结果

研究问题

  • RQ1SolAgent 是否能够在 Solidity 代码生成的功能正确性、gas 效率和安全性方面优于最先进的大型语言模型和代理框架?
  • RQ2Forge、Slither 与文件系统工具对 SolAgent 性能的贡献是什么?
  • RQ3是否可以在不丢失质量的前提下将代理轨迹蒸馏成一个更小的开源模型?

主要发现

  • SolAgent 在 SolEval+ 基准上达到最高 Pass@1 64.39%,显著优于未改良的 LLM (~25%) 以及其他代理。
  • 在所有基线中都实现了较高的编译通过率(超过 90%),表明具备良好的可执行性。
  • 由于 Slither 引导的 refine,安全漏洞相比人工编写基线降低最多 39.77%。
  • 高质量的交互轨迹可用于蒸馏更小的模型(如 Qwen3-8B),实现高效的一次性生成。
Figure 2 . The SolEval+ Benchmark
Figure 2 . The SolEval+ Benchmark

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。