Competition-Level Code Generation with AlphaCode
Written for the Research library (claude-opus-5-5) from the paper text. Original — arxiv.org/pdf/2203.07814
Summary
Large language models can already write short code snippets. Full competitive programming problems are much harder: the model has to read a long problem statement, choose an algorithm and write a complete program that passes hidden tests. AlphaCode, from DeepMind, tackles this setting. Transformer models are pre-trained on a selection of GitHub code and then fine-tuned on CodeContests, a new competitive programming dataset the authors release. CodeContests is split by time so that every evaluation problem was published after the training data, and it adds generated tests so that wrong programs are much less likely to be accepted. For each problem the system generates a very large number of candidate programs. It discards those that fail the example tests in the statement, then groups the survivors by how they behave and submits at most 10. In simulated Codeforces contests AlphaCode placed around the median human competitor. It is the first strong evidence that code generation can handle problems needing real algorithmic reasoning, and the paper also shows that careful dataset design is essential for honest evaluation.
Key points
- Across 10 simulated Codeforces contests, each with over 5,000 participants, AlphaCode placed on average in the top 54.3%. This gives an estimated rating of 1238, which puts it in the top 28% of users active in the previous 6 months.
- On held-out CodeContests problems, the best model solves 34.2% with at most 10 submissions per problem. Earlier reported solve rates on existing benchmarks such as APPS were roughly 1–5%.
- In existing datasets, 30–60% of programs that pass all tests are actually incorrect. The extra tests in CodeContests cut this false positive rate to about 4%.
- The authors name three components as critical: the clean CodeContests dataset, large transformer models that are efficient to sample from, and massive sampling followed by filtering and clustering.
- Analysis found no evidence that AlphaCode copies key parts of solutions from its training data. A stripped-down version of the model performs about as well as Codex.
Cited by
- SantaCoder: don't reach for the stars!
- Qwen Technical Report
- Large Language Monkeys: Scaling Inference Compute with Repeated Sampling
- MLE-bench: Evaluating Machine Learning Agents on Machine Learning Engineering
- Towards Reasoning Era: A Survey of Long Chain-of-Thought for Reasoning Large Language Models
- Process Reinforcement through Implicit Rewards
- Improving Factuality and Reasoning in Language Models through Multiagent Debate
- Gemini: A Family of Highly Capable Multimodal Models
- CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution
- OpenThoughts: Data Recipes for Reasoning Models
- Reinforced Self-Training (ReST) for Language Modeling
- MetaGPT: Meta Programming for A Multi-Agent Collaborative Framework
- LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Code
- Draft, Sketch, and Prove: Guiding Formal Theorem Provers with Informal Proofs
- A Survey on Large Language Models for Code Generation
- SWE-bench: Can Language Models Resolve Real-World GitHub Issues?
- Challenges and Applications of Large Language Models
- CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning
- Solving Quantitative Reasoning Problems with Language Models
- AgentBench: Evaluating LLMs as Agents
- Trustworthy LLMs: a Survey and Guideline for Evaluating Large Language Models' Alignment
- Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation
- A Comprehensive Overview of Large Language Models
- LEVER: Learning to Verify Language-to-Code Generation with Execution
- AlphaEvolve: A coding agent for scientific and algorithmic discovery
- KernelBench: Can LLMs Write Efficient GPU Kernels?
- Gorilla: Large Language Model Connected with Massive APIs
- Automatic Prompt Optimization with ``Gradient Descent'' and Beam Search
- Code Llama: Open Foundation Models for Code
- Reflexion: Language Agents with Verbal Reinforcement Learning
- Can LLMs Generate Novel Research Ideas? A Large-Scale Human Study with 100+ NLP Researchers
- Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them
- Aya Model: An Instruction Finetuned Open-Access Multilingual Language Model
- Long-form factuality in large language models
- Autoformalization with Large Language Models
- LIMO: Less is More for Reasoning
- ReST-MCTS*: LLM Self-Training via Process Reward Guided Tree Search
- A Survey of Large Language Models
- CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X
- LMSYS-Chat-1M: A Large-Scale Real-World LLM Conversation Dataset
- SGLang: Efficient Execution of Structured Language Model Programs
- Large Language Models Are Human-Level Prompt Engineers
- BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructions
Cite
@misc{li2022competition,
title = {{Competition-Level Code Generation with AlphaCode}},
author = {Li, Yujia and Choi, David and Chung, Junyoung and Kushman, Nate and Schrittwieser, Julian and Leblond, Rémi and Eccles, Tom and Keeling, James and Gimeno, Felix and Lago, Agustin Dal and Hubert, Thomas and Choy, Peter and d'Autume, Cyprien de Masson and Babuschkin, Igor and Chen, Xinyun and Huang, Po-Sen and Welbl, Johannes and Gowal, Sven and Cherepanov, Alexey and Molloy, James and Mankowitz, Daniel J. and Robson, Esme Sutherland and Kohli, Pushmeet and Freitas, Nando de and Kavukcuoglu, Koray and Vinyals, Oriol},
year = {2022},
doi = {10.1126/science.abq1158},
eprint = {2203.07814},
archivePrefix = {arXiv},
url = {https://doi.org/10.1126/science.abq1158}
}References
- Albert Ziegler. Research recitation: A first look at rote learning in GitHub Copilot suggestions. https://docs.github.com/en/github/copilot/research-recitation , 2021. Accessed: 2022-01-13. ↗
- M. Allamanis. The adverse effects of code duplication in machine learning models of code. In Proceedings of the 2019 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software, pages 143–153, 2019. find
- J. Austin, A. Odena, M. Nye, M. Bosma, H. Michalewski, D. Dohan, E. Jiang, C. Cai, M. Terry, Q. Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021. find our card
- G. A. Aye, S. Kim, and H. Li. Learning autocompletion from real-world datasets. In 2021 IEEE/ACM 43rd International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP), pages 131–139. find
- M. Balog, A. L. Gaunt, M. Brockschmidt, S. Nowozin, and D. Tarlow. DeepCoder: Learning to write programs. arXiv preprint arXiv:1611.01989, 2016. find
- S. Borgeaud, A. Mensch, J. Hoffmann, T. Cai, E. Rutherford, K. Millican, G. van den Driessche, J.-B. Lespiau, B. Damoc, A. Clark, D. de Las Casas, A. Guy, J. Menick, R. Ring, T. Hennigan, S. Huang, L. Maggiore, C. Jones, A. Cassirer, A. Brock, M. Paganini, G. Irving, O. Vinyals, S. Osindero, K. Simo… find
- J. Bradbury, R. Frostig, P. Hawkins, M. J. Johnson, C. Leary, D. Maclaurin, G. Necula, A. Paszke, J. VanderPlas, S. Wanderman-Milne, and Q. Zhang. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax . ↗
- T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. find
- M. Bruch, M. Monperrus, and M. Mezini. Learning from examples to improve code completion systems. In Proceedings of the 7th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering, pages 213–222, 2009. \#\# 14 Work conducte… find
- E. Caballero, OpenAI, and I. Sutskever. Description2Code Dataset, 8 2016. URL https://github. com/ethancaballero/description2code . find
- N. Carlini, F. Tramer, E. Wallace, M. Jagielski, A. Herbert-Voss, K. Lee, A. Roberts, T. Brown, D. Song, U. Erlingsson, et al. Extracting training data from large language models. In 30th USENIX Security Symposium (USENIX Security 21), pages 2633–2650, 2021. find our card
- M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. d. O. Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph, G. Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021. find our card
- C. B. Clement, D. Drain, J. Timcheck, A. Svyatkovskiy, and N. Sundaresan. PyMT5: multi-mode translation of natural language and Python code with transformers. arXiv preprint arXiv:2010.03150, 2020. find
- K. Cobbe, V. Kosaraju, M. Bavarian, J. Hilton, R. Nakano, C. Hesse, and J. Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. find our card
- R. Dabre and A. Fujita. Softmax tempering for training neural machine translation models. arXiv prepring arXiv:2009.09372, 2020. — [arXiv:2009.09372](https://arxiv.org/abs/2009.09372) find
- J. Devlin, J. Uesato, S. Bhupatiraju, R. Singh, A.-r. Mohamed, and P. Kohli. RobustFill: Neural program learning under noisy I/O. In International conference on machine learning, pages 990–998. PMLR, 2017. find
- J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. find
- I. Drori and N. Verma. Solving linear algebra by program synthesis. arXiv preprint arXiv:2111.08171, 2021. — [arXiv:2111.08171](https://arxiv.org/abs/2111.08171) find
- A. Ebtekar. How to interpret contest ratings. https://codeforces.com/blog/entry/68288 , 2021. Accessed: 2021-12-04. ↗
- S. Edunov, M. Ott, M. Auli, and D. Grangier. Understanding back-translation at scale. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 489–500, Brussels, Belgium, Oct.-Nov. 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1045. URL… find
- Facebook Hacker Cup. Facebook hacker cup. https://www.facebook.com/ codingcompetitions/hacker-cup , 2021. Accessed: 2021-12-09. ↗
- A. Fan, M. Lewis, and Y. Dauphin. Hierarchical neural story generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), 2018. find
- Z. Feng, D. Guo, D. Tang, N. Duan, X. Feng, M. Gong, L. Shou, B. Qin, T. Liu, D. Jiang, et al. CodeBERT: a pre-trained model for programming and natural languages. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, pages 1536–1547, 2020. find our card
- J. Ganitkevitch, B. Van Durme, and C. Callison-Burch. PPDB: The paraphrase database. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 758–764, Atlanta, Georgia, June 2013. Association for Computat… find our card
- D. gal Gershgorn. ground. GitHub’s automatic coding tool rests on untested le-https://www.theverge.com/2021/7/7/22561180/ github-copilot-legal-copyright-fair-use-public-code , 2021. Accessed: 2022-01-10. find
- Google Code Jam. Google Code Jam. codejam , 2021. Accessed: 2021-12-09. https://codingcompetitions.withgoogle.com/ ↗
- C. C. Green. Application of theorem proving to problem solving. In IJCAI, 1969. find
- S. Gulwani. Automating string processing in spreadsheets using input-output examples. ACM Sigplan Notices, 46(1):317–330, 2011. find
- S. Gulwani, O. Polozov, R. Singh, et al. Program synthesis. Foundations and Trends® in Programming Languages, 4(1-2):1–119, 2017. find
- D. Guo, A. Svyatkovskiy, J. Yin, N. Duan, M. Brockschmidt, and M. Allamanis. Learning to generate code sketches. arXiv preprint arXiv:2106.10158, 2021. — [arXiv:2106.10158](https://arxiv.org/abs/2106.10158) find
- D. Hendrycks, S. Basart, S. Kadavath, M. Mazeika, A. Arora, E. Guo, C. Burns, S. Puranik, H. He, D. Song, et al. Measuring coding challenge competence with APPS. arXiv preprint arXiv:2105.09938, 2021. find our card
- T. Hennigan, T. Cai, T. Norman, and I. Babuschkin. Haiku: Sonnet for JAX, 2020. URL http: //github.com/deepmind/dm-haiku . find
- A. Hindle, E. T. Barr, Z. Su, M. Gabel, and P. Devanbu. On the naturalness of software. In Proceedings of the 34th International Conference on Software Engineering, pages 837–847, 2012. find
- A. Holtzman, J. Buys, L. Du, M. Forbes, and Y. Choi. The curious case of neural text degeneration. In Proceedings of the 7 𝑡ℎ International Conference on Learning Representations (ICLR), 2019. find