Why Long-Horizon Coding Is the New Battleground for Chinese LLMs

    As coding benchmarks shift from one-shot correctness to long-horizon task completion, Chinese large language models are betting on iterative engineering loops. This article explains why long-horizon coding is harder, how to evaluate it across five dimensions, and how to integrate it into real development workflows with task ledgers, standardized tools, and human checkpoints.

    1. A Counterintuitive Shift: How We Judge Coding Ability Is Changing

    For the past two years, asking whether a coding model was strong was almost the same as asking one question: can it get the code right on the first try? Benchmarks were therefore designed as closed-book exams—complete a function from its signature, locate and fix a bug from a description, or decide the next command from a piece of terminal output. These evaluations have clear correct answers and clear pass conditions, which makes them well suited to automated scoring.

    Real engineering work is rarely this friendly. A performance problem is usually not solved by “change one line and it’s fixed.” It is more like “write a version, run it, find it insufficient, switch algorithms, run again, still insufficient, refactor the data structure, keep running”—a loop that can last hours or even days. The most noteworthy recent progress from Chinese LLMs in coding is not a ranking on some leaderboard, but a shift in focus toward these long-horizon tasks: a model can, after hundreds of iterations and thousands of tool calls, increase the throughput of a retrieval system by several times, and proactively switch technical approaches midway instead of mechanically repeating the same failed attempt.

    This shows that the evaluation of coding ability is moving from “single-attempt accuracy” to “long-horizon convergence.” This article discusses that shift, its technical implications, evaluation methods, and how to put it into engineering practice.

    2. From Exam Thinking to Engineering Thinking: Two Capability Paradigms

    2.1 The Hidden Assumptions of One-Shot Answering

    One-shot evaluations rest on three assumptions: task boundaries are clear, verification is nearly free, and failures can be attributed immediately. Under these assumptions, the model only needs to complete one step—“understand the requirement and generate code.”

    2.2 The Real Constraints of Long-Horizon Tasks

    Real tasks are the opposite on all three points:

    • The goal can be quantified, but the path to reach it is unknown and must be searched.
    • Verification requires real execution and real load testing, which is not free.
    • Failure causes are often tangled across algorithms, data structures, concurrency models, and caching strategies, and must be ruled out step by step.

    So the core capability in long-horizon tasks is not “generation” but “control”: maintaining task state, deciding the next action, and judging when to abandon the current approach.

    2.3 Breaking Down the Capability

    Long-horizon coding ability can be split into four layers for easier evaluation and development:

    1. State maintenance: remember attempted solutions, constraints, and the current best result.
    2. Tool orchestration: correctly choose actions such as compiling, testing, load testing, and log retrieval.
    3. Strategy switching: change the approach when returns diminish consecutively, rather than repeating minor tweaks.
    4. Termination judgment: stop once constraints are met, avoiding over-optimization that harms stability.

    3. Why Long-Horizon Tasks Are Harder: Three Engineering Bottlenecks

    3.1 Context Expansion and Dilution of Key Information

    After hundreds of interactions, the history far exceeds the context window, and early constraints (for example, “recall must not drop below a certain threshold”) are easily diluted. A practical approach is to introduce an externalized “task ledger” that records constraints, baseline metrics, and the best solutions so far in a separate file, re-injecting only a summary each round.

    A sample ledger structure could be:

    1. goal: increase retrieval throughput while preserving the recall constraint
    2. constraints:
    3. - recall >= 0.95
    4. baseline:
    5. qps: 3500
    6. recall: 0.96
    7. best_so_far:
    8. qps: 12000
    9. approach: adjust quantization strategy + batch scheduling
    10. rejected:
    11. - Option A: gains decayed to 1% within three rounds
    12. - Option B: recall fell below the constraint
    13. next_hypotheses:
    14. - optimize memory layout to improve cache hit rate

    3.2 Noisy Verification Signals

    Load test results are affected by machine load, cache warmth, and concurrency level. Without a fixed verification protocol, the model can mistake noise for gains and fall into a false convergence that “looks like progress.” In engineering terms, the dataset and concurrency should be fixed, samples should be taken multiple times and the median used, and the verification script itself should be one of the deliverables.

    3.3 Difficulty of Detecting Diminishing Returns

    The most common failure mode in long-horizon tasks is not a crash but “only tiny improvements across many consecutive rounds.” A stall condition needs to be defined explicitly—for example, trigger a strategy switch when the relative improvement stays below a threshold for several consecutive rounds.

    4. How to Evaluate a Model’s Long-Horizon Coding Ability

    Build an evaluation matrix across five dimensions instead of looking at a single score:

    • Convergence: the number of rounds and tool calls needed to reach the goal.
    • Constraint preservation: whether hard metrics remain satisfied throughout optimization.
    • Strategy diversity: whether route switching occurs rather than repeated changes of the same kind.
    • Reproducibility: variance in results across multiple runs of the same task.
    • Delivery completeness: whether tests, documentation, and rollback-capable intermediate versions are produced.

    Among these, “constraint preservation” is the easiest to overlook but the closest to production requirements: a throughput gain obtained by sacrificing recall is worth zero in engineering terms.

    5. Engineering Integration: Plugging Long-Horizon Capability into Existing R&D Systems

    5.1 Task Breakdown and Milestones

    Break a large task into verifiable milestones, each with quantitative acceptance criteria. This way, even if the process is interrupted midway, existing results are preserved.

    5.2 Standardization on the Tool Side

    Provide the model with stable, idempotent action interfaces: unified build, unified test, unified load testing, and unified log retrieval. The more standardized the interfaces, the lower the model’s error rate in tool orchestration. Such capabilities are typically supported by common cloud categories such as container platforms, log services, monitoring and alerting, and object storage; the key is least-privilege access and auditable operations.

    5.3 Human Intervention Points

    Long-horizon tasks do not need to be fully automated end to end. A more reasonable design sets three human intervention points: confirming the goal and constraints, reviewing strategy switches, and final acceptance. The remaining steps are left for the model to drive autonomously.

    5.4 Prompt and Workflow Templates

    1. You are an engineer responsible for performance optimization.
    2. Hard constraint: recall must not drop below 0.95.
    3. Each round must output: hypothesis, changes, verification command, measured data, and whether to keep it.
    4. If improvement stays below 1% for 3 consecutive rounds, you must propose a hypothesis for a different technical approach.
    5. Once the goal is met, stop and output the change list and rollback method.

    6. Limitations and Risks

    Long-horizon capability is not a cure-all. It relies heavily on an objective function that can be verified automatically; for tasks with vague requirements and subjective acceptance criteria, the benefits drop noticeably. In addition, long-running sessions raise compute costs, expand the scope of changes, and make review harder, so version snapshots, change auditing, and automatic rollback must be in place. Reliance on generated code should also be treated cautiously: critical paths still need human review and static checks as a backstop.

    7. Conclusion

    The second half of the coding model competition is no longer about who can answer correctly on the first try, but who can keep iterating under a set of verifiable rules, approach the goal without breaking constraints, and know when to stop. For developers, the real preparation is to build the verification system, tool interfaces, and task ledger first—only in that kind of soil can long-horizon capability turn into stable engineering output.