Should you let AI write production code? What the evidence actually says
By Validure team · · 14 min read
A contested question with both sides at full strength. The productivity studies that say yes, the security studies that say no, the context that separates the two, and the decision framework and the review-time arithmetic for letting AI draft code without letting it merge on its own.

A 5-person team at a software company does something that looks reasonable on paper: they turn on an AI coding assistant for everyone, they point it at the company's own codebase, and they tell the team to let it open pull requests. Within a month, the team is shipping faster on the easy stuff. Within two months, an incident report shows up: a function that handled a payment callback had a missing input check, it came from one of the assistant's merges, and nobody had read it line by line because, as one engineer put it in the post-mortem, "the diff looked right."
That post-mortem is the whole argument in one sentence. This is not a yes or no question. It is a question about which kinds of code you let a machine draft, and what a human does between the draft and the merge. We'll put both sides at full strength, look at what the controlled studies actually measured, and end with a decision you can apply on Monday.
We build software and we use these tools ourselves, so we have an interest in the answer. We say so up front because it does not come free, and we try to keep the two things separate below.
First, split the question in two
"There, let AI write production code" collapses two different claims, and most of the disagreement is people arguing past each other on which one they mean.
The first: AI drafts code. The engineer reads it, changes it, tests it, and merges it when they are ready. The human is still the author; the tool is a very fast first draft. This is the version almost every team already does.
The second: AI merges code on its own. No required human read of the diff, or a skim at best, and the pull request lands in production because a model decided it was fine. This is the version the post-mortem above describes.
Everything below is about where to draw the line between these two, and what that line looks like in practice. Settle that, and the rest mostly follows.
The yes side: where the speed is real
The strongest productivity result is a controlled experiment run on GitHub's own platform. A group of developers implemented a JavaScript HTTP server with an AI pair programmer, and the treatment group finished about 56 per cent faster than the control group. That is a real, large effect, not a vibes number. It is why "AI writes code faster" is not hype when it is about the right shape of task.
But read the study before you quote it. The task was a single, well-specified piece of work: build this component, here are the requirements, here is the acceptance test. That is the shape of task where a model is strongest. And the gain was not spread evenly across people. The researchers found it was driven mostly by less experienced developers, while experienced developers got little to no lift. So "56 per cent faster" is not "everyone is 56 per cent faster." It is "on a well-defined task, a team with room to learn moves substantially faster."
The second result is less about speed and more about the cost of the alternative. If a task takes a junior two days and the assistant produces a correct first draft in twenty minutes, the human time moves from "write it" to "check it." That is a real saving, and it is the version of the question most teams should say yes to.
The no side: what the security studies measured
Here is the counterweight, and it is not "AI code is sketchy." It is specific, measured findings.
In a user study from ACM CCS 2023, participants who had access to an AI code assistant wrote significantly less secure code than participants who did not, and they were more likely to believe their own code was secure. That second finding is the one that should worry you more than the first. The tool made the code weaker, and it made the author less able to tell. Confidence rose while quality fell, and the two did not move together.
In a study accepted to the IEEE Symposium on Security and Privacy, researchers prompted an assistant across 89 security-relevant scenarios, producing 1,689 programs. Roughly 40 per cent of those contained at least one security vulnerability. Two hedges matter. The scenarios were security-focused, so 40 per cent is a floor for the code you would want safe, not a figure for all code. And the language was C, where pointers and array handling make security bugs easy to introduce and hard to spot. Read the number as "in a hard, security-sensitive setting, a 2021 era assistant produced a vulnerable program about two times out of five," not "40 per cent of everything AI writes is broken."
A 2025 industry report from Veracode tested more than 100,000 code samples across 80 plus models and found roughly 45 per cent failed its security tests. That is a vendor benchmark, so treat it as a direction of travel, not a fact, and verify it against the report before you build a decision on it. The point it adds is that this has not gotten better just because the models got bigger. Scale alone is not a substitute for a check.
The context that separates the two sides
Here is where the two bodies of evidence stop contradicting each other, because they are measuring different things.
The productivity study used a well-defined, single component task. The METR slowdown study in 2025 used experienced open-source developers on their own codebase, on 246 real issues. Those developers expected the tools to make them 24 per cent faster. They were 19 per cent slower. That gap is not a measurement error. It is the difference between a clean, specified task and a messy, long-lived codebase where the tool has to guess intent, and often produces plausible-looking changes that are subtly wrong and slow to review.
That gap is the whole post. On a greenfield component with a tight spec, the assistant is a real speedup. On your own codebase, with history and hidden invariants, it can be a net drag even when the output looks right. So the answer depends on which of those two shapes of work you are describing.

