Views
No views yet

<|end_of_turn|><|start_of_turn|><|assistant|> boundary — across all 19 layers of the model. This is the decision point where the refusal direction is encoded.(layer, position) pair as:d = normalize(mean(harmful_acts) - mean(harmless_acts))(layer, position) pair was selected — consistent with the paper's finding that refusal is mediated by one direction, not per-layer directions.W_new = W - scale × outer(W @ d, d)W_new = W - scale × outer(d, Wᵀ @ d)| Component | Type | Layers |
|---|---|---|
gate_proj, up_proj | MLP input | All 19 layers |
down_proj | MLP output | All 19 layers |
query_key_value | Attention input (fused GQA) | All 19 layers |
dense | Attention output | All 19 layers |
| Routed experts (×128) | MoE sparse layers | Sparse layers |
shared_experts | Always-active MoE expert | Sparse layers |
lm_head | Logit projection | Final layer |

SarvamMoEMLP: standard gated MLP with hidden size 4096 → 8192SarvamMoESparseMoeBlock: 128 routed experts + 1 shared expert, top-6 routing, expert hidden size 4096 → 1024query_key_value: 4096 → 4608), 32 query heads, 2 KV heads, head dim 128| Parameter | Value |
|---|---|
| Total parameters | ~30B |
| Active parameters | ~2.4B per forward pass |
| Layers | 19 |
| Hidden size | 4096 |
| Experts per layer | 128 routed + 1 shared |
| Top-k routing | 6 |
| RoPE theta | 8,000,000 |
| Context length | 65,536 tokens |
</think> → answer boundary, encoded in the lm_head projection<think> reasons toward compliance but the output projection re-triggers refusal — is a novel finding specific to reasoning models with explicit thinking chains, and has not been previously documented for this architecture class.1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "aoxo/sarvam-30b-uncensored"
5tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
6model = AutoModelForCausalLM.from_pretrained(
7 model_id,
8 trust_remote_code=True,
9 torch_dtype=torch.bfloat16,
10 device_map="auto",
11)
12
13messages = [{"role": "user", "content": "Your prompt here"}]
14chat = tokenizer.apply_chat_template(
15 messages,
16 tokenize=False,
17 add_generation_prompt=True,
18 enable_thinking=True,
19)
20inputs = tokenizer(chat, return_tensors="pt").to(model.device)
21inputs.pop("token_type_ids", None)
22
23with torch.no_grad():
24 out = model.generate(**inputs, max_new_tokens=1024, do_sample=True, temperature=0.8, top_p=0.95)
25
26print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False))1@misc{sarvam_sovereign_models,
2 title = {Introducing Sarvam's Sovereign Models},
3 author = {{Sarvam Foundation Models Team}},
4 year = {2026},
5 howpublished = {\url{https://www.sarvam.ai/blogs/sarvam-30b-105b}},
6}
7
8@misc{arditi2024refusal,
9 title = {Refusal in Language Models Is Mediated by a Single Direction},
10 author = {Andy Arditi and Oscar Obeso and Aaquib Syed and Daniel Paleka and Nina Panickssery and Wes Gurnee and Neel Nanda},
11 year = {2024},
12 eprint = {2406.11717},
13 archivePrefix= {arXiv},
14 primaryClass = {cs.LG},
15}
16
17@misc{sarvam30b-uncensored,
18 author = {aoxo},
19 title = {Sarvam-30B Uncensored: Abliteration of Refusal Mechanisms},
20 year = {2026},
21 howpublished = {\url{https://huggingface.co/aoxo/sarvam-30b-uncensored}},
22}