Skip to content

Commit ada0ea1

Browse files
committed
feat(bench): add preregistered v9 efficiency controller
1 parent b901914 commit ada0ea1

24 files changed

Lines changed: 2198 additions & 69 deletions

.github/workflows/bench.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ on:
2828
- publication-open-admission
2929
- publication-open-screen
3030
- publication-open-release
31+
- literature-v9-ablation
32+
- literature-v9-screen
33+
- literature-v9-release
3134
default: custom
3235
experiment:
3336
description: "Versioned controller protocol; use one admission per causal variant."
@@ -60,7 +63,20 @@ on:
6063
- scalar-milestone-packet-authority-v6
6164
- scalar-milestone-packet-authority-v7
6265
- scalar-milestone-packet-authority-v8
66+
- scalar-milestone-packet-authority-v9
6367
default: control
68+
controller_features:
69+
description: "v9 feature set: all, retrieval, working-context, lanes, early-stop, or early-stop,critical-replay."
70+
required: false
71+
default: "all"
72+
escalation_model:
73+
description: "Optional stronger model used only after a v9 milestone handoff."
74+
required: false
75+
default: ""
76+
escalation_provider:
77+
description: "Provider for the optional escalation model."
78+
required: false
79+
default: "openai-responses"
6480
groups:
6581
description: "Model groups to run (comma-separated: open,open-qwen,open-mid-admission,open-mid-route-recovery,open-mid-followup,open-frontier,open-direct,openai,openai-native,anthropic,google). Default: open."
6682
required: false
@@ -415,15 +431,25 @@ jobs:
415431
BENCH_DRY_RUN: ${{ github.event.inputs.dry_run == 'true' && '1' || '' }}
416432
BENCH_MAX_TURNS: "12"
417433
BENCH_CONTROLLER_EXPERIMENT: ${{ github.event.inputs.experiment || 'control' }}
434+
BENCH_CONTROLLER_FEATURES: ${{ github.event.inputs.controller_features || 'all' }}
435+
ESCALATION_MODEL: ${{ github.event.inputs.escalation_model || '' }}
436+
ESCALATION_PROVIDER: ${{ github.event.inputs.escalation_provider || 'openai-responses' }}
418437
run: |
419438
DRY_FLAG=""
420439
[ "${{ github.event.inputs.dry_run }}" = "true" ] && DRY_FLAG="--dry-run"
440+
ESCALATION_ARGS=""
441+
if [ -n "$ESCALATION_MODEL" ]; then
442+
ESCALATION_ARGS="--escalation-model $ESCALATION_MODEL --escalation-provider $ESCALATION_PROVIDER"
443+
fi
421444
python scripts/govern_bench/run_bench.py \
422445
${{ steps.build-args.outputs.args }} \
423446
--provider ${{ matrix.provider }} \
424447
--model "${{ matrix.model }}" \
448+
--controller-features "$BENCH_CONTROLLER_FEATURES" \
425449
--output "bench-report-${{ matrix.label }}.md" \
426450
--json-output "bench-results-${{ matrix.label }}.json" \
451+
--policy-output "bench-policy-${{ matrix.label }}.jsonl" \
452+
$ESCALATION_ARGS \
427453
$DRY_FLAG
428454
429455
- name: Upload per-model artifact
@@ -435,6 +461,7 @@ jobs:
435461
bench-report-${{ matrix.label }}.md
436462
bench-results-${{ matrix.label }}.json
437463
bench-results-${{ matrix.label }}.audit.json
464+
bench-policy-${{ matrix.label }}.jsonl
438465
retention-days: 30
439466
if-no-files-found: ignore
440467

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ consolidated into the next published release.
1111
## [Unreleased]
1212

1313
### Added
14+
- Add the preregistered literature-driven v9 benchmark controller without
15+
changing frozen v8: role-aware source-on-demand retrieval, lossless bounded
16+
working context, deterministic controller lanes, execution-derived early
17+
stop, focused critical replay, optional same-fixture model escalation,
18+
trace-derived policy exports, and locked n=1/n=5/n=10 experiment profiles.
1419
- Freeze preregistration `GB-PREPRINT-2026-07-30-V1` before paid inference.
1520
It adds the locked T28/T29/T30 three-condition n=10 publication grid,
1621
sequential n=1/n=5/n=10 admissions for six exact 20B-35B open-model routes,

README.md

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -136,32 +136,18 @@ the [`examples/policies`](examples/policies) directory.
136136

