Skip to content

Code Generation

Write runnable code straight from a description

Code & softwareBeginner#33
inTextCode

What this capability means

Takes a description — write a function that reads a CSV into a list of dicts and skips blank lines — and outputs the corresponding source. Unlike code completion it targets a new feature or a whole piece of logic, usually written from scratch; unlike reasoning the deliverable is compilable, runnable code rather than a textual conclusion.

How it is done

The base is a language model pre-trained on large code corpora; strict syntax makes code easier to verify by execution than prose, so unit-test pass signals work well as reward for reinforcement learning or rejection-sampling fine-tuning. Training and evaluation use problems with test cases such as HumanEval and MBPP, and generation can sample several candidates and discard the ones that fail.

Representative products

11

OpenAI

GPT-4o

A natively multimodal general model, with text, image and audio through one door

4Caps
Model Closed
TextImageAudioTextAudio
2024

Anthropic

Claude

A general chat model known for long context and safety alignment

4Caps
Model Closed
TextImageText
2023

DeepSeek

DeepSeek-V3

An open-weight MoE with 671B parameters, activating 37B per token

4Caps
Model Open weights
TextText
2024

Alibaba (Qwen)

Qwen

An open-weight family spanning many sizes, with multimodal versions

4Caps
Model Open weights
TextImageText
2023

Google DeepMind

Gemini

A natively multimodal general model built for very long context

4Caps
Model Closed
TextImageAudioVideoText
2023

Microsoft

GitHub Copilot

Completing and rewriting code in your editor from context

2Caps
Tool Freemium
TextCodeCode
2021

OpenAI

o3

It reasons at length before answering, trading inference-time compute for steadier accuracy

3Caps
Model Closed
TextImageText
2025

Anthropic

Claude Code

A coding agent that carries out multi-step tasks from the terminal

3Caps
Tool Closed
TextCodeCode
2025

DeepSeek

DeepSeek-R1

A reasoning model trained with RL on chains of thought, its weights open under the MIT licence

4Caps
Model Open weights
TextText
2025

Cognition (Devin)

Devin

An autonomous coding agent with its own shell, editor and browser

4Caps
App Closed
TextCodeCode
2024

Anysphere (Cursor)

Cursor

A desktop code editor that treats the whole repository as context

3Caps
App Freemium
TextCodeCode
2023

Organizations involved

Typical uses

  • New features and utility scripts
  • Data cleaning and transformation scripts
  • Test cases and project scaffolding
  • Porting code across languages and frameworks

How it is evaluated

pass@k
Share of problems with at least one sample passing all tests out of k
Benchmark pass rate
Pass rate on fixed sets such as HumanEval
Compile and lint pass rate
Whether generated code passes the compiler and type checks as-is

Limits and hard parts

  • It invents libraries or methods, producing plausible interfaces that do not exist
  • Code can pass unit tests yet leave holes in edge cases, error handling and security
  • Multi-file changes are inconsistent, with call sites disagreeing with definitions

Concepts behind it

NLP & Large Language Models

Transformer ArchitectureIntermediate

Replacing word-by-word relay with a room where everyone speaks at once, so long-range dependencies are one hop away

4Linked
Figures 2 · Data 2

NLP & Large Language Models

Pretraining & Fine-tuningIntermediate

Learn language first from vast unlabelled text, then specialise with little data — the most data-efficient paradigm in modern AI

5Linked
Figures 1 · Data 1

NLP & Large Language Models

Prompting & AlignmentExpert

Making a model helpful, honest and harmless is harder than simply making it bigger

4Linked
Figures 1 · Data 1