RAMBO: Enhancing RAG-based Repository-Level Method Body Completion

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Bui, Tuan-Dung, Luu-Van, Duc-Thieu, Nguyen, Thanh-Phat, Nguyen, Thu-Trang, Nguyen, Son, Vo, Hieu Dinh
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909717127757824
author Bui, Tuan-Dung
Luu-Van, Duc-Thieu
Nguyen, Thanh-Phat
Nguyen, Thu-Trang
Nguyen, Son
Vo, Hieu Dinh
author_facet Bui, Tuan-Dung
Luu-Van, Duc-Thieu
Nguyen, Thanh-Phat
Nguyen, Thu-Trang
Nguyen, Son
Vo, Hieu Dinh
contents Code completion is essential in software development, helping developers by predicting code snippets based on context. Among completion tasks, Method Body Completion (MBC) is particularly challenging as it involves generating complete method bodies based on their signatures and context. This task becomes significantly harder in large repositories, where method bodies must integrate repositoryspecific elements such as custom APIs, inter-module dependencies, and project-specific conventions. In this paper, we introduce RAMBO, a novel RAG-based approach for repository-level MBC. Instead of retrieving similar method bodies, RAMBO identifies essential repository-specific elements, such as classes, methods, and variables/fields, and their relevant usages. By incorporating these elements and their relevant usages into the code generation process, RAMBO ensures more accurate and contextually relevant method bodies. Our experimental results with leading code LLMs across 40 Java projects show that RAMBO significantly outperformed the state-of-the-art repository-level MBC approaches, with the improvements of up to 46% in BLEU, 57% in CodeBLEU, 36% in Compilation Rate, and up to 3X in Exact Match. Notably, RAMBO surpassed RepoCoder Oracle method by up to 12% in Exact Match, setting a new benchmark for repository-level MBC.
format Preprint
id arxiv_https___arxiv_org_abs_2409_15204
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle RAMBO: Enhancing RAG-based Repository-Level Method Body Completion
Bui, Tuan-Dung
Luu-Van, Duc-Thieu
Nguyen, Thanh-Phat
Nguyen, Thu-Trang
Nguyen, Son
Vo, Hieu Dinh
Software Engineering
Machine Learning
Code completion is essential in software development, helping developers by predicting code snippets based on context. Among completion tasks, Method Body Completion (MBC) is particularly challenging as it involves generating complete method bodies based on their signatures and context. This task becomes significantly harder in large repositories, where method bodies must integrate repositoryspecific elements such as custom APIs, inter-module dependencies, and project-specific conventions. In this paper, we introduce RAMBO, a novel RAG-based approach for repository-level MBC. Instead of retrieving similar method bodies, RAMBO identifies essential repository-specific elements, such as classes, methods, and variables/fields, and their relevant usages. By incorporating these elements and their relevant usages into the code generation process, RAMBO ensures more accurate and contextually relevant method bodies. Our experimental results with leading code LLMs across 40 Java projects show that RAMBO significantly outperformed the state-of-the-art repository-level MBC approaches, with the improvements of up to 46% in BLEU, 57% in CodeBLEU, 36% in Compilation Rate, and up to 3X in Exact Match. Notably, RAMBO surpassed RepoCoder Oracle method by up to 12% in Exact Match, setting a new benchmark for repository-level MBC.
title RAMBO: Enhancing RAG-based Repository-Level Method Body Completion
topic Software Engineering
Machine Learning
url https://arxiv.org/abs/2409.15204