hams-reranker-ft
Part of Hams RAG, a self-hosted Arabic/English retrieval-augmented generation system: code, data and benchmarks. Training data: AndrOidBB7/hams-kb-rag. Before/after results: results/before_after.md; component ablation: results/ablation.md.
| Field | Value |
|---|---|
| Base model | BAAI/bge-reranker-v2-m3 (568M params) |
| License | Apache-2.0; commercial use allowed |
| Method | Full fine-tuning, sentence-transformers CrossEncoderTrainer |
| Loss | BinaryCrossEntropyLoss with pos_weight = 7 (number of negatives per positive) |
| Negatives | Top-30 hybrid candidates from the fine-tuned embedder + BM25, designed confusers first, fact-id exclusion; 7 per positive |
| Data | 8,960 query–passage pairs from the training split |
| Hyperparameters | 2 epochs, batch 8, LR 1e-5, warmup 0.1, weight decay 0.01, max length 384, FP16, seed 42 |
| Hardware / time | 1× Tesla T4, 8.9 min; validation after training: nDCG@10 0.862, MRR@10 0.814 |
| Calibration | Platt scaling on validation: a = 0.667, b = −2.275; ECE 0.072 raw → 0.010 calibrated |
| Abstention | Threshold τ = 0.019 on the calibrated score (validation not-found F1 0.78, false abstention 0.8%) |
| Size | 568M params: 1.1 GB in FP16; ≈1.1 GB VRAM plus activations for 20 pairs × 384 tokens |
Results (test split, hybrid + rerank, the served configuration).
| Base reranker | Fine-tuned | |
|---|---|---|
| nDCG@10, all queries | 0.819 | 0.873 |
| nDCG@10, cross-lingual (95% CI of Δ [0.070, 0.144], p = 0.0005) | 0.705 | 0.811 |
| Recall@1 / Recall@5 | 0.677 / 0.913 | 0.784 / 0.937 |
Limitations. 512-token window (384 used in training); scores are calibrated on this domain only.