Views
No views yet

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.| Benchmark | Sarvam-30B | Gemma 27B It | Mistral-3.2-24B | OLMo 3.1 32B Think | Nemotron-3-Nano-30B-A3B | Qwen3-30B-Thinking-2507 | GLM 4.7 Flash | GPT-OSS-20B |
|---|---|---|---|---|---|---|---|---|
| Math500 | 97.0 | 87.4 | 69.4 | 96.2 | 98.0 | 97.6 | 97.0 | 94.2 |
| HumanEval | 92.1 | 88.4 | 92.9 | 95.1 | 97.6 | 95.7 | 96.3 | 95.7 |
| MBPP | 92.7 | 81.8 | 78.3 | 58.7 | 91.9 | 94.3 | 91.8 | 95.3 |
| Live Code Bench v6 | 70.0 | 28.0 | 26.0 | 73.0 | 68.3 | 66.0 | 64.0 | 61.0 |
| MMLU | 85.1 | 81.2 | 80.5 | 86.4 | 84.0 | 88.4 | 86.9 | 85.3 |
| MMLU Pro | 80.0 | 68.1 | 69.1 | 72.0 | 78.3 | 80.9 | 73.6 | 75.0 |
| MILU | 76.8 | 69.2 | 67.9 | 69.9 | 64.8 | 82.6 | 75.6 | 73.7 |
| Arena Hard v2 | 49.0 | 50.1 | 43.1 | 42.0 | 67.7 | 72.1 | 58.1 | 62.9 |
| Writing Bench | 78.7 | 71.4 | 70.3 | 75.7 | 83.7 | 85.0 | 79.2 | 79.1 |
| Benchmark | Sarvam-30B | OLMo 3.1 32B | Nemotron-3-Nano-30B | Qwen3-30B-Thinking-2507 | GLM 4.7 Flash | GPT-OSS-20B |
|---|---|---|---|---|---|---|
| GPQA Diamond | 66.5 | 57.5 | 73.0 | 73.4 | 75.2 | 71.5 |
| AIME 25 (w/ Tools) | 88.3 (96.7) | 78.1 (81.7) | 89.1 (99.2) | 85.0 (-) | 91.6 (-) | 91.7 (98.7) |
| HMMT (Feb 25) | 73.3 | 51.7 | 85.0 | 71.4 | 85.0 | 76.7 |
| HMMT (Nov 25) | 74.2 | 58.3 | 75.0 | 73.3 | 81.7 | 68.3 |
| Beyond AIME | 58.3 | 48.5 | 64.0 | 61.0 | 60.0 | 46.0 |
| Benchmark | Sarvam-30B | Nemotron-3-Nano-30B | Qwen3-30B-Thinking-2507 | GLM 4.7 Flash | GPT-OSS-20B |
|---|---|---|---|---|---|
| BrowseComp | 35.5 | 23.8 | 2.9 | 42.8 | 28.3 |
| SWE Bench Verified | 34.0 | 38.8 | 22.0 | 59.2 | 34.0 |
| τ² Bench (avg.) | 45.7 | 49.0 | 47.7 | 79.5 | 48.7 |
See footnote for evaluation details.
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
3
4model_name = "sarvamai/sarvam-30b"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, device_map="auto")
7
8def generate_text(
9 prompt: str,
10 max_new_tokens: int = 2048,
11 temperature: float = 0.8,
12 top_p: float = 0.95,
13 repetition_penalty: float = 1.0,
14) -> None:
15 inputs = tokenizer(prompt, return_tensors="pt").to("cuda:0")
16
17 generation_config = GenerationConfig(
18 max_new_tokens=max_new_tokens,
19 repetition_penalty=repetition_penalty,
20 temperature=temperature,
21 top_p=top_p,
22 do_sample=True,
23 )
24
25 with torch.no_grad():
26 output_ids = model.generate(
27 input_ids=inputs["input_ids"],
28 attention_mask=inputs["attention_mask"],
29 generation_config=generation_config,
30 )
31 return tokenizer.decode(output_ids[0], skip_special_tokens=True)
32
33prompts = [
34 "What is the capital city of New Zealand?",
35]
36
37for prompt in prompts:
38 templated_prompt = tokenizer.apply_chat_template(
39 [{"role": "user", "content": prompt}],
40 tokenize=False,
41 add_generation_prompt=True,
42 enable_thinking=True
43 )
44 output = generate_text(templated_prompt, max_new_tokens=512)
45 print("Prompt: ", prompt)
46 print("Generated text: ", output)
47 print("=" * 100)1git clone https://github.com/sgl-project/sglang.git
2cd sglang
3pip install -e "python[all]"1import sglang as sgl
2from transformers import AutoTokenizer
3
4model_path = "sarvamai/sarvam-30b"
5engine = sgl.Engine(
6 model_path=model_path,
7 tp_size=2,
8 mem_fraction_static=0.8,
9 trust_remote_code=True,
10 dtype="bfloat16",
11 prefill_attention_backend="fa3",
12 decode_attention_backend="fa3",
13)
14
15sampling_params = {
16 "temperature": 0.8,
17 "max_new_tokens": 2048,
18 "repetition_penalty": 1.0,
19}
20
21prompts = [
22 "Which treaty formally ended World War I and imposed heavy reparations on Germany?",
23]
24
25outputs = engine.generate([
26 tokenizer.apply_chat_template([
27 {"role": "user", "content": prompt}],
28 tokenize=False,
29 add_generation_prompt=True,
30 enable_thinking=True)
31 for prompt in prompts],
32 sampling_params)
33for p, o in zip(prompts, outputs):
34 print("Prompt: ", p)
35 print("Generated text: ", o['text'])
36 print("=" * 100)registry.pysarvam-105b and sarvam-30b1from vllm import LLM, SamplingParams
2from transformers import AutoTokenizer
3
4model_path = "sarvamai/sarvam-30b"
5tokenizer = AutoTokenizer.from_pretrained(model_path)
6llm = LLM(model=model_path,
7 trust_remote_code=True,
8 max_model_len=2048,
9 tensor_parallel_size=8,
10 max_num_seqs=16,
11 )
12sampling_params = SamplingParams(
13 temperature=0.8,
14 max_tokens=2048,
15 repetition_penalty=1.0,
16 spaces_between_special_tokens=True
17 )
18
19prompts = [
20 "Who wrote The Picture of Dorian Gray?",
21]
22
23outputs = llm.generate([
24 tokenizer.apply_chat_template([
25 {"role": "user", "content": prompt}],
26 tokenize=False,
27 add_generation_prompt=True,
28 enable_thinking=True)
29 for prompt in prompts],
30 sampling_params)
31for p, o in zip(prompts, outputs):
32 print("Prompt: ", p)
33 print("Generated text: ", o.outputs[0].text)
34 print("=" * 100)temperature=1.0, top_p=1.0, max_new_tokens=65536.temperature=1.0, top_p=1.0, max_new_tokens=65536.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.temperature=0.5, top_p=1.0, max_new_tokens=32768.@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}
}