AlphaCode is a system for competitive code generation that achieves top 54.3% performance on average in competitions with over 5,000 participants. It uses a large transformer model pre-trained on GitHub code and fine-tuned on a competitive programming dataset. During fine-tuning, it employs techniques like tempering and GOLD to focus on precision over recall. At test time, it generates a large number of samples, filters them based on example tests, and clusters similar programs to select submissions. Extensive evaluations on CodeContests and APPS benchmarks show AlphaCode's performance scales log-linearly with more samples and compute.