Title: Benchmarking gas-saving patterns in AI-generated DeFi smart contract
Authors: Andhika Nugraha Wira Pratama; Arya Wicaksana
Addresses: Department of Informatics, Universitas Multimedia Nusantara, Tangerang, 15810, Banten, Indonesia ' Department of Informatics, Universitas Multimedia Nusantara, Tangerang, 15810, Banten, Indonesia
Abstract: Integrating artificial intelligence (AI) like the large language model (LLM) for smart contract auto-generation standardises performance and security, reduces human error, and offers accessibility for non-developers. In decentralised autonomous systems (DASs) like decentralised finance (DeFi), the ability to AI-generate smart contracts strengthens the decentralisation and automation characteristics of the applications. In order to increase the effectiveness of a smart contract's fully decentralised and autonomous development, this study benchmarks gas-saving patterns in AI-generated DeFi smart contracts. Three DeFI smart contract development scenarios: token generation (ERC-20), tokenised vault (ERC-4626), and flash loan (ERC-3156), and the state-of-the-art LLMs (Code Llama and Code Llama - Python) are explored to study the gas-saving patterns of AI-generated smart contracts. These results help optimise DeFi smart contracts created by AI regarding gas fees for the same operations.
Keywords: Blockchain; Code Llama; DeFi; decentralised finance; LLM; large language model.
DOI: 10.1504/IJASM.2026.154515
International Journal of Agile Systems and Management, 2026 Vol.19 No.5, pp.1 - 26
Accepted: 02 Nov 2025
Published online: 02 Jul 2026 *


