On the localness of software
The DOI matches its Crossref record; 52 of the 52 references it cites were found in a registry or an index.
Abstract
The n-gram language model, which has its roots in statistical natural language processing, has been shown to successfully capture the repetitive and predictable regularities (“naturalness") of source code, and help with tasks such as code suggestion, porting, and designing assistive coding devices. However, we show in this paper that this natural-language-based model fails to exploit a special property of source code: localness. We find that human-written programs are localized: they have useful local regularities that can be captured and exploited. We introduce a novel cache language model that consists of both an n-gram and an added “cache" component to exploit localness. We show empirically that the additional cache component greatly improves the n-gram approach by capturing the localness of software, as measured by both cross-entropy and suggestion accuracy. Our model’s suggestion accuracy is actually comparable to a state-of-the-art, semantically augmented language model; but it is simpler and easier to implement. Our cache language model requires nothing beyond lexicalization, and thus is applicable to all programming languages.
Overview
Integrity signals
Registry
Cites
Statistics
Verification
Claims the paper makes
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
“Vocabularies of a project are highly local, and functions from the same projects are likely to share same set of identifiers [10,22].”
From Few-shot training LLMs for project-specific code-summarization (2022) · cites this paper as [22]
In the citing paper
“It's been well-known right from the outset that language modeling for code has to deal with project-specific phenomena [10,11,22].”
From Few-shot training LLMs for project-specific code-summarization (2022) · cites this paper as [22]
Citations
Cites
(1992) · doi:10.5555/176313.176316 · Cited by 2,892
A statistical approach to machine translation
Brown, P. F., Cocke, J., Pietra, S. A. D., Pietra, V. J. D., Jelinek, F., Lafferty, J., Mercer, R. L., & Roossin, P. S. (1990) · doi:10.5555/92858.92860 · Cited by 1,655
Estimation of probabilities from sparse data for the language model component of a speech recognizer
Katz, S. (1987) · IEEE Transactions on Acoustics, Speech, and Signal Processing · doi:10.1109/tassp.1987.1165125 · Cited by 1,637
A Maximum Likelihood Approach to Continuous Speech Recognition
Bahl, L. R., Jelinek, F., & Mercer, R. L. (1983) · IEEE Transactions on Pattern Analysis and Machine Intelligence · doi:10.1109/tpami.1983.4767370 · Cited by 1,212
On the naturalness of software
Hindle, A., Barr, E. T., Su, Z., Gabel, M., & Dévanbu, P. (2012) · doi:10.5555/2337223.2337322 · Cited by 541
Self-citationTowards automatically generating summary comments for Java methods
Sridhara, G., Hill, E., Muppaneni, D., Pollock, L., & Vijay-Shanker, K. (2010) · Proceedings of the IEEE/ACM international conference on Automated software engineering · doi:10.1145/1858996.1859006 · Cited by 514 · cited 1×
“on GitHub and BitBucket), software engineering researchers have turned to empirical methods to study the process of developing and maintaining software [11, 27, 38, 40, 42–45, 47, 49].”
MethodSemantic clustering: Identifying topics in source code
Kuhn, A., Ducasse, S., & Gîrba, T. (2007) · Information and Software Technology · doi:10.1016/j.infsof.2006.10.017 · Cited by 496
A cache-based natural language model for speech recognition
Kuhn, R., & De Mori, R. (1990) · IEEE Transactions on Pattern Analysis and Machine Intelligence · doi:10.1109/34.56193 · Cited by 495
Using task context to improve programmer productivity
Kersten, M., & Murphy, G. C. (2006) · Proceedings of the 14th ACM SIGSOFT international symposium on Foundations of software engineering · doi:10.1145/1181775.1181777 · Cited by 452
Dixon, W. J., & Mood, A. M. (1946) · Journal of the American Statistical Association · doi:10.1080/01621459.1946.10501898 · Cited by 422
Research works printed but not linked: 4
- 10.5555/2487085.2487127 · doi:10.5555/2487085.2487127
- M. Broy , F. Deißenböck , and M. Pizka . A holistic approach to software quality at work. In 3WCSQ , 2005 . M. Broy, F. Deißenböck, and M. Pizka. A holistic approach to software quality at work. In 3WCSQ, 2005.
- K. Knight . Bayesian inference with tears . Tutorial Workbook , 2009 . K. Knight. Bayesian inference with tears. Tutorial Workbook, 2009.
- 10.1145/1062455.1062526 · doi:10.1145/1062455.1062526 · Paper page
Cited by
Items 201–240 of 240
Deep Learning-Based Code Completion: On the Impact on Performance of Contextual Information
Ciniselli, M., Pascarella, L., & Bavota, G. (2024) · IEEE International Conference on Software Maintenance (ICSM) · doi:10.1109/icsme58944.2024.00029 · Cited by 3
Li, Y., Zhong, W., Shen, Z., Li, C., Chen, X., Ge, J., & Luo, B. (2025) · Automated Software Engineering · doi:10.1007/s10515-025-00502-y · Cited by 3
“This stage is represented by n-gram models, which have been adapted by measures such as adding caches (Tu et al. 2014) and expanding the corpora (Allamanis and Sutton 2013), for various software engineering tasks.”
Intelligent Code Completion by a Unified Multi-task Learning with a Large Language Model
Maharjan, S., Xia, M., Ahn, T. H., & Song, M. (2025) · IEEE/ACIS International Conference on Software Engineering Research, Management and Applications (SERA) · doi:10.1109/sera65747.2025.11154531 · Cited by 1
FastCoder: Accelerating Repository-level Code Generation via Efficient Retrieval and Verification
Zhao, Q., Zhang, L., Liu, F., Lian, X., Meng, Q., Jiao, Z., Zhou, Z., Li, J., & Shi, L. (2025) · IEEE/ACM International Conference on Automated Software Engineering (ASE) · doi:10.1109/ase63991.2025.00190 · Cited by 5
“Human-written programs are typically localized [33], with program entities (token sequences) defined or used in the preceding snippets frequently being reused in the subsequent code snippets within the same code file.”
Evaluating package-level scoping strategies for repository-level code completion in Pharo
AbedelKader, O., Ducasse, S., Polito, G., Zaitsev, O., & Robbes, R. (2026) · Journal of Computer Languages · doi:10.1016/j.cola.2026.101412
“More recently, Bibaev et al., [6] proposed learning-to-rank models trained on anonymous IDE usage logs, validating that user interaction data can serve as a powerful implicit supervision source for improving completion accuracy in production settings.”
Multi-location cryptographic code repair with neural-network-based methodologies
Xiao, Y. (2021) · ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE) · doi:10.1145/3468264.3473102 · Cited by 2
“Many studies validated the naturalness of code sequences [2, 9, 10, 23, 24, 28], which inspires a line of work to build language models for code completion/suggestion tasks [4–6, 26, 27, 29].”
BackgroundHardware descriptions code completion based on a pre-training model
Liang, X. (2021) · IEEE Conference on Telecommunications, Optics and Computer Science (TOCS) · doi:10.1109/tocs53301.2021.9688846 · Cited by 1
“Tu Z et al. [6] showed that statistical natural language fails to take the use of localness and developed a cache language model that captures the localness for improving completion accuracy.”
BackgroundAdvancing code completion through rotary position embedding
Yin, Y., Liu, J., Liu, Y., & Deng, J. (2025) · Cluster Computing · doi:10.1007/s10586-024-05015-z · Cited by 1
“In 2012, Hindle et al. [3] discovered that source code has predictable statistical properties, treating programming languages as natural languages, and statistical language models were applied to model source code [5–7].”
On Data Analysis of Software Repositories
Namiot, D., & Romanov, V. (2020) · Communications in computer and information science · doi:10.1007/978-3-030-37436-5_24 · Cited by 2
N-gram models for code completion in Pharo
Romaniuk, M. (2020) · International Conference on Art, Science, and Engineering of Programming (<Programming>) · doi:10.1145/3397537.3398483 · Cited by 1
“There, as well as in [2, 4, 5, 7], the structural information is not taken into consideration and the problem of improving code completion is reduced to a natural language processing problem, where predicting the next token is treated as predicting the next word in a sentence.”
BackgroundAPI Misuse Detection Based on Stacked LSTM
OuYang, S., Ge, F., Kuang, L., & Yin, Y. (2021) · Lecture notes of the Institute for Computer Sciences, Social Informatics and Telecommunications Engineering · doi:10.1007/978-3-030-67537-0_26 · Cited by 2
FeaRS: Recommending Complete Android Method Implementations
Wen, F., Ferrari, V., Aghajani, E., Nagy, C., Lanza, M., & Bavota, G. (2021) · IEEE International Conference on Software Maintenance (ICSM) · doi:10.1109/icsme52107.2021.00062 · Cited by 1
Context-Sensitive Code Completion
Asaduzzaman, M. (2018) · Cited by 1
Yang, Y. (2019) · arXiv (Cornell University) · doi:10.48550/arxiv.1909.11503 · Cited by 1
“In cacheca [11], they improved n-gram with caching recently appeared tokens in local files to improve next-token suggestion accuracy.”
BackgroundDo People Prefer "Natural" code?Preprint
Casalnuovo, C., Lee, K., Wang, H., Dévanbu, P., & Morgan, E. (2019) · arXiv (Cornell University) · doi:10.48550/arxiv.1910.03704 · Cited by 1
“gram models, we would also like to explore how local style effects the consistency of choice. Prior research has shown this to be a strongly distinguishing factor of source code over natural language [31, 64], so we theorize that cache models would prefer the original code even more strongly. Additionally, we would li…”
BackgroundMethodToward Less Hidden Cost of Code Completion with Acceptance and Ranking Models
lijingxuan, L., Huang, R., Li, W., Yao, K., & Tan, W. (2021) · IEEE International Conference on Software Maintenance (ICSM) · doi:10.26226/morressier.613b5419842293c031b5b638 · Cited by 24
Empirical Software Linguistics: An Investigation of Code Reviews, Recommendations and Faults
Hellendoorn, V. J. (2015) · Research Repository (Delft University of Technology)
Multi-token code suggestions using statistical language modelsPreprint
Santos, E. A., & Hindle, A. (2015) · doi:10.7287/peerj.preprints.1597v1
The Charming Code that Error Messages
Campbell, J. C., & Hindle, A. (2015)
Social software development: Insights and solutions
Sharma, A. B. (2018) · Singapore Management University Institutional Knowledge (InK) (Singapore Management University)
An Improved Recurrent Neural Network Language Model for Programming Language
Wu, L., Wu, Y., Li, F., & Zheng, T. (2019) · International Joint Conference on Neural Networks (IJCNN) · doi:10.1109/ijcnn.2019.8852433
“Tu et al. [30] improved n-gram model with caching capability for recently seen tokens.”
BackgroundYang, Y. (2020) · arXiv (Cornell University)
Yang, Y. (2020) · arXiv (Cornell University) · doi:10.48550/arxiv.2005.04137
“Cacheca [8] improved n-gram model by caching the recently encountered tokens in local files to improve the performance of basic n-gram model.”
MethodAPI Parameter Recommendations Made Effective
Yang, W. (2020) · IEEE International Conference on Software Quality, Reliability and Security Companion (QRS-C) · doi:10.1109/qrs-c51114.2020.00116
“Code tends to take special repetitive forms in local contexts due to module specialization and focus [4].”
BackgroundAn Empirical Exploration of Python Machine Learning API Usage
Vilkomir, A. (2020) · The Scholarship East Carolina University's Institutional Repository (East Carolina University)
DeepMutants: Training neural bug detectors with contextual mutationsPreprint
Richter, C., & Wehrheim, H. (2021) · arXiv (Cornell University) · doi:10.48550/arxiv.2107.06657 · Cited by 3
“These properties include for example the re-occurrence of syntactical or semantic constructs [22], [29] and the co-occurrence of semantically related identifiers [21].”
BackgroundA Deep Learning based Approach to Argument Recommendation
Li, G., Tang, Y., Yi, B., Zhang, X., & Yan, H. (2021) · doi:10.5121/csit.2021.111408
“Zhang et al. [4] recommend arguments for method invocations based on the nearest k usages of them.”
MethodImproved Methods of Pointer Mixture Network for Code Completion
Wei, C., Huang, Z., & Yu, Y. (2022) · IEEE International Conference on Software Quality, Reliability and Security (QRS) · doi:10.1109/qrs57517.2022.00095 · Cited by 1
“Reference [21] found that although the N-gram model achieved good prediction results, it could not obtain the local attributes of the code, so they improved the N-gram model to solve this problem.”
MethodAlignment Offset Based Adaptive Training for Simultaneous Machine Translation
Liang, Q., Liu, Y., Meng, F., Xu, J., Chen, Y., & Zhou, J. (2023) · doi:10.1109/icnlp58431.2023.00035
“Considering the sequentiality and localness of natural language [12], [13], for a target token, the closer its aligned source token is to its visible source prefix, the easier for models to implicitly predict its aligned source token.”
BackgroundA Code Completion Approach Combining Pointer Network and Transformer-XL Network
Zhang, X., Liu, J., Long, T., & Hu, H. (2024) · Lecture notes of the Institute for Computer Sciences, Social Informatics and Telecommunications Engineering · doi:10.1007/978-3-031-54521-4_17
Towards a Block-Level ML-Based Python Vulnerability Detection Tool
Bagheri, A., & Hegedűs, P. (2024) · Acta Cybernetica · doi:10.14232/actacyb.299667 · Cited by 1
A Combined Approach of Program Analysis and Deep Learning for Code Completion
Liu, Y. (2024) · Scientific Journal of Technology · doi:10.54691/hkyc3a89
“Additionally, understanding of semantic information in programs relies both on local code and on long‐distance context[4].”
BackgroundOn the Generalizability of Transformer Models to Code Completions of Different Lengths
Cooper, N., Tufano, R., Bavota, G., & Poshyvanyk, D. (2024) · IEEE International Conference on Software Maintenance (ICSM) · doi:10.1109/icsme58944.2024.00042 · Cited by 1
“Code completion has been studied extensively for several years in SE [25], [26], [27], [28], [29], [30], [31], [32], [33], [34], [35], [36], [37], [38], [39], [40], [14], [2], [15], [16], [41], [42].”
Checking Test Suite Efficacy Through Dual-Channel Techniques
Petrescu, C. C., Smith, S., Butler, A., & Dash, S. K. (2025) · Lecture notes in computer science · doi:10.1007/978-3-031-80889-0_19
“Next, Tu et al. added that code is also localised , which means that code is locally repetitive [23].”
A code completion approach combining pointer network and Transformer-XL network
Zhang, X., Liu, J., Long, T., & Hu, H. (2025) · Applied Intelligence · doi:10.1007/s10489-025-06315-6 · Cited by 2
“Tu et al. [19] built on [18] by suggesting that token units in programs have some repetition at a local scale and that language models often learn only the global laws of the code and ignore the local features in the program.”
PRaFFLineDP: Feature fusion with progressive ranking for efficient line-level defect prediction
Han, F., Yang, F., Chen, J., Zhong, F., Xiao, P., & Liang, Q. (2026) · Empirical Software Engineering · doi:10.1007/s10664-026-10855-x
“The compared approaches are detailed below: (1) N-gram (Tu et al. 2014 ): This approach employs a cache-enhanced N-gram statistical language mode (Hellendoorn and Devanbu 2017 ).”
InfluentialUnderstanding and Predicting Accepted Code Suggestions in AI-Assisted Programming
Jiang, J., Li, L., Hou, J., Tan, X. L., & Zhang, L. (2026) · Proceedings of the ACM on software engineering. · doi:10.1145/3808125
Learning to Navigate (L2N): A Human-Centered Framework for Local Code Search
Leon, S., Zhang, Z., Tadepalli, P. V., & Kuttal, S. K. (2026) · Lecture notes in computer science · doi:10.1007/978-3-032-31048-4_21
Metadata
- Authors
- Tu, Z., Su, Z., & Devanbu, P.
- Affiliations
- University of California, Davis (US)
- University of California at Davis, USA
- Venue
- Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering
- Publisher
- ACM
- Published
- 2014-11-11
- Pages
- 269-280
- OpenAlex
- W2165747537
- Cited by
- 238
- References
- 52
- Citations by year
- 2026: 4 · 2025: 14 · 2024: 16 · 2023: 21 · 2022: 16 · 2021: 27 · 2020: 33 · 2019: 29 · 2018: 26 · 2017: 9 · 2016: 23 · 2015: 20
- FWCI
- 14.79
- Type
- conference paper
- Language
- en
- Open access
- closed
- Locations
- ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE) (publishedVersion)
- Funders
- National Science Foundation
- Topics
- Physical Sciences › Computer Science › Information Systems › Software Engineering Research
- Physical Sciences › Computer Science › Artificial Intelligence › Natural Language Processing Techniques
- Physical Sciences › Computer Science › Computer Science Applications › Teaching and Learning Programming
- Keywords
- n-gram language models, source code, localness, code completion, lexicalization, cross-entropy
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.