Lyra: A Benchmark for Turducken-Style Code Generation

Abstract

Recently, neural techniques have been used to generate source code automatically. While promising for declarative languages, these approaches achieve much poorer performance on datasets for imperative languages. Since a declarative language is typically embedded in an imperative language (i.e., the turducken-style programming) in real-world software development, the promising results on declarative languages can hardly lead to significant reduction of manual software development efforts. In this paper, we define a new code generation task: given a natural language comment, this task aims to generate a program in a base imperative language with an embedded declarative language. To our knowledge, this is the first turducken-style code generation task. For this task, we present Lyra: a dataset in Python with embedded SQL. This dataset contains 2,000 carefully annotated database manipulation programs from real usage projects. Each program is paired with both a Chinese comment and an English comment. In our experiment, we adopted Transformer, BERT-style, and GPT-style models as baselines. In the best setting, GPT-style model can achieve 24% and 25.5% AST exact matching accuracy using Chinese and English comments, respectively. Therefore, we believe that Lyra provides a new challenge for code generation. Yet, overcoming this challenge may significantly boost the applicability of code generation techniques for real-world software development.

Cite

Text

Liang et al. "Lyra: A Benchmark for Turducken-Style Code Generation." International Joint Conference on Artificial Intelligence, 2022. doi:10.24963/IJCAI.2022/588

Markdown

[Liang et al. "Lyra: A Benchmark for Turducken-Style Code Generation." International Joint Conference on Artificial Intelligence, 2022.](https://mlanthology.org/ijcai/2022/liang2022ijcai-lyra/) doi:10.24963/IJCAI.2022/588

BibTeX

@inproceedings{liang2022ijcai-lyra,
  title     = {{Lyra: A Benchmark for Turducken-Style Code Generation}},
  author    = {Liang, Qingyuan and Sun, Zeyu and Zhu, Qihao and Zhang, Wenjie and Yu, Lian and Xiong, Yingfei and Zhang, Lu},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year      = {2022},
  pages     = {4238-4244},
  doi       = {10.24963/IJCAI.2022/588},
  url       = {https://mlanthology.org/ijcai/2022/liang2022ijcai-lyra/}
}