Table of Contents
Fetching ...

Codex Hacks HackerRank: Memorization Issues and a Framework for Code Synthesis Evaluation

Anjan Karmakar, Julian Aron Prenner, Marco D'Ambros, Romain Robbes

TL;DR

The paper interrogates Codex's Python code-synthesis abilities using HackerRank prompts, revealing strong zero-shot and few-shot performance but clear memorization and generalization gaps. It documents how Codex often mirrors training-material patterns when prompts are incomplete or altered, prompting a call for robust, mutation-based evaluation benchmarks. A novel framework is proposed to systematically stress-test code generation across variant problem statements, with implications for security and reliability in real-world use. The work underscores the need for broader, carefully designed benchmarks to curb memorization biases and improve genuine code synthesis capabilities.

Abstract

The Codex model has demonstrated extraordinary competence in synthesizing code from natural language problem descriptions. However, in order to reveal unknown failure modes and hidden biases, such large-scale models must be systematically subjected to multiple and diverse evaluation studies. In this work, we evaluate the code synthesis capabilities of the Codex model based on a set of 115 Python problem statements from a popular competitive programming portal: HackerRank. Our evaluation shows that Codex is indeed proficient in Python, solving 96% of the problems in a zero-shot setting, and 100% of the problems in a few-shot setting. However, Codex exhibits clear signs of generating memorized code based on our evaluation. This is alarming, especially since the adoption and use of such models could directly impact how code is written and produced in the foreseeable future. With this in mind, we further discuss and highlight some of the prominent risks associated with large-scale models of source code. Finally, we propose a framework for code-synthesis evaluation using variations of problem statements based on mutations.

Codex Hacks HackerRank: Memorization Issues and a Framework for Code Synthesis Evaluation

TL;DR

The paper interrogates Codex's Python code-synthesis abilities using HackerRank prompts, revealing strong zero-shot and few-shot performance but clear memorization and generalization gaps. It documents how Codex often mirrors training-material patterns when prompts are incomplete or altered, prompting a call for robust, mutation-based evaluation benchmarks. A novel framework is proposed to systematically stress-test code generation across variant problem statements, with implications for security and reliability in real-world use. The work underscores the need for broader, carefully designed benchmarks to curb memorization biases and improve genuine code synthesis capabilities.

Abstract

The Codex model has demonstrated extraordinary competence in synthesizing code from natural language problem descriptions. However, in order to reveal unknown failure modes and hidden biases, such large-scale models must be systematically subjected to multiple and diverse evaluation studies. In this work, we evaluate the code synthesis capabilities of the Codex model based on a set of 115 Python problem statements from a popular competitive programming portal: HackerRank. Our evaluation shows that Codex is indeed proficient in Python, solving 96% of the problems in a zero-shot setting, and 100% of the problems in a few-shot setting. However, Codex exhibits clear signs of generating memorized code based on our evaluation. This is alarming, especially since the adoption and use of such models could directly impact how code is written and produced in the foreseeable future. With this in mind, we further discuss and highlight some of the prominent risks associated with large-scale models of source code. Finally, we propose a framework for code-synthesis evaluation using variations of problem statements based on mutations.
Paper Structure (10 sections, 2 figures, 1 table)

This paper contains 10 sections, 2 figures, 1 table.

Figures (2)

  • Figure 1: Problem statement #57 original and trimmed.
  • Figure 2: A problem with two variable mutation points