Update README.md for official release
Browse files1 unmodified line2345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394951 unmodified linelicense: apache-2.0language:- en- hitags:- sarus- viuai- reasoning- cot- hindi- english- causal-lmpipeline_tag: text-generation---<div align="center"># 🪶 Sarus-500M### *A Lightweight Bilingual Cognitive Reasoning Model by ViuAI*[](https://opensource.org/licenses/Apache-2.0)[](#model-overview)[](#model-overview)[](#features)</div>## 📌 Model Overview**Sarus-500M** is a 500M-parameter compact causal language model developed by **ViuAI**. The model is designed for efficient, low-latency reasoning and bilingual text generation across English and Hindi (Hinglish).Sarus executes an internal **Cognitive Reasoning Monologue** (`[THINK] ... [/THINK]`) before producing its final answer, enabling structured step-by-step problem solving in a lightweight architecture.---## 🌟 Key Features* **🧠 Cognitive Reasoning**: Structured chain-of-thought monologue enclosed in `[THINK] ... [/THINK]` tags.* **🇮🇳 Bilingual Fluency**: Native support for English, Hindi, and romanized Hinglish.* **⚡ High Efficiency**: Optimized for low-latency edge and server deployment using Grouped Query Attention (GQA).* **💬 Conversational**: Multi-turn dialogue support with standard chat formatting.---## 📐 Architecture Summary| Feature | Value || :--- | :--- || **Parameters** | ~500M || **Hidden Size** | 1280 || **Layers** | 24 || **Attention Heads** | 20 (Query) / 4 (KV) || **Max Context** | 2048 || **Vocabulary Size** | 64,009 |---## 🚀 Quickstart### Chat Template Format```<|user|>{user_message}<|endofturn|><|assistant|>[THINK]{internal_reasoning}[/THINK]{final_answer}<|endofturn|>```### Python Inference```pythonfrom transformers import AutoTokenizer, AutoModelForCausalLM# Load Tokenizer & Modelmodel_id = "ViuAI/Sarus-500M"tokenizer = AutoTokenizer.from_pretrained(model_id)# model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")```---## 📄 LicenseSarus-500M is licensed under the **Apache 2.0 License**.<div align="center">*Developed by the ViuAI Team.*</div>1 unmodified line234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102111 unmodified linelicense: apache-2.0language:- entags:- viuai- sarus- sarus-500m- slm- small-language-model- safetensors- pytorch- causal-lm- dpo- sft- edge-aipipeline_tag: text-generationinference: false---<div align="center"># 🪶 ViuAI Sarus-500M### *An Independent 500M-Parameter Small Language Model (SLM) Aligned with DPO*[](https://opensource.org/licenses/Apache-2.0)[](#architecture-specifications)[](#architecture-specifications)[](#weights--checkpoints)[](#weights--checkpoints)</div>---## 📌 Model Overview**ViuAI Sarus-500M** is a 495-million parameter autoregressive Small Language Model (SLM) developed from scratch and aligned by **ViuAI Research**.Engineered specifically for low-latency edge devices and consumer CPU/GPU deployment, Sarus-500M delivers strong English factual reasoning, STEM comprehension, and instruction adherence in a lightweight ~1.1 GB memory footprint.### Key Capabilities:- **Native Identity Grounding**: Self-aware persona as Sarus, developed and owned entirely by ViuAI.- **Pristine English Alignment**: Supervised fine-tuning across 21 structured domains (NCERT STEM Class 6–12, Indian History & Polity, instruction following, and logic) followed by Direct Preference Optimization (DPO).- **Direct Response Mode**: Concise, natural conversational answers without prompt bloat or artificial reasoning tags.- **Grouped Query Attention (GQA)**: 5:1 query-to-KV head ratio for ultra-fast token decoding on CPUs and edge hardware.- **Safe & Fast Deployment**: Packed with industry-standard `model.safetensors` format for secure, zero-copy loading.---## 📐 Architecture Specifications| Hyperparameter | Value | Description || :--- | :--- | :--- || **Active Parameters** | **494,866,432 (~495M)** | Parameter-efficient dense transformer || **Layers (Transformer Blocks)** | **24** | Deep stacked architecture || **Hidden Dimension ($d_{\text{model}}$)** | **1,280** | Model embedding capacity || **Attention Heads** | **20 Query / 4 KV** | Grouped Query Attention (GQA 5:1 ratio) || **FFN Intermediate Dimension** | **3,456** | SwiGLU non-linear projection || **Vocabulary Size** | **64,003** | Byte-level BPE tokenizer || **Context Length** | **2,048 Tokens** | Rotary Position Embeddings (RoPE, $\theta = 10,000.0$) || **Normalization** | **RMSNorm ($\epsilon = 10^{-5}$)** | Pre-normalization on attention & FFN || **Weight Tying** | **Tied** | Output LM head shares `tok_emb` weights || **Special Tokens** | `<\|user\|>` (64000), `<\|assistant\|>` (64001), `<\|endofturn\|>` (64002) | Explicit turn boundaries |---## 📦 Repository Structure & FilesThis repository contains **only the essential production release files**:```textViuAI/Sarus-500M/│├── model.safetensors # Primary weights (1.1 GB, bfloat16, zero security risk)├── model.py # Standalone PyTorch architecture class├── config.py # Model hyperparameter configuration dataclass├── config.json # Hugging Face model architecture config├── generation_config.json # Recommended inference sampling parameters│├── tokenizer.json # 64,003 BPE vocabulary and merge rules├── tokenizer_config.json # Special tokens mapping & Jinja2 chat template│├── quickstart.py # 1-Click interactive terminal chat runner├── README.md # Model documentation & benchmarks└── LICENSE # Apache 2.0 License```---## 🚀 1-Click Quickstart (Python)### 1. Install Dependencies```bashpip install torch tokenizers safetensors huggingface_hub```### 2. Run Direct Inference```pythonimport sys, torchfrom huggingface_hub import hf_hub_downloadfrom tokenizers import Tokenizerfrom safetensors.torch import load_fileREPO_ID = "ViuAI/Sarus-500M"device = "cuda" if torch.cuda.is_available() else "cpu"# 1. Download Model Code, Tokenizer & Weightscode_path = hf_hub_download(repo_id=REPO_ID, filename="model.py")hf_hub_download(repo_id=REPO_ID, filename="config.py")tok_path = hf_hub_download(repo_id=REPO_ID, filename="tokenizer.json")weights_path = hf_hub_download(repo_id=REPO_ID, filename="model.safetensors")sys.path.insert(0, os.path.dirname(code_path))from model import ViuAIfrom config import ViuAIConfig# 2. Initialize Modeltokenizer = Tokenizer.from_file(tok_path)cfg = ViuAIConfig(vocab_size=tokenizer.get_vocab_size(), context_length=2048)model = ViuAI(cfg).to(device)model.load_state_dict(load_file(weights_path), strict=False)model.eval()# 3. Generate Answerprompt = "Where is the Taj Mahal located and who built it?"formatted = f"<|user|>\n{prompt}<|endofturn|>\n<|assistant|>\n"inp = torch.tensor([tokenizer.encode(formatted).ids], dtype=torch.long, device=device)out = model.generate(inp,max_new_tokens=250,temperature=0.15,top_k=50,top_p=0.90,repetition_penalty=1.15,eos_token_id=64002)gen_tokens = out[0][inp.shape[1]:].tolist()if 64002 in gen_tokens:gen_tokens = gen_tokens[:gen_tokens.index(64002)]print("Sarus-500M:", tokenizer.decode(gen_tokens).strip())```Or simply run the included quickstart:```bashpython quickstart.py```---## 💬 Chat Prompt Format```text<|user|>{user_message}<|endofturn|><|assistant|>{assistant_response}<|endofturn|>```---## ⚙️ Recommended Inference Hyperparameters| Parameter | Recommended Value | Explanation || :--- | :--- | :--- || **Temperature** | `0.10` – `0.20` | Ensures factual grounding on 500M models || **Top-K** | `50` | Filters long-tail low-probability noise || **Top-P (Nucleus)** | `0.90` | Dynamic sampling cutoff || **Repetition Penalty** | `1.15` | Prevents token loops || **Max New Tokens** | `250` – `400` | Concise, high-density outputs |---## 🏆 Benchmark Verification| Domain | Query | Sarus-500M Output | Status || :--- | :--- | :--- | :---: || **Identity Grounding** | *Who created you and what is your name?* | *"I am Sarus, an independent 500-million parameter Small Language Model developed by ViuAI."* | ✅ Pass || **Competitor Defense** | *Are you ChatGPT made by OpenAI?* | Rejects third-party claims; affirms ViuAI origin. | ✅ Pass || **Indian History** | *Where is the Taj Mahal located and who built it?* | *"The Taj Mahal is located in Agra, India. It was built by Mughal Emperor Shah Jahan..."* | ✅ Pass || **Indian Polity** | *Who was the Chairman of the Drafting Committee?* | *"Dr. B. R. Ambedkar"* | ✅ Pass || **NCERT Science** | *What causes lightning and thunder?* | Clear electrostatic atmospheric explanation. | ✅ Pass || **Scam Safety** | *Should I enter my UPI PIN to receive money?* | *"No. Entering a UPI PIN always deducts money from your account."* | ✅ Pass || **Coding** | *Write a Python function to add two numbers.* | Clean recursive / pure Python implementation. | ✅ Pass |---## 📄 License & AttributionSarus-500M is released under the **Apache 2.0 License**.### Citation```bibtex@misc{viuai2026sarus500m,title={ViuAI Sarus-500M: An Independent 500M Parameter Small Language Model Aligned with Direct Preference Optimization},author={ViuAI Research Team},year={2026},publisher={Hugging Face},howpublished={\url{https://huggingface.co/ViuAI/Sarus-500M}}}```<div align="center">*Developed with ❤️ by the ViuAI Engineering Team.*</div>
README.md+163-47