Code Means More Than Plain Language: Bringing Syntax Structure Awareness To Algorithmic Problem Solution Generation

Wenqing Zheng, S P Sharan, Ajay Kumar Jaiswal, Kevin Wang, Yihan Xi, Zhangyang WangOpenReview 2022

Abstract

Program Synthesis (PS) is the task of building computer programs that satisfy problem specifications. Large-scale pre-trained language models treat the PS as a sequence prediction task, which has gained vivid popularity recently. However, these methods heavily rely on the conventional Natural Language Processing (NLP) tokenizers, which overlooks the rich structural/syntax information in the code. In this work, we posit that the syntax structures help generate syntax error-free and algorithmically correct programs. If the program syntax structures can be integrated into the tokenizer, the program representation space could be significantly simplified. To this end, we propose a new end-to-end framework named ASTer, coupled with our novel syntax-aware tokenization design toolkit. More specifically, our tokenizer encodes and decodes the program by its syntax roles and contents, not by what is superficially shown on the strings. The ASTer encompasses a novel sample-wise and token-wise attention mechanism, and avails the benefits of training with the syntactically aligned samples from our tokenization toolkit. Extensive evaluations show superior performance against state-of-the-arts, which confirms that bringing syntax knowledge into the language model can help better capture the data structure and simplify the search space. All of our codes will be publicly available upon acceptance.
BibTeX
@misc{zheng2022code,
  author = {Wenqing Zheng and S P Sharan and AJAY KUMAR JAISWAL and Kevin Wang and Yihan Xi and Zhangyang Wang},
  title = {{Code Means More Than Plain Language: Bringing Syntax Structure Awareness To Algorithmic Problem Solution Generation}},
  year = {2022},
  url = {https://openreview.net/forum?id=RePt5K6wPux},
  howpublished = {OpenReview},
}

Loading related content...

Figure