Skip to content
Back to skills

Reranking

ASecurity

"Rerank BEIR retrieval results with cross-encoder, MonoT5, SBERT,

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 8, 2026
databasespythonapi

Works with

  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill reranking --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Reranking?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Reranking
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-reranking/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-reranking)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: reranking
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
metadata:
  disco-role: operating
license: Apache 2.0
---

# 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.rerank` routing belong to `retrieval-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.md` for `Rerank`, model protocol, pair construction, and result shape.
- Read `references/workflows.md` for BM25/dense + reranker recipes and evaluation handoff.
- Read `references/troubleshooting.md` for common reranking failures.
- Run `scripts/rerank_smoke.py` for a no-download deterministic check of top-k truncation and score replacement.

## Minimal Pattern

```python
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.

Files in this skill

  • SKILL.md2 KB
  • references/api-reference.md4.3 KB
  • references/troubleshooting.md5 KB
  • references/workflows.md4.6 KB
  • scripts/rerank_smoke.py2.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.