Leveraging Mixture-of-Experts Framework for Smart Contract Vulnerability Repair with Large Language Model
Abstract
Smart contracts are a core component of blockchain ecosystems, but their transparency and immutability make them vulnerable to attacks, leading to significant financial losses. Thus, repairing vulnerabilities in smart contracts is crucial for establishing a trustworthy blockchain environment. Existing smart contract vulnerability repair methods suffer from a critical "one-for-all" design limitation, where a single model is tasked with fixing diverse vulnerability types, leading to suboptimal performance due to insufficient specialization. To address this, we propose MoEFix, a novel framework leveraging a Mixture-of-Experts (MoE) architecture tailored for smart contract characteristics. MoEFix partitions vulnerabilities into subspaces, trains specialized experts for each type (e.g., reentrancy, integer overflow), and employs a vulnerability-aware router to dynamically allocate repairs. We further redesign the repair workflow to align with large language models, enabling end-to-end secure contract generation instead of partial patches, and to achieve this, we curated a dataset of 1,391 contracts covering five critical vulnerability types.To validate our approach, we extend the benchmark PVD test suite. Experiments demonstrate that MoEFix outperforms state-of-the-art methods by 21.64% in overall accuracy, achieving improvements of 26.19% (reentrancy) and 23.08% (delegatecall) for specific vulnerabilities.
BibTeX
@inproceedings{Yuan-al:ASE25,
author = {Hang Yuan and
Xizhi Hou and
Lei Yu and
Li Yang and
Jiayue Tang and
Jiadong Xu and
Yifei Liu and
Fengjun Zhang and
Chun Zuo},
title = {Leveraging {Mixture-of-Experts} Framework for Smart Contract Vulnerability Repair with Large Language Model},
booktitle = {ASE},
pages = {1667--1679},
publisher = {{IEEE}},
year = {2025},
}