Papers › GAP-Gen: Guided Automatic Python Code Generation

GAP-Gen: Guided Automatic Python Code Generation

19 Jan 2022arXiv:2201.08810archive 2025-07-28

Junchen Zhao, Yurun Song, Junlin Wang, Ian G. Harris

Automatic code generation from natural language descriptions can be highly beneficial during the process of software development. In this work, we propose GAP-Gen, a Guided Automatic Python Code Generation method based on Python syntactic constraints and semantic constraints. We first introduce Python syntactic constraints in the form of Syntax-Flow, which is a simplified version of Abstract Syntax Tree (AST) reducing the size and high complexity of Abstract Syntax Tree but maintaining crucial syntactic information of Python code. In addition to Syntax-Flow, we introduce Variable-Flow which abstracts variable and function names consistently through out the code. In our work, rather than pretraining, we focus on modifying the finetuning process which reduces computational requirements but retains high generation performance on automatic Python code generation task. GAP-Gen fine-tunes the transformer based language models T5 and CodeT5 using the Code-to-Docstring datasets CodeSearchNet, CodeSearchNet AdvTest and Code-Docstring Corpus from EdinburghNLP. Our experiments show that GAP-Gen achieves better results on automatic Python code generation task than previous works.

PaperPDFCode

Code

rain9876/auto-code-generator officialmentioned in paperpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

Not run by Syntology. Nothing on this page verifies that the listed code works.

Tasks

Code Generation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Code Generation CodeXGLUE - CodeSearchNet GAP-Gen Java/BLEU - #2 of 2 Archive leaderboard report
Code Generation CodeXGLUE - CodeSearchNet GAP-Gen Java/EM - #2 of 2 Archive leaderboard report
Code Generation CodeXGLUE - CodeSearchNet GAP-Gen Python/BLEU 22.3 #2 of 2 Archive leaderboard report
Code Generation CodeXGLUE - CodeSearchNet GAP-Gen Python/CodeBLEU 24.1 #2 of 2 Archive leaderboard report
Code Generation CodeXGLUE - CodeSearchNet GAP-Gen Python/EM - #2 of 2 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

AdafactorAttentionAttention DropoutBPEDense ConnectionsDropoutGated Linear UnitInverse Square Root ScheduleLayer NormalizationLinear LayerMulti-Head AttentionResidual ConnectionSentencePieceSoftmaxT5

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections