IndraLegal-1.5B

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.

Model Details

Model Description

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.

  • Developed by: Purushottam / Team Indra
  • Model type: Causal Language Model (Fine-tuned via PEFT/LoRA)
  • Language(s): English
  • License: Apache 2.0 (same as base model Qwen2.5)
  • Finetuned from model: Qwen/Qwen2.5-Coder-1.5B-Instruct

Model Sources

  • Repository: Submitting as part of IndiaAI Innovation Challenge.

Uses

Direct Use

The 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).

  • Legal Drafting: Drafting standard agreements, force majeure clauses, arbitration clauses, and formal "Record of Settlement" documents.
  • Statutory Interpretation: Explaining sections of Indian law (e.g., MSMED Act, IPC, CPC) in plain English to laypersons.
  • Dispute Analysis: Summarizing the core legal contentions between a petitioner and respondent neutrally.

Out-of-Scope Use

  • Definitive Legal Counsel: IndraLegal-1.5B is an AI assistant, not a human lawyer. It should not be used as a final substitute for certified professional legal advice in high-stakes litigation.
  • General Chatting: While capable, the model is highly specialized for legal terminology and may perform poorly on casual conversation or coding tasks outside of its fine-tuned domain.

Bias, Risks, and Limitations

  • Hallucination Risk: Like all generative models, it may occasionally hallucinate legal sections or precedents that do not exist. Users must verify critical citations.
  • Context Length: It is trained on smaller chunk sizes to maintain speed and efficiency; extremely long legal judgments might exceed its effective context window.
  • Jurisdictional Bias: The model is strictly trained on Indian law. It will respond inaccurately if queried about US, UK, or other international laws.

Recommendations

  • Always use the ChatML template format (using tokenizer.apply_chat_template) during inference to prevent infinite loops and ensure structural integrity.
  • Apply a repetition_penalty of roughly 1.15 during generation to maximize output quality.
  • Include a disclaimer in any UI stating that the tool is for negotiation assistance and not definitive legal advice.

How to Get Started with the Model

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())

Model Details

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)

Training Details

Training Data

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.

Training Procedure

  • Method: LoRA (Low-Rank Adaptation)
  • LoRA Config: r=16, alpha=16, dropout=0.05
  • Target Modules: q_proj, k_proj, v_proj, o_proj
  • Epochs: 3
  • Learning Rate: 2e-4
  • Optimizer: paged_adamw_8bit
  • Sequence Length: 2048 tokens
  • Precision: FP16 mixed precision
  • Quantization: 4-bit NF4 (QLoRA) during training
  • Batch Size: 2 (Gradient Accumulation Steps: 4)

Compute Infrastructure

  • Hardware: Single NVIDIA GPU (e.g., T4/P100)
  • Frameworks: transformers, peft, trl, bitsandbytes

Capabilities

βœ… What IndraLegal Can Do

  • Interpret Indian Law β€” Instantly explain provisions from major Indian statutes (IPC, CrPC, CPC, etc.)
  • Draft Legal Agreements β€” Generate structurally sound MSME settlement agreements, force majeure clauses, and non-disclosure terms
  • Mediate MSME Disputes β€” Clarify the legal liabilities of buyers and rights of suppliers under the MSMED Act, 2006
  • Neutral Analysis β€” Avoid taking aggressive sides; instead, it provides balanced, factual legal standing for all parties in a virtual negotiation

⚠️ Limitations

  • Not Definitive Legal Counsel β€” This is an AI assistant, not a human lawyer. It should not be used as a final substitute for certified professional legal advice in high-stakes litigation.
  • 1.5B model β€” Due to its lightweight parameter count, extremely lengthy or multi-document dispute analyses may exceed its contextual reasoning capabilities.
  • May hallucinate β€” Always verify specific section numbers, historical precedents, and generated citations.
  • Jurisdictional Boundary β€” Strictly trained on Indian law. It will respond inaccurately if queried about US, UK, or other international laws.

❌ Out-of-Scope Use

  • Serving as the sole arbiter in legally binding tribunals without human oversight
  • Providing certified medical or financial advice
  • Generating harmful or discriminatory legal loopholes

Evaluation

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

Citation

@misc{indralegal2026,
  title={IndraLegal-1.5B: An Indian Law AI Assistant for Virtual Negotiation},
  author={Team Indra},
  year={2026},
  publisher={HuggingFace},
}
Downloads last month
-
Safetensors
Model size
2B params
Tensor type
F16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for RockySinghRajput/IndraLegal-1.5B

Adapters
1 model