Measuring Coding Challenge Competence With APPS

Dan Hendrycks, Steven Basart, Saurav Kadavath, Mantas Mazeika, Akul Arora, Ethan Guo, Collin Burns, Samir Puranik, Horace He, Dawn Song, Jacob Steinhardt

TL;DR

The authors introduce APPS (Automated Programming Progress Standard), a benchmark of 10,000 Python coding problems designed to rigorously evaluate whether language models can translate arbitrary natural language specifications into functionally correct programs. By evaluating generated code against extensive test suites rather than text-overlap heuristics, the study reveals that while models are beginning to grasp programming, performance on real-world algorithmic problems remains a major open challenge.

What Problem Does This Paper Address?

Prior benchmarks for code generation largely evaluated models on restricted tasks—such as line-by-line pseudocode-to-code translation, translation across languages, or generating short snippets from single docstrings (averaging fewer than 15 words). Crucially, many prior studies relied on surface-level text similarity metrics like BLEU, which fail to evaluate functional correctness.

The paper addresses the lack of an objective, realistic, and rigorous benchmark for program synthesis from full, self-contained natural language problem descriptions (averaging ~293 words), complete with unit test suites to determine true semantic correctness.

Methods

  • Functional Evaluation via Test Cases: Instead of n-gram matching, candidate solutions are executed in a standardized testing environment against problem-specific unit tests. The evaluation tracks two primary metrics:
  • Test Case Average: The average fraction of unit tests passed across problems.
  • Strict Accuracy: The percentage of problems where the generated code passes 100% of test cases.
  • Problem Representation Formats: Models are evaluated across two standard interfaces:
  • Call-Based Format: Function headers / starter code provided; output returned.
  • Standard Input Format: Solutions read from stdin and print results to stdout.
  • Pretraining & Fine-Tuning Pipeline:
  • GPT-2 variants (0.1B, 1.5B) were pretrained on a decontaminated corpus of 30 GB of Python code from GitHub (filtering out repos with <1 star and removing common exercise keywords).
  • Models were fine-tuned for 10 epochs on the APPS training set using AdamW and ZeRO/DeepSpeed.
  • Models evaluated include fine-tuned GPT-2 (0.1B, 1.5B), fine-tuned GPT-Neo (2.7B), and few-shot GPT-3 (175B 'davinci').

Datasets

  • APPS Dataset (Introduced):
  • 10,000 total problems curated from open coding platforms (Codeforces, Kattis, AtCoder, Codewars), split evenly into 5,000 training and 5,000 test problems.
  • 131,777 test cases (average 21.2 per test problem) and 232,421 human reference solutions.
  • Three difficulty tiers:
    1. Introductory (3,639 total; 1,000 test) – basic programming logic (1–2 years experience).
  • Interview (5,000 total; 3,000 test) – standard technical interview algorithms/data structures.
  • Competition (1,361 total; 1,000 test) – advanced contest problems (USACO, IOI, ACM).
  • Compared Benchmarks: Contrasted with existing datasets like PY150, CONCODE, and SPoC, APPS contains significantly longer problem specifications, orders of magnitude more reference solutions, and comprehensive unit tests.

Key Insights and Ideas

  • BLEU is actively misleading: BLEU scores actually increase on harder problem categories despite model functional accuracy dropping. In some comparisons, worse-performing models achieve higher BLEU scores than stronger models because reference solutions share boilerplate syntax.
  • Syntax errors decay exponentially: Larger, fine-tuned models rarely fail due to malformed Python. While few-shot GPT-3 exhibited syntax errors on ~59% of introductory solutions, GPT-Neo (2.7B) dropped syntax errors to ~3%.
  • Sampling candidate solutions yields big gains: Evaluating the top-5 beams instead of greedy/top-1 generation nearly doubled accuracy (e.g., GPT-Neo 2.7B strict accuracy on introductory tasks jumped from 3.9% to 5.5%).
  • Few-shot scale does not beat domain fine-tuning: Zero/few-shot GPT-3 (175B) solved only 3 out of 5,000 test problems, heavily underperforming fine-tuned models that are two orders of magnitude smaller.

Key Results

  • Introductory Problems: Fine-tuned GPT-Neo (2.7B) achieved a 14.68% test case average and 3.90% strict accuracy (rising to 19.9% test case average and 5.5% strict accuracy under Top-5 evaluation).
  • Interview & Competition Problems: Performance drops steeply with problem difficulty. On competition problems, strict accuracy was 0.00% across all tested models (GPT-Neo attained a 6.54% test case average).
  • External Validation (Codex): Subsequent evaluations by Chen et al. on OpenAI's Codex (12B) achieved 4.14% Top-1 and 9.65% Top-5 strict accuracy on introductory problems (reaching 25% with Top-1000 sampling), demonstrating that scaling specialized code models improves performance but leaves substantial room for progress.

Limitations and Future Work

  • Algorithmic Reasoning Bottleneck: While models generate superficially plausible code without syntax errors, they struggle with complex algorithmic reasoning, dynamic programming, and edge cases.
  • Few-Test Edge Cases: A small subset of test problems had only 2 or 3 test cases, occasionally introducing false positives on binary-output problems (e.g., "YES"/"NO").
  • Future Directions: Solving APPS will require models that can self-debug, plan complex control flow, verify program semantics against constraints, and utilize test-time execution feedback rather than relying purely on left-to-right next-token generation.

Summary updated

BibTeX
@inproceedings{hendrycks2021measuring,
  author = {Dan Hendrycks and Steven Basart and Saurav Kadavath and Mantas Mazeika and Akul Arora and Ethan Guo and Collin Burns and Samir Puranik and Horace He and Dawn Song and Jacob Steinhardt},
  title = {{Measuring Coding Challenge Competence With APPS}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=sD93GOzH3i5},
}

Loading related content...

Figure