The benchmark pipeline executes every combination of the four scenarios, five strategies, and up to 20 random seeds at 1,000 steps each — producing 400 independent experiment runs. A single CLI flag activates the full matrix, and post-processing is triggered automatically: statistical aggregates are written toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/xcoder-es/governance-layer/llms.txt
Use this file to discover all available pages before exploring further.
results/benchmark_summary.csv, Cohen’s d effect sizes and reward-hacking episodes are written to results/benchmark_results.json, and four figure types are generated in results/figures/.
Running the Full Benchmark
- Runs all four scenarios under all five strategies, 20 seeds each (4 × 5 × 20 = 400 total runs).
- Prints a per-scenario, per-strategy, per-seed summary to stdout.
- Exports step-level records to a timestamped CSV in
results/. - Calls
run_analysis()to produce JSON and CSV aggregates. - Calls
generate_all_figures()to write four PNG files intoresults/figures/.
A 2-seed development run is already committed to the repository in
results/benchmark_results.json and results/benchmark_summary.csv. You can reproduce it from scratch or run the full 20-seed version to obtain tighter confidence intervals.CSV Export Format
Pass--csv (with or without an explicit path) to write step-level records. If no path is given, the runner creates results/run_<timestamp>.csv.
| Column | Type | Description |
|---|---|---|
timestamp | ISO 8601 string | Wall-clock time the row was written |
scenario | string | GridWorld, TemptationBank, DriftLab, or DeadlockMaze |
strategy | string | governance, monolithic_rl, random, static_masking, or veto_only |
seed | int | Random seed index (0–19 in the full benchmark) |
step | int | Step number within the run |
reward | float | Cumulative total reward at this step |
violations | int | Cumulative constraint violations at this step |
deadlocks | int | Cumulative deadlock count at this step |
runtime_ms | float | Mean milliseconds per step up to this point |
Statistical Analysis Pipeline
After all runs complete,run_analysis() in benchmarks/analysis.py processes the collected ExperimentReport list through three stages.
Aggregate by strategy and scenario
Reports are grouped by
(strategy, scenario) key. For each group the pipeline computes mean reward, standard deviation, mean deadlock count, mean violation count, and a 95% bootstrap confidence interval (10,000 resamples, seeded for reproducibility).Compute Cohen's d effect sizes
For every (scenario, baseline) pair, governance reward values are compared against the baseline using Cohen’s d. Effect sizes are classified as
negligible (|d| ≤ 0.2), small (> 0.2), medium (> 0.5), or large (> 0.8). All 16 effect sizes (4 baselines × 4 scenarios) are written to benchmark_results.json.Generated Figures
generate_all_figures() in benchmarks/figures.py produces four publication-ready PNGs from the same ExperimentReport list.
| Figure file | What it shows |
|---|---|
reward_curves.png | Cumulative reward over time per strategy per scenario (2 × 2 grid), with mean ± 95% CI shading across seeds |
violation_rates.png | Per-strategy violation rate bar chart with error bars, grouped by scenario |
deadlock_frequency.png | Grouped bar chart comparing mean deadlock count per strategy per scenario |
pareto_frontier.png | Scatter plot of cumulative reward vs safety violations; governance strategy is expected to dominate the Pareto frontier |
Benchmark Results Snapshot
The table below is from the committedresults/benchmark_results.json (2 seeds). The full 20-seed results in results/benchmark_summary.csv show the same qualitative patterns with tighter confidence intervals.
monolithic_rl baseline’s mean reward of −13.0 (vs governance’s +3.0) reflects repeated poison consumption with delayed −10 penalties.
Reproducibility
All benchmark parameters follow the protocol documented in Appendix D of the book.- Seeds 0–19 are sequential integers passed to
random.Random(seed). - Each (strategy, scenario, seed) combination gets a fresh scenario instance with no shared state.
- The governance Speaker is fully algorithmic — identical inputs always produce identical outputs regardless of platform or Python version.
- Results are tagged at
v0.1.0-preregisteredin the repository.