Views
No views yet
Hanno-Labs/bosun-4b.--rerank mode--rerank endpoint silently discards
your <Instruct> and returns degenerate scores (~1e-12; opposite rules score identically). It
looks like it works — it does not. (Thanks to Frederick Wood for the careful report.)serving.json and read two logits at the final token:prompt = prefix
+ "<Instruct>: <your rule>\n<Query>: <query>\n<Document>: <document>"
+ suffix # suffix already contains the empty "<think>\n\n</think>" block
score = sigmoid( logit[yes_id] - logit[no_id] ) # at the last positionyes_id = 9693, no_id = 2152, max_len = 3072.1import json, math
2from llama_cpp import Llama
3
4cfg = json.load(open("serving.json"))
5llm = Llama("Bosun-4B-Q8_0.gguf", n_ctx=cfg["max_len"], logits_all=True, verbose=False)
6
7def score(instruct, query, document):
8 body = f"<Instruct>: {instruct}\n<Query>: {query}\n<Document>: {document}"
9 prompt = cfg["prefix"] + body + cfg["suffix"]
10 toks = llm.tokenize(prompt.encode(), add_bos=False, special=True)
11 llm.reset(); llm.eval(toks)
12 lg = llm.scores[len(toks) - 1]
13 return 1.0 / (1.0 + math.exp(-(lg[cfg["yes_id"]] - lg[cfg["no_id"]])))
14
15# the document is an ORDERED pair — FINDING A then FINDING B (direction matters)
16doc = "FINDING A:\nMercury set up its own bank charter.\n\nFINDING B:\nKlar bought a small bank."
17print(score("Connected only if both findings are about the same broad topic.",
18 "These two findings share the specified relationship.", doc))transformers inference (logits_to_keep=1) on a fixture
spanning the default rubric, instruction steering, and dedup. Mean / max absolute score difference
vs that reference:| file | size | mean abs diff | max abs diff |
|---|---|---|---|
Bosun-4B-f16.gguf | 8050 MB | 0.0004 | 0.001 |
Bosun-4B-Q8_0.gguf | 4280 MB | 0.0011 | 0.0035 |
Bosun-4B-Q4_K_M.gguf | 2497 MB | 0.0036 | 0.0097 |
f16 is reference-grade; Q8_0 is recommended (calibrated scores intact
at ~half the size). Q4_K_M is smallest; on this model it stays calibration-safe too.