[Paper Review] SolAgent: A Specialized Multi-Agent Framework for Solidity Code Generation
SolAgent is a tool-augmented multi-agent framework that uses Forge for correctness and Slither for security in an inner/outer loop to generate secure, correct Solidity code, outperforming baselines on the SolEval+ Benchmark.
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.
Motivation & Objective
- Motivate the need for reliable, secure Solidity code generation given high-stakes smart contracts.
- Introduce a specialized dual-loop refinement framework that integrates domain tools into the generation workflow.
- Demonstrate through rigorous benchmarks that SolAgent outperforms general LLMs and existing agent frameworks in correctness and security.
Proposed method
- Proposes a two-agent system (Coding Agent and Refining Agent) that iteratively refines Solidity code.
- Integrates Forge for correctness and gas efficiency feedback.
- Integrates Slither for static security analysis feedback.
- Equips agents with file system tools to understand project structure and dependencies.
- Implements a dynamic stopping mechanism to terminate refinement when convergence, stagnation, or looping is detected.
- Performs workflow distillation by collecting high-quality agent trajectories to train a smaller model (Qwen3-8B).

Experimental results
Research questions
- RQ1Can SolAgent outperform state-of-the-art LLMs and agent frameworks in functional correctness, gas efficiency, and security for Solidity code generation?
- RQ2What is the contribution of Forge, Slither, and file system tools to SolAgent’s performance?
- RQ3Can the agent trajectories be distilled into a smaller open-source model without losing quality?
Key findings
- SolAgent achieves a Pass@1 of up to 64.39% on the SolEval+ Benchmark, outperforming vanilla LLMs (~25%) and other agents.
- It attains high compilation rates (over 90%) across baselines, indicating strong executability.
- Security vulnerabilities are reduced by up to 39.77% compared to human-written baselines, due to Slither-guided refinements.
- The high-quality interaction trajectories can be used to distill smaller models (e.g., Qwen3-8B) for efficient one-shot generation.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.