mlsanityData to 14 Oct 2026

Bringing Structure to Naturalness: On the Naturalness of ASTs

arXiv 2504.08234 ↗First posted 11 Apr 2025cs.SE cs.LGcited by 1

Not on the map. Why?

Abstract (arXiv)

Source code comes in different shapes and forms. Previous research has already shown code to be more predictable than natural language as well as highlighted its statistical predictability at the token level: source code can be natural. More recently, the structure of code -- control flow, syntax graphs, abstract syntax trees etc. -- has been successfully used to improve the state-of-the-art on numerous tasks: code suggestion, code summarisation, method naming etc. This body of work implicitly assumes that structured representations of code are similarly statistically predictable, i.e. that a structured view of code is also natural. We consider that this view should be made explicit and propose directly studying the Structured Naturalness Hypothesis. Beyond just naming existing research that assumes this hypothesis and formulating it, we also provide evidence in the case of trees: TreeLSTM models over ASTs for some languages, such as Ruby, are competitive with n-gram models while handling the syntax token issue highlighted by previous research 'for free'. For other languages, such as Java or Python, we find tree models to perform worse, suggesting that downstream task improvement is uncorrelated to the language modelling task. Further, we show how such naturalness signals can be employed for near state-of-the-art results on just-in-time defect prediction while forgoing manual feature engineering work.

Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Builds on 25 of its 57 references that are in the map. First posted on arXiv 11 Apr 2025.

Builds on

25 of 57 references.

References · 25

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
  3. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
  4. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
  5. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
  6. 2021QA-GNN: Reasoning with Language Models and Knowledge Graphs for Question Answeringcited by 388
  7. 2023StructGPT: A General Framework for Large Language Model to Reason over Structured Datacited by 343
  8. 2015Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networkscited by 306
  9. 2022Can language models learn from explanations in context?cited by 249
  10. 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 221
  11. 2017Learning to Represent Programs with Graphscited by 220
  12. 2018code2seq: Generating Sequences from Structured Representations of Codecited by 179
13 more
  1. 2016A Convolutional Attention Network for Extreme Summarization of Source Codecited by 91
  2. 2019Tree Transformer: Integrating Tree Structures into Self-Attentioncited by 68
  3. 2018Structured Neural Summarizationcited by 54
  4. 2023Large Language Models for Compiler Optimizationcited by 52
  5. 2015On the "Naturalness" of Buggy Codecited by 35
  6. 2019Automatic Source Code Summarization with Extended Tree-LSTMcited by 28
  7. 2014Mining Idioms from Source Codecited by 19
  8. 2016A deep language model for software codecited by 14
  9. 2021AST-Transformer: Encoding Abstract Syntax Trees Efficiently for Code Summarizationcited by 11
  10. 2018A deep tree-based model for software defect predictioncited by 8
  11. 2014Autofolding for Source Code Summarizationcited by 6
  12. 2024Which Syntactic Capabilities Are Statistically Learned by Masked Language Models for Code?cited by 6
  13. 2022CodeBERT-nt: code naturalness via CodeBERTcited by 4

Built on by

Cited by year

Citing papers per year: 2025: 1.

1 paper.