Labs · Methodology

Experiment methodology

The experiments measure whether a candidate context transformation reduces an agent's token use while preserving its ability to complete software-engineering tasks. The process is independent of a particular runner or provider; the important distinction is between a reference condition and a candidate condition.

Methodology

What is measured

Each task is executed in two conditions. In the reference condition the agent receives the original conversation and context. In the candidate condition it receives the transformed context. The task definition, repository revision, environment, evaluator, model, provider, generation settings, and repeat count are held constant between the two conditions.

One variable at a time

Task

  • Pinned repository revision
  • Issue statement
  • Deterministic evaluator

ReferenceOriginal conversation and context

Same agent, model and settings

CandidateTransformed context

Tokens

Reference
Candidate

Task quality

ReferenceCandidate

Compared per task and pooled

Held constant

  • Task definition
  • Repository revision
  • Environment
  • Evaluator
  • Model
  • Provider
  • Generation settings
  • Repeat count
Both conditions share everything except the context the agent receives.

This isolates the effect of the transformation. The experiments measure both efficiency and quality: lower token use is only meaningful when task quality is not materially reduced.

Every attempt is retained as an individual observation. The collected data includes the task and dataset version, condition, model and provider, input, cached-input and output tokens, weighted token use, agent steps, duration, patch/evaluation outcome, and diagnostic artifacts such as trajectories, request/response records, and evaluator output.

Infrastructure failures, upstream timeouts, missing images, interrupted runs, empty responses, and runs without token accounting are classified separately from task results. They are invalid measurements rather than evidence that a task passed or failed.

Token weighting

The principal efficiency measure is weighted token use rather than a simple count of all tokens. It combines the three token categories using the configured weights.

Weighted tokens

Illustrative data - not a measured result
weighted = 1.0 × input + 0.1 × cached input + 3.0 × output
Candidate change
Reference

60k × 1.0 + 400k × 0.1 + 12k × 3.0 = 136k

Raw tokens 472kWeighted 136k
Candidate

33k × 1.0 + 400k × 0.1 + 12k × 3.0 = 109k

Raw tokens 445kWeighted 109k−19.9%
  • Input × 1.0
  • Cached input × 0.1
  • Output × 3.0

Pick how the candidate differs from the reference. The formula and both bars follow.

Input tokens represent uncached prompt/context tokens. Cached input tokens have a lower weight because their marginal cost is lower than uncached input under the pricing model represented by this metric. Output tokens have the highest weight because generation is comparatively more expensive. The same formula is applied to both conditions, so the comparison reflects the relative mix of input, cache reuse, and generated output as well as the raw total.

The component counts remain in the collected data. A lower weighted value can come from reducing uncached input, increasing cache reuse, reducing output, or a combination of these effects. Reporting the components alongside the weighted total makes that distinction visible and avoids interpreting a change in cache behaviour as compression alone.

Why there are repeated runs

Agent trajectories are stochastic. On the same task, one attempt can take a short path while another may explore a dead end, loop for many more steps, or encounter a transient provider failure. Token use consequently has substantial run-to-run variance and is commonly right-skewed: a few unusually long trajectories can shift the mean considerably.

Run-to-run variance

Illustrative data - not a measured result
Attempts
0 / 60
Mean
-
Median
-
p10 - p90
-
0100k200k300k400k+

Weighted tokens per attempt

60 attempts at the same task in one condition. A few long trajectories pull the mean to the right; the median barely moves.

Multiple repetitions estimate the typical result and its uncertainty rather than reporting a single incidental outcome. They reveal outliers, reduce the effect of transient failures or lucky trajectories, and make it possible to distinguish a stable improvement from random variation.

Repetitions are spread across tasks. This matters because a candidate can look strong on one repository or issue type while not generalising to others. Per-task repeats show whether a pooled result is consistent across the workload or dominated by a small number of tasks. The selected repeat counts are based on the expected size of the difference and variance observed in pilot data: smaller expected effects require more observations.

How the data is interpreted

Analysis begins with the usable sample. For each condition, the results show the planned attempt count, usable count, and exclusions by reason. Missing records are not treated as zero tokens, a pass, or a task failure. A large difference in invalid-run rate is itself diagnostic, since reliability affects whether an apparent efficiency result can be trusted.

Usable sample first

Illustrative data - not a measured result
  1. 1Usable sample
  2. 2Quality
  3. 3Token distribution
  4. 4Uncertainty
  5. 5Task-level consistency
