Skip to main navigation Skip to search Skip to main content

LPFGen: Smart Contract Generation with Prompt-Guided and Fine-Tuned LLMs

  • Lixue Liu
  • , Wei Ke
  • , Haiyang Chi
  • Macao Polytechnic University

Research output: Chapter in Book/Report/Conference proceeding › Conference contribution › peer-review

Abstract

Smart contracts enable autonomous blockchain applications but remain difficult to implement securely and efficiently. We present LPFGen, a prompt–plus–fine-tuning framework for automated contract synthesis with large language models (LLMs). Our approach leverages Qwen3-8B with LoRA adapters, trained on a mixed corpus of 141,000 contract–prompt pairs and 6,003 masked-function repair samples, providing a reproducible and efficient PEFT recipe. Evaluation across 100 user-style specifications combines usability screening, compilation success, and static analysis, along with held-out repair and detection tasks. Results show that LPFGen raises the proportion of usable generations from 58.3% to 78.2%, while also improving detection and repair performance (F1 from 0.376 to 0.613; Accuracy from 0.696 to 0.787). These consistent gains indicate clear improvements in generation quality and reliability over untuned baselines. By integrating prompt design with targeted fine-tuning, LPFGen demonstrates that principled adaptation of LLMs can yield secure, verifiable, and practically deployable smart contracts. All code and experiment scripts are released to support reproducibility and further research.

Original languageEnglish
Title of host publicationBlockchain Technology and Applications - Proceedings of 2025 8th International Conference on Blockchain Technology and Applications
EditorsRuidong Li
PublisherSpringer Science and Business Media Deutschland GmbH
Pages409-418
Number of pages10
ISBN (Print)9783032220875
DOIs
Publication statusPublished - 2026
Event8th International Conference on Blockchain Technology and Applications, ICBTA 2025 - Kanazawa, Japan
Duration: 12 Dec 2025 → 14 Dec 2025

Publication series

NameLecture Notes in Networks and Systems
Volume1920 LNNS
ISSN (Print)2367-3370
ISSN (Electronic)2367-3389

Conference

Conference8th International Conference on Blockchain Technology and Applications, ICBTA 2025
Country/TerritoryJapan
CityKanazawa
Period12/12/25 → 14/12/25

Keywords

  • Fine-tuned
  • Generation
  • Large language model
  • Smart contract
  • Test cases

Fingerprint

Dive into the research topics of 'LPFGen: Smart Contract Generation with Prompt-Guided and Fine-Tuned LLMs'. Together they form a unique fingerprint.

Cite this