Answers are grounded in this paper and cite their sources.
Dual Multi-RAG improves code completion accuracy, enhancing semantic understanding in complex scenarios.
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.
No takes yet. Share an insight, caveat, or question.
Shang et al. (2026) studied this question.
Synapse has enriched 10 related papers. Consider them for comparative context: