Hinglish to English Translator 2
Hinglish v2 is an upgraded Hinglish-to-English translation model, fine-tuned on a larger and more capable 4B instruction-tuned base model using PEFT (LoRA). It significantly improves on v1 in both fluency and contextual understanding of informal Hinglish, the code-mixed blend of Hindi and English widely used in everyday conversations across India.
What's New in v2
- Stronger base model — Upgraded from a 2B to a 4B instruction-tuned language model for better language understanding and generation quality.
- Chat-style fine-tuning — v2 is trained using a conversational (chat template) format, making it more natural and instruction-following.
- Larger and cleaner dataset — Trained on 15,000 samples from the findnitai/english-to-hinglish dataset, a rich parallel Hinglish–English corpus.
- Improved LoRA config — Rank 64 with lora_alpha 64 for better adaptation.
- TRL SFTTrainer — Uses the SFTTrainer from TRL for robust supervised fine-tuning.
Dataset: findnitai/english-to-hinglish Format: Each training example is formatted as a user/assistant chat pair:
- User: Hinglish sentence (hi_ng field)
- Assistant: English translation (en field)
Usage
python from transformers import AutoTokenizer, AutoModelForCausalLM model_id = "rudrashah/RLM-hinglish-translator-2" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id) messages = [ { "role": "user", "content": "aapka name kya hai?" } ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to("cuda") outputs = model.generate( **inputs, max_new_tokens=128, use_cache=True, temperature=1.0, top_p=0.95, top_k=64, ) print(tokenizer.batch_decode(outputs))
Note: v2 uses a chat template format (apply_chat_template) instead of v1's raw prompt template. Make sure to use the messages format shown above for correct outputs.
Example
| Hinglish Input | English Output |
|---|---|
| aapka name kya hai? | What is your name? |
| kal mujhe office jaana hai | I have to go to the office tomorrow. |
| Tumne kal ki match dekhi thi? kon man of the match bana tha? | Did you watch yesterday's match? Who was man of the match? |
Limitations
- Best suited for short, informal Hinglish sentences (similar to everyday chat messages).
- May struggle with very long sentences, heavy slang, or regional dialect variations.
- The model outputs only English text — it is not a bidirectional translator.
Previous Version
Looking for the original model? → RLM-hinglish-translator (v1)