Downloads · 30 days
9
13% of all-time downloads
Daniel2503/themis-mistral-7b-lora
themis-mistral-7b-lora is a text generation model from Daniel2503. Use it when you need the model to write or continue text. It is set up for peft.
The Parametric Legal Intelligence Engine for Indian Law
Downloads · 30 days
9
13% of all-time downloads
All-time downloads
71
Public
Repo size
14.2 MB
Likes
1
Public
Click a slice to open those files.
.safetensors13.6 MB · 76%
From the Hugging Face model README
The Parametric Legal Intelligence Engine for Indian Law
Status: v1 trained | v2 in progress Honest assessment: This adapter proves the fine-tuning pipeline works. It does NOT yet produce reliable legal knowledge. See Limitations below.
A LoRA adapter fine-tuned on 1,939 Indian legal Q&A pairs (BNS 2023, BNSS 2023, IPC, Consumer Protection Act, RTI Act). Must be loaded on top of unsloth/mistral-7b-instruct-v0.3-bnb-4bit.
Root cause: Mistral 7B has near-zero BNS 2023 pretraining knowledge — BNS was enacted Dec 2023, at/after Mistral's training cutoff. The fine-tune taught style, not substance.
| Parameter | Value |
|---|---|
| Base Model | unsloth/mistral-7b-instruct-v0.3-bnb-4bit |
| LoRA Rank | 8 |
| LoRA Alpha | 16 |
| Target Modules | q_proj, v_proj |
| Epochs | 3 |
| Batch Size | 1 |
| Gradient Accumulation | 8 |
| Learning Rate | 2e-4 |
| Max Sequence Length | 512 |
| Training Pairs | 1,939 |
| Platform | Kaggle T4 (free) |
| Framework | Unsloth + PEFT |
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
)
tokenizer = AutoTokenizer.from_pretrained("unsloth/mistral-7b-instruct-v0.3-bnb-4bit")
base_model = AutoModelForCausalLM.from_pretrained(
"unsloth/mistral-7b-instruct-v0.3-bnb-4bit",
quantization_config=bnb_config,
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, "Daniel2503/themis-mistral-7b-lora")
model.eval()
# Use FULL ACT NAMES for best results (e.g., "Bharatiya Nyaya Sanhita" not "BNS")
prompt = "### Instruction:\nWhat is the punishment for theft under the Bharatiya Nyaya Sanhita?\n\n### Response:\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.3)
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(response)
| Parameter | v1 (current) | v2 (next) |
|---|---|---|
| Training pairs | 1,939 | 10,000–15,000 |
| LoRA rank | 8 | 16 |
| Target modules | q_proj, v_proj | q,k,v,o proj |
| Sequence length | 512 | 1,024 |
| Expected citation accuracy | ~40% | >70% |
Success criteria: Model correctly identifies BNS as Bharatiya Nyaya Sanhita and cites accurate section numbers on 70%+ of criminal law queries.
@misc{themis2026,
title={THEMIS: Parametric Legal Intelligence Engine for Indian Law},
author={Daniel Deshmukh},
year={2026},
howpublished={\url{https://huggingface.co/Daniel2503/themis-mistral-7b-lora}},
}
MIT License
THEMIS v1 proves the pipeline works. v2 will make the model actually know Indian law.