Long-horizon Coding Tasks: The New Battleground for Chinese LLMs

    Chinese large language models are shifting the coding benchmark from single-shot correctness to sustained progress on long-horizon tasks. This article explains what long-horizon tasks are, breaks down a public database retrieval optimization case that ran hundreds of iterations and thousands of tool calls, and shows how to read multi-dimensional scorecards. It also gives practical guidance for engineering adoption: executable constraint checks, budget and context control, full trajectory retention, clear human-AI division of labor, and cloud-native infrastructure support.

    1. A counterintuitive shift: how we judge coding ability is changing

    For the past two years, almost every discussion about code generation revolved around the same question: can the model get it right on the first try? It is a simple, intuitive way to measure capability, and it did push rapid improvements in foundational skills. But in real development work, code that works on the first attempt is the exception, not the norm.

    Recent progress in coding among Chinese large language models offers a useful angle for observation: the standard is moving from single-attempt accuracy to the ability to keep making progress on long-horizon tasks. In one publicly reported case, a Chinese model worked on a database query optimization task through more than 600 rounds of iteration and over 6,000 tool calls, ultimately raising queries per second by roughly 6x while holding a recall constraint. The significance is not the number itself, but the new form of capability it reveals.

    2. What long-horizon tasks are, and why they resemble real engineering

    Most traditional code evaluations carry an “exam mindset”: given a function signature or a bug description, can the model produce the correct answer in one shot? The strength of this approach is clear boundaries and easy automated scoring; the limitation is narrow coverage.

    Real engineering usually looks like this:

    • Write a first implementation;
    • Run tests or benchmarks and find that performance or correctness falls short;
    • Locate the bottleneck and adjust the algorithm or data structure;
    • Run and evaluate again;
    • Iterate repeatedly until the constraints are met.

    This process can last hours or even days, with plenty of failures and rollbacks along the way. So long-horizon tasks measure not “inspiration” but four more fundamental abilities:

    1. State retention: remembering the goal, constraints, and approaches already tried after hundreds of interactions;
    2. Self-evaluation: reading test output and performance data to judge whether the current approach works;
    3. Strategy switching: proactively changing direction when a path shows diminishing returns, instead of mechanically retrying;
    4. Convergence control: stopping iteration under the constraints and delivering a usable result.

    3. Case breakdown: the methodology behind a database retrieval optimization

    The task setup in one public evaluation is fairly representative: a vector database skeleton implemented in a systems programming language is provided, and the goal is to optimize approximate nearest neighbor retrieval, maximizing query throughput under a hard constraint of recall no lower than 95%.

    A few details in the model’s behavior are worth noting for developers.

    First, establish a measurable baseline. Without a baseline, there is no way to tell whether any later optimization helps. The same holds in engineering practice: performance work must start with a repeatable benchmark and explicit constraints.

    Second, identify the bottleneck. The early approach used a full scan, which is logically simple but limited in throughput; it then switched to a clustering-based index structure, shrinking the search space from the full set to a few candidate clusters.

    Third, introduce layered retrieval. Coarse filtering with a low-cost method first, then precise ranking with a high-accuracy method. This “coarse then fine” pipeline is widely used in retrieval, recommendation, and risk control, and is a common engineering pattern in the industry.

    Fourth, guard the constraint. Recall is re-verified after every strategy change, so throughput is never gained at the expense of quality. This step is often overlooked, yet it is the dividing line for whether automated optimization can actually ship.

    In pseudocode, this kind of iteration loop looks roughly like this:

    1. baseline = evaluate(current_impl, dataset)
    2. while budget_left and not satisfied(baseline):
    3. hypothesis = propose_change(history, baseline) # propose a hypothesis
    4. candidate = apply(current_impl, hypothesis)
    5. result = evaluate(candidate, dataset) # measure
    6. if result.qps > baseline.qps and result.recall >= 0.95:
    7. current_impl, baseline = candidate, result # accept
    8. else:
    9. history.append(rejected(hypothesis, result)) # record the failure

    What really decides success is the quality of propose_change and history: the former depends on judgment about the system’s structure, the latter on accumulated experience from failures.

    4. Beyond benchmark scores: how to read a multi-dimensional capability list

    Public scorecards usually contain several dimensions, and understanding what they mean matters more than memorizing the numbers:

    • Software engineering evaluations: the ability to locate and fix problems in a real codebase, involving cross-file understanding and dependency analysis;
    • Repository-level generation evaluations: generating a complete project structure from a natural language description, testing architecture design and module decomposition;
    • Terminal operation evaluations: executing, observing, and correcting in a command-line environment, which is the foundation of automation;
    • Tool-augmented knowledge and retrieval evaluations: reasoning and fact verification with the help of external information;
    • Web task evaluations: multi-step information gathering and task orchestration.

    One caveat: no single score is enough to support a selection decision. There is a gap between evaluation sets and real business distributions, so engineering teams should build internal evaluation sets from their own codebases to reach valid conclusions.

    5. Engineering adoption: how to put long-horizon capability to work

    To use this kind of capability in a real development workflow, keep the following in mind.

    1. Write constraints as executable checks. Recall, latency limits, memory usage, and compatibility requirements should all become automated validations rather than staying in a requirements document.

    2. Control budget and context. Long-horizon iteration is expensive, so set caps on rounds, time, and call counts, and summarize and compress history to avoid context bloat that degrades judgment.

    3. Keep the full trajectory. Record every change, measurement result, and rejection reason, which helps both human review and later retrieval and reuse.

    4. Draw a clear human-AI division of labor. Let the model handle exploration and repeated verification, while people own goal definition, risk judgment, and final merges; code review and permission boundaries cannot be skipped.

    5. Build on general cloud-native capabilities. Container platforms provide isolated execution environments, object storage holds trajectories and artifacts, message queues distribute tasks, and logging plus monitoring and alerting provide observability. Baidu AI Cloud offers corresponding capabilities in these general categories and can serve as a reference for building automated development infrastructure.

    6. Trend outlook and selection advice

    The move from single-shot generation to long-horizon collaboration has a structural impact on the development system. As the evaluation focus shifts, context management, tool-call reliability, and failure recovery become as important as raw model intelligence.

    For technical teams, the pragmatic path has three steps: first, build a small internal evaluation set from real tasks; second, choose a solution with stable tool calls, observable trajectories, and budget control; finally, expand automation gradually, from test completion and bug fixing to performance optimization and dependency upgrades.

    The value of Chinese large language models catching up in coding lies precisely in pulling the competition back from leaderboard rankings to engineering results. Whoever can push long tasks to convergence more reliably is the one with real productivity.