Downloads · 30 days
17
14% of all-time downloads
RockySinghRajput/IndraLegal-1.5B
IndraLegal-1.5B is a text generation model from RockySinghRajput. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
IndraLegal-1.5B is a lightweight, specialized Large Language Model (LLM) fine-tuned specifically for the Indian legal context. It is designed to act as an AI mediator and virtual negotiation assistant for Micro, Small…
Downloads · 30 days
17
14% of all-time downloads
All-time downloads
121
Public
Parameters
1.5B
3.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors3.1 GB · 99%
From the Hugging Face model README
IndraLegal-1.5B is a lightweight, specialized Large Language Model (LLM) fine-tuned specifically for the Indian legal context. It is designed to act as an AI mediator and virtual negotiation assistant for Micro, Small and Medium Enterprises (MSMEs) facing delayed payment disputes.
IndraLegal-1.5B is built on top of the highly efficient Qwen/Qwen2.5-Coder-1.5B-Instruct base model. It has been fine-tuned using LoRA (Low-Rank Adaptation) on a curated corpus of Indian statutory laws (IPC, CrPC, CPC), thousands of standard Indian contract clauses, and outcome judgments from the National Company Law Tribunal (NCLT).
The model's primary objective is to solve Problem Statement 1: AI Enabled Virtual Negotiation Assistance for the IndiaAI Innovation Challenge by empowering MSMEs with accessible legal knowledge, neutral dispute summarization, and automated settlement drafting without requiring expensive legal counsel.
Qwen/Qwen2.5-Coder-1.5B-InstructThe model is designed to be used directly via the transformers library, preferably utilizing the ChatML template for best results. It is intended to be plugged into the backend of a dispute resolution platform (e.g., the MSME Samadhaan portal).
ChatML template format (using tokenizer.apply_chat_template) during inference to prevent infinite loops and ensure structural integrity.repetition_penalty of roughly 1.15 during generation to maximize output quality.Use the code below to load the model in 4-bit precision and run inference:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
BASE_MODEL = "Qwen/Qwen2.5-Coder-1.5B-Instruct"
ADAPTER_PATH = "RockySinghRajput/IndraLegal-1.5B-Adapter" # Replace with your actual repo name
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16,
)
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, trust_remote_code=True)
base = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
quantization_config=bnb_config,
device_map="auto"
)
model = PeftModel.from_pretrained(base, ADAPTER_PATH)
SYSTEM_PROMPT = """You are IndraLegal, an expert AI legal and virtual negotiation assistant specialized in Indian Law.
Your role is to assist with legal drafting, contract analysis, dispute resolution, and interpreting Indian statutes (IPC, CrPC, etc.) accurately and neutrally.
When analyzing cases or drafting settlements, provide sound legal reasoning based on Indian judicial precedents."""
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "What is the liability of a buyer for delayed payments under the MSMED Act, 2006?"}
]
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():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.3, # Low temperature for factual legal answers
top_p=0.9,
repetition_penalty=1.15,
do_sample=True,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response.strip())
| Property | Value |
|---|---|
| Base Model | Qwen/Qwen2.5-Coder-1.5B-Instruct |
| Parameters | 1.5B |
| Type | Causal Language Model (LoRA fine-tune) |
| Languages | English |
| License | Apache 2.0 |
| Developed by | Team Indra / RockySinghRajput |
| Target Use Case | Problem Statement 1: AI Enabled Virtual Negotiation Assistance (Ministry of MSME) |
Fine-tuned on a heavily curated blend of structured Indian legal datasets:
| Dataset | Purpose | Content |
|---|---|---|
| Indian-Law-Penal-Code-Json | Statutory Knowledge | Complete sections from IPC, CrPC, CPC, HMA, IDA, IEA, NIA |
| Legal Indian Contract Clauses | Automated Drafting | Thousands of professionally structured commercial contract clauses |
| NCLT Cause Lists V1 | Corporate Disputes | Tribunal corporate insolvency, petitioner, and respondent metadata |
All data was parsed into strictly formatted instruction-following pairs (System/User/Assistant) using a custom ChatML template.
transformers, peft, trl, bitsandbytes| Test Area | Task | Result |
|---|---|---|
| Legal Drafting | Draft a standard 'Force Majeure' clause under Indian Law | ✅ Highly structured, professional formatting, and legally accurate coverage of delay limits |
| Statutory Interpretation | Explain Section 420 of the Indian Penal Code | ✅ Neutrally quoted the section's stance on fraud and cheating, including potential punishments |
| MSME Dispute | Evaluate buyer liability for a 60-day delayed payment of Rs 5 Lakhs | ✅ Correctly identified the buyer's liability to pay the sum under the MSMED Act |
@misc{indralegal2026,
title={IndraLegal-1.5B: An Indian Law AI Assistant for Virtual Negotiation},
author={Team Indra},
year={2026},
publisher={HuggingFace},
}