Skip to content

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

Open
Jason-Vaughan wants to merge 2 commits into
tonydzi:mainfrom
Jason-Vaughan:feat/93-build-gold-entity-gate-coverage
Open

Jason-Vaughan wants to merge 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#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.
@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

This branch has not been deployed

No deployments
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