Skip to content

Docs

Cookbook: Re-ranking

One question per query-candidate pair raises top-1 accuracy from 5% to 18% and top-10 accuracy from 38% to 62% on 40 CLERC legal queries.
Format
Docs
Reading time
2 min
Published by
TypeSafe AI
Last verified
Sep 2026

Highlights

  • BM25 shortlists 30 candidates per query over 3,565 CLERC passages; the gold passage appears in the shortlist 100% of the time but at rank 1 only 5%.
  • One Noul per query-candidate pair (1,200 calls across 12 threads) lifts top-1 from 5% to 18% and top-10 from 38% to 62%.
  • The 1,200 calls used 1,536,002 input tokens and 25,200 output tokens, costing $0.0645 at $0.042 per 1M input tokens.
  • The scoring question asks whether the candidate could come from the cited precedent, with NoulCriteria spelling out true and false cases.

Quickstart

python
question = Noul(
    instructions="Is this candidate the cited case?",
    criteria=NoulCriteria(
        true="The candidate states the specific rule the query cites.",
        false="The candidate is only on a similar topic.",
    ),
)
response = client.system_one(
    state={"query_excerpt": query, "candidate_passage": candidate},
    questions={"is_cited_source": question},
)
noul = response.answers["is_cited_source"].noul  # -> 0.87

Watch out

Re-ranking can only reorder the shortlist fast search already produced — it cannot recover a passage BM25 failed to select.

Questions about this entry

Short answers drawn from the linked project or page.

Reactions & coverage

Posts, threads, and videos about this entry from around the web.

X: Search and tagging on keep.md

X: Jev reranks station suggestions in TrainLCD

YouTube: Jev in the reranking step of a RAG pipeline: why cosine similarity fails and how a steerable reranker compares. A Colab notebook comes with it.

X: LinkedIn bookmarks search

From the Jev guides

Original write-ups on what this entry is for.

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai