feat(core): record per-episode cost in EpisodeReport (#253)#255
Merged
Conversation
EpisodeReport carried the graded result but no notion of what the episode cost to run, so any "capability per unit cost" comparison had to be reconstructed with an external stopwatch. Add EpisodeCost (wall_seconds, realize_seconds, turns) populated by the episode loop: perf_counter at realize start and grade end, realize_seconds for the setup portion, turns counted from record_turn. It rides on EpisodeReport as a defaulted field (zero-cost when unset, so existing constructions are unaffected) and serializes in as_dict for eval runs and the dashboard. Backing-agnostic: the same field is populated whether the world ran as PROCESS or any future backing, so cost is comparable across the fidelity range. Token attribution is deferred — it needs per-backend usage reporting, a separate piece. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Self-Review
Closes #253
Summary
EpisodeReportcarried the graded result but no notion of what the episode cost to run, so a "capability per unit cost" comparison had to be reconstructed with an external stopwatch.EpisodeCost(wall_seconds, realize_seconds, turns), populated by the episode loop:perf_counterat realize start and grade end,realize_secondsfor the setup (realize + reset) portion,turnscounted fromrecord_turn.EpisodeReportas a defaulted field — zero-cost when unset, so the existing direct constructions (SWE, trading, TRL, training tests) are unaffected — and serializes inas_dictfor eval runs and the dashboard.PROCESSor any future backing, so cost is comparable across the fidelity range.Token attribution is deliberately out of scope here — it needs per-backend usage reporting, a separate piece.
Testing
Verified through the real episode loop (scripted solvers, no LLM):
turnsmatches the number of recorded turns (2 for a two-turn solver, 0 for a no-op);wall_seconds >= realize_seconds >= 0;as_dict()["cost"]carries the three keys. The five test files that constructEpisodeReportdirectly all still pass, confirming the defaulted field is backward-compatible.Review Notes
EpisodeCostis exported alongsideEpisodeReportat the package top level.seed— wire backing + scale selection #251, merged) so cost is measured at every rung of the fidelity range from the first training run.