CoolFace
Modelpublic

ManiKumarAdapala/Gemma3-En2Indic-NMT-270M

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
1likes29downloads
Model Card

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

PropertyValue
Base Modelgoogle/gemma-3-270m-it
ArchitectureGemma 3
Parameters270 Million
TaskEnglish → Indic Machine Translation
FrameworkHugging Face Transformers
Precisionbfloat16
AttentionFlash Attention 2
GenerationBeam Search
Beam Size5
SamplingDisabled (do_sample=False)
Padding SideLeft
CacheEnabled (use_cache=True)

Supported Languages

LanguageLanguage Code
Assameseasm_Beng
Bengaliben_Beng
Gujaratiguj_Gujr
Hindihin_Deva
Kannadakan_Knda
Kashmirikas_Arab
Malayalammal_Mlym
Marathimar_Deva
Odiaory_Orya
Punjabipan_Guru
Sanskritsan_Deva
Tamiltam_Taml
Telugutel_Telu
Urduurd_Arab

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.

Prompt Format

The model expects prompts in the following format:

text
Translate to {Target Language}:

{English Sentence}

Example:

text
Translate to Telugu:

Artificial Intelligence is changing healthcare.

Usage

python
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

python
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:

  • —BLEU
  • —chrF2

Average benchmark results:

Language CodeLanguageBLEU ↑chrF2 ↑
asm_BengAssamese44.148.2
ben_BengBengali55.354.3
guj_GujrGujarati54.153.5
hin_DevaHindi61.959.5
kan_KndaKannada41.046.6
kas_ArabKashmiri8.431.6
mal_MlymMalayalam45.346.7
mar_DevaMarathi50.750.6
ory_OryaOdia40.644.3
pan_GuruPunjabi48.749.2
san_DevaSanskrit38.441.2
tam_TamlTamil48.949.2
tel_TeluTelugu49.849.7
urd_ArabUrdu33.755.2
Average14 Languages44.448.6

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

bibtex
@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.