Long-Horizon Task Capabilities of Chinese Coding LLMs: Evaluation, Convergence, and Engineering Practice
This article examines the shift in coding model evaluation from single-shot problem solving to long-horizon task execution, where models must converge toward a clear goal across hundreds of iterations and thousands of tool calls. It defines what long-horizon tasks are, why large state spaces, delayed feedback, coupled constraints, and hidden failures make them harder than short benchmarks, and how convergence can be measured through goal retention, strategy switching, budget efficiency, and rollback safety. Readers will find a capability matrix for evaluation, pseudocode and JSON/YAML examples for constraint gating and guardrails, an anatomy of a hard-constraint performance optimization task, and engineering guidance on external memory, hierarchical planning, sandboxing, observability, and cost control, including how Baidu AI Cloud capability categories can support such a loop.
1. A Counterintuitive Shift: Coding Models Are Moving from Answering Questions to Doing the Work
Over the past two years, the mainstream way to measure a coding model has resembled an exam: hand it a function signature, a defect description, or a test case, and see whether it can produce a correct implementation in one shot. Such evaluations have clear boundaries, automated judging, and low reproduction cost, which is why they have long held the center of the stage. Real software engineering, however, is not a single answer. It is a long chain of localization, hypothesis, verification, backtracking, and redesign.
A recent class of Chinese coding LLMs demonstrates capabilities that point precisely at this long-undervalued direction: within a budget of hundreds of iterations and thousands of tool calls, a model can keep optimizing around a clear objective and proactively switch approaches midway instead of mechanically retrying. This ability to sustain work is closer to engineering reality than a single leaderboard rank, and it is more informative for enterprise adoption. This article does not focus on any specific product. Instead, it abstracts the phenomenon into a reusable technical question: how to build and evaluate long-horizon task capability.
2. What Long-Horizon Tasks Are, and Why They Are the Main Battleground
A long-horizon task is one with a clear objective but an uncertain path, requiring multiple rounds of “execute-observe-correct” before it converges. Its differences from traditional short-horizon evaluation show up in four areas:
- Large state space: the files, configurations, dependencies, and data that can be modified are enormous, and the combinations of actions grow close to exponentially.
- Delayed feedback: the effect of a single change may not appear until a build, a load test, or even live traffic.
- Tightly coupled constraints: performance, recall, memory footprint, and compatibility pull against each other, so a local optimum often causes global regression.
- Invisible failures: errors may hide in boundary conditions or concurrent paths that short tests cannot expose.
Long-horizon tasks therefore test not “can it write” but “can it converge.” Convergence can be broken into four observable metrics: goal retention (whether it stays anchored to the original constraints), strategy switching rate (whether it changes direction promptly on dead-end paths), budget efficiency (the incremental gain per unit of compute), and rollback capability (whether failed attempts are safely isolated).
3. Rebuilding the Evaluation Dimensions: from a Single Score to a Capability Matrix
Looking at one aggregate score alone makes long-horizon capability easy to miss. A more reasonable approach is to break evaluation into a matrix that maps one-to-one onto engineering goals:
| Dimension | Question of interest | Typical metric |
|---|---|---|
| Repository-level repair | Can it locate and fix issues in a real codebase | Defect resolution pass rate |
| Natural-language project generation | Can it produce a runnable project skeleton from requirements | Build success rate, test pass rate |
| Terminal operation | Can it orchestrate and troubleshoot in a command-line environment | Task completion rate, average steps |
| Tool-augmented reasoning | Can it answer by combining retrieval and external capabilities | Accuracy with tools |
| Browsing and operation | Can it complete multi-step tasks in a page environment | Task completion rate |
| Long-horizon optimization | Can it keep improving under hard constraints | Gain multiplier, constraint violation count |
A schematic evaluation driver can be written as the following pseudocode; the point is to make “constraint checking” and “gain judgment” hard gates:
def run_long_horizon(model, task, budget=600):best = task.baseline()for step in range(budget):action = model.propose(best, task.observations())candidate = task.apply(action) # run in an isolated sandboxreport = task.evaluate(candidate) # build + tests + load testif report.violates_constraints(): # e.g. recall must not drop below thresholdtask.rollback(candidate)continueif report.score > best.score:best = candidate # adopt only when strictly betterreturn best
The core of this logic is not the code itself but three engineering disciplines: constraints take priority over gains, advance only on a strict improvement, and run every attempt in a rollback-capable environment.
4. Why Long-Horizon Capability Is Harder: Error Accumulation and Context Governance
A short-horizon task can be judged after a single failure. The difficulty of long-horizon tasks is that errors amplify along the chain. A wrong assumption at step 10 may only surface at step 200, by which point the cost of backtracking is very high. Two kinds of mechanisms are needed to mitigate this.
The first is external memory. Write historical attempts, failure reasons, and the current best configuration into a structured log rather than stuffing everything into the context window. A common practice is to maintain a “conclusions list” where each entry records the hypothesis, how it was verified, the result, and whether it was adopted:
{"id": 37, "hypothesis": "adjusting index shard granularity can reduce lock contention","verified_by": "load test report #12", "result": "QPS +8%", "adopted": true}
The second is hierarchical planning. Break the overall goal into milestone stages, each with its own acceptance criteria, so the model does not drift over a long chain. When a milestone fails acceptance, roll back only to the previous milestone instead of starting from zero.
5. Anatomy of a Typical Long-Horizon Task: Performance Optimization under Hard Constraints
Consider a task: given a retrieval service skeleton with basic read and write capability, maximize queries per unit time while keeping recall at or above a set threshold. Such tasks are valuable because they combine long-horizon characteristics with a clear acceptance standard.
A mature agent’s execution typically shows four stages:
- Establish a baseline: get the build and load test running, and fix the dataset, concurrency level, and random seed so later comparisons are trustworthy.
- Locate the bottleneck: use sampling and flame graphs to distinguish whether the limit is compute-bound, memory-bandwidth-bound, or lock contention, rather than changing code on intuition.
- Iterate on solutions: try options ordered by “low risk, high gain,” for example caching hot results, adjusting batch granularity, optimizing data layout, or replacing the approximate retrieval strategy.
- Converge and consolidate: turn effective changes into a minimal commit, add regression tests and documentation, and drop experimental branches.
It is worth stressing that the gain multiplier is not the only criterion. If the model quietly loosens the recall constraint to raise throughput, or introduces non-reproducible randomness, that counts as invalid progress. The acceptance script must therefore express hard constraints as assertions and sample the same configuration multiple times to obtain a confidence interval.
6. Enterprise Adoption: Building a Long-Horizon Loop on Baidu AI Cloud
For long-horizon capability to create business value, it must rely on a controllable execution foundation. Using Baidu AI Cloud capability categories as an example, the following loop can be composed:
- A container platform hosts isolated sandboxes, giving each attempt its own environment and preventing cross-contamination.
- Object storage holds datasets, build artifacts, and load test reports so results remain traceable.
- A message queue decouples task scheduling from execution and supports retry of failed work and priority control.
- Logging and monitoring with alerting track step count, failure rate, and cost per unit of gain, making “idling” visible early.
- Key and permission management constrain the resources the model can reach, enforcing least privilege.
Cost control is equally important. Long-horizon tasks consume resources heavily by nature, so three guardrails are recommended: a per-task budget cap, a threshold for consecutive steps without gain, and a floor for cost per unit of gain. Once any is triggered, pause and produce a diagnostic summary for a human to decide whether to continue.
guardrails:max_steps: 600stagnation_limit: 40 # pause after 40 consecutive steps without strict gainmin_gain_per_cost: 0.05 # floor for gain per unit costsandbox: isolatedrollback: enabled
7. Common Pitfalls and Engineering Recommendations
- Judging only by the final score: ignoring constraint violations and reproducibility easily yields “paper gains.”
- Over-delegating authority: letting the model operate production directly is uncontrollable; keep sandboxes and human gates.
- No baseline governance: when the baseline is unstable, every comparison is untrustworthy, so fix the environment and data first.
- Ignoring maintainability: if experimental branches are not merged into the mainline with tests, gains erode with each iteration.
- Judging by step count: more steps do not mean more progress; look at strict gains and the quality of strategy switching.
8. Conclusion
In the second half of the coding model competition, the focus is shifting from “writing it right once” to “converging continuously.” For technical teams, the real opportunity is not chasing a leaderboard rank but bringing long-horizon tasks into the evaluation system and the development workflow: replace a single score with matrix-based metrics, govern long chains with external memory and hierarchical planning, and control risk and cost with sandboxes, observability, and guardrails. Built on the foundational capabilities offered by Baidu AI Cloud, enterprises can set up their own long-horizon task loop with a relatively low barrier, turning the model from an “answerer” into a manageable “engineering executor.”
