Evaluating LLM Coding Capabilities and Long-Horizon Task Practices

    This article explains why coding ability must be evaluated as a separate dimension from general conversation, breaks down the four layers of code-task capability, and compares three common evaluation approaches along with their blind spots. It then examines why long-horizon tasks fail through constraint forgetting, design drift, local-optimum traps, and context pollution, and presents practical engineering methods: contract-first task decomposition, layered context supply, feedback loops over one-shot generation, and a self-built regression set. The closing sections cover the general-purpose cloud capabilities needed to run such workflows and three common pitfalls to avoid.

    1. Why Coding Ability Needs Its Own Evaluation

    In general conversation, a fluent answer with a complete structure often earns a high score. In an engineering context, the bar changes immediately: does the code compile, are boundary conditions covered, are dependency versions compatible, are exception paths handled, does performance meet the target. A model can produce a function that “looks correct” and still break on empty input, oversized input, or concurrent calls. Coding ability therefore has to be evaluated as an independent dimension rather than inferred from general Q&A performance.

    From an engineering standpoint, code tasks involve at least four layers of capability:

    1. Syntactic and semantic correctness: generating runnable code with matching types and interfaces;
    2. Adherence to engineering constraints: respecting the existing directory structure, naming conventions, dependency versions, and framework conventions;
    3. Long-horizon consistency: keeping the design from drifting across multiple files and multiple rounds of edits;
    4. Verifiability: being able to close the loop with tests, logs, and static checks.

    These four layers call for completely different evaluation methods. Rolling them into a single total score easily leads to misleading conclusions.

    2. Three Evaluation Approaches: Differences and Complementarity

    Industry evaluations generally fall into three categories, each with its own focus and blind spots.

    • Composite intelligence indices: weighted aggregates of coding, math reasoning, long context, instruction following, and other benchmarks. They are horizontally comparable and updated frequently, but the weighting scheme is opaque and a weakness in one area gets averaged away.
    • Crowdsourced blind-test arenas: large numbers of real users compare two anonymous answers and vote. They stay close to real usage experience and have large samples, but the question distribution is shaped by user preference, so front-end and visual tasks tend to be overrepresented.
    • Code-specific benchmarks: repository-level bug fixing, function-level generation, and test pass rate as core metrics. They are objective and reproducible, but the tasks carry a risk of contamination from training data and say little about long-horizon collaboration.

    The practical recommendation is cross-validation across all three: use a composite index to gauge the capability floor, a blind test to gauge interaction feel, and a self-built case set to validate the scenarios most relevant to your own business. The top spot on any single leaderboard should not be treated as the best choice for production.

    3. Why Long-Horizon Tasks Are Harder Than Single-Turn Generation

    Single-turn code generation can be solved in one pass with a large enough context window. A long-horizon task requires the model to still remember the original constraints dozens of steps later. Common failure modes include:

    • Constraint forgetting: an early requirement such as “do not introduce new dependencies” is violated later when the model adds one on its own;
    • Design drift: interface semantics quietly change during refactoring;
    • Local-optimum traps: one test case is fixed while three others break;
    • Context pollution: intermediate artifacts from failed attempts are treated as facts and used for further reasoning.

    The fix is not simply a bigger window but externalizing state: task checklists, interface contract files, and decision records in place of model memory.

    4. Engineering Methods That Work in Practice

    4.1 Task Decomposition and Contract First

    Have the model produce the interface contract and acceptance criteria before the implementation. Example:

    1. Goal: add idempotent order creation to the order module
    2. Contract:
    3. - requestId is required; a repeated submission returns the same orderId
    4. - no duplicate orders under 50 QPS concurrency
    5. Acceptance:
    6. - unit tests cover duplicate, concurrent, and timeout cases
    7. Constraints:
    8. - no new external dependencies; reuse the existing cache and logging components

    4.2 Layered Context Supply

    Split context into four layers and inject them separately: global conventions (directories and naming), module contracts (interfaces and data structures), the current task (this round’s change points), and feedback signals (compile errors, test failures, log fragments). Avoid pasting the entire repository in.

    4.3 Feedback Loops Over One-Shot Output

    Use a cycle of small commits, automated verification, and targeted fixes, allowing only one semantic unit to change per step:

    1. # Pseudo-flow; actual commands depend on the environment
    2. run_lint && run_unit_tests || collect_failure_context

    4.4 Build Your Own Evaluation Set

    Pull 50–100 real tasks from production defect tickets and freeze them as a regression set. Run it every time you switch models or prompt strategies, and record three metrics: pass rate, average number of steps, and manual rework rate.

    5. General-Purpose Cloud Support

    Running this kind of workflow typically only requires general-purpose capabilities: a container platform for isolated sandbox environments, object storage for build artifacts and evaluation datasets, a message queue to smooth peaks and chain long task pipelines, and logging plus monitoring and alerting to trace the time and failure cause of each step. Baidu AI Cloud offers corresponding products in these general categories, which can be combined as needed without binding to proprietary interfaces.

    6. Common Pitfalls and Conclusion

    Pitfall one: choosing a stack based on a single leaderboard score. Pitfall two: expanding context blindly without layering it. Pitfall three: aiming to generate a complete system in one shot. The safer path is to define contracts clearly, supply context in layers, build an automated verification loop, and keep measuring with a self-built regression set. Evaluation scores are only the starting point; what really determines production results is the quality of how engineering constraints are expressed and how complete the feedback loop is.