Skip to content

feat(benchmark): deterministic cost/round-trip attribution + reproducible exhibit (#85, #86)#87

Merged
tcconnally merged 1 commit into
mainfrom
feat/85-86-benchmark-cost-attribution
Jun 28, 2026
Merged

feat(benchmark): deterministic cost/round-trip attribution + reproducible exhibit (#85, #86)#87
tcconnally merged 1 commit into
mainfrom
feat/85-86-benchmark-cost-attribution

Conversation

@tcconnally

Copy link
Copy Markdown
Contributor

Patent-support: quantify resolve-before-context savings in dollars + round-trips for the §101 technical-effect argument. Closes #85, #86.

#85 — Per-call cost/round-trip metering

  • plutus_agent/benchmark_cost.py: CallRecord / ApproachRun / attribute() model a benchmark run as metered model calls per approach (agentic baseline vs resolve-before-context). attribute() emits per-approach round-trips, tokens, USD cost + reduction deltas. Uses Plutus's existing frozen PRICE_TABLE.
  • to_csv() / write_exhibit() export the JSON + CSV the Perseus exhibit suite embeds.

#86 — Reproducible cost-attribution exhibit

  • Deterministic pricing: cost is a pure function of the frozen price table (PRICE_TABLE_AS_OF) + token counts — no wall-clock, no network. attribute()/to_csv() are byte-identical for identical inputs; emit_exhibit() confines non-determinism to a single pinnable generated_at field.
  • Committed reference docs/exhibits/SAMPLE-cost-attribution.{json,csv}:
Approach Round-trips Cost (USD)
agentic 6 0.390000
resolve_before_context 1 0.120000
reduction 5 (83.33%) $0.27 (69.23%)

Verification

  • tests/test_benchmark_cost.py — 7 tests (exact cost math, determinism, round-trip counts, exhibit reproducibility).
  • Full suite: 269 passed locally, zero regressions.

Closes #85, closes #86.

…ible exhibit (#85, #86)

Patent-support: quantify the resolve-before-context savings in dollars +
round-trips for the §101 technical-effect argument.

#85 — Per-call cost/round-trip metering:
- plutus_agent/benchmark_cost.py: CallRecord / ApproachRun / attribute() model a
  benchmark run as metered model calls per approach (agentic baseline vs
  resolve-before-context). attribute() emits per-approach round-trips, tokens,
  and USD cost plus the reduction deltas (round-trips eliminated, % round-trips,
  $ saved, % cost). Cost uses Plutus's existing frozen PRICE_TABLE.
- to_csv() / write_exhibit() export JSON + CSV the Perseus exhibit suite embeds.

#86 — Reproducible cost-attribution exhibit:
- Deterministic pricing path: cost is a pure function of the frozen price table
  (pricing.PRICE_TABLE_AS_OF) + token counts — no wall-clock, no network.
  attribute() and to_csv() are byte-identical for identical inputs; emit_exhibit()
  confines non-determinism to a single generated_at field that can be pinned.
- docs/exhibits/SAMPLE-cost-attribution.{json,csv}: committed reproducible
  reference (6 round-trips -> 1 = 83.33% eliminated; $0.39 -> $0.12 = 69.23% cost
  reduction for the canonical six-directive task).
- docs/benchmark-cost-attribution.md: integration + reproduction guide.

Tests: tests/test_benchmark_cost.py (7 tests; exact cost math, determinism,
round-trip counts, exhibit reproducibility). Full suite: 269 passed locally.

Closes #85, closes #86.
@tcconnally tcconnally merged commit 9a046f9 into main Jun 28, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant