Indian Legal Contract Generation Model
A specialized language model fine-tuned for generating comprehensive and legally-sound Indian contracts.
Overview
This model is built on the Llama-3.2-1B-Instruct architecture and specifically fine-tuned to generate various types of Indian legal contracts. It combines legal domain knowledge with natural language generation capabilities to produce well-structured, contextually appropriate legal documents.
Model Details
- Base Model:
unsloth/Llama-3.2-1B-Instruct-bnb-4bit
- Model Type: Causal Language Model (CLM) with LoRA fine-tuning
- Language: English (Indian Legal Context)
- Quantization: 4-bit
- Context Length: 2048 tokens
- License: Same as base model (Llama 3.2)
Features
- Generates 24+ categories of legal contracts
- Trained on chain-of-thought reasoning for contract generation
- Follows Indian legal requirements and formatting
- Memory-efficient 4-bit quantization
Supported Contract Types
1. Business Contracts
- Partnership Agreements
- Franchise Agreements
- Distribution Agreements
- Supply Chain Contracts
2. Employment Contracts
- Employment Agreements
- Consultant Contracts
- Internship Agreements
- Remote Work Contracts
3. Real Estate
- Property Lease Agreements
- Purchase Contracts
- Commercial Property Agreements
- Construction Contracts
4. Technology
- Software Development Agreements
- IT Services Contracts
- Technology License Agreements
- SaaS Agreements
5. Services
- Professional Services Agreements
- Maintenance Contracts
- Consulting Services Agreements
- Outsourcing Contracts
6. Legal Protection
- Confidentiality Agreements
- Non-Disclosure Agreements
- Service Level Agreements
- Joint Venture Contracts
Technical Specifications
Training Details
- Training Method: LoRA (Low-Rank Adaptation)
- LoRA Configuration:
- Rank: 8
- Alpha: 8
- Target Modules:
q_proj
,k_proj
,v_proj
,o_proj
,gate_proj
,up_proj
,down_proj
- Training Parameters:
- Batch Size: 1
- Gradient Accumulation: 8
- Learning Rate: 1e-4
- Training Steps: 40
- Optimizer: AdamW 8-bit
Dataset
- 500 diverse contract examples
- Structured with chain-of-thought reasoning
- Indian legal context and requirements
- Multiple variations per contract type
Usage
Installation
# Create virtual environment
python -m venv venv
# Activate virtual environment
source venv/bin/activate # Unix/MacOS
venv\Scripts\activate # Windows
# Install requirements
pip install -r requirements.txt
Quickstart
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("axondendriteplus/contract_drafter-Llama-3.2-1B-Instruct")
model = AutoModelForCausalLM.from_pretrained(
"axondendriteplus/contract_drafter-Llama-3.2-1B-Instruct",
torch_dtype=torch.float16,
device_map="auto"
)
# Generate contract
prompt = "Generate an Indian legal contract for: Employment Agreement"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=2048,
temperature=0.7,
top_p=0.95,
repetition_penalty=1.15
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Scripts
Github: https://github.com/adw777/contract_drafter
Limitations and Disclaimers
- This model is a tool to assist in contract generation and should not replace legal counsel.
- Generated contracts should be reviewed by qualified legal professionals.
- The model's knowledge is limited to its training data and may not cover all legal scenarios.
- Specific jurisdictional requirements may need manual verification.
- Not suitable for non-Indian legal contexts without modification.
Performance Considerations
- Recommended minimum RAM: 8GB
- GPU acceleration: Supported but not required
- 4-bit quantization: Enables efficient CPU inference
- Typical generation time: 10-30 seconds per contract
Contributing
We welcome contributions to improve the model's capabilities.
Citation
If you use this model in your research or application, please cite:
@Wasserstoff innovation & learning Labs{indian_legal_contract_model,
title = {Indian Legal Contract Generation Model},
year = {2025},
description = {A specialized language model for generating Indian legal contracts}
}
Support
For issues, questions, or contributions, please:
- Open an issue in the repository.
- Provide detailed information about your use case.
- Include sample outputs if relevant.
License
This model follows the licensing terms of the base Llama 3.3 model. Please refer to the Llama 3.3 license for usage terms and conditions.
Made with 🔥 for the Indian Legal-Tech Community
Model tree for axondendriteplus/contract_drafter-Llama-3.2-1B-Instruct
Base model
meta-llama/Llama-3.2-1B-Instruct