Views
No views yet
(query, passage) pairs and is intended to reorder candidate chunks returned by a
first-stage hybrid retriever.cross-encoder/ms-marco-MiniLM-L12-v2.cross-encoder/ms-marco-MiniLM-L12-v21rerank_top_k = 10
2final_top_k = 5-8
3max_length = 512
4
5### Out-of-Scope Use
6
7This model is not an answer-generation model. It should not be used to generate legal, banking, or compliance advice directly. It only ranks passages.
8
9It is not validated outside the BCT regulatory corpus and may perform poorly on unrelated domains.
10
11## Training Data
12
13The model was trained using generated and curated question/chunk supervision derived from a BCT regulatory document corpus.
14
15Main training experiment:
16
17training/eval source: qwen_bct_questions_5k.jsonl
18split: 80% train / 10% validation / 10% test
19train queries: ~4000
20validation queries: ~500
21test queries: ~500
22
23Gold chunks were resolved from the indexed BCT corpus. Training used top-10 hybrid retriever candidates with injected gold chunks when missing.
24
25## Training Procedure
26
27The model was trained with a hybrid reranker distillation objective:
28
29total_loss =
30 0.1 * teacher_distillation_loss
31 + 3.0 * gold_pairwise_loss
32
33Teacher model:
34
35BAAI/bge-reranker-v2-m3
36
37Student/base model:
38
39cross-encoder/ms-marco-MiniLM-L12-v2
40
41Important hyperparameters:
42
43hybrid_candidate_top_k: 10
44learning_rate: 1e-5
45num_epochs: 5
46max_length: 512
47batch_size: 16
48selection_metric: hit@1
49
50## Evaluation
51
52Evaluation was performed on a strict top-10 candidate split without injected gold chunks or injected hard negatives. This better reflects real retrieval behavior, where the reranker cannot recover chunks that the first-stage
53retriever did not retrieve.
54
55### 5k Strict Test Results
56
57┌───────────────────┬────────┬────────┬────────┬────────┬────────┬─────────┐
58│ System │ Hit@1 │ Hit@3 │ Hit@5 │ Hit@10 │ MRR@10 │ NDCG@10 │
59├───────────────────┼────────┼────────┼────────┼────────┼────────┼─────────┤
60│ No reranker │ 0.7120 │ 0.8760 │ 0.9060 │ 0.9480 │ 0.8009 │ 0.8290 │
61│ BGE v2-m3 teacher │ 0.8380 │ 0.9220 │ 0.9400 │ 0.9480 │ 0.8827 │ 0.8913 │
62│ This model │ 0.8260 │ 0.9180 │ 0.9360 │ 0.9480 │ 0.8744 │ 0.8838 │
63└───────────────────┴────────┴────────┴────────┴────────┴────────┴─────────┘
64
65The model nearly matches the BGE v2-m3 teacher on this generated 5k strict test split.
66
67### Latency
68
69Measured on Kaggle GPU over top-10 reranking:
70
71┌───────────────────┬───────────┬───────────┬───────────┬───────────┐
72│ Model │ Avg/query │ P50/query │ P95/query │ Pairs/sec │
73├───────────────────┼───────────┼───────────┼───────────┼───────────┤
74│ BGE v2-m3 teacher │ 0.1920s │ 0.2013s │ 0.2153s │ 52.10 │
75│ This model │ 0.0998s │ 0.1014s │ 0.1063s │ 100.24 │
76└───────────────────┴───────────┴───────────┴───────────┴───────────┘
77
78Approximate speedup:
79
801.92x faster than BGE v2-m3
81
82## Limitations
83
84- Evaluation is strongest on generated 5k questions; additional testing on real/manual queries is recommended.
85- The model may incorrectly demote relevant chunks when the query is ambiguous or when multiple similar regulatory articles exist.
86- It should be used with source display and human verification for compliance-sensitive workflows.
87- It is optimized for BCT regulatory retrieval, not general legal or financial retrieval.
88
89## Example Usage
90
91from transformers import AutoTokenizer, AutoModelForSequenceClassification
92import torch
93
94model_id = "slim0001/bct-l12-reranker"
95
96tokenizer = AutoTokenizer.from_pretrained(model_id)
97model = AutoModelForSequenceClassification.from_pretrained(model_id)
98model.eval()
99
100query = "Quelles sont les obligations de communication à la BCT ?"
101passages = [
102 "Article ... texte réglementaire ...",
103 "Autre passage ..."
104]
105
106inputs = tokenizer(
107 [query] * len(passages),
108 passages,
109 padding=True,
110 truncation=True,
111 max_length=512,
112 return_tensors="pt",
113)
114
115with torch.no_grad():
116 logits = model(**inputs).logits
117 scores = logits.squeeze(-1) if logits.shape[-1] == 1 else logits[:, -1]
118
119ranked = sorted(zip(scores.tolist(), passages), reverse=True)
120print(ranked)
121
122## Recommended Production Use
123
124Use as a reranker inside a RAG system:
125
126first-stage retrieval: BGE-M3 dense + BM25 + RRF
127rerank_top_k: 10
128final_top_k: 5-8
129answer generation: separate LLM
130
131## Contact
132
133Model owner: slim0001