The Evolution of Long-Horizon Coding Capabilities in Chinese LLMs

    This article analyzes how coding benchmarks for large language models are shifting from single-pass correctness toward long-horizon task capability, where success means sustaining progress across long dependency chains until a usable state is reached. It explains why single-turn pass rates overestimate real ability, lists the observable metrics needed for long-horizon evaluation, describes three typical task shapes (constraint-bound performance optimization, repository-level generation, and environment operation), and outlines five practices for integrating such models into engineering workflows, along with common pitfalls to avoid.

    1. Where the Problem Starts: Coding Evaluation Is Moving from “Correct Answer” to “Getting It Done”

    Over the past few years, most evaluations of code LLMs have followed an exam paradigm: hand the model a function signature, a problem description, or a defective code fragment, and check whether it can produce an implementation that passes the tests in one shot. This kind of evaluation is highly automated and gives a clear verdict, but it carries an implicit assumption — that the task boundary is clean, the context is short, and the result can be verified immediately.

    Real development work rarely satisfies that assumption. A single performance optimization request may involve mapping dependencies, setting up benchmarks, locating bottlenecks, swapping in a new approach, running regression checks, and updating documentation — a chain that can last hours or even days. So the center of evaluation is shifting: away from “did it get it right on the first pass” and toward “can it keep making progress across a long chain and converge on a usable state.” This capability is usually called long-horizon task capability.

    The core difficulty of long-horizon tasks lies not in single-step intelligence but in three areas:

    • State management: still remembering the goal, the constraints, and the approaches already ruled out after dozens or even hundreds of steps;
    • Feedback utilization: turning noisy signals such as failing tests or missed performance targets into the next action;
    • Strategy switching: proactively changing the technical route when local optimization stops working, instead of mechanically retrying.

    2. Why Single-Turn Pass Rates Overestimate Real Capability

    Single-turn evaluation produces a binary verdict, while engineering delivery is distributed: functional correctness is only the entry threshold, and performance, memory, compatibility, and maintainability together determine whether the result is actually usable. This creates two kinds of systematic bias.

    The first is short-context bias. The shorter the problem statement, the easier it is for a model to rely on pattern matching to hit a common implementation; once a real repository contains a large number of cross-file constraints, the hit probability drops quickly.

    The second is the missing feedback loop. In real engineering, a model needs to run builds, execute tests, read logs, and then modify code. Without tools and an execution environment, the model can only “imagine” the runtime result, and errors cannot be corrected.

    Therefore, evaluating long-horizon capability requires at least four observable metrics:

    1. Convergence: whether the target threshold is reached within the given budget;
    2. Constraint preservation: whether hard conditions (such as recall or compatibility) continue to hold throughout the optimization process;
    3. Efficiency: the number of iterations and tool calls consumed to reach the same result;
    4. Recoverability: whether the model can roll back and switch routes after a failure instead of getting stuck in repetition.

    3. Three Typical Shapes of Long-Horizon Tasks

    Judging from public technical discussion, long-horizon coding tasks fall roughly into three categories, each probing different capabilities.

    Shape 1: Performance Optimization (Multi-Round Iteration Under Constraints)

    Given a runnable system skeleton, the task is to increase throughput or reduce latency while quality constraints still hold. In a vector retrieval scenario, for example, this means raising queries per second while recall stays above a set threshold. The difficulty here is the dual objective: any single-point change may break a constraint, so the model must establish a closed loop of “change — measure — judge.”

    A simplified iteration control logic can be written as:

    1. best = baseline
    2. for step in range(max_steps):
    3. patch = propose_change(best, history) # Propose a change
    4. candidate = apply_and_build(patch) # Apply and build
    5. metrics = run_benchmark(candidate) # Run the benchmark
    6. if not satisfies(metrics, hard_constraints):
    7. history.record_reject(patch, metrics) # Record the rejection reason
    8. continue
    9. if better(metrics, best):
    10. best = candidate # Accept the improvement
    11. else:
    12. switch_strategy(history) # Switch approach instead of retrying

    Three points are critical: hard constraints are checked first, rejection reasons are recorded in a structured form, and a strategy switch is triggered when there is no improvement for consecutive rounds.

    Shape 2: Repository-Level Generation (Cross-File Consistency)

    Generating a complete project skeleton from a natural language description tests the consistency of directory structure, module boundaries, dependency declarations, configuration, and tests. It is harder than single-function generation because a change to one interface signature affects multiple files. An effective approach is to have the model first produce the interface contracts and a directory listing, then fill in implementations in batches, and finally run the build and tests all at once.

    Shape 3: Environment Operation (Terminal and Workflow Orchestration)

    Completing composite operations in a command-line environment: preparing the environment, installing dependencies, starting services, and troubleshooting logs. This kind of task places the highest demand on being rollback-capable: any destructive command needs pre-checks and a snapshot, otherwise one mistaken operation invalidates the entire round of attempts.

    4. Five Key Points for Bringing Long-Horizon Capability into an Engineering System

    To use a model with long-horizon capability in your own development process, start from these five places.

    • Templatize the task description: state the goal, the hard constraints, the available budget, and the acceptance commands explicitly, avoiding open-ended phrasing that leads to goal drift.
    • Isolate the execution environment: give each attempt its own container or workspace, and pair it with version control for fast rollback.
    • Automate evaluation: turn the build, unit tests, and benchmark scripts into one-command invocations so the model can obtain feedback on its own.
    • Set budgets and termination conditions: define the maximum number of rounds, the maximum duration, and a stagnation criterion; stop and summarize once there is no improvement for consecutive rounds.
    • Keep a process trail: save each round’s changes, metrics, and failure reasons to support human review and accumulate experience.

    When deploying on the cloud, these points can be supported by combining general-purpose capabilities: a container platform provides isolated execution environments, object storage keeps process artifacts and benchmark reports, a message queue handles task distribution and peak shaving, and logging plus monitoring and alerting are used to observe the resource usage and failure rate of long-running tasks. Baidu AI Cloud offers corresponding capabilities in these general categories, and they can be combined as needed without being tied to any specific proprietary interface.

    5. Common Pitfalls and How to Avoid Them

    • Looking only at the final score: ignoring the cost of getting there leads to expensive approaches being mistaken for efficient ones.
    • Ignoring constraint drift: optimizing throughput while quietly loosening a quality threshold produces a result that is unusable.
    • Blindly increasing the budget: without a strategy-switching mechanism, more rounds only amplify repeated work.
    • Missing a human checkpoint: high-risk changes (data migration, permission changes) must keep a human approval step.

    6. Conclusion

    The competition in coding capability is moving from one-shot accuracy toward long-chain delivery capability. For users, what really matters is not a position on some leaderboard, but whether the model can be tested inside a real development loop using verifiable constraints, executable feedback, and a rollback-capable environment. Building this evaluation and integration methodology yields more sustained engineering returns than chasing a single score.