Dual Multi-RAG: Multi-View Contrastive Learning for Code Completion

Recent advances in pre-trained Large Language Models (LLMs) have greatly improved automated code completion, but challenges such as logical errors, semantic misunderstandings, and hallucinated outputs persist, especially for complex or unseen code. Retrieval-Augmented Generation (RAG) alleviates these issues by retrieving external snippets as supplementary context, yet its single-view encoder often fails to capture the full range of code semantics. We propose Dual Multi-RAG, a novel framework that combines prompt-driven multi-retrieval with multi-view contrastive learning. In the retrieval stage, carefully designed prompts guide LLMs to elicit diverse semantic perspectives. In the selection stage, a contrastive learning mechanism identifies the most contextually relevant snippet for completion. This dual design enriches semantic coverage and improves reliability. Experiments demonstrate that Dual Multi-RAG consistently outperforms existing approaches, achieving 3.91% higher accuracy on the CCEval benchmark and 2.8% improvement on HumanEval-Infilling, confirming its effectiveness for robust and accurate code completion.

Authors

Institutions

Publication Details

Journal
International Journal of Software Engineering and Knowledge Engineering
Published
2026-04-22
DOI
https://doi.org/10.1142/s0218194026500348
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Dual Multi-RAG: Multi-View Contrastive Learning for Code Completion

Shaoying Liu, Yuxiang Shang
International Journal of Software Engineering and Knowledge Engineering
Software Engineering Research
article

Dual Multi-RAG: Multi-View Contrastive Learning for Code Completion

Shaoying Liu, Yuxiang Shang
article en

Abstract

Recent advances in pre-trained Large Language Models (LLMs) have greatly improved automated code completion, but challenges such as logical errors, semantic misunderstandings, and hallucinated outputs persist, especially for complex or unseen code. Retrieval-Augmented Generation (RAG) alleviates these issues by retrieving external snippets as supplementary context, yet its single-view encoder often fails to capture the full range of code semantics. We propose Dual Multi-RAG, a novel framework that combines prompt-driven multi-retrieval with multi-view contrastive learning. In the retrieval stage, carefully designed prompts guide LLMs to elicit diverse semantic perspectives. In the selection stage, a contrastive learning mechanism identifies the most contextually relevant snippet for completion. This dual design enriches semantic coverage and improves reliability. Experiments demonstrate that Dual Multi-RAG consistently outperforms existing approaches, achieving 3.91% higher accuracy on the CCEval benchmark and 2.8% improvement on HumanEval-Infilling, confirming its effectiveness for robust and accurate code completion.

International Journal of Software Engineering and Knowledge Engineering
Twitter (United States) (US)
Quality Education
Openalex Percentile: Top 4%
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Dual Multi-RAG: Multi-View Contrastive Learning for Code Completion — Shaoying Liu, Yuxiang Shang · International Journal of Software Engineering and Knowledge Engineering (2026) | TGRS Research Map | TGRS