Fast and Focused: Interactive Repository-Level Fill-in-the-Middle Code Completion with Hybrid Structural Retrieval

Long S. T. Nguyen, Dat Huynh, Quynh Vo, LE Dang Nguyen Hai, Cong-Duy T Nguyen, Anh Tuan Luu, Anh Nguyen-Duc, Tho Quan


Abstract
Large language models are effective at code completion when the required evidence is local, but repository-level fill-in-the-middle completion remains challenging when it depends on code and structural relationships across files. We present ACAR, a framework that combines lexical and AST/LSP-based structural retrieval through line-level reciprocal rank fusion, then applies syntax-aware post-processing to align generated completions with the surrounding code. We evaluate ACAR on RepoEval, ReccEval, and CrossCodeEval across Python, Java, TypeScript, and C#, covering more than 3,000 real-world repositories. In the main Qwen2.5-Coder experiments, ACAR outperforms strong retrieval baselines in most settings, reaching 42.98 EM on ReccEval and 32.86 on CrossCodeEval at 3B, versus 36.25 and 28.40 for the strongest retrieval baseline, respectively. With the largest tested Qwen and DeepSeek backbones, ACAR improves EM over their corresponding no-retrieval baselines across all five evaluation settings. Ablations show that lexical and structural evidence are complementary, while removing syntax-aware refinement causes the largest drop in edit similarity. These gains come with 87–95 ms of non-decoding overhead under warm-cache conditions across the three benchmarks, supporting latency-sensitive code completion. To support reproducibility, we make our implementation and evaluation scripts publicly available at https://github.com/longstnguyen/ACAR.
Anthology ID:
2026.emnlp-main.81
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
1856–1874
Language:
URL:
https://aclanthology.org/2026.emnlp-main.81/
DOI:
Bibkey:
Cite (ACL):
Long S. T. Nguyen, Dat Huynh, Quynh Vo, LE Dang Nguyen Hai, Cong-Duy T Nguyen, Anh Tuan Luu, Anh Nguyen-Duc, and Tho Quan. 2026. Fast and Focused: Interactive Repository-Level Fill-in-the-Middle Code Completion with Hybrid Structural Retrieval. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, pages 1856–1874, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Fast and Focused: Interactive Repository-Level Fill-in-the-Middle Code Completion with Hybrid Structural Retrieval (Nguyen et al., EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-main.81.pdf