Nyaya-1.5B
Specialized language model for Indian criminal law
2 min readupdated
Nyaya-1.5B (Indian-Legal-Qwen2.5-1.5B) is a compact language model based on Qwen 2.5 (1.5B Instruct), fine-tuned by author NamanAnand66 for the new 2023 criminal law reforms of India. The model covers all 1,059 sections of the new codes (BNS, BNSS, and BSA) replacing outdated colonial laws. It delivers structured legal analysis with references to specific sections, offense elements, and consequences while requiring minimal resources for local deployment. Useful for legal tech developers, lawyers, and researchers of Indian jurisprudence.
Key features
- Complete coverage of the three main codes: 358 sections of BNS, 531 sections of BNSS, and 170 sections of BSA.
- Six-dimensional decomposition: each section is broken down by concept, exact text, scenario, elements (Actus Reus and Mens Rea), exceptions, and penalties.
- Lightweight footprint: requires less than 3.5 GB of VRAM in 16-bit mode for fast inference on consumer GPUs.
- Unified weights: distributed as ready-to-use safetensors files without needing to merge LoRA adapters.
What you can do
- Build a RAG assistant (Retrieval-Augmented Generation) for precise search and citation of Indian laws.
- Integrate the model into local services via vLLM or Ollama to automate legal analysis.
- Set up automatic mapping of old IPC and CrPC wordings to the new BNS and BNSS regulations.
- Use it as a study companion for law students and judicial exam candidates.
Example
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "NamanAnand66/Nyaya-1.5B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
inputs = tokenizer("Explain Section 61 of BSA 2023.", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Read more
DetailsBase model: unsloth/Qwen2.5-1.5B-Instruct-bnb-4bit
Training dataset: GSMS-B/Indian-Legal-QA-BNS-BNSS-BSA (6,354 instruction pairs)
Fine-tuning method: QLoRA (r = 64, lora_alpha = 128, context 4096 tokens)
Hardware requirements: up to 3.5 GB VRAM (16-bit precision)










Comments