Automatic Smart Contract Comment Generation via Large Language Models and In-Context Learning
Not on the map. Why?
Abstract (arXiv)
The previous smart contract code comment (SCC) generation approaches can be divided into two categories: fine-tuning paradigm-based approaches and information retrieval-based approaches. However, for the fine-tuning paradigm-based approaches, the performance may be limited by the quality of the gathered dataset for the downstream task and they may have knowledge-forgetting issues. While for the information retrieval-based approaches, it is difficult for them to generate high-quality comments if similar code does not exist in the historical repository. Therefore we want to utilize the domain knowledge related to SCC generation in large language models (LLMs) to alleviate the disadvantages of these two types of approaches. In this study, we propose an approach SCCLLM based on LLMs and in-context learning. Specifically, in the demonstration selection phase, SCCLLM retrieves the top-k code snippets from the historical corpus by considering syntax, semantics, and lexical information. In the in-context learning phase, SCCLLM utilizes the retrieved code snippets as demonstrations, which can help to utilize the related knowledge for this task. We select a large corpus from a smart contract community Etherscan.io as our experimental subject. Extensive experimental results show the effectiveness of SCCLLM when compared with baselines in automatic evaluation and human evaluation.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). First posted on arXiv 17 Nov 2023.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2024: 3; 2025: 3.
6 papers.
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 354
- 2024Efficacy of Various Large Language Models in Generating Smart Contractscited by 4
- 2024Blockchain Meets LLMs: A Living Survey on Bidirectional Integrationcited by 2
- 2025Towards Automated Smart Contract Generation: Evaluation, Benchmarking, and Retrieval-Augmented Repaircited by 0
- 2025Simple and Effective Baselines for Code Summarisation Evaluationcited by 0
- 2025evalSmarT: An LLM-Based Framework for Evaluating Smart Contract Generated Commentscited by 0
- 2025evalSmarT: An LLM-Based Framework for Evaluating Smart Contract Generated Comments28 Jul 2025
- 2025Simple and Effective Baselines for Code Summarisation Evaluation26 May 2025
- 2025Towards Automated Smart Contract Generation: Evaluation, Benchmarking, and Retrieval-Augmented Repair3 Mar 2025
- 2024Blockchain Meets LLMs: A Living Survey on Bidirectional Integration25 Nov 2024
- 2024Efficacy of Various Large Language Models in Generating Smart Contracts28 Jun 2024
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Survey29 Feb 2024