Skip to main content
QUICK REVIEW

[Paper Review] PanGu-Coder: Program Synthesis with Function-Level Language Modeling

Fenia Christopoulou, Γεράσιμος Λάμπουρας|arXiv (Cornell University)|Jul 22, 2022
Software Engineering ResearchComputer Science23 citations
TL;DR

PanGu-Coder is a decoder-only pre-trained model for text-to-code generation that uses a two-stage training strategy and achieves competitive performance on functionally correct code generation with smaller context and data requirements. It also demonstrates gains from in-domain fine-tuning and post-processing filters.

ABSTRACT

We present PanGu-Coder, a pretrained decoder-only language model adopting the PanGu-Alpha architecture for text-to-code generation, i.e. the synthesis of programming language solutions given a natural language problem description. We train PanGu-Coder using a two-stage strategy: the first stage employs Causal Language Modelling (CLM) to pre-train on raw programming language data, while the second stage uses a combination of Causal Language Modelling and Masked Language Modelling (MLM) training objectives that focus on the downstream task of text-to-code generation and train on loosely curated pairs of natural language program definitions and code functions. Finally, we discuss PanGu-Coder-FT, which is fine-tuned on a combination of competitive programming problems and code with continuous integration tests. We evaluate PanGu-Coder with a focus on whether it generates functionally correct programs and demonstrate that it achieves equivalent or better performance than similarly sized models, such as CodeX, while attending a smaller context window and training on less data.

Motivation & Objective

  • Motivate text-to-code generation with a decoder-only PanGu-α based model.
  • Propose a two-stage training strategy to leverage raw code data and NL-to-code pairs.
  • Explore fine-tuning on domain-relevant data and its impact on functional performance.
  • Investigate decoding strategies, training objectives, and data similarity for improved code synthesis.
  • Propose post-processing techniques to boost pass rates on functional benchmarks.

Proposed method

  • Use a PanGu-α style decoder-only transformer with an extra query layer for next-token prediction.
  • Stage 1 pre-trains with causal language modeling on raw code (with NL signals via docstrings/comments).
  • Stage 2 trains on aligned NL-code pairs using combinations of Code-CLM, Docstr-MLM, and Docstr-MCLM objectives.
  • Fine-tune PanGu-Coder on domain-relevant data such as competitive programming problems and CI test functions (PanGu-Coder -FT).
  • Evaluate zero-shot performance on HumanEval and MBPP benchmarks focusing on functional correctness.
  • Examine data selection via few-shot similarity and post-processing filters (unit tests, typing, syntax) to boost pass rates.

Experimental results

Research questions

  • RQ1Can a decoder-only model effectively perform text-to-code generation with function-level emphasis?
  • RQ2How do two-stage training objectives (CLM and MLM variants) impact functional code generation quality?
  • RQ3What is the effect of in-domain fine-tuning data on functional correctness scores?
  • RQ4Can similarity-based data selection reduce training compute while maintaining or improving performance?
  • RQ5Do post-generation filters (unit tests, typing, syntax checks) significantly boost pass rates on benchmarks?

Key findings

  • PanGu-Coder achieves equivalents or better performance than similarly sized models such as CodeX on functionally correct code generation with smaller context windows and less data.
  • Fine-tuning on in-domain data (PanGu-Coder -FT) yields faster improvement in pass rates, especially on MBPP, compared to out-of-domain data.
  • Unit tests in prompts and post-processing filters substantially improve MBPP pass rates, with varied effects on HumanEval.
  • Typing-based filtering and syntax checks can further enhance or maintain pass rates while reducing candidate solutions.
  • Few-shot similarity-based data selection can reach or exceed full-data fine-tuning performance using only 25-50% of the data, reducing compute needs.
  • PanGu-Coder -FT benefits from domain-aligned data, showing sensitivity to distribution shifts in fine-tuning data.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.