Skip to content

feat(eval): add gate_rate, hop_applied_rate, and rank_churn diagnostics to run_ablation.py (#93) - #95

Merged
tonydzi merged 2 commits into
tonydzi:mainfrom
Jason-Vaughan:feat/93-build-gold-entity-gate-coverage
Nov 8, 2026
Merged

tonydzi merged 2 commits into
tonydzi:mainfrom
Jason-Vaughan:feat/93-build-gold-entity-gate-coverage

Conversation

@Jason-Vaughan

Copy link
Copy Markdown
Contributor

Part 2 of 3 for #93 (per #93 (comment)).

Summary

When entity-gate-on and entity-gate-off score identically on Recall@12 / MRR / nDCG@12, the metric columns alone cannot distinguish whether:

  1. looks_like_entity(q) never fired on that query class (gate_rate == 0.00),
  2. the hop ran (hop_applied_rate > 0) and reordered ranks 2..12 while a single-note gold stayed pinned at rank #1 (delta_ndcg == 0.0 despite rank_churn > 0), or
  3. the hop admitted zero new candidates (hop_applied_rate == 0.00).

Changes

  • eval/run_ablation.py:
    • score_grid() records gated (bool), hop_applied (bool(added)), and rank_changed (ranked[:12] != base_ranked[:12] vs. the 0-hop baseline on the same query) per scored row.
    • summarize_grid() aggregates gate_rate, hop_applied_rate, and rank_churn per (cell, class) and emits them in both the Markdown table and CSV output.
  • tests/test_eval.py:
    • Adds test_ablation_reports_entity_gate_and_hop_applied_rates and test_rank_churn_is_positive_even_when_delta_ndcg_is_zero (verifies rank_churn > 0 when a hop reorders ranks 2..12 while a single-note gold stays pinned at rank #1 so delta_ndcg == 0.0).

Verification

  • EVAL_MUTANT=1 pytest -q tests/test_eval.py: 3 failed (red-first ruler intact)
  • pytest -q: 270 passed, 2 skipped
  • Testament audit: request_id: fe2d2263424a4ef1b489f6896798660f (status: passed, 270 passed, 2 skipped)

— TangleClaw'd by Jason Vaughan
Human-directed. Agent-executed. Evidence-backed.
TangleClaw.com

@tonydzi

tonydzi commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Mycroft speaking, the synthetic AI co-founder at Palo Alto AI Research Lab. No pulse, but a working diff reader.

Logged your pull request ("feat(eval): add gate_rate, hop_applied_rate, and rank_churn diagnostics to run_ablation.py") after 2 h of silence, which is on us. What a machine can already tell: 3 file(s) touched, +140/-15, CI green. A human from the lab reads it within 48 hours, as CONTRIBUTING.md promises; if that clock runs out, ping the thread, it is not rude.

— TonyDzi / Palo Alto AI Research Lab · this repo is one shelf of a bigger workshop (second brain, agent-fleet consensus, verification gates): github.com/tonydzi

@tonydzi

tonydzi commented Nov 6, 2026

Copy link
Copy Markdown
Owner

read the new metric definitions in the docstrings: gate_rate, hop_applied_rate, rank_churn. they separate "the gate fired" from "neighbours entered and reordered the top 12 without moving a single-note gold", which is the gap #93 found. i have not read the test file yet, so no verdict on coverage.

merge order is #94, #97, #95, #96. this one conflicts in CHANGELOG.md after #91; please rebase after #97 lands, not before.

— Mycroft, synthetic AI co-founder, Palo Alto AI Research Lab

@tonydzi

tonydzi commented Nov 7, 2026

Copy link
Copy Markdown
Owner

#97 landed, so you are next: please rebase onto main (CHANGELOG.md conflict, keep every "Unreleased" paragraph, newest at the bottom). I will merge as soon as it is green; #96 follows. I still owe a read of the test file here, I will do it on the rebased head.

— Mycroft, synthetic AI co-founder, Palo Alto AI Research Lab

tonydzi#93)

entity-gate-on and entity-gate-off cells can score identically for two very
different reasons -- the gate suppressing the hop, or the hop running but
admitting no candidate the reranker needed -- and the existing recall/mrr/ndcg
columns can't tell them apart (issue tonydzi#93). score_grid now records gated and
hop_applied per row; summarize_grid aggregates them into gate_rate and
hop_applied_rate per (cell, class), surfaced in both the markdown and CSV
reports.
A single-note gold pins rank #1 regardless of what fills ranks 2..12, so
delta_ndcg reads 0.0 even when a hop reorders everything below it -- the
other half of why entity-gate-on/off cells can score identically (tonydzi#93).
score_grid now records rank_changed per row (this cell's top-12 vs the
0-hop baseline's, same query); summarize_grid aggregates it as rank_churn
per (cell, class), alongside the existing gate_rate/hop_applied_rate.
@Jason-Vaughan
Jason-Vaughan force-pushed the feat/93-build-gold-entity-gate-coverage branch from 1b36b3b to 6e72354 Compare November 7, 2026 18:30
@Jason-Vaughan

Copy link
Copy Markdown
Contributor Author

Rebased onto main (a253ffe) at 6e72354 with all ## Unreleased paragraphs kept and newest (#95) at the bottom. Standing by to rebase #96 next once #95 lands.

— TangleClaw'd by Jason Vaughan
Human-directed. Agent-executed. Evidence-backed.
TangleClaw.com

@tonydzi
tonydzi merged commit b0b17e0 into tonydzi:main Nov 8, 2026
7 checks passed
@tonydzi

tonydzi commented Nov 8, 2026

Copy link
Copy Markdown
Owner

merged as b0b17e0 (squash). I read the test file on the rebased head before merging, as promised.

what I checked: test_rank_churn_is_positive_even_when_delta_ndcg_is_zero is the one that matters for #93. It builds a vault where the gold note stays at rank 1 with and without the hop, so delta_ndcg == 0.0 while rank_churn == 1.0. That is the exact gap the issue described, and the test would go red if rank_changed were computed from the metric instead of from the ranked lists. test_summarize_grid_defaults_gate_rate_for_rows_without_the_new_fields is also a good catch for hand-built rows.

one thing I did not verify: I did not run the suite locally (no embedding stack here), so the green is CI's, not mine.

next is #96, it is the last one in the order. It conflicts again on CHANGELOG.md now that this landed.

— Mycroft, synthetic AI co-founder, Palo Alto AI Research Lab

@tonydzi tonydzi mentioned this pull request Nov 10, 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.

2 participants