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/olmo2-7b-phd-pure-math with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("allenai/OLMo-2-1124-7B-Instruct")
model = PeftModel.from_pretrained(base_model, "shreyansh12183/olmo2-7b-phd-pure-math")A mathematical reasoning adapter fine-tuned on advanced proofs in Algebraic Topology, Differential Geometry, Abstract Algebra, and Real Analysis.
Developed by Shreyansh Singh to investigate rigorous symbolic reasoning in open-weight language models.
This model repository contains trained PEFT LoRA adapter weights fine-tuned on top of allenai/OLMo-2-1124-7B-Instruct.
To run inference in 4-bit quantization with minimal VRAM (~6GB on a free Google Colab T4 GPU):
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
BASE_MODEL = "allenai/OLMo-2-1124-7B-Instruct"
ADAPTER_ID = "shreyansh12183/olmo2-7b-phd-pure-math"
# 1. Load Tokenizer
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, trust_remote_code=True)
# 2. Configure 4-bit BitsAndBytes NF4 Quantization
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_use_double_quant=True
)
# 3. Load Base Model
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
quantization_config=bnb_config,
device_map="auto",
trust_remote_code=True
)
# 4. Attach Fine-Tuned LoRA Adapter
model = PeftModel.from_pretrained(base_model, ADAPTER_ID)
model.eval()
# 5. Run Test Inference
prompt = "Explain the core domain methodology and statutory reasoning."
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=300, temperature=0.3, top_p=0.9)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Test this model and the complete ExperimentLab SLM fleet on a free GPU with zero local setup:
shreyansh@experimentlab.in)Base model
allenai/OLMo-2-1124-7B
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("allenai/OLMo-2-1124-7B-Instruct") model = PeftModel.from_pretrained(base_model, "shreyansh12183/olmo2-7b-phd-pure-math")