AI Trained on Old Code Could Be Making Mistakes—Here's Why
Your favorite coding assistant might be learning from outdated code, and it's costing you time.
When companies train AI to write code, they often feed it the entire history of a software project—every change ever made. A new study shows this history is highly repetitive: a typical project contains the equivalent of 19 copies of its current code, and mature projects have 89 copies. That's because most edits change only a few lines, leaving the rest of the file the same. So even though each version is slightly different, they're mostly identical.
To reduce repetition, AI trainers use deduplication—a process that groups near-identical files and keeps just one. But the study found that in many tools, the version kept is often an old one, because the selection rule ignores dates. That means AI could learn from outdated code, leading to suggestions that are inefficient or even buggy. The fix: sort versions newest first before deduplicating, which is easy and cheap.
Another problem is benchmark contamination. Benchmarks like SWE-bench test AI on real bug fixes, but those fixes appear in many later versions of the files they changed. So if you train on history, you might accidentally include the answers, making the AI look smarter than it is. To avoid this, you need a separate step that checks every version for benchmark fixes.
The study's authors release a set of rules and tools for teams that train on code history. For everyday users, this means the AI coding assistants you use could be giving you outdated advice—but with these fixes, they can be more accurate and up-to-date.
- Code history is highly repetitive—a typical project has 19 copies of its current code.
- Deduplication tools often keep old versions, so AI may learn outdated coding practices.
- Benchmark answers persist in many versions, so testing AI requires careful checking.
Why It Matters
AI coding tools might suggest outdated code, wasting your time and causing bugs—but simple fixes can make them more reliable.