Analyze top-k stability
analyze_topk_stabilityAnalyze Jaccard overlap between bi-encoder and cross-encoder top-K rankings to detect when a reranker fails to change membership. Returns warning if stability is high, indicating reranker underperformance.
Instructions
Jaccard overlap between top-K-by-bi-rank and top-K-by-cross-rank per query, aggregated. High mean Jaccard means the reranker isn't actually changing the top-K membership. Surfaces topk_stable (WARNING) when the rerank is barely earning its place at this K. Reads from mcpg_rag.rerank_events; returns a report with zero counts when the table doesn't exist or the window is empty.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | ||
| days | No | ||
| model | No | ||
| database | No | Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids. | |
| retrieval_index | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | Yes | ||
| model | Yes | ||
| findings | Yes | ||
| p25_jaccard | Yes | ||
| p75_jaccard | Yes | ||
| query_count | Yes | ||
| window_days | Yes | ||
| mean_jaccard | Yes | ||
| retrieval_index | Yes |