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.
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
Task quality
Compared per task and pooled
Held constant
- Task definition
- Repository revision
- Environment
- Evaluator
- Model
- Provider
- Generation settings
- Repeat count
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 result60k × 1.0 + 400k × 0.1 + 12k × 3.0 = 136k
33k × 1.0 + 400k × 0.1 + 12k × 3.0 = 109k
- Input × 1.0
- Cached input × 0.1
- Output × 3.0
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
- -
Weighted tokens per attempt
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- 1Usable sample
- 2Quality
- 3Token distribution
- 4Uncertainty
- 5Task-level consistency
| Reference | Candidate | |
|---|---|---|
| Infrastructure failure | 3 | 4 |
| Upstream timeout | 2 | 5 |
| Missing image | 1 | 1 |
| No token accounting | 0 | 2 |
Exclusions are invalid measurements - never zero tokens, a pass or a fail.
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 resultCandidate A
80 attempts
Candidate B · pilot
10 attempts
Candidate C
80 attempts
Change vs reference
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
Local development
Debugging and early iteration.
Mainnet
Development under realistic operating conditions and feedback.
Held-out evaluation
Final generalisation check after mainnet testing and before production.
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
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.