Transformer with Tree-order Encoding for Neural Program Generation

Klaudia-Doris Thellmann, Bernhard Stadler, Ricardo Usbeck, Jens Lehmann
5/30/2022
cs.CLcs.AI
transformer-attention

Official code: SmartDataAnalytics/codeCAI (4 stars, Python, MIT, last commit 2022-06-01).

Abstract

While a considerable amount of semantic parsing approaches have employed RNN architectures for code generation tasks, there have been only few attempts to investigate the applicability of Transformers for this task. Including hierarchical information of the underlying programming language syntax has proven to be effective for code generation.

Show full abstract

Since the positional encoding of the Transformer can only represent positions in a flat sequence, we have extended the encoding scheme to allow the attention mechanism to also attend over hierarchical positions in the input. Furthermore, we have realized a decoder based on a restrictive grammar graph model to improve the generation accuracy and ensure the well-formedness of the generated code. While we did not surpass the state of the art, our findings suggest that employing a tree-based positional encoding in combination with a shared natural-language subword vocabulary improves generation performance over sequential positional encodings.

View on arXivView PDF

Code Implementations(1)

MIT
40Python, TypeScriptOct 11, 20214 years agoMIT

Similar Papers

Cite this paper

@article{thellmann2022transformer,
  title  = {Transformer with Tree-order Encoding for Neural Program Generation},
  author = {Klaudia-Doris Thellmann and Bernhard Stadler and Ricardo Usbeck and Jens Lehmann},
  year   = {2022},
  eprint = {2206.13354},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2206.13354}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2206.13354.svg)](https://codeofpaper.com/paper/2206.13354)

Discussion