Automated Generation and Optimization Methods for Smart Contract Vulnerability Code Integrating Large Models and RAG Framework
Abstract
The application of big models to vulnerability generation for smart contracts is hampered by a lack of knowledge within the field, regularly producing difficulties such as logical anomalies, conceptual misunderstandings, and poor concealment within the generation results. In order to overcome the discrepancy between the poor quality of generated results and the important role played by big models within the field, the article proposes a retrieval-enhanced generation optimization strategy that combines a hybrid retrieval strategy and a strategy for a prompt and programmatic validation cycle constrained by pre-defined generation objectives. The results demonstrate that the strategy effectively enhances the authenticity level from 0.342 for the benchmark model CodeLlama (Code Large Language Model Meta AI)-13B to 0.867 and enhances the concealment score from 0.106 to
0.289, which contributes to improving the recognition capability level within the field by improving the quality and concealment level of generation, supplying a useful model for the proper use of big models within a relevant field. This research work presents a systematic optimization strategy for automatically optimizing the generation of data concerning smart contract security tests and adversarial examples. In addition to optimizing generation quality and concealment level, it functions as a relevant model for big models within a relevant field.
Keywords: Smart contract security; vulnerability code generation; large language model; search enhanced generation; automated testing
Cite As
Z. Chen, Z. Peng, Y. Dou, N. He, W. Li, "Automated Generation and Optimization Methods for Smart Contract Vulnerability Code Integrating Large Models and RAG Framework", Engineering Intelligent Systems, vol. 34 no. 3, pp. 305-318, 2026.