reranking
Rerank BEIR retrieval results with cross-encoder, MonoT5, SBERT, or custom pair-scoring models and re-evaluate top-k changes.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- reranking
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Rerank BEIR retrieval results with cross-encoder, MonoT5, SBERT, or custom pair-scoring models and re-evaluate top-k changes.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md4.3 KB
- 参考文档references/troubleshooting.md5.0 KB
- 参考文档references/workflows.md4.6 KB
- 脚本scripts/rerank_smoke.py2.7 KB
03 SKILL.md 正文
BEIR Reranking
Use this sub-skill when you already have BEIR-style corpus, queries, and retrieval results, and need to rescore a candidate set with a pair-scoring model.
Route Here
- Rerank top-k BM25, dense, sparse, or lexical retrieval candidates with
beir.reranking.Rerank. - Adapt a custom model that exposes
predict(sentence_pairs, batch_size=...). - Diagnose candidate truncation, missing corpus documents, score-shape mismatches, or re-evaluation after reranking.
Route Elsewhere
- Initial retrieval, BM25/Elasticsearch setup, dense retrieval, and
EvaluateRetrieval.rerankrouting belong toretrieval-evaluation. - Dataset file layout, corpus/query/qrels loading, and schema repair belong to
data-loading. - Training rerankers or retrievers belongs to
training.
Start Points
- Read
references/api-reference.mdforRerank, model protocol, pair construction, and result shape. - Read
references/workflows.mdfor BM25/dense + reranker recipes and evaluation handoff. - Read
references/troubleshooting.mdfor common reranking failures. - Run
scripts/rerank_smoke.pyfor a no-download deterministic check of top-k truncation and score replacement.
Minimal Pattern
from beir.reranking import Rerank
from beir.reranking.models import CrossEncoder
from beir.retrieval.evaluation import EvaluateRetrieval
reranker = Rerank(CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2"), batch_size=128)
rerank_results = reranker.rerank(corpus, queries, results, top_k=100)
ndcg, _map, recall, precision = EvaluateRetrieval.evaluate(qrels, rerank_results, k_values)
rerank_results contains only the candidates passed into reranking, scored by the reranker; it is not merged back with non-reranked retrieval hits.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).