Evaluating and Selecting Long-Horizon Coding Agents: From Metrics to Gradual Rollout
Single-turn QA benchmarks cannot reveal how a model performs on real development tasks that span dozens of interdependent steps. This article explains why long-horizon tasks require dedicated evaluation, how to interpret model specifications such as total vs. active parameters and effective context length, what a reproducible evaluation report should contain, how to trade off cost and speed on a per-successful-task basis, and how to close the loop from evaluation through selection, canary deployment, monitoring, and rollback.
1. Why Long-Horizon Tasks Need Dedicated Evaluation
Single-turn QA only checks whether one output is correct. Development tasks are different. Fixing a production bug typically requires reading multiple files, running tests, interpreting error messages, modifying code, and verifying the result again. The whole process may span dozens of steps, where each step’s output becomes the next step’s input.
Failures in long-horizon tasks usually stem from a few recurring mechanisms. The table below lists common failure types and the evaluation items they map to.
| Failure Type | Typical Symptom | Corresponding Evaluation Item |
|---|---|---|
| Forgetting | Ignoring interface contracts read earlier | Information recall in long contexts |
| Error propagation | A wrong dependency judgment at step 3 skews all later changes | Per-step checkpoint accuracy |
| Environment drift | Command results, network responses, or file states deviate from expectations | Recovery ability under unexpected inputs |
| Tool-call failure | Malformed arguments, repeated calls, missing required steps | Tool-call validity rate and retry count |
Fluency alone therefore proves nothing. Evaluation must examine whether a model can reliably complete multi-step goals under constraints, and whether it can detect problems, roll back, and retry after failures.
2. Reading the Specifications of Large-Parameter Models
2.1 Total Parameters vs. Active Parameters
Mixture of Experts (MoE) architectures split the network into multiple groups of expert sub-networks. A routing module selects only a few experts for each forward pass. The model’s total parameter count can be very large, while the compute cost of a single inference is mainly determined by the active parameters.
Total parameters roughly indicate the model’s capacity ceiling; active parameters are closer to the per-inference compute cost. Neither directly equates to actual capability. Given the same active parameter count, training data, routing load balance, memory bandwidth, and inference framework implementation all affect final latency and quality. Parameter scale is only one input to model selection and cannot judge a model on its own.
Record the following specifications during selection, along with data sources and measurement conditions.
| Item | What to Record | Notes |
|---|---|---|
| Total parameters | Officially disclosed value | Note whether the figure is public |
| Active parameters | Parameters involved per forward pass | Record separately from total parameters |
| Architecture | Dense or MoE, number of experts and experts selected per pass | Mark as “undisclosed” when unavailable |
| Context window | Nominal maximum input length | Nominal length differs from effective length; see 2.2 |
| Pricing | Per-million-token prices for input and output | Use a consistent currency and billing basis |
| Latency | Time to first token and full-output duration | Note concurrency and input length |
2.2 Effective Context Length
The nominal context length is the maximum number of tokens allowed in a single input. Whether the model can reliably use information across the entire window must be tested separately.
One reproducible approach is a needle-in-a-haystack test: embed a verifiable fact at different positions in a long document, then ask the model to retrieve it. Fix the test parameters in advance:
- Embedding positions: one group each at 10%, 50%, and 90% of the window.
- Document lengths: based on real usage, e.g., 8k, 32k, and 128k tokens.
- Sample size: at least 50 samples per group, each with different fact content.
- Pass criteria: the answer must contain the embedded field value and must not contain distractor values.
Report recall rates broken down by position and length rather than a single aggregate score. If mid-window recall drops significantly below the ends at a given length, that length should not be used directly for tasks that depend on mid-window information.
Long contexts also increase memory and latency pressure. KV cache usage grows with context length, and longer inputs usually mean higher time to first token. Whole-codebase comprehension suits long windows. For routine small changes, trim the context to only the relevant files and test logs—cheaper and easier to verify.
2.3 Applicability of Multimodal Input
Native vision input can directly handle UI screenshots, architecture diagrams, reports, and error dialogs. Typical use cases include:
- Generating page structure from design mockups.
- Locating anomalous metrics in monitoring screenshots.
- Cross-checking figures in document charts.
Small-font text, dense tables, handwritten content, and any numbers that directly affect release decisions should not rely on image reading alone. Cross-check such content against source files. A practical approach: have the model produce structured output, compare it item by item against the source data, and route discrepancies through human review before they enter downstream pipelines.
3. What a Reproducible Evaluation Report Contains
A reproducible evaluation report includes at least five parts:
- Task set: task sources, difficulty distribution, and whether it covers real repositories and real defects.
- Runtime environment: model version, inference parameters, tool set, timeout and retry policies, and sandbox configuration.
- Metrics: task success rate, per-step checkpoint accuracy, tool-call validity rate, per-task duration, and per-task cost.
- Failure classification: attribute each failure to the types in Section 1, with a log location attached to every record.
- Statistical methodology: sample size, number of repeated runs, confidence interval calculation, and rules and reasons for excluding anomalous samples.
Reproducibility checklist:
- The task set and evaluation scripts are committed to version control, with the commit hash recorded.
- Each task runs at least 3 times in the same environment, and the report states the variance range.
- Every failed sample carries a failure-type label and a log link.
- The report states the model version, call dates, and billing basis.
- Every number in the report is traceable to raw logs.
4. Trading Off Cost and Speed
A common selection mistake is comparing only unit prices. A cheaper model may require more retries or generate longer outputs, making per-task cost higher. Compare on the cost per successful task instead:
Per-task cost = total spend ÷ number of successful tasks
Total spend includes all attempts, including retries after failures.
The table below summarizes the main dimensions and their interactions.
| Dimension | Increasing It Brings | Decreasing It Brings | Recommended Practice |
|---|---|---|---|
| Active parameter scale | Higher reasoning ceiling, more compute and latency | Lower latency and unit price, possibly weaker complex reasoning | Tier models by task difficulty |
| Context length | Covers more code, higher time to first token | Lower latency, limited cross-file understanding | Inject only relevant files |
| Concurrency | Higher throughput, possibly higher per-request latency | Faster single requests, lower resource utilization | Set limits based on load testing |
| Output length cap | Supports long patches, more time and cost | Lower cost, long edits may be truncated | Set a reasonable cap and track truncation rate |
| Retry count | Higher success rate, higher cost | Lower cost, transient failures harder to recover | Decide retries by failure type |
For speed, record time to first token and full completion time separately. The former affects interactive experience; the latter affects throughput of batch tasks. Their optimization directions do not always align, so weigh them per use case.
5. Selection and Gradual Rollout
Deployment requires a closed loop: evaluation, selection, small-traffic canary, monitoring, and rollback. Missing any step makes results unverifiable.
- Evaluate: following the methodology in Section 3, establish a baseline on the team’s own task set.
- Select: define task tiers first. Route simple tasks to models with smaller active parameter counts and lower cost; route complex cross-file changes to more capable models. Document candidate models and rationale for each tier.
- Canary: switch a small portion of non-critical tasks to the new model, run it in parallel with the existing solution, and compare success rates and costs.
- Monitor: continuously track task success rate, tool-call failure rate, per-task cost, latency, and human rework rate.
- Roll back: agree on thresholds in advance. If any core metric breaches its threshold, revert to the original solution and preserve failed samples for the next evaluation round.
Thresholds should be based on the team’s own historical baselines rather than copied from others’ numbers.