137137
## Governance efficiency benchmark
138138

139-
In the same-commit GPT-5.6 Sol n=10 replication, Specsmith FULL passed 80/80
140-
cells at 10.7k tokens per correct answer (TPCA); the versioned Cursor-style
141-
condition passed 70/80 at 24.8k. A separate preregistered mixed-suite run found
142-
Terra + FULL at 80/80 and 11.7k TPCA versus raw Sol at 65/80 and 28.0k; its
143-
coding-only correctness gate remained inconclusive.
144-
145-
The fresh synthetic polyglot T29 package later passed an independent 10/10
146-
confirmation first-pass at 17.6k TPCA, five turns, and 1.62% CV. These are
147-
task-, route-, and benchmark-specific results. Published-size open models have
148-
not passed the repeated frontier-replacement gates, so Specsmith does not claim
149-
that small models generally replace frontier models.
150-
151-
The publication-readiness round adds a commit-pinned independent upstream
152-
repository, matched raw/Cursor/Specsmith conditions, explicit failed-run
153-
expenditure, and sequential 20B–35B open-model admission. Its self-audit
154-
invalidated the original T30 evaluator before publication; corrected frozen
155-
protocol `GB-PREPRINT-2026-07-30-V2` is the only scored real-repository
156-
stratum. Full receipts and limitations stay in the benchmark report rather
157-
than this quick start.
158-
159-
On corrected T30, Sol FULL passed 8/10 at 105.5k TPCA versus raw Sol at 5/10
160-
and 234.5k and the versioned Cursor-style condition at 1/10 and 1,027.1k.
161-
Terra FULL improved over Terra controls but passed only 2/10, so the
162-
lower-tier substitution claim does not transfer to this repository. The
163-
within-model point estimates favor FULL, but their joint uncertainty gates
164-
remain unconfirmed at n=10.
139+
Same-commit repeated runs show that deterministic requirements, bounded
140+
context, and executable verification can materially reduce tokens per correct
141+
answer on the evaluated task/route combinations. The result is conditional:
142+
it transfers strongly on some synthetic suites, but current 20B–35B routes and
143+
the independent upstream task do not substantiate a general claim that small
144+
models replace frontier models.
145+
146+
The preregistered v9 experiment now isolates role-aware retrieval, lossless
147+
working-context bounds, minimal controller lanes, execution-derived early
148+
stopping, focused replay, and optional stronger-model handoff. These are
149+
experimental controls, not published gains, until they clear n=1, n=5, and
150+
n=10 correctness and efficiency gates.
165151

166152
See the
167153
[full benchmark report](https://specsmith.readthedocs.io/stable/efficiency-benchmark/),

docs/ARCHITECTURE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ The free default ESDB uses SQLite. The optional ChronoMemory backend adds its
4141
licensed ChronoStore implementation. Both expose the same Specsmith evidence
4242
boundary so integrations do not depend on a proprietary backend.
4343

44+
`specsmith.efficiency_controller` is the reusable experimental boundary for
45+
long-horizon model efficiency. It selects the smallest deterministic lane that
46+
can satisfy a task, keeps only five recent tool exchanges in working context,
47+
and archives every evicted exchange losslessly under a content-addressed
48+
evidence reference. Role/symbol/dependency repository maps identify likely
49+
files without preloading raw source. Repeated execution signatures trigger one
50+
focused replay and then a machine-readable milestone handoff; an optional
51+
stronger route resumes the same fixture and diff rather than restarting.
52+
4453
### Interfaces
4554

4655
- The focused CLI supports project adoption, requirements, tests, preflight,
@@ -82,6 +91,8 @@ flowchart LR
8291
7. Windows, Linux, and macOS use equivalent paths and command semantics.
8392
8. Specsmith publication occurs only through reviewed release branches and
8493
repository-local CI.
94+
9. Experimental benchmark controllers never mutate a frozen publication
95+
controller, and hidden acceptance runs only after the final route stops.
8596

8697
## Release architecture
8798

docs/LEDGER.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,3 +561,41 @@
561561
- **Status**: complete
562562
- **Epistemic status**: high
563563
- **Chain hash**: `e148e0000c209daf...`
564+
565+
## 2026-07-31T07:44 — KILL SWITCH ACTIVATED: emergency stop
566+
- **Author**: specsmith-operator
567+
- **Type**: kill-switch
568+
- **REQs affected**: REG-005
569+
- **Status**: complete
570+
- **Epistemic status**: high
571+
- **Chain hash**: `d90f093acee88be2...`
572+
573+
## 2026-07-31T09:09 — wi_close WI-9EEA67280570: REQ-484 v9 implementation and release-path verification complete
574+
- **Author**: specsmith
575+
- **Type**: wi_close
576+
- **Status**: complete
577+
- **Chain hash**: `23f0c39ccfa156a5...`
578+
579+
## 2026-07-31T09:09 — wi_close WI-9D3192B60628: Accepted efficiency improvements implemented and verified
580+
- **Author**: specsmith
581+
- **Type**: wi_close
582+
- **Status**: complete
583+
- **Chain hash**: `d33ec2683ac0bf60...`
584+
585+
## 2026-07-31T09:09 — wi_close WI-3E78F9B1FE6B: Canonical requirements, tests, docs, and preprint updated and verified
586+
- **Author**: specsmith
587+
- **Type**: wi_close
588+
- **Status**: complete
589+
- **Chain hash**: `27d2379ef500efe4...`
590+
591+
## 2026-07-31T09:09 — wi_archive WI-96A3586F61CD: Read-only research assessment completed and subsumed by REQ-484 v9
592+
- **Author**: specsmith
593+
- **Type**: wi_archive
594+
- **Status**: complete
595+
- **Chain hash**: `c90aefea916d9e55...`
596+
597+
## 2026-07-31T09:09 — wi_archive WI-EC9713B9BF5A: Read-only implementation planning completed and subsumed by REQ-484 v9
598+
- **Author**: specsmith
599+
- **Type**: wi_archive
600+
- **Status**: complete
601+
- **Chain hash**: `7859f9465d9eaacb...`

docs/requirements/govern_bench.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@
3535
including simulated dispatch, MUST be excluded from published comparisons.
3636
A deterministic single-file repair handoff SHOULD provide bounded current
3737
content and a write-only tool surface so compaction does not force a reread.
38+
New controller changes MUST be isolated behind a versioned experiment and
39+
MUST NOT mutate a frozen publication controller. The literature-driven v9
40+
experiment MUST support role-aware source-on-demand retrieval, lossless
41+
evidence references with a bounded recent working history, deterministic
42+
selection of the smallest sufficient controller lane, execution-derived
43+
stall replay and milestone escalation, and an optional same-fixture model
44+
cascade that evaluates the hidden oracle exactly once. Its retrieval,
45+
working-context, lane-selection, early-stop, and critical-replay controls
46+
MUST be independently ablatable before n=1 admission, n=5 screening, and
47+
n=10 confirmation. Raw rows MUST retain controller lane, context pruning,
48+
evidence references, handoff state, failed-token mass, and trace-derived
49+
policy examples so efficiency decisions remain reproducible.
3850
source: scripts/govern_bench benchmark trustworthiness fixes (plan aebed8bd)
3951
status: implemented
4052
- id: REQ-485

docs/site/benchmark-audit.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Long-Horizon Benchmark and Weakness Audit
22

3+
## V9 efficiency audit contract
4+
5+
The literature-driven v9 controller adds two directly actionable audit signals:
6+
`failed_token_share` identifies how much spend ended in incorrect rows, and
7+
`milestone_escalation_rate` identifies how often a route could not recover
8+
within one focused replay. It also records peak/pruned working-context size,
9+
evidence references, deterministic lane choice, and the exact handoff used by
10+
an optional stronger model.
11+
12+
A repeated execution signature now restores only the active file boundary once.
13+
Another identical signature stops the current route and emits completed,
14+
pending, changed-file, validator, and evidence state. The next model continues
15+
that work; it does not receive a clean restart or an early hidden-oracle hint.
16+
The audit recommends a cascade comparison when escalation is recurring and
17+
blocks repetition when failed runs hold at least half the observed token mass
18+
in an n≥5 slice.
19+
320
GovernanceBench `T28` is a 20-turn product task spanning a Python/FastAPI API,
421
Go worker, TypeScript/React UI, Playwright journey, JSON Schema, CSS, public
522
tests, and architecture documentation. Its result is reported separately as

docs/site/efficiency-benchmark.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Specsmith Governance Efficiency Benchmark
22

3+
## Preregistered literature-driven v9 experiment
4+
5+
The next controller study is preregistered in
6+
`scripts/govern_bench/LITERATURE_V9_PROTOCOL.yml`; it does not alter the frozen
7+
v8 publication controller and has no reported gain yet. Six cells isolate
8+
role-aware retrieval, lossless five-pair working context, smallest-lane
9+
selection, execution-derived early stopping, focused replay, and their combined
10+
effect on T28, T29, and the pinned upstream T30 repository. Promotion remains
11+
n=1 admission → n=5 screen → n=10 confirmation.
12+
13+
The design is motivated by primary studies reporting that role-aware code
14+
representations can improve localization with much smaller footprints
15+
([Caumartin et al.](https://arxiv.org/abs/2607.11046)); five-pair pruning can
16+
lower token use while improving completion in a long-horizon tool workflow
17+
([Lodha et al.](https://arxiv.org/abs/2606.10209)); indexed external evidence
18+
can bound working context without discarding the underlying observations
19+
([Memex](https://arxiv.org/abs/2603.04257)); and critical trajectory replay can
20+
reduce test-time scaling cost ([SWE-Replay](https://arxiv.org/abs/2601.22129)).
21+
Those results motivate hypotheses; they are not evidence that the mechanisms
22+
will transfer to GovernanceBench.
23+
24+
Raw v9 rows add controller lane, peak and pruned working-context characters,
25+
evidence-reference count, failed-token share, milestone escalation, handoff
26+
state, and trace-derived policy examples. The audit fails closed on missing or
27+
errored cells and treats high failed-token mass as an efficiency blocker.
28+
329
## Current promotion and release protocol
430

531
Benchmark spend now follows locked, versioned profiles:

docs/site/preprint.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,28 @@ does not imply a parameter count or architecture that the provider has not
1818
published. “Small model” is reserved for a route with a published size, such
1919
as Llama 3.1 8B.
2020

21+
## Publication hold and next evidence
22+
23+
The preprint remains unsubmitted while the preregistered v9 controller is
24+
evaluated. Its mechanisms are literature-backed hypotheses—role-aware compact
25+
retrieval, five-pair lossless context, minimal controller lanes, one critical
26+
replay, and bounded model escalation—not claimed improvements. Each is first
27+
ablated on T28/T29/T30 at n=1; only a fully correct cell advances to n=5, and
28+
only a passing screen advances to independent n=10 confirmation.
29+
30+
This also tests whether Specsmith's narrow integration direction is justified.
31+
[SWE-Skills-Bench](https://arxiv.org/abs/2603.15401) reports that most tested
32+
generic skills did not improve pass rate and sometimes added substantial token
33+
overhead, supporting measurement of specialized governance controls rather
34+
than expansion of the default skill catalogue. Training or distillation is a
35+
later stage: trace-derived controller labels can support focused verifiers or
36+
compression policies, while executable environments and diverse generated
37+
tasks follow the evidence strategy of
38+
[SWE-Gym](https://arxiv.org/abs/2412.21139),
39+
[SWE-smith](https://arxiv.org/abs/2504.21798), and
40+
[SWE-Dev](https://arxiv.org/abs/2506.07636). No broader small-model claim is
41+
approved until repeated fresh-repository gates pass.
42+
2143
## Claim ladder
2244

2345
Public wording follows the strongest completed evidence gate, not the most

docs/tests/govern_bench.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@
1515
each selected model for a live provider before a full run, fail partial real
1616
runs, reject incomplete or mismatched comparison artifacts, and hand a
1717
single-file deterministic repair its bounded current content without an
18-
avoidable reread turn.
18+
avoidable reread turn. Tests also verify that the versioned v9 experiment
19+
leaves frozen v8 behavior unchanged, ranks compact role/symbol/dependency
20+
repository entries, preserves pruned evidence by exact reference, retains
21+
only five recent tool pairs, selects deterministic controller lanes,
22+
restores only the focused file during critical replay, escalates repeated
23+
execution failures with a machine-readable handoff, defers hidden-oracle
24+
evaluation until a cascade finishes, exposes isolated controller features,
25+
exports trace-derived policy examples, and defines n=1, n=5, and n=10 gates.
1926
requirement_id: REQ-484
2027
type: integration
21-
verification_method: pytest tests/test_govern_bench_integrity.py tests/test_benchmark_harness.py
28+
verification_method: pytest tests/test_govern_bench_integrity.py tests/test_benchmark_harness.py tests/test_efficiency_controller.py tests/test_benchmark_v9_controller.py
2229
input: {}
2330
expected_behavior: {}
2431
confidence: 1.0

0 commit comments

Comments
 (0)