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. 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.
%0 Journal Article
%1 Thellmann2022-do
%A Thellmann, Klaudia-Doris
%A Stadler, Bernhard
%A Usbeck, Ricardo
%A Lehmann, Jens
%D 2022
%I arXiv
%K topic_language topic_knowledge
%T Transformer with tree-order encoding for neural program generation
%X 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. 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.
@article{Thellmann2022-do,
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. 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.},
added-at = {2024-09-10T11:56:37.000+0200},
author = {Thellmann, Klaudia-Doris and Stadler, Bernhard and Usbeck, Ricardo and Lehmann, Jens},
biburl = {https://puma.scadsai.uni-leipzig.de/bibtex/21ce0316cde920c21fec80940e5a86be3/scadsfct},
interhash = {f5d616b52365ef04cf1962ba3555a918},
intrahash = {1ce0316cde920c21fec80940e5a86be3},
keywords = {topic_language topic_knowledge},
publisher = {arXiv},
timestamp = {2024-11-22T15:47:40.000+0100},
title = {Transformer with tree-order encoding for neural program generation},
year = 2022
}