Reference
Usable 114 / 120 planned
Candidate
Usable 108 / 120 planned
ReferenceCandidate
Infrastructure failure34
Upstream timeout25
Missing image11
No token accounting02

Exclusions are invalid measurements - never zero tokens, a pass or a fail.

The order of the analysis, and why some planned attempts never become measurements.

Quality is considered before efficiency. The evaluator pass rate, or other predefined task-quality outcome, is compared between conditions for every task and across the dataset. A token reduction accompanied by a material decline in quality, malformed patches, or changed evaluation behaviour is not counted as a useful improvement.

Token use is treated as a distribution rather than a single headline value. The analysis contains mean and median weighted tokens, variance or standard deviation, percentile ranges, absolute change, and percentage change from the reference condition. The mean estimates expected aggregate cost, while the median describes a typical attempt and is less affected by long trajectories. Task-level tables and distributions are retained beside pooled values.

Uncertainty is represented with confidence intervals or bootstrap estimates over attempts, preferably preserving the task structure. A result is inconclusive when its uncertainty includes both a practically meaningful saving and a practically meaningful regression. In that case, the data does not yet support selecting either condition with confidence.

Reading uncertainty

Illustrative data - not a measured result
← saves tokenscosts more →

Candidate A

80 attempts

−19.6% (−29.6% to −7.6%)
−19.6%Stable saving

Candidate B · pilot

10 attempts

−3.3% (−33.5% to +36.7%)
−3.3%Inconclusive

Candidate C

80 attempts

+21.8% (+5.5% to +40.8%)
+21.8%Regression
−40%−20%0+20%+40%

Change vs reference

Bootstrap 95% intervals for the change in mean weighted tokens. Only an interval that clears the practical threshold supports a decision.

The interpretation also examines task-level consistency. A result supported by small, consistent improvements across task types is stronger than a larger pooled value driven by one atypical task. Regressions, unusually variable tasks, and substantial behavioural changes remain visible in the report instead of being hidden by the aggregate.

Conclusions are bounded by the sampled workload and configuration. They take a form such as: “On this held-out task set, with this model and provider, the candidate changed mean weighted token use by X% and median token use by Y%, with an observed quality difference of Z percentage points.” They do not claim that the result applies universally beyond the tested task distribution.

The data records the task-set version, code revisions, environment images, model/provider settings, repeat count, exclusions, and analysis method. This makes later comparisons reproducible and gives a concrete explanation when a result changes.

Why the tasks are self-generated and SWE-bench-style

Public software-engineering benchmarks remain useful for comparability, but they do not represent every repository, dependency stack, language, issue type, or context pattern relevant to the target workload. Self-generated tasks extend coverage to those areas.

The tasks use a SWE-bench-style contract: a pinned repository revision, a concrete issue statement, an isolated environment, a deterministic evaluator, and a known expected behaviour. This preserves the important properties of a benchmark task - reproducibility and independently checkable evaluation - without reducing the workload to an informal prompt or hand-judged example.

These tasks complement rather than replace public benchmark tasks. Their definitions and evaluators are reviewed for reproducible images, evaluator correctness, meaningful issues, and separation between the implementation being tested and the tests that determine the outcome.

Dataset separation

Mainnet data is part of development. It supplies realistic operating conditions, feedback, and a source of improvements before release. Since it is seen during development, it is not the final evidence used to promote a candidate to production.

The separate held-out evaluation occurs after mainnet testing and before production release. It measures whether a candidate that appeared promising during development generalises to tasks it has not been tuned against. This prevents adaptive overfitting, where repeated development against known tasks gradually optimises for their specific prompts, repositories, tool outputs, and quirks rather than unseen work.

The split also supports fairness: knowledge of earlier mainnet tasks, trajectories, or score feedback cannot become an advantage in the final evaluation. The final score then measures general performance rather than familiarity with a known set.

Three datasets, three roles

  1. Local development

    Debugging and early iteration.

  2. Mainnet

    Development under realistic operating conditions and feedback.

  3. Held-out evaluation

    Final generalisation check after mainnet testing and before production.

  4. Production

    Release of a candidate that generalised.

Split by repository and issue family

Related tasks share solutions and trajectory patterns. Splitting by attempts alone would leak them into the held-out set.

Development

Held-out

A candidate earns production only on tasks it has not been tuned against.

Where practical, separation occurs by repository and issue family rather than by random attempts alone. Closely related tasks can share solutions and trajectory patterns, so a purely random split can leak information. Dataset versions are retained with the experiment results.