CoolFace
Modelpublic

CHKishore/indic-criminal-law-llm-v1

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes6downloads
Model Card

IndicCrimLawLLM v1 — Qwen 2.5 7B fine-tuned for Indian Criminal Law

A LoRA adapter on top of Qwen 2.5 7B Instruct, fine-tuned to reason about Indian criminal law statutes — the Indian Penal Code (IPC), the new Bharatiya Nyaya Sanhita (BNS), the Code of Criminal Procedure (CrPC), and the Bharatiya Nagarik Suraksha Sanhita (BNSS) — with explicit awareness of the 2024 IPC–BNS legal transition.

This is the first openly released LLM specifically fine-tuned on the IPC–BNS / CrPC–BNSS transition mapping data.

Model Description

  • —Base model: Qwen/Qwen2.5-7B-Instruct (4-bit NF4 quantized for training)
  • —Adapter type: LoRA (rank 16, alpha 32)
  • —Trainable params: 40.4 M (0.92% of base model)
  • —Training framework: TRL SFTTrainer + PEFT + bitsandbytes
  • —Hardware: Kaggle Tesla T4 (16 GB VRAM, single GPU)
  • —Training time: ~71 minutes (333 steps, 3 epochs)

Training Data

Trained on IndicCrimLawLLM Instruction Dataset v0.2 — 1,869 Alpaca-style instruction-output pairs covering:

  • —Mapping QA (~1,250 pairs): "What is the BNS equivalent of IPC 302?" style lookups across 149 IPC–BNS and 67 CrPC–BNSS mappings (216 total mapping entries).
  • —Section interpretation (~290 pairs): "What does Section X criminalize?" grounded in the top-50 most-cited sections of a 1,579-document Supreme Court of India criminal corpus (2015–2024).
  • —BNS-transition reasoning (~219 pairs): Doctrinally-narrow Q&A on 11 paper-quality empirical findings about the 2024 IPC–BNS / CrPC–BNSS transition (sedition shifts, abetment chapter consolidation, default-bail timeline, anticipatory-bail number collisions, etc.).
  • —Refusal examples (115 pairs): Out-of-scope, personal-advice-seeking, and hallucination-bait queries.

All training data is released openly: see CHKishore/indic-criminal-law-instruction-v02 (forthcoming).

Training Hyperparameters

LoRA rank:         16
LoRA alpha:        32
LoRA dropout:      0.05
Target modules:    q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
Quantization:      4-bit NF4 (double quantization)
Optimizer:         paged_adamw_8bit
Learning rate:     2e-4
LR schedule:       cosine, 50-step warmup
Batch size:        4 × 4 grad accum (effective 16)
Sequence length:   1024
Epochs:            3
Total steps:       333

Training Results

MetricValue
Final training loss0.157
Final validation loss0.187
Generalization gap0.030
Train rows1,775
Eval rows94

The small generalization gap (0.030) indicates healthy training without significant overfitting on the small dataset.

Usage

python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

base_model_id = "Qwen/Qwen2.5-7B-Instruct"
adapter_id = "CHKishore/indic-criminal-law-llm-v1"

tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    torch_dtype=torch.float16,
    device_map="auto",
)
model = PeftModel.from_pretrained(base, adapter_id)
model.eval()

# Use Qwen's chat template
messages = [
    {"role": "user", "content": "What is the BNS equivalent of IPC Section 302?"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

with torch.no_grad():
    out = model.generate(**inputs, max_new_tokens=400, do_sample=False)

print(tokenizer.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))

Intended Use

  • —Primary: Research on Indian legal NLP, the IPC–BNS transition, and citation-grounded legal reasoning systems.
  • —Secondary: As a building block for retrieval-augmented systems (RAG) over Indian Supreme Court case law. The model is designed to be paired with a citation-verified retriever rather than used in isolation.

Out-of-Scope Use

  • —NOT a substitute for a lawyer. This model produces statements about Indian criminal law for research and educational purposes only. Do not use for legal advice, charge-sheet drafting, or any decision affecting a real person's liberty.
  • —Hallucination is a real risk. Frontier LLMs hallucinate Indian legal citations at non-trivial rates even with retrieval grounding (see Findings below). Always verify citations against authoritative sources.
  • —Coverage is criminal law only. Civil, tax, corporate, family, and administrative law are explicitly out of scope.
  • —Training data is mostly English. Hindi and regional-language coverage is limited and untested.

Limitations and Open Questions

  • —Sub-section precision: Many BNSS and BNS sub-section mappings (e.g., 187(3), 35(7), 528) are flagged as needs_verification in the source mapping data — they were derived from the MHA Comparative Table without direct Gazette cross-check. Treat sub-section indices in answers with caution.
  • —BNS jurisprudence is empirically rare at SC level. A 1,579-judgment audit through end-2024 found 0 BNS-only Supreme Court judgments and 2 transition cases — the model has been trained on the mapping of BNS but has no real BNS jurisprudence to draw from yet.
  • —Hallucination remains possible despite training. The companion project includes a citation verifier; production use is recommended only with such a verifier in the loop.
  • —Small dataset (1,869 pairs). This is a v1 release. Future versions will expand to ~30k pairs with case-law summarization and Hindi-language pairs.

Empirical Findings from the Companion Project

This model is the artifact of a research project that produced several documented empirical findings about Indian legal AI:

  1. 1.The BNS transition has not yet reached the Supreme Court of India as of mid-2026. A 1,579-judgment audit shows ~0% BNS-only judgments through end-2024, ten months post-effective-date.
  2. 2.Frontier RAG-grounded LLMs hallucinate Indian legal citations at materially non-trivial rates. Initial signal capture observed two distinct failure modes: stable fabrication of plausible-looking 8-digit document IDs (Mode 1) and chunk-ordinal-as-citation collapse (Mode 2). Net hallucination rate observed: ~50% of emitted citations on a single landmark query, in a 5-run capture.
  3. 3.Gemini 2.5 Flash burns ~95% of `max_output_tokens` on hidden reasoning by default when used for RAG, silently truncating responses unless ThinkingConfig(thinking_budget=0) is set. This may affect reproducibility of published Gemini-2.5 RAG benchmarks.
  4. 4.CrPC–BNSS chapter renumbering follows a structural-shift pattern producing predictable section-number collisions — most notably "Section 482" denoting wholly different doctrines (HC inherent powers under CrPC; anticipatory bail under BNSS).

Full findings documented in the project repository: github.com/ChaitanyaKis/indic-criminal-law-llm

Citation

If you use this model in research, please cite:

bibtex
@misc{kishore2026indiccrimlaw,
  title         = {IndicCrimLawLLM v1: A Qwen 2.5 7B fine-tune for Indian Criminal Law with explicit IPC-BNS transition handling},
  author        = {Kishore, Chaitanya},
  year          = {2026},
  howpublished  = {\url{https://huggingface.co/CHKishore/indic-criminal-law-llm-v1}},
}

License

Apache 2.0 (matches the Qwen 2.5 base license).

Acknowledgments

Built on top of Qwen 2.5 7B Instruct (Alibaba), trained on Kaggle's free GPU tier (Tesla T4). The instruction dataset draws from Indian Kanoon's openly accessible Supreme Court judgments and the Ministry of Home Affairs comparative tables for IPC–BNS and CrPC–BNSS mappings.


Released as a research artifact. Feedback, issues, and collaboration welcome via the project GitHub repository.