Gemma-3-270M English → Indic Translator
A fine-tuned version of Gemma-3-270m-it for multilingual machine translation from English to 14 Indic languages.
This model is designed for lightweight, fast, and high-quality translation from English into major Indic languages while maintaining the conversational capabilities inherited from Gemma-3.
Model Details
Table with columns: Property, Value| Property | Value |
|---|
| Base Model | google/gemma-3-270m-it |
| Architecture | Gemma 3 |
| Parameters | 270 Million |
| Task | English → Indic Machine Translation |
| Framework | Hugging Face Transformers |
| Precision | bfloat16 |
| Attention | Flash Attention 2 |
| Generation | Beam Search |
| Beam Size | 5 |
| Sampling | Disabled (do_sample=False) |
| Padding Side | Left |
| Cache | Enabled (use_cache=True) |
Supported Languages
Table with columns: Language, Language Code| Language | Language Code |
|---|
| Assamese | asm_Beng |
| Bengali | ben_Beng |
| Gujarati | guj_Gujr |
| Hindi | hin_Deva |
| Kannada | kan_Knda |
| Kashmiri | kas_Arab |
| Malayalam | mal_Mlym |
| Marathi | mar_Deva |
| Odia | ory_Orya |
Input language is always English.
Dataset
The model was fine-tuned using the AI4Bharat BPCC (bpcc-seed-v2) multilingual parallel corpus.
The dataset contains parallel English–Indic sentence pairs covering multiple domains and language families.
The model expects prompts in the following format:
Translate to {Target Language}:
{English Sentence}
Example:
Translate to Telugu:
Artificial Intelligence is changing healthcare.
Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
MODEL_NAME = "ManiKumarAdapala/Gemma3-En2Indic-NMT-270M"
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
tokenizer.padding_side = "left"
model = AutoModelForCausalLM.from_pretrained(
MODEL_NAME,
dtype=torch.bfloat16,
attn_implementation="flash_attention_2",
device_map={"": 0},
)
model.config.use_cache = True
model.eval()
EOT = tokenizer.convert_tokens_to_ids("<end_of_turn>")
@torch.inference_mode()
def translate(sentences, language):
if isinstance(sentences, str):
sentences = [sentences]
prompts = [
tokenizer.apply_chat_template(
[
{
"role": "user",
"content": f"Translate to {language}:\n\n{s}",
}
],
tokenize=False,
add_generation_prompt=True,
)
for s in sentences
]
inputs = tokenizer(
prompts,
return_tensors="pt",
padding=True,
add_special_tokens=False,
).to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256,
do_sample=False,
num_beams=5,
eos_token_id=[
tokenizer.eos_token_id,
EOT,
],
pad_token_id=tokenizer.pad_token_id,
)
generated = outputs[:, inputs["input_ids"].shape[1]:]
return tokenizer.batch_decode(
generated,
skip_special_tokens=True,
)
sentence = "Artificial Intelligence is transforming agriculture."
translation = translate(sentence, "Hindi")
print(translation[0])
Recommended Generation Settings
max_new_tokens = 256
num_beams = 5
do_sample = False
use_cache = True
padding_side = "left"
dtype = torch.bfloat16
attn_implementation = "flash_attention_2"
These settings are the same as those used in the provided inference notebook and are recommended for obtaining deterministic, high-quality translations.
Evaluation
The model was evaluated using sentence pairs from the BPCC dataset.
Metrics used:
Average benchmark results:
Table with columns: Language Code, Language, BLEU ↑, chrF2 ↑| Language Code | Language | BLEU ↑ | chrF2 ↑ |
|---|
| asm_Beng | Assamese | 44.1 | 48.2 |
| ben_Beng | Bengali | 55.3 | 54.3 |
| guj_Gujr | Gujarati | 54.1 | 53.5 |
| hin_Deva | Hindi | 61.9 |
Known Limitations
Like most compact multilingual translation models, this model has a few limitations.
- Numerical values may occasionally change during translation.
- Rarely, Latin characters may appear within Indic script outputs.
- Translation quality varies across languages, with lower-resource languages generally being more challenging.
- Not intended for legal, medical, or other safety-critical translation tasks without human verification.
Citation
@misc{Gemma3-En2Indic-NMT-270M,
title = {Gemma3-En2Indic-NMT-270M: English to Indic Neural Machine Translation},
author = {Adapala, Mani Kumar},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/ManiKumarAdapala/Gemma3-En2Indic-NMT-270M}
}
Acknowledgements
This work builds upon:
- Google for the Gemma-3 model.
- AI4Bharat for the BPCC multilingual parallel corpus.
- Hugging Face for the Transformers ecosystem.
- The open-source community for tools and libraries that enabled this work.