Lune

AAAI2020Top-tier venue

TreeGen: A Tree-Based Transformer Architecture for Code Generation

Zeyu Sun, Qihao Zhu, Yingfei Xiong, Yican Sun, Lili Mou, Lu Zhang

Abstract

A code generation system generates programming language code based on an input natural language description. State-of-the-art approaches rely on neural networks for code generation. However, these code generators suffer from two problems. One is the long dependency problem, where a code element often depends on another far-away code element. A variable reference, for example, depends on its definition, which may appear quite a few lines before. The other problem is structure modeling, as programs contain rich structural information. In this paper, we propose a novel tree-based neural architecture, TreeGen, for code generation. TreeGen uses the attention mechanism of Transformers to alleviate the long-dependency problem, and introduces a novel AST reader (encoder) to incorporate grammar rules and AST structures into the network. We evaluated TreeGen on a Python benchmark, HearthStone, and two semantic parsing benchmarks, ATIS and GEO. TreeGen outperformed the previous state-of-the-art approach by 4.5 percentage points on HearthStone, and achieved the best accuracy among neural network-based approaches on ATIS (89.1%) and GEO (89.6%). We also conducted an ablation test to better understand each component of our model.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

41 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • KNOD: Domain Knowledge Distilled Tree Decoder for Automated Program Repair cites A syntax-guided edit decoder for neural program repair
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers41

  1. A syntax-guided edit decoder for neural program repairQihao Zhu, Zeyu Sun, Yuan-an Xiao, Wenjie Zhang et al.FSE 2021 · 214 citations
  2. CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data PoisoningZhensu Sun, Xiaoning Du, Fu Song, Mingze Ni et al.WWW 2022 · 95 citations
  3. KNOD: Domain Knowledge Distilled Tree Decoder for Automated Program RepairNan Jiang, Thibaud Lutellier, Yiling Lou, Lin Tan et al.ICSE 2023 · 55 citations
  4. Empirical study of transformers for source codeNadezhda Chirkova, Sergey TroshinFSE 2021 · 53 citations
  5. SkCoder: A Sketch-based Approach for Automatic Code GenerationJia Li, Yongmin Li, Ge Li, Zhi Jin et al.ICSE 2023 · 50 citations

Related papers

  1. Analysis of Tree-Structured Architectures for Code GenerationSamip Dahal, Adyasha Maharana, Mohit BansalACL Findings 2021 · 9 citations
  2. Code Summarization with Structure-induced TransformerHongqiu Wu, Hai Zhao, Min ZhangACL Findings 2021 · 70 citations
  3. AST-Trans: Code Summarization with Efficient Tree-Structured AttentionZe Tang, Xiaoyu Shen, Chuanyi Li, Jidong Ge et al.ICSE 2022 · 57 citations
  4. DRTS Parsing with Structure-Aware Encoding and DecodingQiankun Fu, Yue Zhang, Jiangming Liu, Meishan ZhangACL 2020 · 8 citations
  5. Graph-tree Fusion Model with Bidirectional Information Propagation for Long Document ClassificationSudipta Singha Roy, Xindi Wang, Robert E. Mercer, Frank RudziczEMNLP Findings 2024 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines