Sovereign Domain SLMs
Collection
Domain-adapted Small Language Models fine-tuned for statutory law, silicon hardware design, chemistry, and formal mathematics. • 6 items • Updated
How to use shreyansh12183/Vidhi-AI-Instruct with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
model = PeftModel.from_pretrained(base_model, "shreyansh12183/Vidhi-AI-Instruct")Vidhi AI is a specialized domain-adapted reasoning model fine-tuned on structured Indian statutory jurisprudence, modern criminal codes (Bharatiya Nyaya Sanhita 2023, Bharatiya Nagarik Suraksha Sanhita 2023), debt recovery (SARFAESI Act 2002), and constitutional property law.
Developed by Shreyansh Singh as part of an open research initiative exploring sovereign domain-specific SLMs.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
BASE_MODEL = "Qwen/Qwen2.5-7B-Instruct"
ADAPTER = "shreyansh12183/Vidhi-AI-Instruct"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(model, ADAPTER)
prompt = "Explain the statutory prerequisites for declaring a security interest enforceable under Section 13(2) of the SARFAESI Act 2002."
messages = [{"role": "user", "content": prompt}]
formatted = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(formatted, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.3)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Qwen/Qwen2.5-7B-Instructshreyansh12183/vidhi-ai-1k-curated (1,074 verified statutory reasoning pairs)