Qwen3-8B passage reranker trained with
Eklav
: the teacher's reasoning is given as a hint in the prompt and the loss is on the final answer only.
Code
·
Std-SFT version
Results
BRIGHT nDCG@10
Qwen3-4B
▶ Qwen3-8B
GLM-Z1-9B
Qwen3-14B
Std-SFT
29.3
31.5
30.1
32.5
▶ Eklav
31.5
▶
34.2
33.2
34.7
Usage
Pointwise reranker in the style of
Rank1
: the model writes its reasoning, ending in
</think> true
or
</think> false
, and relevance is the probability of
true
at that last token.
from vllm import LLM, SamplingParams
import math
model_id = "AdarshSingh7647/Eklav-Passage-8B"
model = LLM(model=model_id, max_model_len=20000)
tokenizer = model.get_tokenizer()
SYSTEM_PROMPT = "You are a careful retrieval assistant that judges whether a passage is relevant to a user's query."
TASK_INSTRUCTION = "Determine if the following passage is relevant to the query. Answer only with 'true' or 'false'."defcreate_prompt(query: str, passage: str) -> str:
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": f"{TASK_INSTRUCTION}\n\nQuery: {query}\nPassage: {passage}"},
]
return tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True, enable_thinking=True
)
sampling_params = SamplingParams(
temperature=0,
max_tokens=4096,
logprobs=20,
stop=["</think> true", "</think> false", "</think>\ntrue", "</think>\nfalse",
"</think>\n\ntrue", "</think>\n\nfalse"],
)
defscore(query: str, passage: str) -> float:
prompt = create_prompt(query, passage)
output = model.generate([prompt], sampling_params)[0].outputs[0]
# the answer token is usually the second to last logprob step (vLLM's stop# string match can consume one extra token, e.g. <|im_end|>, after it), but# scan from the end so this is robust to that off by onefor step inreversed(output.logprobs or []):
true_lp = next((v.logprob for k, v in step.items() if tokenizer.decode([k]).strip().lower() == "true"), None)
false_lp = next((v.logprob for k, v in step.items() if tokenizer.decode([k]).strip().lower() == "false"), None)
if true_lp isnotNoneand false_lp isnotNone:
true_score, false_score = math.exp(true_lp), math.exp(false_lp)
return true_score / (true_score + false_score)
return0.5
query = "What causes seasons on Earth?"
passages = [
"Seasons are caused by the tilt of Earth's axis relative to its orbit around the Sun.",
"The Great Wall of China is visible from space, according to popular belief.",
]
ranked = sorted(passages, key=lambda p: score(query, p), reverse=True)
for p in ranked:
print(p)
Runs of AdarshSingh7647 Eklav-Passage-8B on huggingface.co
98
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs
More Information About Eklav-Passage-8B huggingface.co Model
Eklav-Passage-8B huggingface.co
Eklav-Passage-8B huggingface.co is an AI model on huggingface.co that provides Eklav-Passage-8B's model effect (), which can be used instantly with this AdarshSingh7647 Eklav-Passage-8B model. huggingface.co supports a free trial of the Eklav-Passage-8B model, and also provides paid use of the Eklav-Passage-8B. Support call Eklav-Passage-8B model through api, including Node.js, Python, http.
Eklav-Passage-8B huggingface.co is an online trial and call api platform, which integrates Eklav-Passage-8B's modeling effects, including api services, and provides a free online trial of Eklav-Passage-8B, you can try Eklav-Passage-8B online for free by clicking the link below.
AdarshSingh7647 Eklav-Passage-8B online free url in huggingface.co:
Eklav-Passage-8B is an open source model from GitHub that offers a free installation service, and any user can find Eklav-Passage-8B on GitHub to install. At the same time, huggingface.co provides the effect of Eklav-Passage-8B install, users can directly use Eklav-Passage-8B installed effect in huggingface.co for debugging and trial. It also supports api for free installation.