Skip to content
System One

reranker

Uses Jev as a calibrated reranker: one relevance question per document, up to 30 documents per call, returning a probability usable both as a ranking score and an absolute threshold. Apache-2.0; benchmarked on SciFact, NFCorpus and FiQA. The repo now redirects to hev/reranker.

hev/reranker on GitHub

Stars
11
Forks
0
Language
Python
License
Apache-2.0
Last push
17 Sep 2026

Read from GitHub on . Counts change daily.

How it uses Jev

    ids = {f"D{j:02d}": i for j, i in enumerate(idx)}
    state = {"query": query, "documents": {k: _doc_state(documents[i]) for k, i in ids.items()}}
    questions = {k: Noul(instructions=p["question"].format(id=k), criteria=p["criteria"]) for k in ids}
    r = client.system_one(state=state, questions=questions, model=model)
    return [(ids[k], float(r.answers[k].noul)) for k in ids]

batches = list(_chunk(documents, max_docs_per_call, max_state_chars))
if len(batches) == 1:
    scored = score_batch(batches[0])
else:
    with ThreadPoolExecutor(concurrency) as ex:
        scored = [s for part in ex.map(score_batch, batches) for s in part]

results = [RerankResult(i, s, documents[i]) for i, s in scored]
if threshold is not None:

View in hev_rerank/rerank.py

Open on GitHub

More like this

Use cases this is tagged with