Details

Retrieval-augmented code completion for local projects using large language models
ID Hostnik, Marko (Author), ID Robnik Šikonja, Marko (Author)

.pdfPDF - Presentation file, Download (2,82 MB)
MD5: B2EEDC5CC010223F3B81D36A1CFE2040
URLURL - Source URL, Visit https://www.sciencedirect.com/science/article/pii/S0957417425022158 This link opens in a new window

Abstract
The use of large language models (LLMs) is becoming increasingly widespread among software developers. However, privacy and computational requirements are problematic with commercial solutions and the use of LLMs. In this work, we focus on using relatively small and efficient LLMs with 160M parameters that are suitable for local execution and augmentation with retrieval from local projects. We train two open transformer-based models, the generative GPT-2 and the retrieval-adapted RETRO, on open-source Python files, and empirically compare them, confirming the benefits of embedding-based retrieval. Furthermore, we improve our models’ performance with In-context retrieval-augmented generation (RAG), which retrieves code snippets using the Jaccard similarity of tokens. We evaluate In-context RAG on larger models and determine that, despite its simplicity, the approach is more suitable than using the RETRO architecture. Experimental results indicate that In-context RAG improves the code completion baseline by over 26 %, while RETRO improves over the similarly sized GPT-2 baseline by 12 %. We highlight the key role of proper tokenization in achieving the full potential of LLMs in code completion.

Language:English
Keywords:large language models, code completion, retrieval-augmented generation, in-context retrieval
Work type:Article
Typology:1.01 - Original Scientific Article
Organization:FRI - Faculty of Computer and Information Science
FMF - Faculty of Mathematics and Physics
Publication status:Published
Publication version:Version of Record
Year:2025
Number of pages:15 str.
Numbering:Vol. 292, art. 128596
PID:20.500.12556/RUL-174280 This link opens in a new window
UDC:004.85:81'322
ISSN on article:0957-4174
DOI:10.1016/j.eswa.2025.128596 This link opens in a new window
COBISS.SI-ID:242180867 This link opens in a new window
Publication date in RUL:30.09.2025
Views:324
Downloads:96
Metadata:XML DC-XML DC-RDF
:
Copy citation
Share:Bookmark and Share

Record is a part of a journal

Title:Expert systems with applications
Shortened title:Expert syst. appl.
Publisher:Elsevier
ISSN:0957-4174
COBISS.SI-ID:171291 This link opens in a new window

Licences

License:CC BY 4.0, Creative Commons Attribution 4.0 International
Link:http://creativecommons.org/licenses/by/4.0/
Description:This is the standard Creative Commons license that gives others maximum freedom to do what they want with the work as long as they credit the author.

Secondary language

Language:Slovenian
Keywords:obdelava naravnega jezika, veliki jezikovni modeli, programsko inženirstvo, generiranje kode

Projects

Funder:ARIS - Slovenian Research and Innovation Agency
Project number:P6-0411
Name:Jezikovni viri in tehnologije za slovenski jezik

Funder:ARIS - Slovenian Research and Innovation Agency
Project number:GC-0002
Name:Veliki jezikovni modeli za digitalno humanistiko

Funder:EC - European Commission
Funding programme:HE
Project number:101186647
Name:Centre of Excellence in Artificial Intelligence for Digital Humanities
Acronym:AI4DH

Funder:EC - European Commission
Project number:C3.K8.IB
Name:Project PoVeJMo

Similar documents

Similar works from RUL:
Similar works from other Slovenian collections:

Back