A position, labelled
Our position: let AI draft, don't let AI merge. The boundary is not "is the tool clever enough." The boundary is "is there a check between the draft and production that does not depend on the model's self-assessment." A model that says "this looks fine" is not a check. A test suite that fails when the input check is missing is. A person who reads the diff before clicking merge is. The model's confidence is the one input in the loop that the security study showed you should not rely on.
That is an opinion and it is ours. It is where the evidence points for a team that wants the speed without the incident, and we say it plainly because we are the ones who would be quoted otherwise.
When it is clearly fine, and when it is clearly not
Not every piece of code is the same risk. The framework below is the one we would apply, and it is a decision table, not a list of rules to debate.
| Kind of change | Let AI draft | Gate on tests only | Require a human read of the diff |
|---|---|---|---|
| Boilerplate, fixtures, test scaffolding, docs-as-code | yes | yes | no, sample it |
| New feature in a well-specified module with a good test suite | yes | yes | spot-check the hard parts |
| Auth, payment, data handling, anything a user's money or identity flows through | no, draft only | no | yes, line by line, by someone who knows the domain |
| A change to a dependency, a build, or anything that ships to production on its own | no | no | yes, and pin it |
The last column is not a punishment. It is where the "AI wrote it" claim does the most damage, because it is where the reviewer's instinct is weakest. An engineer reviewing a payment callback is more likely to skim a diff that a tool produced, precisely because the tool's output looks confident. That is the confidence effect from the security study, arriving on the reviewer side. So the rule for the highest-risk rows is the opposite of the one you would pick on a clean task: the more the tool can do, the more a specific human has to read.
The arithmetic of "AI wrote it" moving the work, not removing it
This is the check the teams in the post-mortem never ran. Let it be an example, not data.
Say the assistant opens 100 pull requests a week for your team, and say a human review pass on one of those diffs takes 20 minutes, because the right move is to read it the way you would not trust your own first draft. That is 2,000 minutes, or about 33 hours a week of human reading. None of the "we are now 56 per cent faster" math includes that. The tool did not remove the human work. It moved it from writing to reviewing, and made the reviewing slower, because the code is plausible enough that you cannot skip it.
So the decision is not "does AI save time." It is "does the time it saves on drafting exceed the time it adds on reviewing plus the cost of the mistakes that slip through." For boilerplate it does, and the table above says you can sample instead of read. For the payment callback it does not, and the table says you read it line by line. Same decision, different numbers plugged in.
The controls, in one checklist
If you let AI draft, the guardrails are nearly the same every time. This is the checklist we would put on the wall, and it is the shape a secure-software-development framework like NIST SP 800-218 points toward: a human reviews, automated tests run, the change is traceable, and vulnerabilities are caught continuously rather than hoped away.

