mlsanityData to 7 Oct 2026

On the "Naturalness" of Buggy Code

arXiv 1506.01159 ↗First posted 3 Jun 2015cs.SEcited by 35

Not on the map. Why?

Abstract (arXiv)

Real software, the kind working programmers produce by the kLOC to solve real-world problems, tends to be "natural", like speech or natural language; it tends to be highly repetitive and predictable. Researchers have captured this naturalness of software through statistical models and used them to good effect in suggestion engines, porting tools, coding standards checkers, and idiom miners. This suggests that code that appears improbable, or surprising, to a good statistical language model is "unnatural" in some sense, and thus possibly suspicious. In this paper, we investigate this hypothesis. We consider a large corpus of bug fix commits (ca.~8,296), from 10 different Java projects, and we focus on its language statistics, evaluating the naturalness of buggy code and the corresponding fixes. We find that code with bugs tends to be more entropic (i.e., unnatural), becoming less so as bugs are fixed. Focusing on highly entropic lines is similar in cost-effectiveness to some well-known static bug finders (PMD, FindBugs) and ordering warnings from these bug finders using an entropy measure improves the cost-effectiveness of inspecting code implicated in warnings. This suggests that entropy may be a valid language-independent and simple way to complement the effectiveness of PMD or FindBugs, and that search-based bug-fixing methods may benefit from using entropy both for fault-localization and searching for fixes.

Key facts. Cited by 35 papers in the map (data through 7 Oct 2026). First posted on arXiv 3 Jun 2015.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2021: 9; 2022: 4; 2023: 4; 2024: 4; 2025: 11; 2026: 3.

35 papers.

Sort:

By area:

  1. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  2. 2021Unified Pre-training for Program Understanding and Generationcited by 361
  3. 2023Keep the Conversation Going: Fixing 162 out of 337 bugs for 0.42 each using ChatGPTcited by 125
  4. 2023Large Language Models for Test-Free Fault Localizationcited by 67
  5. 2021Self-Supervised Bug Detection and Repaircited by 59
  6. 2022NatGen: Generative pre-training by "Naturalizing" source codecited by 53
  7. 2021On Multi-Modal Learning of Editing Source Codecited by 25
  8. 2025EpiCoder: Encompassing Diversity and Complexity in Code Generationcited by 21
  9. 2021Understanding Neural Code Intelligence Through Program Simplificationcited by 20
  10. 2025Can LLMs Reason About Program Semantics? A Comprehensive Evaluation of LLMs on Formal Specification Inferencecited by 14
  11. 2023Toward a Theory of Causation for Interpreting Neural Code Modelscited by 12
  12. 2025Exploring Code Language Models for Automated HLS-based Hardware Generation: Benchmark, Infrastructure and Analysiscited by 10
23 more
  1. 2022Detect-Localize-Repair: A Unified Framework for Learning to Debug with CodeT5cited by 9
  2. 2022Towards a consistent interpretation of AIOps modelscited by 8
  3. 2021Variable Name Recovery in Decompiled Binary Code using Constrained Masked Language Modelingcited by 7
  4. 2024Towards Reliable Evaluation of Neural Program Repair with Natural Robustness Testingcited by 5
  5. 2024Leveraging Reviewer Experience in Code Review Comment Generationcited by 4
  6. 2025ObscuraCoder: Powering Efficient Code LM Pre-Training Via Obfuscation Groundingcited by 4
  7. 2021Learning to Extend Program Graphs to Work-in-Progress Codecited by 3
  8. 2024Assessing the Latent Automated Program Repair Capabilities of Large Language Models using Round-Trip Translationcited by 3
  9. 2025Show Me Your Code! Kill Code Poisoning: A Lightweight Method Based on Code Naturalnesscited by 3
  10. 2025Aligning Crowd-sourced Human Feedback for Reinforcement Learning on Code Generation by Large Language Modelscited by 3
  11. 2025The Fools are Certain; the Wise are Doubtful: Exploring LLM Confidence in Code Completioncited by 3
  12. 2022Leveraging Structural Properties of Source Code Graphs for Just-In-Time Bug Predictioncited by 2
  13. 2023INSPECT: Intrinsic and Systematic Probing Evaluation for Code Transformerscited by 2
  14. 2025Deep Learning-Based Identification of Inconsistent Method Names: How Far Are We?cited by 2
  15. 2025Deep Learning-based Intrusion Detection Systems: A Surveycited by 2
  16. 2026Code for Machines, Not Just Humans: Quantifying AI-Friendliness with Code Health Metricscited by 2
  17. 2024ANVIL: Anomaly-based Vulnerability Identification without Labelled Training Datacited by 1
  18. 2025Bringing Structure to Naturalness: On the Naturalness of ASTscited by 1
  19. 2025Empirical Study of Code Large Language Models for Binary Security Patch Detectioncited by 1
  20. 2021Embedding Code Contexts for Cryptographic API Suggestion:New Methodologies and Comparisonscited by 0
  21. 2021DeepMutants: Training neural bug detectors with contextual mutationscited by 0
  22. 2026Prompt Coverage Adequacycited by 0
  23. 2026What is the Difference Between Me and You? Benchmarking the Quality Gap Between Human-Written and AI-Generated Codecited by 0