feat(analysis): verify SPEC R3 (TRINITY > best multi-agent baseline) offline - #386
Merged
James-CUDA merged 1 commit intoJul 22, 2026
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #385
What
docs/SPEC.md§1.3 lists R3 — "TRINITY > best multi-agent baseline (MoA / MasRouter / RouterDC / Smoothie)" (§4.2, Fig. 3) as a replication invariant, but nothing verified it (R5/R7/R8/R11/R12 have offline checks; R3 had none). R3 is the claim that separates a learned coordinator from the prior art it is measured against — routing better than any multi-agent ensembling/routing baseline is strictly stronger than beating a single model (R1) or random routing (R4).This adds
src/trinity/analysis/multi_agent_baseline.py(+ tests) — an offline check that reads per-benchmark TRINITY accuracy and a{baseline: score}map and reports whether TRINITY strictly beats the best baseline present, per benchmark and on the equally-weighted union.API (mirrors the R11
coordinator_vs_llmmodule)analyze_benchmark(trinity, {baseline: score}, *, benchmark, tol)→MultiAgentComparison(best baseline named, margin, comparable, holds)analyze_benchmarks({benchmark: (trinity, baselines)})→ per-benchmark rows +r3_holds, equal-weight union accuracies/margin,violationsrender(...)→ compact markdown reportStrict win (a tie is not a pass); the bar is the strongest baseline present; tolerant to missing TRINITY / non-numeric / absent baselines (excluded from the union, never crash); accepts pair tuples or
{trinity, baselines}mappings. The four SPEC-named baselines are recognized for reporting but the set is open.Verification
Pure numpy/stdlib — no torch, no network, no GPU. 13 offline tests;
ruff+mypyclean onsrc/.