| Check | What to look for | What a fail means |
|---|---|---|
| The tool does not hold prod or secret access | The assistant's environment cannot read keys, cannot reach the production database, cannot push to a release branch | A fail here means the tool can do damage a review would never see |
| Every change lands through the same gate as human code | No "AI fast path" that skips CI | A fast path is where the un-reviewed merge lives |
| Tests are the gate, not the model's summary | The build fails on the missing check, not on the tool saying it is fine | If the gate is the tool's opinion, the gate is the thing the study says you cannot trust |
| The diff is read by a person for high-risk rows | A named human reads the payment, auth and data code | The confidence effect means a skim is worse than it looks |
| You measure after a month | How many AI-drafted PRs needed a revert or a post-merge fix | If the number climbs, the drafting is doing more work than the team is catching |
The last row is the one that turns the debate into a decision. You can settle it empirically in your own codebase in a month. You do not have to argue it.
Where we don't need a system, and where we do
One honest line, because the question gets over-applied. If you are a one or two person shop shipping a small internal tool, the whole framework is a lot of machinery for a small amount of risk. Let the assistant draft, you read it, you ship it. That is the entire policy, and it is enough. The checklist earns its keep when you have more than a couple of people, when the code touches money or identity, or when the assistant is writing into a shared codebase that outlives any one session.
Sources and checks
The numbers above come from the primary sources below. Studies of AI code change fast, and a figure that was true in a 2021 era model is not a forecast for the model you will use next quarter, so check the current versions before you build a policy on a single number.
- Peng et al., "The Impact of AI on Developer Productivity: Evidence from GitHub Copilot," arXiv 2302.06590, for the 56 per cent figure on a well-defined task and the finding that the gain was driven by less experienced developers.
- METR, "Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity," 2025, for the 19 per cent slower result against a 24 per cent expectation, on 246 real issues.
- Perry et al., "Do Users Write More Insecure Code with AI Assistants?", ACM CCS 2023, for the finding that assistant users wrote less secure code and were more confident it was secure.
- Sandoval, Pearce et al., "Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions," IEEE S&P 2022, for the 89 scenarios, 1,689 programs and the roughly 40 per cent vulnerable result in a security-focused, C-language setting.
- Veracode, 2025 State of Software Security, for the roughly 45 per cent failure figure. This is a vendor benchmark, so verify it against the report.
- NIST SP 800-218, the Secure Software Development Framework, for the shape of the controls: human review, automated testing, provenance, continuous monitoring.
The worked numbers are examples, not measurements. The opinion is ours and is labelled as such. This is not security, legal or investment advice. For a specific posture, talk to the person who owns the risk.
Frequently asked questions
Can I just let the AI merge its own pull requests?
No, not as a general rule. The one input in the loop the security study showed you cannot rely on is the model's own confidence. A merge is a check that does not depend on that confidence: a test that fails, or a person who reads the diff. For low-risk boilerplate you can relax to sampling. For anything that touches money, identity or a release, a named human approves the merge.
Is AI code inherently unsafe?
No. The studies say a 2021 era assistant produced a vulnerable program about two times out of five in a hard, security-focused setting, and that users got more confident while the code got weaker. That is a property of the loop, not a verdict on the tool. With the gate in place, the tool is a fast first draft. Without it, it is a fast way to ship an unreviewed change.
Who is the speedup actually for?
In the controlled study, the 56 per cent gain was driven mostly by less experienced developers, while experienced developers got little lift. On well-specified tasks the whole team moves faster. On a messy codebase the experienced developers can go slower, which is why the context, not the tool, decides the answer.
How do I know which code needs a human read?
Use the decision table. Boilerplate and scaffolding: sample it. A new feature behind a good test suite: spot-check the hard parts. Auth, payment, data handling and anything that ships on its own: read it line by line, by someone who knows the domain. The rule is the opposite of your instinct on a clean task: the more the tool can do, the more a specific human has to read.
Does bigger model fix the security problem?
Not by itself. The 2025 industry report found roughly 45 per cent of samples across 80 plus models still failed its tests, which is a sign that scale did not close the gap. Treat a bigger model as a better draft, not as a check. The check is the test, the gate and the human.
What is the one number I should track?
The revert or post-merge fix rate on AI-drafted pull requests. If it is low and falling, the drafting is worth what you pay in review time. If it is climbing, the tool is doing more work than your team is catching, and you pull the line back toward human-read-only.
