--- license: apache-2.0 language: - en - hi tags: - viuai - viutranslate - sarus-500m - translation - nmt - english-to-hindi - hindi-to-english - indic - devanagari - bfloat16 - pytorch - zero-synthetic datasets: - cfilt/iitb-english-hindi - ai4bharat/samanantar pipeline_tag: translation library_name: transformers inference: false ---
# ๐ŸŒ ViuTranslate-500M ### *High-Performance English โ†” Hindi Neural Machine Translation Foundation Model* [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Parameters](https://img.shields.io/badge/Parameters-500M-green.svg)](#-model-specifications) [![Context](https://img.shields.io/badge/Context%20Length-2048-orange.svg)](#-model-specifications) [![Dataset](https://img.shields.io/badge/Corpus-100K%2B%20Real%20Academic-purple.svg)](https://huggingface.co/datasets/ViuAI/ViuTranslate-Data) [![Languages](https://img.shields.io/badge/Languages-English%20%7C%20Hindi-red.svg)](#-translation-capabilities) [![Data Quality](https://img.shields.io/badge/Data-100%25%20Human%20Verified-brightgreen.svg)](#-zero-synthetic-data-guarantee) [**๐ŸŒ ViuAI Studio**](https://github.com/ViuAI) | [**๐Ÿ“š Translation Dataset**](https://huggingface.co/datasets/ViuAI/ViuTranslate-Data) | [**๐Ÿ“ Architecture**](#-model-specifications) | [**โšก Quickstart**](#-quickstart--inference) | [**๐Ÿš€ 5090 Runner**](#-training-on-rtx-5090) ---
## ๐Ÿ“Œ Introduction **ViuTranslate-500M** is a production-grade bilingual Neural Machine Translation (NMT) foundation model developed by **ViuAI**. Built on the custom **Sarus-500M** decoder-only transformer architecture, it is engineered specifically for fluid, high-fidelity bidirectional translation between **English and Hindi (Devanagari)**. Unlike general-purpose conversational LLMs that frequently inject conversational fluff, unsolicited commentary, or mathematical reasoning hallucinations, **ViuTranslate-500M** is optimized purely for deterministic, end-to-end translation with native-speaker fluency. --- ## ๐ŸŒŸ Key Capabilities & Highlights 1. **โšก Google-Translate Style Direct Input**: * Accepts raw, untagged sentences directly. Input plain English to receive pure Hindi; input plain Hindi to receive pure English. 2. **๐Ÿ’ฌ Command / Instruction Mode Support**: * Seamlessly handles explicit prompts (e.g., `Translate to Hindi: ...` and `Translate to English: ...`). 3. **๐Ÿ›ก๏ธ Zero Synthetic Data Guarantee**: * Trained exclusively on authentic, human-verified parallel corpora from top research institutions (**CFILT IIT Bombay** and **AI4Bharat Samanantar**). Zero synthetic, template-generated, or LLM-distilled text. 4. **๐Ÿ”ค 100% Devanagari Unicode Coverage**: * Custom 64,003-vocab byte-fallback BPE tokenizer ensures **exactly 0 `` tokens** across standard benchmark corpora. 5. **๐Ÿš€ Ultra-Low Latency & Edge-Ready**: * Sub-15ms generation per sentence on modern GPUs (RTX 5090, RTX 4090, A100, T4) with efficient Grouped Query Attention (GQA). --- ## ๐Ÿ“ Model Specifications | Parameter | Specification | Details | | :--- | :--- | :--- | | **Model Name** | **ViuTranslate-500M** | *ViuAI Translation Engine* | | **Base Architecture** | **Sarus-500M** | Decoder-only Autoregressive Transformer | | **Total Parameters** | **500,642,560** (~500M) | Optimal size for high translation density & fast inference | | **Hidden Dimension ($d_{\text{model}}$)** | **1280** | Latent semantic space | | **Transformer Layers** | **24** | Balanced depth for deep bilingual representations | | **Attention Heads** | **20 Query / 4 KV Heads** | Grouped Query Attention (GQA 5:1 ratio) | | **Intermediate Size (FFN)** | **3456** | SwiGLU non-linear projection | | **Vocabulary Size** | **64,003** | Byte-fallback BPE with full Devanagari coverage | | **Context Length** | **2048 Tokens** | Rotary Positional Embeddings (RoPE, $\theta = 10,000$) | | **Normalization** | **RMSNorm** | Root Mean Square Layer Normalization ($\epsilon = 10^{-6}$) | | **Precision** | **BFloat16 / FP16** | Native Blackwell, Ada Lovelace, Ampere support | --- ## ๐Ÿ“š Training Corpus & Provenance The model is trained on the curated dataset hosted at [**`ViuAI/ViuTranslate-Data`**](https://huggingface.co/datasets/ViuAI/ViuTranslate-Data): | Dataset Source | Contributing Institution | Curated Pairs | Description | | :--- | :--- | :--- | :--- | | **IIT Bombay English-Hindi Corpus** | CFILT, IIT Bombay | **50,000** | Gold-standard academic corpus covering news, judicial, and literature | | **AI4Bharat Samanantar** | IIT Madras / AI4Bharat | **50,000** | Large-scale verified Indian language web & publication texts | | **IIT Bombay Benchmark Test Set** | CFILT, IIT Bombay | **2,502** | Standardized international evaluation test suite | | **Total Curated Dataset** | โ€” | **102,502 Pairs** | **13.6 Million Active Training Tokens** | ### ๐Ÿ›ก๏ธ Mathematical Quality Guardrails: * **Length Ratio Bound:** Enforced $0.40 \le \frac{\text{len(en)}}{\text{len(hi)}} \le 2.40$ to eliminate truncated pairs. * **Script Purity:** Minimum 50% Latin characters on English side; minimum 40% Devanagari characters ($[\u0900-\u097F]$) on Hindi side. * **Hygiene Sanitization:** 100% stripped of HTML tags, XML entities, programming code blocks, and URLs. * **Bidirectional Augmentation:** Trained in both Direct Mode and Command Mode in both directions ($EN \leftrightarrow HI$). --- ## ๐Ÿš€ Quickstart & Inference ### 1. Installation ```bash pip install torch tokenizers huggingface_hub ``` ### 2. Standalone Python Inference ```python import torch from tokenizers import Tokenizer from huggingface_hub import hf_hub_download # Download model code and tokenizer repo_id = "ViuAI/ViuTranslate" tok_path = hf_hub_download(repo_id=repo_id, filename="tokenizer.json") config_path = hf_hub_download(repo_id=repo_id, filename="config.py") model_path = hf_hub_download(repo_id=repo_id, filename="model.py") # Import architecture import sys, os sys.path.insert(0, os.path.dirname(config_path)) from config import ViuAIConfig from model import ViuAI device = torch.device("cuda" if torch.cuda.is_available() else "cpu") tokenizer = Tokenizer.from_file(tok_path) cfg = ViuAIConfig(vocab_size=64003, context_length=2048) model = ViuAI(cfg).to(device) # Load weights (supports base checkpoint or fine-tuned weights) try: ckpt_path = hf_hub_download(repo_id=repo_id, filename="viutranslate_final.pt") except Exception: ckpt_path = hf_hub_download(repo_id="ViuAI/ViuAI-500M", filename="checkpoints/ckpt_latest.pt") state = torch.load(ckpt_path, map_location=device, weights_only=False) model.load_state_dict(state.get("model_state_dict", state), strict=False) model.eval() def translate(text: str) -> str: prompt = f"<|user|>\n{text.strip()}<|endofturn|>\n<|assistant|>\n" inp = torch.tensor([tokenizer.encode(prompt).ids], device=device) with torch.no_grad(): out = model.generate(inp, max_new_tokens=128, temperature=0.2, top_p=0.9, eos_token_id=64002) return tokenizer.decode(out[0][inp.shape[1]:].tolist()).replace("<|endofturn|>", "").strip() # Examples print("EN -> HI:", translate("Consistency and discipline are the keys to long term success.")) print("HI -> EN:", translate("เคธเฅ‚เคฐเคœ เคชเฅ‚เคฐเฅเคต เคฎเฅ‡เค‚ เค‰เค—เคคเคพ เคนเฅˆ เค”เคฐ เคชเคถเฅเคšเคฟเคฎ เคฎเฅ‡เค‚ เคกเฅ‚เคฌเคคเคพ เคนเฅˆเฅค")) ``` --- ## ๐Ÿ‹๏ธ Training on RTX 5090 (32GB) Run the ultra-optimized 1-click training launcher directly from your terminal: ```bash # Download and launch runner curl -O https://huggingface.co/ViuAI/ViuTranslate/raw/main/runners/run_5090.py python run_5090.py ``` * **Target Hardware:** NVIDIA GeForce RTX 5090 (32GB VRAM, Blackwell Architecture) * **Configuration:** `micro_batch=32`, `grad_accum=2` (Effective Batch = 64), `bfloat16` * **Speed:** ~100,000 tokens/sec (~6.5 minutes for full 100K training run) --- ## ๐Ÿ“ Repository Structure ``` ViuAI/ViuTranslate โ”œโ”€โ”€ README.md # Official Model Card & Documentation โ”œโ”€โ”€ config.py # Sarus-500M Architecture Config โ”œโ”€โ”€ model.py # PyTorch Transformer Definition โ”œโ”€โ”€ tokenizer.json # 64,003 Byte-Fallback Tokenizer โ”œโ”€โ”€ tokenizer_config.json # Fast Tokenizer Configuration โ”œโ”€โ”€ special_tokens_map.json # Turn & Separation Tokens โ”œโ”€โ”€ generation_config.json # Recommended Decoding Parameters โ”‚ โ”œโ”€โ”€ scripts/ # Modular Pipeline Scripts โ”‚ โ”œโ”€โ”€ train.py # High-Throughput SFT Training Engine โ”‚ โ”œโ”€โ”€ inference.py # Interactive CLI Translation Console โ”‚ โ””โ”€โ”€ evaluate.py # BLEU / chrF++ Benchmark Evaluator โ”‚ โ””โ”€โ”€ runners/ # 1-Click Hardware Launchers โ”œโ”€โ”€ run_5090.py # RTX 5090 Ultra-Fast Launcher โ””โ”€โ”€ run_kaggle.py # Kaggle GPU T4 Launcher ``` --- ## ๐Ÿ“œ Citation & Reference ```bibtex @misc{viutranslate2026, author = {ViuAI Research Team}, title = {ViuTranslate-500M: High-Performance English-Hindi Neural Machine Translation Foundation Model}, year = {2026}, publisher = {Hugging Face}, journal = {Hugging Face Model Hub}, howpublished = {\url{https://huggingface.co/ViuAI/ViuTranslate}} } ```