Instructions to use wasabihu/VeriCorpus-Reranker-0.6B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use wasabihu/VeriCorpus-Reranker-0.6B with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("wasabihu/VeriCorpus-Reranker-0.6B") model = AutoModelForCausalLM.from_pretrained("wasabihu/VeriCorpus-Reranker-0.6B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
VeriCorpus-Reranker-0.6B
100% clean-room Apache-2.0 bilingual (ZH / EN) calibrated cross-encoder reranker specialized for Financial Accounting Caliber Traps, PRC Statutory Article Disambiguation, and Clinical Trial Evidence Ranking.
100% 纯洁净许可(Apache-2.0)中英双语校准重排模型——专为金融财报口径陷阱识别、中国法条精准辨析与临床试验循证重排打造,可直接作为 XERJ 混合检索之后的二阶段精排器。
Highlights / 核心亮点
- Solves Financial & Statutory Caliber Traps That General Rerankers Mis-Rank:
- General-purpose rerankers assign high probabilities (
0.90–0.96) to nearly identical distractors (wrong fiscal year, consolidated vs. parent-only statements, GAAP/IFRS vs. Non-GAAP/adjusted figures, single-quarter vs. YTD cumulative figures, executive summary vs. footnote detail, or adjacent statutory articles). - Fine-tuned from
Qwen/Qwen3-Reranker-0.6B(Apache-2.0, 28 layers, BF16 merged weights1.11 GiB) with Groupwise Listwise InfoNCE + Pointwise BCE + 32B Teacher Soft-Score Knowledge Distillation (Qwen/Qwen3-32B-AWQ, Apache-2.0).
- General-purpose rerankers assign high probabilities (
- Dramatic Held-Out Zero-Leakage Gains (240 Blind Groups, 19 Held-Out Entity Groups):
- Top-1 Accuracy:
86.25%→100.00%(+13.75pp) across all 6 trap categories! - MRR / NDCG@3:
0.9188 / 0.9358→1.0000 / 1.0000! - Strict Calibrated Pass (
pos >= 0.70&max_neg <= 0.30):20.83%→98.33%(+77.50pp!) - Mean Probability Margin (
P(pos) - max P(neg)):+0.2070→+0.9743(+0.7673) (mean P(pos) = 0.9938,mean P(neg) = 0.0065) — enabling reliable standalone RAG cutoff thresholds without brittle per-query score rescaling.
- Top-1 Accuracy:
- 100% Clean-Room Commercial Provenance (
Apache-2.0):- Programmatically audited across all
962training +240held-out evaluation groups (CLEAN_ROOM_AUDIT.json):0CNINFO,0HKEX,0private/proprietary records, and0 / 0 / 0 / 0entity / document / query / passage train-eval leakage.
- Programmatically audited across all
- Native Qwen3-Reranker Prompt Contract Preserved:
- Uses the exact upstream
Qwen/Qwen3-Reranker-0.6Byes/nonext-token logit difference (sigmoid(logit("yes") - logit("no"))) and<think>\n\n</think>\n\nsuffix (chat_template.jinjaincluded).
- Uses the exact upstream
Benchmarks / 零泄漏盲测基准
Evaluated on 240 held-out clean-room groups (19 completely unseen entity groups: held-out US SEC tickers, held-out PRC statutes, and held-out clinical trial docs; 0 entity/doc/query/passage overlap with the 962 training groups):
1. Overall Before vs. After
| Metric | Base Qwen/Qwen3-Reranker-0.6B |
VeriCorpus-Reranker-0.6B |
Delta |
|---|---|---|---|
| Top-1 Accuracy | 86.25% (0.8625) |
100.00% (1.0000) |
+13.75pp |
| MRR | 0.9188 |
1.0000 |
+0.0812 |
| NDCG@3 | 0.9358 |
1.0000 |
+0.0642 |
StrictCal Pass (pos >= 0.7 & all neg <= 0.3) |
20.83% (0.2083) |
98.33% (0.9833) |
+77.50pp |
| Mean Positive Prob | 0.9851 |
0.9938 |
+0.0087 |
| Mean Negative Prob | 0.5621 |
0.0065 |
-0.5556 |
Mean Prob Margin (pos - max_neg) |
+0.2070 |
+0.9743 |
+0.7673 |
2. Per-Trap-Type Breakdown (All 6 Caliber & Statutory Traps)
Trap Category (trap_type) |
Eval Groups | Base Top-1 | Tuned Top-1 | Base StrictCal | Tuned StrictCal | Base Margin | Tuned Margin |
|---|---|---|---|---|---|---|---|
consolidated_vs_parent (合并 vs 母公司口径) |
6 |
33.33% |
100.00% |
0.00% |
100.00% |
-0.0024 |
+0.9994 |
gaap_vs_nongaap (GAAP/IFRS vs Non-GAAP) |
8 |
50.00% |
100.00% |
0.00% |
100.00% |
+0.0130 |
+1.0000 |
summary_vs_footnote (摘要 vs 附注明细) |
23 |
60.87% |
100.00% |
0.00% |
95.65% |
-0.0022 |
+0.9358 |
single_quarter_vs_cumulative (单季 vs 累计) |
17 |
70.59% |
100.00% |
0.00% |
94.12% |
-0.0011 |
+0.9297 |
cross_fiscal_year (跨财年 / 报告期混淆) |
42 |
78.57% |
100.00% |
0.00% |
100.00% |
+0.0091 |
+0.9971 |
statute_article_trap (中国法规邻近条文陷阱) |
144 |
98.61% |
100.00% |
34.72% |
98.61% |
+0.3422 |
+0.9765 |
Quickstart (transformers) / 快速使用
Always preserve the prefix, <Instruct>, <Query>, and <|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n suffix when truncating long documents (truncate <Document> tail only):
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_ID = "wasabihu/VeriCorpus-Reranker-0.6B" # or local directory path
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, padding_side="left")
model = AutoModelForCausalLM.from_pretrained(MODEL_ID, torch_dtype=torch.bfloat16, device_map="auto").eval()
PREFIX = (
"<|im_start|>system\n"
"Judge 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"
DEFAULT_INSTRUCT = (
"Given a financial analysis or legal compliance query, judge whether the Document "
"matches the exact entity, fiscal period, accounting caliber (consolidated vs parent, "
"GAAP/IFRS vs Non-IFRS/non-recurring adjusted, single-quarter vs cumulative, executive "
"summary vs footnote detail), or exact statutory law and article requested."
)
yes_id = tokenizer.convert_tokens_to_ids("yes")
no_id = tokenizer.convert_tokens_to_ids("no")
prefix_ids = tokenizer.encode(PREFIX, add_special_tokens=False)
suffix_ids = tokenizer.encode(SUFFIX, add_special_tokens=False)
def score_pairs(query: str, documents: list[str], instruct: str = DEFAULT_INSTRUCT, max_length: int = 768) -> list[float]:
header = f"<Instruct>: {instruct.strip()}\n<Query>: {query.strip()}\n<Document>: "
header_ids = tokenizer.encode(header, add_special_tokens=False)
doc_budget = max(32, max_length - len(prefix_ids) - len(suffix_ids) - len(header_ids))
seqs = []
for doc in documents:
doc_ids = tokenizer.encode(doc.strip(), add_special_tokens=False)[:doc_budget]
seqs.append(prefix_ids + header_ids + doc_ids + suffix_ids)
pad_id = tokenizer.pad_token_id if tokenizer.pad_token_id is not None else tokenizer.eos_token_id
max_len = max(len(s) for s in seqs)
input_ids = torch.tensor([[pad_id] * (max_len - len(s)) + s for s in seqs], device=model.device)
attention_mask = torch.tensor([[0] * (max_len - len(s)) + [1] * len(s) for s in seqs], device=model.device)
with torch.no_grad():
logits = model(input_ids=input_ids, attention_mask=attention_mask).logits[:, -1, :]
scores = torch.sigmoid((logits[:, yes_id] - logits[:, no_id]).float())
return [round(float(s), 6) for s in scores.cpu()]
probs = score_pairs(
query="Company FY2024 GAAP diluted EPS (consolidated)",
documents=[
"In FY2024, consolidated GAAP diluted net income per share was $3.42.",
"In FY2024, Non-GAAP adjusted diluted EPS was $4.15, excluding stock-based compensation.",
"In FY2023, consolidated GAAP diluted net income per share was $2.88.",
],
)
print(probs) # Positive caliber match scores ~0.99+, caliber traps score ~0.00-0.05
Recommended Two-Stage Open-Source RAG Stack
Pair xerj-bilingual-fin-law-384 (MIT, Stage-1 hybrid recall inside XERJ v1.0.0-rc.105+ achieving 99.17%–100.00% Top-10 recall in ~6 ms/query) with VeriCorpus-Reranker-0.6B (Apache-2.0, Stage-2 calibrated reranking on Top-10 candidates) for an end-to-end local, zero-cloud, commercially clean-room financial/legal/clinical RAG stack.
Clean-Room Provenance & Zero-Leakage Audit / 洁净溯源与零泄漏审计
Full programmatic verification is stored in CLEAN_ROOM_AUDIT.json:
| Split | Groups | Licences Present (license_tag) |
Domains | Zero CNINFO / HKEX / Private | 4D Leakage (entity / doc / query / passage) |
|---|---|---|---|---|---|
| Train | 962 |
CC0-1.0 (559), SEC-Public-Filing (343), NLM-Public-Domain (43), CC-BY-4.0 (17) |
PRC Statutes, SEC Filings, NLM Clinical Trials, Europe PMC | PASS (0 violations) |
0 / 0 / 0 / 0 |
| Held-out Eval | 240 |
CC0-1.0 (144), SEC-Public-Filing (87), NLM-Public-Domain (8), CC-BY-4.0 (1) |
PRC Statutes, SEC Filings, NLM Clinical Trials, Europe PMC | PASS (0 violations) |
0 / 0 / 0 / 0 |
Training Summary / 训练摘要
- Base Model:
Qwen/Qwen3-Reranker-0.6B(Apache-2.0) - Teacher Supervision:
Qwen/Qwen3-32B-AWQ(Apache-2.0, strict verbatim-verified soft scores) - Method: LoRA (
r=32,alpha=64, all 7 attention + MLP projections),3epochs,lr=1.5e-4,max_length=768, combined Listwise InfoNCE (weight=0.6,temp=0.5) + Pointwise BCE + Teacher Soft-Score KD (kd_weight=0.1), merged cleanly into BF16model.safetensors.
Limitations / 使用限制
- Optimized for Chinese & English financial disclosures, PRC statutory articles, and clinical trial evidence; out-of-domain web search tasks should be re-validated before enforcing a strict
0.70/0.30probability cutoff. - Maximum tested input length during fine-tuning is
768tokens (truncating<Document>only); longer documents should be chunked at passage level before reranking.
License / 许可证
Released under the Apache License 2.0 (see LICENSE and NOTICE). Derived from Qwen/Qwen3-Reranker-0.6B (Apache-2.0).
- Downloads last month
- 4