mlsanityData to 14 Oct 2026

Antecedent Predictions Are More Important Than You Think: An Effective Method for Tree-Based Code Generation

arXiv 2208.09998 ↗First posted 22 Aug 2022cs.SE cs.AI cs.PLcited by 0

Not on the map. Why?

Abstract (arXiv)

Code generation focuses on the automatic conversion of natural language (NL) utterances into code snippets. The sequence-to-tree (Seq2Tree) approaches are proposed for code generation, with the guarantee of the grammatical correctness of the generated code, which generate the subsequent Abstract Syntax Tree (AST) node relying on antecedent predictions of AST nodes. Existing Seq2Tree methods tend to treat both antecedent predictions and subsequent predictions equally. However, under the AST constraints, it is difficult for Seq2Tree models to produce the correct subsequent prediction based on incorrect antecedent predictions. Thus, antecedent predictions ought to receive more attention than subsequent predictions. To this end, in this paper, we propose an effective method, named Antecedent Prioritized (AP) Loss, that helps the model attach importance to antecedent predictions by exploiting the position information of the generated AST nodes. We design an AST-to-Vector (AST2Vec) method, that maps AST node positions to two-dimensional vectors, to model the position information of AST nodes. To evaluate the effectiveness of our proposed loss, we implement and train an Antecedent Prioritized Tree-based code generation model called APT. With better antecedent predictions and accompanying subsequent predictions, APT significantly improves the performance. We conduct extensive experiments on four benchmark datasets, and the experimental results demonstrate the superiority and generality of our proposed method.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 18 of its 30 references that are in the map. First posted on arXiv 22 Aug 2022.

Builds on

18 of 30 references.

References · 18

  1. 2017Attention Is All You Needcited by 60,361
  2. 2014Adam: A Method for Stochastic Optimizationcited by 37,240
  3. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  4. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
  5. 2018Learning to Mine Aligned Code and Natural Language Pairs from Stack Overflowcited by 165
  6. 2016Language to Logical Form with Neural Attentioncited by 158
  7. 2018Coarse-to-Fine Decoding for Neural Semantic Parsingcited by 110
  8. 2017Abstract Syntax Networks for Code Generation and Semantic Parsingcited by 92
  9. 2018TRANX: A Transition-based Neural Abstract Syntax Parser for Semantic Parsing and Code Generationcited by 88
  10. 2016Latent Predictor Networks for Code Generationcited by 73
  11. 2019Code Generation as a Dual Task of Code Summarizationcited by 62
  12. 2019TreeGen: A Tree-Based Transformer Architecture for Code Generationcited by 58
6 more
  1. 2018Retrieval-Based Neural Code Generationcited by 41
  2. 2020Incorporating External Knowledge through Pre-training for Natural Language to Code Generationcited by 36
  3. 2019Program Synthesis and Semantic Parsing with Learned Code Idiomscited by 34
  4. 2018A Grammar-Based Structural CNN Decoder for Code Generationcited by 29
  5. 2021Improving Tree-Structured Decoder Training for Code Generation via Mutual Learningcited by 10
  6. 2021Exploring Dynamic Selection of Branch Expansion Orders for Code Generationcited by 10

Built on by

Not cited yet.