code generation
Code generation is when artificial intelligence writes program code from a request phrased in everyday language, which the human must then verify.
In plain terms
Imagine giving a carpenter not a technical drawing, but just saying: "I need a shelf in the corner, with three levels, space for a flower on top." The carpenter then designs, cuts, and assembles it. Code generation is the same in the world of software: you say what you want, and the machine writes the program for it. You must still check the result, just like the shelf, before you load it up.
Previously, programming required learning a programming language, like a foreign language. Today, a language model creates code written in a programming language from a request described in Hungarian or English. Thus, even someone who never learned programming can create a simple website, small utility, or application.
A useful accelerator even for professionals: developers can delegate routine tasks to the machine while focusing on planning and review. However, responsibility remains with the human: code written by the machine can be just as faulty as human-written code, only produced much faster.
How it works
- The language model is trained on vast amounts of public code and text, then given separate practice at writing code, for example by receiving a reward when the code it writes passes tests.
- You describe what you want: in a single sentence, a detailed description, or even a partial code snippet.
- The model predicts the most likely continuation piece by piece based on the request and existing code, assembling the program from these predictions.
- In more advanced tools, a coding agent runs the code, checks error messages, and keeps fixing it until the tests pass.
- At the end, a human must review the result: whether it does what you asked, is safe, and fits with the rest of the system.
An everyday example
You have an Excel spreadsheet with your monthly expenses, and you ask the chatbot: 'write a small program that sums them up by category and shows them on a chart'. Half a minute later, you receive code that you copy and run. If it does not work, you send back the error message, and the machine fixes it.
Who is affected
A common misconception
Limits and risks
- Generated code can look convincing even if it is flawed, so do not trust it without testing and review.
- Security vulnerabilities can be introduced, such as poorly handled passwords. The model sometimes invents non-existent software packages, and if someone maliciously registers that name, the code could download a harmful package.
- In large, long-term systems, the model may not grasp the whole picture, potentially offering a solution that does not fit other parts.
- If you do not understand what the machine wrote, it will be difficult to fix or expand later, and before sharing company data, you must clarify what is allowed to be entered into the tool.
Similar, but not the same
- code completion – Code completion suggests the end of a line or block while typing, whereas code generation creates a full function, file, or program from a description.
- coding agent – Code generation is writing code itself, while a coding agent additionally plans, runs, tests, and fixes independently in multiple steps.
- no-code development – In no-code tools, you assemble the application by clicking together pre-made elements, while code generation provides real, freely editable source code.
Related concepts
generative AI, software development, automation
code completion, test generation, code translation
coding agent, vibe coding, large language model, prompt, code verification, hallucination
A brief history
Automatic program generation is a long-standing goal in computer science, but its current form based on language models became widely known in 2021: GitHub Copilot was introduced in June, and in the summer, OpenAI revealed the Codex model running beneath it. After ChatGPT's launch at the end of 2022, laypeople began mass-requesting code from chatbots.
Where things stand
By the end of 2026, code generation has become a daily tool for developers, and the focus has shifted from individual code snippets to coding agents that independently perform entire tasks. The main question is now how to reliably verify code written by machines.
In the news
- Survey: 67% of developers use AI for code generation, 61% for debugging, only 20% in productionNov 7, 2026 · Code
- OpenAI shows better code generation in low-resource languages and for COBOL migrationOct 19, 2026 · Code
- Nearly 75% of Google's code is now written by AI, but speed-up lagsOct 16, 2026 · Code
- Tampere University: lessons from GitHub Copilot training projects on adopting AI code generationOct 12, 2026 · Code
- Microsoft rebuilds Copilot as an agent-based 'super app' for business usersSep 22, 2026 · Agent Age
- After AI code generation, verification is the bottleneck: more commits, not proportionally more releasesSep 21, 2026 · Code
- New study finds 43% security flaw rate in AI coding toolsAug 10, 2026 · Code
Also known as
code generation · code generation · code generation · codegen · AI code generation · automatic code generation · AI code generation · AI-based code generation
Sources
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.