Why Are Large Language Models So Good at Coding
This article explains why large language models have recently made sharp gains in coding tasks, breaking down four main drivers: highly structured code data, executable feedback in training, inference-time compute, and tool-based closed loops. It also argues that ranking models by a single benchmark score is misleading, and offers a practical framework for choosing models by scenario, along with engineering practices for observability and rollback. Readers will learn how to map evaluation dimensions to their own workflows and make cost, latency, and compliance part of the decision.
Introduction: The Score That Made the Industry Pause
In late May 2026, an overseas model family released a new version that scored 88.6% on a benchmark for fixing defects in real open-source projects. A year earlier, the best score on comparable benchmarks was just above 60%. What made the industry fall silent was not that it proved “machines can write code,” but that it came close to a more sensitive question: can AI take over part of the daily work of a junior software engineer?
This benchmark does not test algorithm puzzles. Given a real repository, a defect description, and a set of test cases, the model must locate, modify, and verify the fix on its own. Because it is tightly coupled with engineering practice, score changes are quickly translated into discussions about replacing human labor. But treating a single score as the full picture of capability is a classic case of overgeneralization. This article answers two questions: why coding capability has surged recently, and how to make a reasonable selection when there is no single answer.
1. Four Sources of Strong Coding Capability
1. Data: Code Is the Most “Structured” Corpus in Nature
Code carries both natural-language explanations (comments, documentation, commit messages) and strict syntactic structure, along with a large number of “input-output” pairs: test cases, type signatures, and example calls. This density of self-supervised signal is far higher than that of ordinary text, allowing models to obtain a large amount of verifiable training signal without relying on human annotation.
2. Training Objective: From “Looking Like Code” to “Running Successfully”
Early models optimized for next-token prediction and produced code that “looked right.” Current mainstream approaches introduce executable feedback, using the results of compilation, static checks, and unit tests as reward signals, shifting the optimization target from surface similarity to functional correctness. This is one of the core reasons for the score jump: the model learned a loop of “assume first, then verify, then fix.”
3. Inference-Time Compute: Trading Thinking Time for Accuracy
With the same model, allowing a longer reasoning budget, more sampling, and self-checking can make a significant difference in results. Common engineering practices include: having the model first produce a plan and risk points, then generate a patch; generating multiple candidates for the same task and selecting the one with the highest test pass rate; and feeding error logs back for retries on failure. These are all forms of “trading compute for quality,” and they are the main reason different products perform differently on the same model.
4. Tool Closed Loop: From Code Completion to Repository-Level Operations
Real fixes require reading files, searching symbols, running commands, checking logs, and then changing code. Giving the model tools for retrieval, execution, logs, and monitoring alerts to form a closed loop is the key to moving from “snippet generation” to “task completion.” Illustrative pseudocode:
# Pseudocode: closed-loop flow for defect fixingtask = load_issue(issue_id)ctx = retrieve_context(task.repo, task.hint) # retrieve relevant files and symbolsplan = model.plan(task, ctx) # produce a plan and impact scope firstfor attempt in range(3):patch = model.generate_patch(task, ctx, plan)result = run_tests(patch) # compile + unit testsif result.passed:return patchctx = append_logs(ctx, result.logs) # feed failure logs backplan = model.revise_plan(plan, result.logs)return escalate_to_human(task)
2. Why “Which Model Is the Best” Is the Wrong Question
Putting scores from different dimensions into a single ranking table obscures three things.
First, the benchmarks measure different constructs. Software engineering benchmarks measure long-chain task completion; PhD-level scientific reasoning benchmarks measure the boundaries of domain knowledge; competitive programming benchmarks measure algorithms and implementation speed; Chinese comprehensive knowledge benchmarks measure coverage of local context. They are weakly correlated with one another, so a model leading in one dimension cannot be extrapolated to all scenarios.
Second, versions and reasoning modes are inconsistent. The score gap for the same model between “fast response” and “deep reasoning” modes is often larger than the gap between different models; records for the same model from different sources may also differ, some being official evaluations and others third-party summaries.
Third, scores are not proportional to cost. The per-unit cost of a top-of-leaderboard model may be several times that of a mid-tier model, while the benefit curve of most business tasks flattens quickly after a certain level.
So the right question is: in what scenario, by what standard, and at what price.
3. A Practical Framework for Scenario-Based Selection
- Repository-level defect fixing and refactoring: prioritize long-context stability, tool-call success rate, and self-recovery from failures, rather than a single algorithm score.
- High-concurrency online completion: prioritize first-token latency and unit cost; a slight drop in quality is acceptable because developers will edit the output a second time.
- Strong compliance and data residency: prioritize private deployment and audit capabilities; model scores become secondary.
- Chinese business and local knowledge: prioritize Chinese comprehensive knowledge and terminology consistency evaluations.
- High-risk domains (finance, healthcare): human review and traceable logs must be added on top; the model serves only as an accelerator.
An example of a reusable scoring function:
def score(candidate, weights):return (weights["quality"] * candidate.task_pass_rate+ weights["latency"] * (1 - candidate.p95_latency / SLA)+ weights["cost"] * (1 - candidate.unit_cost / BUDGET)+ weights["compliance"] * candidate.audit_ready)
4. Putting Capability into Engineering: Observability and Rollback
After adopting AI coding tools, what really determines the payoff is the engineering setup, not the model itself. At a minimum, you should have: a unified calling gateway for canary releases and fallback; full-chain logging and metrics (adoption rate, first-pass rate, rollback rate); version control for prompts and patches; the same static checks, tests, and reviews for generated code as for human-written code; and a clear threshold for human takeover. If you use general-purpose cloud capabilities, you can store build artifacts in object storage, use a message queue to smooth out spikes, run execution sandboxes on a container platform, and use logging and monitoring services to form a feedback loop.
You should also establish “counterintuitive metrics”: if the adoption rate rises but the rollback rate rises at the same time, the model is creating rework; if the first-pass rate rises but review time stays the same, the bottleneck is in the process rather than the model.
5. Conclusion
The leap in coding capability comes from the combination of structured corpora, executable feedback, inference-time compute, and tool closed loops, not from a single breakthrough. Faced with a flood of leaderboards, the rational approach is to map evaluation dimensions to your own business workflow, continuously calibrate with observable metrics, and bring cost, latency, and compliance into the decision function alongside quality. Tools will keep getting stronger, but selection and engineering capability are the real moat for a team.
