atlas

Research map / Large language models / Agents, code and math

AST-T5: Structure-Aware Pretraining for Code Generation and Understanding

ICML 2024 · Large language models › Agents, code and math · approach: Execution-based code verification · 7 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Introduces AST-T5, an encoder-decoder pretrained with AST-aware segmentation and AST-aware subtree span corruption, achieving strong results on code generation, transpilation and understanding at 277M parameters.

Problem

Code LMs treat code as token sequences, ignoring its syntactic structure; existing structure-aware methods need costly program analysis or execution, and greedy segmentation fragments AST structures during pretraining.

Approach

Use Tree-sitter ASTs with a dynamic-programming segmentation that minimizes AST-subtree breaks across chunk boundaries, and a span-corruption objective that masks whole AST subtrees (granularity controlled by a random threshold theta), with no architecture changes relative to T5.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
add AST-Aware Segmentation instead of Greedy Segmentation (ablation)T5 code pretraining · HumanEvalPass@1: 5.2 -> 7.2Helped
add AST-Aware Segmentation instead of Greedy Segmentation (ablation)T5 code pretraining · ConcodeEM: 18.3 -> 20.2Helped
add AST-Aware Segmentation instead of Greedy Segmentation (ablation)T5 code pretraining · All evaluation tasks (Avg)average performance: 44.2 -> 45.7Helped
replace Vanilla T5 Span Corruption with AST-Aware Subtree Corruption (ablation)T5 with AST-Aware Segmentation · HumanEvalPass@1: 7.2 -> 9.6Helped
replace Vanilla T5 Span Corruption with AST-Aware Subtree Corruption (ablation)T5 with AST-Aware Segmentation · All evaluation tasks (Avg)average performance: 45.7 -> 47.0Helped
increase masking ratio from 15% to 25% (ablation)AST-T5 with AST-aware pretraining · HumanEvalPass@1: 9.6 -> 14.0Helped
increase masking ratio from 15% to 25% (ablation)AST-T5 with AST-aware pretraining · All evaluation tasks (Avg)average performance: 47.0 -> 47.9Helped
increase masking ratio from 15% to 25% (ablation)AST-T5 with AST-aware pretraining · Defect Detectaccuracy: 66.0 -> 65.8No clear effect
increase masking ratio from 25% to 50% (ablation)AST-T5 · HumanEvalPass@1: 14.0 -> 14.3Helped
increase masking ratio from 25% to 50% (ablation)AST-T5 · Bugs2Fix SmallEM: 23.8 -> 21.9Hurt
increase masking ratio from 25% to 50% (ablation)AST-T5 · BigCloneBenchF1: 98.6 -> 97.1Hurt
increase masking ratio from 25% to 50% (ablation)AST-T5 · All evaluation tasks (Avg)average performance: 47.9 -> 46.4Hurt

Surprising findings

Limitations

Experimental setup

Datasets: The Stack Dedup CodeSearchNet CodeXGLUE HumanEval MBPP Concode Bugs2Fix BigCloneBench Defect Detection

Benchmarks: HumanEval MBPP Concode Bugs2Fix Java-C# transpilation BigCloneBench Defect Detection HumanEval+ MBPP+ MBXP

Metrics: Pass@1 exact match F1 accuracy CodeBLEU

Baselines: T5 (own code-trained baseline) CodeT5 CodeT5+ StructCoder PLBART CodeBERT GraphCodeBERT GPT-J

Builds on: T5 CodeT5 Vanilla T5 span corruption Tree-sitter

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy