Skip to content

feat(analysis): verify SPEC R11 (trained coordinator > LLM-as-coordinator) offline - #373

Closed
philluiz2323 wants to merge 1 commit into
James-CUDA:mainfrom
philluiz2323:feat/verify-spec-r11-coordinator-vs-llm
Closed

feat(analysis): verify SPEC R11 (trained coordinator > LLM-as-coordinator) offline#373
philluiz2323 wants to merge 1 commit into
James-CUDA:mainfrom
philluiz2323:feat/verify-spec-r11-coordinator-vs-llm

Conversation

@philluiz2323

Copy link
Copy Markdown
Contributor

Type

  • General improvement — bug fix, docs, refactor, or infrastructure (welcome but earns no TAO)

General improvement

What does this PR do?

Closes #372.

Adds the offline verifier for SPEC §1.3 invariant R11 — "Trained coordinator > LLM-as-coordinator" (Table 8), which had no check (R5/R7/R12 do; R6 is in flight in #351).

  • src/trinity/analysis/coordinator_vs_llm.py — per benchmark, computes the margin TRINITY - LLM-as-coordinator and whether TRINITY wins; analyze_benchmarks rolls up the R11 verdict on the equal-weight union (default: TRINITY must win on every benchmark, the SPEC reading; require_all=False holds on the average).
  • scripts/coordinator_vs_llm_report.py — CLI reading {benchmark: {trinity, llm_coordinator}}, printing the report and exiting non-zero on a violation. Mirrors scripts/turns_monotonicity_report.py (R7) / the merged R5 report.

Pure numpy/stdlib — no torch, no network, no GPU.

Why is it needed?

R11 is the justification for training a tiny derivative-free head at all: a ~10K-param linear head optimized with sep-CMA-ES should route better than prompting a full LLM to pick model/role each turn. Without an offline check the claim can't be reported alongside the other invariants, and a regression that lets the LLM baseline catch up would go unnoticed. SPEC §6 notes the paper's LLM-as-coordinator average is 53.76 (Table 8), not the text's 64.14.

Example

| benchmark      | trained coord | LLM-as-coord | margin | R11 |
| livecodebench  | 0.615         | 0.520        | +0.095 | ok  |
| math500        | 0.880         | 0.700        | +0.180 | ok  |
| mmlu           | 0.916         | 0.600        | +0.316 | ok  |

R11 (trained coordinator > LLM-as-coordinator): HOLDS — won 3/3 benchmarks (union mean margin +0.197)

Checklist

  • Tests pass: pytest tests/ — added tests/test_coordinator_vs_llm.py (9 cases: per-benchmark win/loss/tie, the require-all verdict, the union-average mode, key aliases + skipping of missing/non-numeric entries, empty input, and render). Purely additive (3 new files).
  • Lint passes: ruff check src/ — clean.
  • Type check passes: mypy src/Success: no issues found.
  • New code follows existing style (mirrors trinity.analysis.turns_monotonicity / the merged per_question_best).
  • Public functions have docstrings and type annotations.

…ator) offline

SPEC §1.3 lists R11 -- "Trained coordinator > LLM-as-coordinator" (Table 8) -- as
a replication invariant, but nothing verified it (R5/R7/R12 have checks, R6 is in
flight). R11 justifies training a tiny derivative-free head at all: a ~10K-param
linear head should route better than prompting a full LLM to pick model/role.

trinity.analysis.coordinator_vs_llm reads per-benchmark trained-coordinator
(TRINITY) accuracy and the LLM-as-coordinator baseline accuracy and reports, per
benchmark, the margin TRINITY - LLM and whether TRINITY wins, plus the R11 verdict
on the equal-weight union (default: win on every benchmark; a union mode holds on
the average). SPEC §6 notes the paper's LLM-as-coordinator average is 53.76
(Table 8). scripts/coordinator_vs_llm_report.py is the CLI (exit non-zero on
violation), mirroring the R5/R7 report scripts. Pure numpy/stdlib. Adds tests.
@James-CUDA

Copy link
Copy Markdown
Owner

The coordinator_vs_llm.py and test files were already merged via #376. The unique script (scripts/coordinator_vs_llm_report.py) has been cherry-picked directly to main (b1e9ce7). Closing as duplicate/merged.

@James-CUDA James-CUDA closed this Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify SPEC R11 (trained coordinator > LLM-as-coordinator) offline

2 participants