Adilet Search reranker (Russian and Kazakh legislation)
A cross-encoder that scores how well an article of Kazakhstan legislation answers a question. It is cross-encoder/mmarco-mMiniLMv2-L12-H384-v1 fine-tuned on question–article pairs, and it is the reranker of pipeline 1.0.0 of Adilet Search.
Use
from sentence_transformers import CrossEncoder
model = CrossEncoder("qb2k/adilet-reranker-mminilm-ru-kk", max_length=256)
scores = model.predict([("работодатель задерживает зарплату", "Статья 113. Порядок и сроки выплаты заработной платы ...")])
Training
- Data: 4,264 (question, article) pairs: LLM-written questions in everyday and legal wording for articles of 8 codes of Kazakhstan (AdiletCodex v1.0, CC BY 4.0), each with the correct article and 7 wrong candidates drawn at random from the top 20 of BM25. Split by article; test articles were not seen.
- Settings: binary cross-entropy, AdamW, learning rate 1e-5, batch 32, 2 epochs, 320 tokens, seed 42.
- Notebook:
ml/notebooks/A4_embeddings_to_finetuning.ipynbin the repository (configuration E3b).
Results
Reranking 20 BM25 candidates for 195 test questions (41% Kazakh); the ceiling is 0.923.
| Model | nDCG@10 | MRR@10 | ROC-AUC | F1 |
|---|---|---|---|---|
| Base model, zero-shot | 0.867 | 0.849 | 0.959 | 0.598 |
| This model | 0.880 | 0.866 | 0.973 | 0.652 |
The difference in nDCG@10 is +0.013 (95% bootstrap interval +0.003 to +0.025, p = 0.016). nDCG@10 by language: 0.83 Kazakh, 0.91 Russian.
Limits
- The test questions are LLM-written and each has one labelled article; a person reviewed 60 of them (53 correct).
- Kazakh is weaker than Russian.
- Trained on 8 codes; other acts are out of distribution.
- A search aid, not legal advice.