ReCode: Robustness Evaluation of Code Generation Models

By Shiqi Wang, Zheng Li, Haifeng Qian, Cheng Yang, Zijian Wang, Mingyue Shang, Varun Kumar, Samson Tan, Baishakhi Ray, Parminder Bhatia and 4 more. 2022

161 citations recorded by the source corpus.

Code generation models have achieved impressive performance. However, they tend to be brittle as slight edits to a prompt could lead to very different generations; these robustness properties, critical for user experience when deployed in real-life applications, are not well understood. Most existing works on robustness in text or code tasks have focused on classification, while robustness in generation tasks is an uncharted area and to date there is no comprehensive benchmark for robustness in code generation. In this paper, we propose ReCode, a comprehensive robustness evaluation benchmark for code generation models. We customize over 30 transformations specifically for code on docstrings, function and variable names, code syntax, and code format. They are carefully designed to be natural in real-life coding practice, preserve the original semantic meaning, and thus provide multifaceted assessments of a model’s robustness performance. With human annotators, we verified that over 90% of the perturbed prompts do not alter the semantic meaning of the original prompt. In addition, we define robustness metrics for code generation models considering the worst-case behavior under each type of perturbation, taking advantage of the fact that executing the generated code can serve as objective evaluation. We demonstrate ReCode on SOTA models using HumanEval, MBPP, as well as function completion tasks derived from them. Interesting observations include: better robustness for CodeGen over InCoder and GPT-J; models are most sensitive to syntax perturbations; more challenging robustness evaluation on MBPP over HumanEval.

Subfields: Artificial Intelligence, Information Systems, Evaluation & Benchmarks, Code Generation & Program Synthesis, Signal Processing

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Armando Solar-Lezama
  2. Xavier García
  3. Koushik Sen
  4. Naman Jain
  5. Michele Catasta
  6. Tianjun Zhang
  7. Niklas Muennighoff
  8. Jacob Austin

In Information Systems

  1. Armando Solar-Lezama
  2. Koushik Sen
  3. Naman Jain
  4. Michele Catasta
  5. Tianjun Zhang
  6. Jacob Austin
  7. Ion Stoica
  8. Leandro Von Werra

In Evaluation & Benchmarks

  1. Armando Solar-Lezama
  2. Xavier García
  3. Naman Jain
  4. Tianjun Zhang
  5. Niklas Muennighoff
  6. Terry Yue Zhuo
  7. Ion Stoica
  8. Prateek Yadav

In Code Generation & Program Synthesis

  1. Armando Solar-Lezama
  2. Koushik Sen
  3. Michele Catasta
  4. Rishabh Singh

In Signal Processing

  1. Armando Solar-Lezama
  2. Koushik Sen
  3. Michele Catasta
  4. Tianjun Zhang
  5. Jacob Austin
  6. Ion Stoica
  7. Leandro Von Werra
  8. Patrice Godefroid

Citations in the corpus