Instructions to use Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ
- SGLang
How to use Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ with Docker Model Runner:
docker model run hf.co/Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ
sarvam-30b-MxMoE: Mixed-Precision Mixture-of-Experts Quantization
Heterogeneous mixed-precision quantization of
sarvamai/sarvam-30busing the MxMoE pipeline. Each expert is quantized to a precision matched to its importance, achieving significant compression with minimal quality loss.
Model Overview
| Property | Value |
|---|---|
| Base model | sarvamai/sarvam-30b |
| Architecture | Mixture-of-Experts (MoE): 32B total, 2.4B active per token |
| MoE layers | 18 layers (indices 1–18), 128 routed experts per layer |
| Routing | Top-6 sigmoid with expert bias |
| Dense layer | Layer 0 (non-MoE) |
| Quantization method | MxMoE heterogeneous mixed-precision |
| Format | compressed-tensors (vLLM compatible) |
| Codebase | GitHub Repository |
Precision Assignment
The MxMoE pipeline assigns precision per-expert based on Fisher Information sensitivity analysis and routing frequency:
| Component | Precision | Method | Count |
|---|---|---|---|
| Attention (QKV, dense) | FP8 Dynamic | oneshot() call 1 |
38 modules |
| Shared experts | FP8 Dynamic | oneshot() call 1 |
54 modules |
| Dense layer 0 MLP | FP8 Dynamic | oneshot() call 1 |
3 modules |
| HIGH-importance routed | FP8 Dynamic | oneshot() call 1 |
1013 experts |
| MEDIUM-importance routed | FP8 Dynamic | oneshot() call 1 |
1030 experts |
| LOW-importance routed | W4A16 (GPTQ) | oneshot() call 2 |
261 experts |
lm_head, gates |
Ignored (BF16) | — | — |
Evaluation Results
| Benchmark | FP8_GPTQ | INT8_GPTQ |
|---|---|---|
| MMLU | 65.18 | 65.69 |
| HellaSwag | 39.95 | 40.79 |
| Winogrande | 51.30 | 52.57 |
| ARC-Challenge | 26.37 | 28.75 |
| GSM8K | 60.20 | 70.96 |
| TruthfulQA | 48.79 | 49.11 |
Inference Performance
Benchmarked with vLLM (tensor_parallel=2):
| Strategy | Batch Size | Tokens/sec | Latency (s) | ms/token |
|---|---|---|---|---|
fp8_gptq |
1 | 27.5 | 4.662 | 36.4 |
fp8_gptq |
4 | 125.0 | 4.096 | 8.0 |
fp8_gptq |
8 | 245.6 | 4.170 | 4.1 |
fp8_gptq |
16 | 478.4 | 4.281 | 2.1 |
fp8_gptq |
32 | 962.4 | 4.256 | 1.0 |
Hardware Requirements
| Requirement | Specification |
|---|---|
| Minimum GPU VRAM | ~40 GB (single GPU with offloading) |
| Recommended setup | 2× NVIDIA A100 80 GB |
| Tensor parallel | 2 (one model shard per GPU) |
| Precision | Mixed (FP8 Dynamic / W4A16 GPTQ) |
| Framework | vLLM ≥ 0.8.0 with compressed-tensors support |
Usage
vLLM (Recommended)
from vllm import LLM, SamplingParams
llm = LLM(
model="Nikhil-SG/sarvam-30b-MxMoE",
tensor_parallel_size=2,
max_model_len=4096,
trust_remote_code=True,
dtype="auto",
gpu_memory_utilization=0.90,
)
params = SamplingParams(temperature=0.7, max_tokens=256)
outputs = llm.generate(["Explain quantum entanglement:"], params)
print(outputs[0].outputs[0].text)
Transformers (with compressed-tensors)
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"Nikhil-SG/sarvam-30b-MxMoE",
device_map="auto",
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
"Nikhil-SG/sarvam-30b-MxMoE",
trust_remote_code=True,
)
inputs = tokenizer("Hello, how are you?", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Methodology: MxMoE Pipeline
The MxMoE (Mixed-precision Mixture-of-Experts) pipeline assigns heterogeneous precision to each expert based on its measured importance:
Sensitivity Profiling (Module 1)
- Diagonal Fisher Information estimation per expert
- Expert routing frequency analysis across calibration data
- Combined importance scoring → HIGH / MEDIUM / LOW classification
Mixed-Precision Synthesis (Module 2)
- Dynamic recipe generation: each expert gets precision matching its importance tier
- Compression via
llm-compressoroneshotAPI - Output in
compressed-tensorsformat for vLLM compatibility
Evaluation & Ablation (Module 3)
- Perplexity (WikiText-2) and benchmark evaluation via
lm-eval - Ablation study sweeping LOW-expert bit-widths to find accuracy floor
- Perplexity (WikiText-2) and benchmark evaluation via
Deployment Profiling (Module 4)
- vLLM inference benchmarks at multiple batch sizes
- Technical model card and optional HuggingFace publication
Citation
If you use this model or the MxMoE quantization pipeline, please cite:
@misc{mxmoe2026,
title={MxMoE: Heterogeneous Mixed-Precision Quantization for Mixture-of-Experts Models},
year={2026},
note={Applied to sarvamai/sarvam-30b}
}
Acknowledgments
- Base model: sarvamai/sarvam-30b
- Quantization: llm-compressor
- Inference: vLLM
- Evaluation: lm-evaluation-harness
- Downloads last month
- 2
Model tree for Nikhil-SG/sarvam-30b-MxMoE-INT8-GPTQ
Base model
sarvamai/sarvam-30b