PreprintCited by 7Software Engineering ResearchTopic ModelingTeaching and Learning Programming

AST-T5: Structure-aware pretraining for code generation and understanding

Open access
Gong, Linyuan, Elhoushi, Mostafa, Cheung, Alvin·2024·arXiv

Abstract

Large language models (LLMs) have made significant advancements in code-related tasks, yet many LLMs treat code as simple sequences, neglecting its structured nature. We introduce AST-T5, a novel pretraining paradigm that leverages the Abstract Syntax Tree (AST) for enhanced code generation, transpilation, and understanding. Using dynamic programming, our AST-Aware Segmentation retains code structure, while our AST-Aware Span Corruption objective equips the model to reconstruct various code structures. Unlike other models, AST-T5 avoids intricate program analyses or architectural changes, so it integrates seamlessly with any encoder-decoder Transformer. Evaluations show that AST-T5 consistently outperforms similar-sized LMs across various code-related tasks. Structure-awareness makes AST-T5 particularly powerful in code-to-code tasks, surpassing CodeT5 by 2 points in exact match score for the Bugs2Fix task and by 3 points in exact match score for Java-C# Transpilation in CodeXGLUE. Our code and model are publicly available at https://github.com/gonglinyuan/ast_t5.

Integrity signals

Registry

DataCite · 10.48550/arxiv.2401.03003

Cites

Statistics

Recomputing p-values needs the paper’s full text.

Claims the paper makes

We couldn’t retrieve this paper’s full text, so its claims and self-check weren’t run. The registry and citation checks still apply.

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?

  • Explicitly incorporating structural knowledge into models enhances their perceptual understanding of code, thereby aiding software mining tasks, including code translation.

    “explicitly incorporating structural knowledge into models enhances their perceptual understanding of code, thereby aiding software mining tasks [14], [15], including code translation [9], [13].”

Cited by

Sorted by citations

Authors
Gong, L., Elhoushi, M., & Cheung, A.
Venue
arXiv
Publisher
arXiv
Published
2024
ISSN
2331-8422 (ISSN-L)
OpenAlex
W4390723549
Cited by
7
References
0
Citations by year
2026: 1 · 2025: 3 · 2024: 3
Type
posted content
Language
en
Open access
Locations
  • arXiv (Cornell University) (submittedVersion, other-oa)
  • arXiv (Cornell University)
Funders
  • National Science Foundation (1955488, 2027575)
  • U.S. Department of Energy (DESC0016260)
  • Styrelsen för Internationellt Utvecklingssamarbete
  • Instituto de Ciencias del Mar y Limnología, Universidad Nacional Autónoma de México
  • Office of Naval Research (N00014-21-1-2724, ONR-N00014, N00014)
  • Army Research Office (W911NF2110339)
Topics
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Artificial Intelligence › Topic Modeling
  • Physical Sciences › Computer Science › Computer Science Applications › Teaching and Learning Programming
Keywords
abstract syntax tree, code generation, program comprehension, CodeXGLUE, transformer encoder-decoder

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