Flintglass Prism β Open Agent & RAG Stack
Collection
Apache-2.0 6-pillar Agent & RAG stack: PrismParse, PrismEmbed, PrismRerank (Zero MS MARCO), PrismGuard, PrismAgent, PrismVerify. β’ 48 items β’ Updated
How to use flintglass/PrismRerank-4B with Transformers:
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("flintglass/PrismRerank-4B")
model = AutoModelForCausalLM.from_pretrained("flintglass/PrismRerank-4B", device_map="auto")Flagship 4B, 32K-Context, 100+ Language, 100% Commercial-Safe (Zero MS MARCO!) Causal Reranker β distilling Apache-2.0 Qwen/Qwen3-Reranker-8B (2Γ larger teacher) into Apache-2.0 Qwen/Qwen3-Reranker-4B via LoRA (r=32, merged cleanly to native BF16) across 18,000 permissive long-context groups (108,000 pairs).
70.42% All-7 NDCG@10): Beats Base Qwen/Qwen3-Reranker-4B by +1.27 pts (70.42% vs 69.15%) and crushes BAAI/bge-reranker-v2-m3 by +6.89 pts (70.42% vs 63.53%) across 7 strictly held-out zero-shot retrieval benchmarks!99.17% NDCG@10 (99.00% MRR@10) on LongDoc-8K (+5.95 pts over Base 4B, +14.06 pts over bge-reranker-v2-m3): Near-perfect reranking accuracy on 2Kβ6K token documents.99.06% on Mr.TyDi (11 Languages) & 58.94% BEIR-5 Avg (+0.58 pts over Base 4B): Improves SciFact (76.75%), NFCorpus (42.14%), FiQA (39.76%), ArguAna (52.01%), Mr.TyDi (99.06%), and LongDoc-8K (99.17%) simultaneously!transformers, vLLM, TEI, and llama.cpp --reranking.Part of the Flintglass Prism Open-Source Agent & RAG Stack Β· Matched Embedder:
flintglass/PrismEmbed-4BΒ· GGUF Quantizations:flintglass/PrismRerank-4B-GGUF(F16,Q8_0,Q4_K_M)
Evaluated identically with official Qwen3-Reranker yes/no log-odds scoring (max_length=4096) across 7 strictly held-out zero-shot benchmarks (zero overlap with training data):
| Model | Params | Ctx | SciFact | NFCorpus | FiQA | ArguAna | TREC-COVID | BEIR-5 Avg | Mr.TyDi (11L) | LongDoc-8K | All-7 Avg |
|---|---|---|---|---|---|---|---|---|---|---|---|
| BM25 Baseline | β | β | 67.89 | 32.51 | 23.61 | 39.70 | 65.59 | 45.86 | 42.10 | 45.20 | 45.23 |
BAAI/bge-reranker-v2-m3 |
568M | 8K | 71.88 | 36.73 | 37.98 | 37.14 | 79.40 | 52.63 | 96.45 | 85.11 | 63.53 |
Qwen/Qwen3-Reranker-0.6B |
600M | 32K | 75.05 | 41.12 | 35.49 | 49.07 | 82.88 | 56.72 | 97.99 | 91.72 | 67.62 |
Qwen/Qwen3-Reranker-4B (Base) |
4B | 32K | 76.13 | 41.91 | 38.45 | 51.22 | 84.12 | 58.36 | 99.04 | 93.22 | 69.15 |
flintglass/PrismRerank-0.6B |
600M | 32K | 76.27 | 41.31 | 37.48 | 49.21 | 84.56 | 57.77 | 98.22 | 97.64 | 69.24 |
flintglass/PrismRerank-4B |
4B | 32K | 76.75 | 42.14 | 39.76 | 52.01 | 84.05 | 58.94 | 99.06 | 99.17 | 70.42 |
| Delta vs Base 4B | β | β | +0.62 | +0.23 | +1.31 | +0.79 | -0.07 | +0.58 | +0.02 | +5.95 | +1.27 |
transformers)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "flintglass/PrismRerank-4B"
tok = AutoTokenizer.from_pretrained(model_id, padding_side="left")
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto").eval()
yes_id = tok.convert_tokens_to_ids("yes")
no_id = tok.convert_tokens_to_ids("no")
PREFIX = '<|im_start|>system\nJudge whether the Document meets the requirements based on the Query and the Instruct provided. Note that the answer can only be "yes" or "no".<|im_end|>\n<|im_start|>user\n'
SUFFIX = "<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n"
INST = "Given a web search query, retrieve relevant passages that answer the query"
query = "How does Matryoshka Representation Learning reduce vector database memory?"
docs = [
"Matryoshka Representation Learning trains embeddings so leading prefixes (e.g., 512d, 256d, 128d) preserve retrieval quality, shrinking vector index RAM by 5x-20x.",
"The Russian nesting doll was first carved in 1890 by Vasily Zvyozdochkin.",
]
texts = [f"{PREFIX}<Instruct>: {INST}\n<Query>: {query}\n<Document>: {d}{SUFFIX}" for d in docs]
enc = tok(texts, padding=True, truncation=True, max_length=8192, return_tensors="pt").to(model.device)
with torch.inference_mode():
logits = model(**enc).logits[:, -1, :]
scores = torch.sigmoid(logits[:, yes_id] - logits[:, no_id]).float().cpu().tolist()
for s, d in sorted(zip(scores, docs), reverse=True):
print(f"{s:.4f} | {d}")
Qwen/Qwen3-Reranker-4B (Apache-2.0)Qwen/Qwen3-Reranker-8B (Apache-2.0)18,000 groups (108,000 query-document pairs) built strictly from permissive commercial-safe sources (zero MS MARCO, zero CC-BY-NC, zero proprietary API labels).r=32, merged cleanly to native BF16) with Joint Listwise Teacher KL-Distillation (T=1.5) + Listwise Gold-Positive CE + Calibrated Pointwise Soft-BCE.