matrixdose/sarvam-30b

Want a bigger model? Download Sarvam-105B!
Index
- Introduction
- Architecture
- Benchmarks
- Knowledge & Coding
- Reasoning & Math
- Agentic
- Inference
- Hugging Face
- vLLM
- SGLang
- Footnote
- Citation
Introduction
Sarvam-30B is an advanced Mixture-of-Experts (MoE) model with 2.4B non-embedding active parameters, designed primarily for practical deployment. It combines strong reasoning, reliable coding ability, and best-in-class conversational quality across Indian languages. Sarvam-30B is built to run reliably in resource-constrained environments and can handle multilingual voice calls while performing tool calls.
A major focus during training was the Indian context and languages, resulting in state-of-the-art performance across 22 Indian languages for its model size.
Sarvam-30B is open-sourced under the Apache License. For more details, see our blog.
Architecture
The 30B MoE model is designed for throughput and memory efficiency. It uses 19 layers, a dense FFN intermediate_size of 8192, moe_intermediate_size of 1024, top-6 routing, grouped KV heads (num_key_value_heads=4), and an extremely high rope_theta (8e6) for long-context stability without RoPE scaling. It has 128 experts with a shared expert, a routed scaling factor of 2.5, and auxiliary-loss-free router balancing. The 30B model focuses on throughput and memory efficiency through fewer layers, grouped KV attention, and smaller experts.
Benchmarks
<details> <summary>Knowledge & Coding</summary>
</details>
<details> <summary>Reasoning & Math</summary>
</details>
<details> <summary>Agentic</summary>
See footnote for evaluation details.
</details>
Inference
<details> <summary>Huggingface</summary>
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
model_name = "sarvamai/sarvam-30b"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, device_map="auto")
def generate_text(
prompt: str,
max_new_tokens: int = 2048,
temperature: float = 0.8,
top_p: float = 0.95,
repetition_penalty: float = 1.0,
) -> None:
inputs = tokenizer(prompt, return_tensors="pt").to("cuda:0")
generation_config = GenerationConfig(
max_new_tokens=max_new_tokens,
repetition_penalty=repetition_penalty,
temperature=temperature,
top_p=top_p,
do_sample=True,
)
with torch.no_grad():
output_ids = model.generate(
input_ids=inputs["input_ids"],
attention_mask=inputs["attention_mask"],
generation_config=generation_config,
)
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
prompts = [
"What is the capital city of New Zealand?",
]
for prompt in prompts:
templated_prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}],
tokenize=False,
add_generation_prompt=True,
enable_thinking=True
)
output = generate_text(templated_prompt, max_new_tokens=512)
print("Prompt: ", prompt)
print("Generated text: ", output)
print("=" * 100)</details>
<details> <summary>SGLang</summary>
Install latest SGLang from source
git clone https://github.com/sgl-project/sglang.git
cd sglang
pip install -e "python[all]"Instantiate model and Run
import sglang as sgl
from transformers import AutoTokenizer
model_path = "sarvamai/sarvam-30b"
engine = sgl.Engine(
model_path=model_path,
tp_size=2,
mem_fraction_static=0.8,
trust_remote_code=True,
dtype="bfloat16",
prefill_attention_backend="fa3",
decode_attention_backend="fa3",
)
sampling_params = {
"temperature": 0.8,
"max_new_tokens": 2048,
"repetition_penalty": 1.0,
}
prompts = [
"Which treaty formally ended World War I and imposed heavy reparations on Germany?",
]
outputs = engine.generate([
tokenizer.apply_chat_template([
{"role": "user", "content": prompt}],
tokenize=False,
add_generation_prompt=True,
enable_thinking=True)
for prompt in prompts],
sampling_params)
for p, o in zip(prompts, outputs):
print("Prompt: ", p)
print("Generated text: ", o['text'])
print("=" * 100)</details>
<details> <summary>vLLM</summary>
Note: currently a PR is open for native support for the Sarvam models in vLLM (link). Therefore, we have 2 options here.
Option 1: install from source (hard)
Option 2: hot-patch (easy)
- Run hotpatch_vllm.py
- This will do the following:
- install vllm=0.15.0
- add 2 model entries to
registry.py - download the model executors for
sarvam-105bandsarvam-30b
Once this is done, you can run vLLM as usual
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer
model_path = "sarvamai/sarvam-30b"
tokenizer = AutoTokenizer.from_pretrained(model_path)
llm = LLM(model=model_path,
trust_remote_code=True,
max_model_len=2048,
tensor_parallel_size=8,
max_num_seqs=16,
)
sampling_params = SamplingParams(
temperature=0.8,
max_tokens=2048,
repetition_penalty=1.0,
spaces_between_special_tokens=True
)
prompts = [
"Who wrote The Picture of Dorian Gray?",
]
outputs = llm.generate([
tokenizer.apply_chat_template([
{"role": "user", "content": prompt}],
tokenize=False,
add_generation_prompt=True,
enable_thinking=True)
for prompt in prompts],
sampling_params)
for p, o in zip(prompts, outputs):
print("Prompt: ", p)
print("Generated text: ", o.outputs[0].text)
print("=" * 100)</details>
Footnote
- General settings: All benchmarks are evaluated with a maximum context length of 65,536 tokens.
- Reasoning & Math benchmarks (Math500, MMLU, MMLU Pro, GPQA Diamond, AIME 25, Beyond AIME, HMMT, HumanEval, MBPP): Evaluated with
temperature=1.0, top_p=1.0, max_new_tokens=65536. - Coding & Knowledge benchmarks (Live Code Bench v6, Arena Hard v2, IF Eval): Evaluated with
temperature=1.0, top_p=1.0, max_new_tokens=65536. - Writing Bench: Responses generated using official Writing-Bench parameters:
temperature=0.7, top_p=0.8, top_k=20, max_length=16000. Scoring performed using the official Writing-Bench critic model with:temperature=1.0, top_p=0.95, max_length=2048. - Agentic benchmarks (BrowseComp, SWE Bench Verified, τ² Bench): Evaluated with
temperature=0.5, top_p=1.0, max_new_tokens=32768.
Citation
@misc{sarvam_sovereign_models,
title = {Introducing Sarvam's Sovereign Models},
author = {{Sarvam Foundation Models Team}},
year = {2026},
howpublished = {\url{https://www.sarvam.ai/blogs/sarvam-30b-105b}},
note = {Accessed: 2026-03-03}
}