A Kashmiri ↔ English translation model fine-tuned from sarvamai/sarvam-translate (Gemma 3, 4.5B parameters). A QLoRA adapter has been merged into the base weights and published as a fully self-contained transformers-compatible checkpoint.
1deffirst_nonempty_line(text:str)->str:2for line in text.splitlines():3if line.strip():4return line.strip()5return text.strip()678deftranslate(source:str, direction:str, max_new_tokens:int=48)->str:9 instructions ={10"ks2en":"Translate the text below to English. Return only the translation.",11"en2ks":"Translate the text below to Kashmiri. Return only the translation.",12}13 messages =[14{"role":"system","content": instructions[direction]},15{"role":"user","content": source},16]17 prompt = tokenizer.apply_chat_template(18 messages, tokenize=False, add_generation_prompt=True19)20 inputs = tokenizer(21 prompt, return_tensors="pt", truncation=True, max_length=102422).to(model.device)2324with torch.no_grad():25 outputs = model.generate(26**inputs,27 max_new_tokens=max_new_tokens,28 do_sample=False,29 repetition_penalty=1.15,30 no_repeat_ngram_size=3,31 pad_token_id=tokenizer.eos_token_id,32)3334 suffix = outputs[0][inputs.input_ids.shape[1]:]35return first_nonempty_line(tokenizer.decode(suffix, skip_special_tokens=True))363738print(translate("Hello how are you doing today?.","en2ks"))39print(translate("کٔشیر چھُ اکھ خوبصورت جٲی","ks2en"))
A ready-to-run notebook is included at notebooks/colab_load_stage1_model.ipynb.
The model is sensitive to decoding settings. The defaults shipped in generation_config.json are tuned for stable translation rather than open-ended generation:
Parameter
Value
do_sample
False
max_new_tokens
48
repetition_penalty
1.15
no_repeat_ngram_size
3
Post-processing: decode only the generated suffix and take the first non-empty line. Looser decoding (sampling, longer windows, no repetition penalty) produces continuation artifacts and quote-tail noise.
Training
Procedure
The model was trained with a QLoRA supervised fine-tuning setup on a bidirectional Kashmiri ↔ English parallel corpus, on top of sarvamai/sarvam-translate. The resulting LoRA adapter was merged into the base weights; this release ships the merged checkpoint.
⚠️ Caveat. This score is implausibly perfect and almost certainly reflects an easy or in-distribution slice. It is reported here for completeness and must not be interpreted as a generalization estimate.
benchmark_simple_ks2en_200 (ks → en)
Metric
Value
BLEU
13.07
chrF
46.99
Exact match
0.00
The benchmark contains some noisy or mismatched references; scores should be interpreted as a lower-bound indicator rather than a clean evaluation. Files: benchmarks/benchmark_simple_ks2en_200.{jsonl,stage1_eval.json}.
500-sample mixed-direction review set (source-only)
A 500-sample source-only set is provided for human review. Automatic BLEU/chrF is not applicable.
Decoding sensitivity. Output quality degrades sharply under sampling or loose repetition controls. Use the recommended deterministic settings.
Length bias. The model was trained on sentence-level pairs (≤ 512 tokens). Long-form translation is not supported.
Internal eval is not generalization. The 100/100 BLEU/chrF figure is a fixture, not a quality claim.
Benchmark noise. Reported BLEU/chrF on benchmark_simple_ks2en_200 is depressed by reference noise; treat as indicative only.
Domain coverage. The training distribution skews toward general / literary Kashmiri; performance on technical, legal, or dialectal inputs is unverified.
Artifacts. Earlier decoding configurations occasionally produced quote-tail or continuation artifacts; the shipped generation_config.json mitigates but does not eliminate these.
Low-resource caveat. Kashmiri remains a low-resource language; reference quality, orthographic normalization, and dialectal coverage are open problems that bound any model trained on currently-available data.
Citation
If you use this model, please cite:
bibtex
1@misc{malik2026koshurkouter,
2 title = {Koshur Kouter KS-EN v1: A Merged QLoRA Kashmiri--English Translation Model},
3 author = {Malik, Haq Nawaz and Nissar, Nahfid},
4 year = {2026},
5 howpublished = {\url{https://huggingface.co/Omarrran/koshur-kouter-ks-en_v1}},
6 note = {Fine-tuned from sarvamai/sarvam-translate}
7}
Built on top of sarvamai/sarvam-translate. Training and evaluation infrastructure run on Colab and Modal. Thanks to the broader Kashmiri NLP community whose data and tooling made this work possible.