--- language: - bn license: apache-2.0 base_model: Qwen/Qwen3-Embedding-0.6B library_name: sentence-transformers pipeline_tag: sentence-similarity tags: - bengali - bangla - dialect - romanized-bengali - banglish - information-retrieval - sentence-transformers --- # Bohuswar Embed (বহুস্বর) A Bengali sentence embedding model for search across regional dialects. You can type a query in Chittagonian, Sylheti, Noakhali, Barishal or Mymensingh Bangla, in Bengali script or in Latin letters (Banglish), and it finds the matching text written in standard Bangla. It is [Qwen/Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B), fully fine-tuned on dialect-to-standard sentence pairs. Companion reranker: [jafrilalam/bohuswar-reranker](https://huggingface.co/jafrilalam/bohuswar-reranker). For most uses you do not need it (see the results below). ## What it is for - Search over a Bangla document collection when users write the way they speak, for example a helpline FAQ, a government service portal or a news archive. - Matching romanized Bangla (`tomar abbu kemon ache`) to Bengali-script text (`তোমার আব্বু কেমন আছে?`). - Finding near-duplicate or same-meaning sentences across dialects, for example when you group user messages or clean a dataset. - The retrieval step of a RAG system whose documents are in standard Bangla. It is not a translation model. It does not convert dialect text into standard Bangla. It only places sentences with the same meaning close together. ## How to use ```bash pip install -U sentence-transformers ``` Queries need the saved `query` prompt. Documents are encoded as plain text with no prompt. ```python from sentence_transformers import SentenceTransformer model = SentenceTransformer("jafrilalam/bohuswar-embed") docs = [ "তোমার আব্বু কেমন আছে?", "আমার বড় বোনের আজকে মন ভালো নেই", "তুমি কি আমাকে এই কাজটি করে দিতে পারবে?", ] queries = [ "তোয়ার আব্বু কেন আসে?", # Chittagonian, Bengali script "mor boro buiner aijgo mon valo nai", # Barishal, romanized ] doc_emb = model.encode(docs) query_emb = model.encode(queries, prompt_name="query") scores = model.similarity(query_emb, doc_emb) print(scores) for q, row in zip(queries, scores): print(q, "->", docs[int(row.argmax())]) ``` If you write your own pipeline, the query prompt is: ``` Instruct: Given a Bengali dialect or romanized Bengali query, retrieve relevant text written in standard Bengali. Query: ``` Tips: - Use the model alone. In our tests, adding BM25 with rank fusion made results much worse, because BM25 cannot match romanized queries against Bengali-script text. - Long documents: split them into short passages of 1 to 3 sentences. The model was trained with a 192-token limit on short sentences. - Apply Unicode NFC normalization to queries and documents before encoding. ## Results Task: for each dialect query, find its standard Bangla sentence among 2,507 candidates. Test meanings were never seen in training. Mymensingh was removed from training completely, so it shows how the model handles a dialect it has never seen. MRR@10, test set (about 250 queries per row): | Dialect | Script | Base Qwen3-Embedding-0.6B | Bohuswar Embed | |---|---|---|---| | Barishal | Bengali | 0.767 | 0.980 | | Barishal | Romanized | 0.219 | 0.977 | | Chittagong | Bengali | 0.544 | 0.974 | | Chittagong | Romanized | 0.210 | 0.969 | | Noakhali | Bengali | 0.751 | 0.985 | | Noakhali | Romanized | 0.225 | 0.983 | | Sylhet | Bengali | 0.772 | 0.988 | | Sylhet | Romanized | 0.251 | 0.979 | | **Mymensingh (unseen)** | Bengali | 0.909 | 0.995 | | **Mymensingh (unseen)** | Romanized | 0.321 | 0.992 | Overall: | System | Test R@1 | Test MRR@10 | Unseen-dialect MRR@10 | |---|---|---|---| | BM25 | 0.267 | 0.301 | 0.439 | | Base Qwen3-Embedding-0.6B | 0.404 | 0.467 | 0.617 | | Base Qwen3 + base bge-reranker-v2-m3 | 0.477 | 0.537 | 0.668 | | **Bohuswar Embed** | **0.966** | **0.979** | **0.994** | | Bohuswar Embed + Bohuswar Reranker | 0.968 | 0.980 | 0.991 | A cluster bootstrap over meanings (2,000 resamples) gives a test MRR@10 gain of +0.44 over the base pipeline, with a 95% interval of 0.41 to 0.47. Most remaining errors put the correct sentence at rank 2. Many of these are near-duplicate standard sentences in the corpus (for example, the same sentence with a spelling variant), so the true error rate is a little lower than shown. Chittagonian is the hardest dialect. ## Training - Data: [Vashantor](https://data.mendeley.com/datasets/bj5jgk878b) parallel corpus (dialect sentence, standard Bangla sentence), Bengali script and romanized. 15,923 training pairs from Barishal, Chittagong, Noakhali and Sylhet. Data was split by meaning, so no standard sentence appears in both train and test. - Text cleaning: NFC normalization, khanda-ta unification, removal of zero-width characters (ZWJ/ZWNJ kept). Dialect spelling was not changed. - Loss: CachedMultipleNegativesRankingLoss with in-batch negatives and 3 hard negatives per pair (mined from ranks 10 to 30 of the base model). The sampler avoids duplicates in a batch. - Settings: 1 epoch, learning rate 1e-5, batch size 32, max length 192, Adafactor, fp16, seed 42. - Hardware: one NVIDIA T4, about 2.5 hours. ## Limitations - Trained and tested on one dataset of short, conversational sentences. Scores on long passages or real search queries will be lower. They have not been measured yet. - Covers five dialects. Others (Rangpur, Rajshahi, Khulna and so on) are untested. - Mymensingh is close to standard Bangla, so the unseen-dialect score in Bengali script is a mild test. The romanized result (0.321 to 0.992) is the stronger evidence. - It may confuse pronoun and politeness forms (তুই / তুমি, তারা / তিনি) and rare dialect words. - Performance on standard Bangla to standard Bangla retrieval after fine-tuning has not been checked. - Results come from a single training run. - Check the Vashantor license terms before any commercial use. ## Versions Every upload is tagged. The current sentence-level checkpoint is tag `sentence-1619d1f10d8d`. Pin it with `SentenceTransformer("jafrilalam/bohuswar-embed", revision="sentence-1619d1f10d8d")`.