Domain Adaptive Code Completion via Language Models and Decoupled Domain Databases
The DOI matches its Crossref record; 26 of the 26 references it cites were found in a registry or an index.
Abstract
Large Language Models (LLMs) have demonstrated remarkable performance in code completion. However, due to the lack of domain-specific knowledge, they may not be optimal in completing code that requires intensive domain knowledge for example completing the library names. Although there are several works that have confirmed the effectiveness of fine-tuning techniques to adapt language models for code completion in specific domains. They are limited by the need for constant fine-tuning of the model when the project is in constant iteration. To address this limitation, in this paper, we propose$k$NM-LM, a retrieval-augmented language model (R-LM), that integrates domain knowledge into language models without fine-tuning. Different from previous techniques, our approach is able to automatically adapt to different language models and domains. Specifically, it utilizes the in-domain code to build the retrieval-based database decoupled from LM, and then combines it with LM through Bayesian inference to complete the code. The extensive experiments on the completion of intra-project and intra-scenario have confirmed that$k$NM-LM brings about appreciable enhancements when compared to CodeGPT and UnixCoder. A deep analysis of our tool including the responding speed, storage usage, specific type code completion, and API invocation completion has confirmed that$k$NM-LM provides satisfactory performance, which renders it highly appropriate for domain adaptive code completion. Furthermore, our approach operates without the requirement for direct access to the language model's parameters. As a result, it can seamlessly integrate with black-box code completion models, making it easy to integrate our approach as a plugin to further enhance the performance of these models.
Overview
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Integrity signals
Registry
Cites
Statistics
Verification
Claims the paper makes
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Claims other papers make about this one
Each is checked against this paper’s own text: does it say what the citing paper says it does?
In the citing paper
“kNM-LM [246] performs logit-based RAG, combining the logits of retrieval and generation using bayes inference.”
From Retrieval-Augmented Generation for AI-Generated Content: A Survey (2024) · cites this paper as [246]
Self-check
Percentages, sums and reported differences re-computed from the paper’s own numbers.
The self-check needs the paper’s full text.
Citations
Cites
Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., & Liu, P. J. (2019) · arXiv · doi:10.48550/arxiv.1910.10683 · Cited by 10,929
Billion-scale similarity search with GPUs
Johnson, J., Douze, M., & Jegou, H. (2021) · IEEE Transactions on Big Data · doi:10.1109/tbdata.2019.2921572 · Cited by 4,228
Billion-scale similarity search with GPUs
Johnson, J., Douze, M., & Jégou, H. (2017) · arXiv · doi:10.48550/arxiv.1702.08734 · Cited by 4,140 · cited 1×
“Faiss-gpu [23] is used for accelerated k nearest neighbors search, same as Khandelwal et al.”
MethodThe probabilistic relevance framework: BM25 and beyond
Robertson, S., & Zaragoza, H. (2009) · Foundations and Trends® in Information Retrieval · doi:10.1561/1500000019 · Cited by 3,374
Generalizing from a Few Examples: A Survey on Few-shot Learning
Wang, Y., Yao, Q., Kwok, J. T., & Ni, L. M. (2021) · ACM Computing Surveys · doi:10.1145/3386252 · Cited by 3,165 · cited 1×
“Block R-LMs [12], [13], [48] are similar to one-shot or few-shot learning [49], where one or a few examples are retrieved from a database instead of being randomly selected.”
BackgroundImproved Semantic Representations From Tree-Structured Long Short-Term Memory Networks
Tai, K. S., Socher, R., & Manning, C. D. (2015) · Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers) · doi:10.3115/v1/p15-1150 · Cited by 3,081
Don’t Stop Pretraining: Adapt Language Models to Domains and Tasks
Gururangan, S., Marasović, A., Swayamdipta, S., Lo, K., Beltagy, I., Downey, D., & Smith, N. A. (2020) · Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics · doi:10.18653/v1/2020.acl-main.740 · Cited by 2,103
Evaluating Large Language Models Trained on Code
Chen, M., Tworek, J., Jun, H., Yuan, Q., Pinto, H. P. D. O., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., et al. (2021) · arXiv · doi:10.48550/arxiv.2107.03374 · Cited by 1,436
UniXcoder: Unified Cross-Modal Pre-training for Code Representation
Guo, D., Lu, S., Duan, N., Wang, Y., Zhou, M., & Yin, J. (2022) · Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · doi:10.18653/v1/2022.acl-long.499 · Cited by 673
Unified Pre-training for Program Understanding and Generation
Ahmad, W., Chakraborty, S., Ray, B., & Chang, K.-W. (2021) · Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies · doi:10.18653/v1/2021.naacl-main.211 · Cited by 642
Research works printed but not linked: 33
- 10.18653/v1/2022.acl-long.431 · doi:10.18653/v1/2022.acl-long.431 · Paper page
- 10.1145/3551349.3556943 · DOI
- guu, 2020, Retrieval augmented language model pre-training, International Conference on Machine Learning, 3929
- 10.1109/ICSE48619.2023.00028 · DOI
- zhou, 2019, Devign: Effective vulnerability identification by learning comprehensive program semantics via graph neural networks, Advances in neural information processing systems, 32
- 10.24963/ijcai.2022/329 · DOI · Paper page
- 10.1145/3196321.3196334 · DOI · Paper page
- 0, Openai's text embedding api
- 10.1007/3-540-45014-9_1 · DOI · Paper page
- joyce, 2003, Bayes' theorem, Stanford Encyclopedia of Philosophy
- 0, Openai's completion api
- huang, 2023, k nn-adapter: Efficient domain adaptation for black-box language models, ArXiv Preprint
- meng, 0, Gnn-lm: Language modeling based on global contexts via gnn, ICLR 2022 Workshop on Deep Learning on Graphs for Natural Language Processing
- 10.1109/ICSE48619.2023.00178 · DOI · Paper page
- 10.1145/3510003.3510141 · DOI · Paper page
- wang, 2022, A tree-structured transformer for program representation learning, ArXiv Preprint
- liu, 0, Retrieval-augmented generation for code summarization via hybrid gnn, International Conference on Learning Representations
- xu, 2022, Capturing structural locality in non-parametric language models, The Tenth International Conferenceon Learning Representations ICLR 2022 Virtual Event April 25-29 2022
- 0, ChatGPT plugin in VSCode
- bogomolov, 2022, Assessing project-level fine-tuning of ML4SE models, CoRR, abs 2206 3333
- 10.1145/3510003.3510096 · DOI · Paper page
- 0, GitHub Copilot website
- 10.1007/978-3-642-03013-0_15 · DOI · Paper page
- 10.24963/ijcai.2018/578 · DOI · Paper page
- guo, 0, Learning to complete code with sketches, International Conference on Learning Representations
- allamanis, 0, Learning to represent programs with graphs, International Conference on Learning Representations
- 10.1186/1471-2105-15-293 · DOI · Paper page
- peng, 2022, Revisiting, benchmarking and exploring api recommendation: How far are we?, IEEE Transactions on Software Engineering
- 10.1109/ICSE43902.2021.00145 · DOI
- wang, 2023, Practitioners' expectations on code completion, ArXiv Preprint
- 10.18653/v1/D18-1111 · DOI · Paper page
- alon, 0, code2seq: Generating sequences from structured representations of code, International Conference on Learning Representations
- 10.1109/MSR52588.2021.00014 · DOI
Cited by
Retrieval-Augmented Generation for AI-Generated Content: A Survey
Zhao, P., Zhang, H., Yu, Q., Wang, Z., Geng, Y., Fu, F., Yang, L., Zhang, W., Jiang, J., & Cui, B. (2024) · arXiv · doi:10.48550/arxiv.2402.19473 · Cited by 240
“It filters out lower-quality data to maintain a high standard of information mapping, offering a variety of retrieval system options like TF-IDF, DPR, RAG, and BLINK + flair to support evidence-based predictions or citations according to task requirements.”
Large language models for code completion: A systematic literature review
Husein, R. A., Aburajouh, H., & Catal, C. (2025) · Computer Standards & Interfaces · doi:10.1016/j.csi.2024.103917 · Cited by 72
Metadata
- Authors
- Tang, Z., Ge, J., Liu, S., Zhu, T., Xu, T., Huang, L., & Luo, B.
- Affiliations
- Nanjing University,National Key Laboratory for Novel Software Technology,China
- Nanyang Technological University,Singapore
- Huawei Software Engineering Application Technology,China
- Southern Methodist University,Department of Computer Science,USA
- Venue
- 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)
- Publisher
- IEEE
- Published
- 2023-09-11
- Pages
- 421-433
- Cited by
- 36
- References
- 26
- Funders
- National Key Research and Development Program of China (2022YFF0711404)
- Natural Science Foundation of Jiangsu Province (BK20201250)
About these checks
Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.
Statistics and arithmetic are recomputed, not judged.
Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.
What counts as a claim ›How we measure confidence ›How we check this ›
Are you an author, or do you see a problem with this page? Request a review
Data sources
Bibliographic data: Semantic Scholar, OpenAlex, Crossref.
Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).
Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.