Run this model with HF Jobs
Run jafrilalam/bohuswar-reranker on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/jafrilalam/bohuswar-reranker. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/jafrilalam/bohuswar-reranker on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use jafrilalam/bohuswar-reranker with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use jafrilalam/bohuswar-reranker with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("jafrilalam/bohuswar-reranker") query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Notebooks
- Google Colab
- Kaggle
Bohuswar Reranker (বহুস্বর)
A cross-encoder that scores how well a Bengali dialect query matches a standard Bangla text. It reads the query and the candidate together and returns one relevance score. It handles Chittagonian, Sylheti, Noakhali, Barishal and Mymensingh Bangla, in Bengali script or romanized (Banglish).
It is BAAI/bge-reranker-v2-m3, fully fine-tuned on dialect-to-standard sentence pairs.
It was built to go after jafrilalam/bohuswar-embed: the embedder finds about 50 candidates, then this model reorders them.
When to use it
- With a general-purpose retriever. If your first stage is BM25 or a general multilingual embedder, this model helps a lot. With base Qwen3-Embedding-0.6B as the first stage, test MRR@10 went from 0.537 (base reranker) to 0.692.
- As a dialect-aware pair scorer, for example to check whether a user message matches a known FAQ entry, or to rank a short list of candidates.
- Not needed with Bohuswar Embed on short sentences. The embedder alone already scores 0.979 MRR@10. The reranker brings this to 0.980, which is not worth the extra latency. It may help more on longer or harder passages, but that has not been tested yet.
Do not use the original bge-reranker-v2-m3 after Bohuswar Embed. It cannot read dialect text well and drops MRR@10 from 0.979 to 0.647.
How to use
pip install -U sentence-transformers
from sentence_transformers import CrossEncoder
model = CrossEncoder("jafrilalam/bohuswar-reranker", max_length=256)
query = "হেতনে কি বিদেশ তুন আইছেন" # Noakhali
candidates = [
"তিনি কি বিদেশ থেকে এসেছেন",
"আপনি কি বিদেশে যেতে চান?",
"টেবিলে নাশতা দেওয়া ছিল",
]
ranked = model.rank(query, candidates, return_documents=True)
for r in ranked:
print(round(float(r["score"]), 3), r["text"])
Give it the raw query. No prompt or prefix is needed.
With Bohuswar Embed
from sentence_transformers import SentenceTransformer, CrossEncoder
embedder = SentenceTransformer("jafrilalam/bohuswar-embed")
reranker = CrossEncoder("jafrilalam/bohuswar-reranker", max_length=256)
doc_emb = embedder.encode(docs) # your standard Bangla passages
q_emb = embedder.encode([query], prompt_name="query")
top = embedder.similarity(q_emb, doc_emb)[0].topk(50).indices.tolist()
ranked = reranker.rank(query, [docs[i] for i in top])
best = docs[top[ranked[0]["corpus_id"]]]
About the scores
Scores are very confident: almost all are close to 1 or close to 0, and near-paraphrases can both get about 1.0. Use them to order candidates. Do not use a fixed threshold to decide that no good answer exists without testing it on your own data first.
Results
Task: for each dialect query, rank the correct standard Bangla sentence among 2,507 candidates. The first stage returns the top 50. Mymensingh was never seen in training.
| First stage | Reranker | Test R@1 | Test MRR@10 | Unseen-dialect MRR@10 |
|---|---|---|---|---|
| Base Qwen3-Embedding-0.6B | base bge-reranker-v2-m3 | 0.477 | 0.537 | 0.668 |
| Base Qwen3-Embedding-0.6B | Bohuswar Reranker | 0.681 | 0.692 | 0.815 |
| Bohuswar Embed | base bge-reranker-v2-m3 | 0.562 | 0.647 | 0.753 |
| Bohuswar Embed | none | 0.966 | 0.979 | 0.994 |
| Bohuswar Embed | Bohuswar Reranker | 0.968 | 0.980 | 0.991 |
With the base embedder as first stage, R@1 (0.681) is close to R@10 (0.705). When the correct sentence is in the candidate list, the reranker almost always puts it first. Most of the misses come from the first stage.
Training
- Data: Vashantor parallel corpus, Barishal, Chittagong, Noakhali and Sylhet, Bengali script and romanized. Mymensingh was held out.
- Examples: 15,923 queries, each with 1 positive and the 4 hardest negatives from Bohuswar Embed's top 30 (79,615 pairs in total).
- Loss: binary cross-entropy with positive weight of about 4 to balance the classes.
- Settings: 1 epoch, learning rate 1e-5, batch size 8, max length 256, 10% warmup, Adafactor, fp16, seed 42.
- Hardware: one NVIDIA T4, about 1 hour.
Limitations
- Trained and tested on short conversational sentences from one dataset. Long passages are untested.
- Five dialects only.
- Hard negatives were mined automatically, and some of them are true paraphrases. The model may therefore punish valid near-paraphrases, for example when they differ only in pronoun or politeness forms.
- Results come from a single training run.
- Check the Vashantor license terms before any commercial use.
Versions
The current sentence-level checkpoint is tag sentence-ebb5835c4fe5. Pin it with CrossEncoder("jafrilalam/bohuswar-reranker", revision="sentence-ebb5835c4fe5").
- Downloads last month
- -
Model tree for jafrilalam/bohuswar-reranker
Base model
BAAI/bge-reranker-v2-m3