CoolFace
Modelpublic

LocalDoc/LocRet-small

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
2likes208downloads
Model Card

LocRet-small — Azerbaijani Retrieval Embedding Model

LocRet-small is a compact, high-performance retrieval embedding model specialized for the Azerbaijani language. Despite being 4.8× smaller than BGE-m3, it significantly outperforms it on Azerbaijani retrieval benchmarks.

Key Results

AZ-MIRAGE Benchmark (Native Azerbaijani Retrieval)

RankModelParametersMRR@10P@1R@5R@10NDCG@5NDCG@10
#1LocRet-small118M0.52500.31320.82670.89480.59380.6162
#2BAAI/bge-m3568M0.42040.23100.69050.77870.47910.5079
#3perplexity-ai/pplx-embed-v1-0.6b600M0.41170.22760.67150.76050.46770.4968
#4intfloat/multilingual-e5-large560M0.40430.22640.65710.74540.45840.4875
#5intfloat/multilingual-e5-base278M0.38520.21160.63530.72160.43900.4672
#6Snowflake/snowflake-arctic-embed-l-v2.0568M0.37460.21350.60060.69160.42180.4516
#7Qwen/Qwen3-Embedding-4B4B0.36020.18690.60670.70360.41190.4437
#8intfloat/multilingual-e5-small (base)118M0.35860.19580.59270.68340.40790.4375
#9Qwen/Qwen3-Embedding-0.6B600M0.29510.15160.49260.59560.33390.3676

Usage

python
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("LocalDoc/LocRet-small")

queries = ["Azərbaycanın paytaxtı hansı şəhərdir?"]
passages = [
    "Bakı Azərbaycan Respublikasının paytaxtı və ən böyük şəhəridir.",
    "Gəncə Azərbaycanın ikinci böyük şəhəridir.",
]

query_embeddings = model.encode_query(queries)
passage_embeddings = model.encode_document(passages)

similarities = model.similarity(query_embeddings, passage_embeddings)
print(similarities)

Prefixes "query: " and "passage: " are applied automatically via encodequery and encodedocument. If using model.encode directly, the "passage: " prefix is added by default.

Training

Method

LocRet-small is fine-tuned from multilingual-e5-small using listwise KL distillation combined with a contrastive loss:

$$\mathcal{L} = \mathcal{L}{\text{KL}} + 0.1 \cdot \mathcal{L}{\text{InfoNCE}}$$

  • Listwise KL divergence: Distills the ranking distribution from a cross-encoder teacher (bge-reranker-v2-m3) over candidate lists of 1 positive + up to 10 hard negatives per query. Teacher and student softmax distributions use asymmetric temperatures (τteacher = 0.3, τstudent = 0.05).
  • In-batch contrastive loss (InfoNCE): Provides additional diversity through in-batch negatives on positive passages.

This approach preserves the full teacher ranking signal rather than reducing it to binary relevance labels, which is critical for training on top of already strong pre-trained retrievers.

Data

The model was trained on approximately 3.5 million Azerbaijani query-passage pairs from four datasets:

DatasetPairsDomainType
msmarco-az-reranked~1.4MGeneral web QATranslated EN→AZ
azerbaijani_books_retriever_corpus-reranked~1.6MBooks, politics, historyNative AZ
azerbaijani_retriever_corpus-reranked~189KNews, cultureNative AZ
ldquad_v2_retrieval-reranked~330KWikipedia QANative AZ

All datasets include hard negatives scored by a cross-encoder reranker, which serve as the teacher signal for listwise distillation. False negatives were filtered using normalized score thresholds.

Hyperparameters

ParameterValue
Base modelintfloat/multilingual-e5-small
Max sequence length512
Effective batch size256
Learning rate5e-5
ScheduleLinear warmup (5%) + cosine decay
PrecisionFP16
Epochs1
Training time~25 hours
Hardware4× NVIDIA RTX 5090 (32GB)

Training Insights

  • Listwise KL distillation outperforms standard contrastive training (MultipleNegativesRankingLoss) for fine-tuning pre-trained retrievers, consistent with findings from Arctic-Embed 2.0 and cadet-embed.
  • Retrieval pre-training matters more than language-specific pre-training for retrieval tasks: multilingual-e5-small (with retrieval pre-training) significantly outperforms XLM-RoBERTa and other BERT variants (without retrieval pre-training) as a base model.
  • A mix of translated and native data prevents catastrophic forgetting while enabling language specialization.

Benchmark

AZ-MIRAGE

A native Azerbaijani retrieval benchmark (https://github.com/LocalDoc-Azerbaijan/AZ-MIRAGE) with 7,373 queries and 40,448 document chunks covering diverse topics. Evaluates retrieval quality on naturally written Azerbaijani text.

Model Details

PropertyValue
ArchitectureBERT (XLM-RoBERTa)
Parameters118M
Embedding dimension384
Max tokens512
VocabularySentencePiece (250K)
Similarity functionCosine similarity
LanguageAzerbaijani (az)
LicenseApache 2.0

Limitations

  • Optimized for Azerbaijani text retrieval. Performance on other languages may be lower than the base multilingual-e5-small model.
  • Maximum input length is 512 tokens. Longer documents should be chunked.

Citation

bibtex
@misc{locret-small-2026,
  title={LocRet-small: A Compact Azerbaijani Retrieval Embedding Model},
  author={LocalDoc},
  year={2026},
  url={https://huggingface.co/LocalDoc/LocRet-small}
}

Acknowledgments