Long-Horizon Coding Capabilities of Chinese LLMs: From One-Shot Correctness to Iterative Engineering
This article examines how coding benchmarks for large language models are shifting from single-response accuracy toward long-horizon task completion. It explains the four core capabilities behind long-horizon performance, how to read a multi-dimensional capability matrix beyond aggregate scores, and a real execution chain from a vector retrieval optimization task. It also covers how to integrate these capabilities into existing development workflows, along with the key limitations and guardrails needed to make them reliable.
1. From “Getting It Right Once” to “Iterating Continuously”: A Shift in How We Evaluate Coding
For the past two years, most discussions about code generation have rested on an implicit assumption: a model should produce the correct answer in a single response. Whether the task is function-level completion or bug fixing, the scoring logic is essentially exam-style—given an input, compare the output, and award points for a correct answer. This approach is easy to automate, but it diverges significantly from real software engineering.
Real engineering tasks are rarely finished in one pass. A performance optimization request typically involves a cycle: establish a baseline, locate the bottleneck, form a hypothesis, modify the implementation, run benchmarks, analyze results, and adjust the approach. This loop can last hours or even days, with failures, rollbacks, and strategy switches along the way. So when measuring whether a coding agent is “close to engineering-ready,” the key metric is shifting from single-shot accuracy to the ability to complete long-horizon tasks.
A long-horizon task can be defined as follows: with no clear termination signal and a need for extensive tool calls and intermediate state maintenance, can the model keep advancing the goal and self-correct along the way? It involves at least four capabilities:
- State retention: remembering constraints, goals, and attempted approaches after hundreds of turns;
- Tool orchestration: reading and writing files, executing commands, running tests, and collecting metrics on demand;
- Strategy adjustment: proactively switching approaches when a path yields diminishing returns, rather than mechanically retrying;
- Convergence judgment: stopping when metrics meet targets or returns saturate, avoiding wasted effort.
2. Beyond Benchmark Scores: How to Read a Multi-Dimensional Capability Matrix
A recent version of a Chinese LLM has achieved near-leading or leading results on several public benchmarks—for example, roughly 58 on a software engineering evaluation, roughly 40 on natural-language-to-full-repository generation, around 63 on a terminal operation benchmark, about 52 on a tool-augmented subject knowledge evaluation, and around 79 on web browsing and task handling. It is worth stressing that specific numbers vary with the evaluation version and tool configuration. Readers should focus on relative position and capability structure rather than memorizing a single figure.
A more sensible interpretation is to build a capability matrix:
- Code correctness: function-level and repository-level generation, assessing syntax, semantics, and dependency completeness;
- Environment interaction: terminal commands, file systems, and process management, assessing the ability to operate in a real workspace;
- Retrieval and verification: search, reading documentation, and running tests, assessing closed-loop verification awareness;
- Long-horizon stability: goal consistency across multiple iterations, assessing whether the model “drifts further off course the longer it runs.”
The value of the matrix is avoiding “total-score worship.” A model that scores slightly lower on repository-level generation but stands out in long-horizon stability may matter more for engineering adoption, because the latter directly determines whether a task can be delivered.
3. Case Breakdown: The Execution Chain of a Long-Horizon Optimization Task
Take vector retrieval performance optimization as an example. The task constraints are usually very clear: maximize queries per second (QPS) while keeping recall no lower than 95%. This kind of task is well suited to testing long-horizon capability because it combines a quantifiable goal, a long feedback chain, and a multi-solution space.
A typical execution chain can be abstracted as:
Establish baseline -> Collect metrics (QPS/recall) -> Attribution analysis (index structure/distance computation/memory layout)-> Form hypothesis -> Make small changes -> Regression validation -> Keep or roll back -> Enter the next round
Public information shows that on this type of task, a model has completed more than 600 iterations and over 6,000 tool calls, raising throughput from about 3,500 to about 21,500—an improvement of nearly 6x. What truly deserves attention is not the multiplier itself, but three behavioral traits during the process:
- Attribution before action: first confirming whether the bottleneck lies in index construction or query-time computation, avoiding blind parameter tuning;
- Small, reversible steps: keeping the granularity of each round’s changes controllable so metrics can be quickly reverted when they degrade;
- No constraint drift: recall, as a hard constraint, is always validated, preventing speed from being traded for accuracy.
At the pseudocode level, this loop is closer to “constrained search” than “one-shot generation”:
best = baseline()while budget_left() and not satisfied(best):hypothesis = propose(best, history)candidate = apply(hypothesis)metrics = evaluate(candidate) # throughput + recall + resourcesif metrics.recall < 0.95:rollback(candidate); continueif metrics.qps > best.qps:best = candidatehistory.append((hypothesis, metrics))
4. Engineering Adoption: Integrating Long-Horizon Capability into Existing R&D Workflows
For enterprises and developers, the capability itself must be engineered and packaged to deliver value. It is recommended to start from four areas:
- Task decomposition and standardized acceptance: rewrite vague requirements into quantifiable acceptance conditions, such as thresholds for throughput, latency, recall, and coverage;
- Sandboxing and observability: run in an isolated environment and uniformly collect logs, metrics, and traces to provide the model with reliable feedback;
- Budget and guardrail mechanisms: set limits on rounds, call counts, duration, and cost, and apply allowlist constraints to high-risk commands;
- Asset accumulation: abstract successful trajectories into reusable scripts, test baselines, and checklists to reduce repeated exploration.
When implementing on the cloud, you can compose general-purpose capabilities into a closed loop: a container platform provides an isolated runtime environment, object storage holds code and artifacts, a message queue decouples long-task scheduling, logging and monitoring/alerting services carry observability, and key management handles credential security. Baidu AI Cloud offers relatively complete product category coverage for these general-purpose capabilities and can serve as an architectural reference, but specific choices should still be based on your own compliance and cost assessment.
5. Limitations and Risks: Do Not Equate Long-Horizon with Reliable
Long-horizon capability also brings new problems. First is error accumulation: early deviations get amplified after hundreds of rounds. Second is goal drift: the model may optimize an easily measured proxy metric while deviating from the true intent. Third is cost uncertainty: resource consumption for long chains of calls is far higher than for single-shot generation. Fourth is reproducibility: differences in tool versions and environments can cause result fluctuations.
Corresponding mitigations include: introducing periodic human review; converting unmeasurable goals into measurable proxies and cross-validating them; setting hard budgets and circuit breakers; and pinning dependency versions and recording complete trajectories for reproducibility.
6. Conclusion
The focus of the coding capability competition is shifting from “whether it is correct on the first pass” to “whether it can keep approaching the goal through long feedback loops.” The practical implication of this shift for developers is that evaluations become closer to delivery, agents can take on more of the tedious, heavy lifting, and human value concentrates on defining goals, setting constraints, and judging results. Understanding the characteristics of long-horizon tasks, the evaluation dimensions, and the engineering guardrails is the prerequisite for genuinely turning this capability into productivity.
