Skill
Build RAG reranker pipeline
Add cross-encoder reranker as second stage after vector retrieval (pgvector/Neo4j-vector) to reorder top-K by true semantic relevance — local, no GPU, no API, using sentence-transformers cross-encoder/ms-marco-MiniLM-L-6-v2
Primitives inside (7)
cpu-rerank-latency-budgetcalibrationBudget ~1s (measured 925ms) for top-50 cross-encoder MiniLM-L-6 reranking on laptop CPU; expect over 1s at top-100 and 2-5x slowdowns for the larger cross-encoder models.
When: Sizing latency expectations for CPU-based reranking in an interactive or batch pipeline.
cross-encoder-rerank-rank-order-onlycalibrationA cross-encoder reranker's raw logit scores (ms-marco-MiniLM-L-6-v2) are not probabilities — use them for rank ORDER only, never as confidence thresholds; runs CPU-only with no API.
When: Adding a second-stage reranker over hybrid-retrieval candidates before returning results to an agent.
lazy-singleton-model-loaddisciplineLoad a heavyweight model once via a module-level lazy singleton so repeated pipeline calls pay the multi-second load/download only on first use.
When: A function invoked repeatedly in one process needs an expensive-to-load model.
prefer-builtin-rank-apidisciplinesentence-transformers >= 2.7 ships CrossEncoder.rank() (pair-build + predict + sort in one call, dict output) — check for the built-in before reimplementing ranking around a raw CrossEncoder.
When: You hold a raw CrossEncoder instance and need ranked results over documents.
rank-order-not-absolute-thresholdgotcha-fixCross-encoder scores are model-config-dependent raw logits (measured -11.4 to +7.8 on the default model) — consume rank order only, never threshold on absolute score.
When: Downstream logic is about to consume cross-encoder relevance scores.
stage1-headroom-ratio-5xcalibrationSize Stage-1 so top_stage1/top_final >= 5x — below 3x the reranker has too little selection headroom to improve on retrieval.
When: Choosing candidate counts for a retrieve-then-rerank pipeline.
unpack-cross-library-tuples-by-namegotcha-fixSibling utilities can return the same logical pair in REVERSED tuple order ((score,text) vs (text,score)) — when chaining libraries, never assume tuple element order; destructure explicitly per producer.
When: Consuming tuple-returning functions from more than one library or skill in a single chain.
Get the whole skill
All 7 primitives of this skill as one package, with the order to apply them.
Buy only the primitives you need
Each primitive is 1 credit (≈ €0.10). Pick them from the list above — the button is next to each one.
Upgrade your own skill
Paste your skill; we pick the 5 primitives from the shelf that fit it best, as one bundle for 5 credits (≈ €0.50).
Upgrade my skillNeighbour skills
Skills whose primitives are closest to this one (bge-m3 similarity):