Text Generation
Transformers
Safetensors
PEFT
English
legal-ai
lora
qlora
indian-law
legal-simplification
accessibility
irac
unsloth
conversational
Instructions to use joyboseroy/nyayasaar-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use joyboseroy/nyayasaar-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="joyboseroy/nyayasaar-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("joyboseroy/nyayasaar-lora", dtype="auto") - PEFT
How to use joyboseroy/nyayasaar-lora with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use joyboseroy/nyayasaar-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "joyboseroy/nyayasaar-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "joyboseroy/nyayasaar-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/joyboseroy/nyayasaar-lora
- SGLang
How to use joyboseroy/nyayasaar-lora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "joyboseroy/nyayasaar-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "joyboseroy/nyayasaar-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "joyboseroy/nyayasaar-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "joyboseroy/nyayasaar-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use joyboseroy/nyayasaar-lora with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for joyboseroy/nyayasaar-lora to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for joyboseroy/nyayasaar-lora to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for joyboseroy/nyayasaar-lora to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="joyboseroy/nyayasaar-lora", max_seq_length=2048, ) - Docker Model Runner
How to use joyboseroy/nyayasaar-lora with Docker Model Runner:
docker model run hf.co/joyboseroy/nyayasaar-lora
File size: 4,577 Bytes
169e801 a446150 3fc0665 a446150 3fc0665 a446150 3fc0665 a446150 169e801 a446150 3fc0665 a446150 3fc0665 a446150 3fc0665 a446150 3fc0665 f6ca789 a446150 f6ca789 a446150 f6ca789 a446150 f6ca789 8f67ac4 a446150 8f67ac4 a446150 8f67ac4 f6ca789 a446150 f6ca789 a446150 f6ca789 a446150 f6ca789 a446150 f6ca789 a446150 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | ---
license: apache-2.0
base_model: "Qwen/Qwen2.5-0.5B-Instruct"
tags: ["legal-ai", "lora", "peft", "qlora", "indian-law", "legal-simplification", "accessibility", "irac", "transformers", "unsloth"]
language: ["en"]
pipeline_tag: text-generation
datasets: ["joyboseroy/inIRAC"]
library_name: transformers
---
--------------------------
# NyayaSaar-LoRA
NyayaSaar-LoRA is a lightweight LoRA adapter fine-tuned to simplify structured Indian legal reasoning into plain English.
The project focuses on improving accessibility to legal reasoning for non-lawyers interacting with the Indian legal system.
This model was trained using parameter-efficient fine-tuning (LoRA/QLoRA) on structured IRAC-style legal reasoning examples derived from the inIRAC dataset.
---
# Motivation
Indian legal documents are often difficult for ordinary citizens to understand because of:
* archaic terminology
* procedural complexity
* dense sentence structures
* formal legal phrasing
NyayaSaar-LoRA explores whether small language models can learn to preserve legal meaning while simplifying language and improving readability.
The project prioritizes:
* accessibility
* explainability
* low-resource adaptation
* efficient fine-tuning
---
# Example
## Input
```text id="jlwmkm"
Issue: Whether the detention order violates Article 22.
Rule: Preventive detention laws require procedural safeguards.
Application: The petitioner argued safeguards were not followed.
Conclusion: The detention order is quashed.
```
## Output
```text id="4awft0"
The court examined whether the detention was legal under the Constitution.
The law says preventive detention must follow proper safeguards.
The petitioner argued these safeguards were ignored.
The court agreed and cancelled the detention order.
```
---
# Technical Details
## Base Model
* Qwen2.5-0.5B-Instruct (4-bit quantized)
## Fine-Tuning Method
* LoRA / QLoRA
* PEFT
* Unsloth
* Supervised Fine-Tuning (SFT)
## Training Environment
* Google Colab
* Single GPU
* Low-resource fine-tuning setup
---
# Dataset
Training examples were derived from the inIRAC dataset:
https://huggingface.co/datasets/joyboseroy/inIRAC
The dataset contains structured Indian legal reasoning in IRAC format:
* Issue
* Rule
* Application
* Conclusion
---
# Intended Use
This project is intended for:
* legal accessibility research
* plain-English legal explanation
* educational demonstrations
* low-resource legal NLP experimentation
* research into explainable legal AI
---
# Usage
```python id="zj38zt"
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model = "Qwen/Qwen2.5-0.5B-Instruct"
adapter_model = "joyboseroy/nyayasaar-lora"
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(
base_model,
device_map="auto"
)
model = PeftModel.from_pretrained(model, adapter_model)
prompt = """
Issue: Whether the detention order violates Article 22.
Rule: Preventive detention laws require procedural safeguards.
Application: The petitioner argued safeguards were not followed.
Conclusion: The detention order is quashed.
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=200
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
---
# Limitations
This model:
* does not provide legal advice
* may oversimplify nuanced legal reasoning
* may omit procedural subtleties
* should not be used in high-stakes legal decision-making
Outputs must always be reviewed by qualified legal professionals before practical use.
---
# Future Work
Potential future directions include:
* multilingual Indian legal simplification
* Hindi and Bengali adaptation
* graph-grounded legal reasoning
* retrieval-augmented legal explanation
* evaluation using readability and semantic-preservation metrics
---
# Related Work
## Dataset
inIRAC Dataset:
https://huggingface.co/datasets/joyboseroy/inIRAC
## Research
Falkor-IRAC: Graph-Constrained Generation for Verified Legal Reasoning in Indian Judicial AI
https://arxiv.org/abs/2605.14665
---
# Citation
```bibtex id="t1xjlwm"
@misc{bose2026nyayasaar,
title={NyayaSaar-LoRA: Simplifying Indian Legal Reasoning using PEFT},
author={Joy Bose},
year={2026},
howpublished={Hugging Face Model Repository}
}
```
---
# Author
Joy Bose
Senior Data Scientist and Researcher
Research interests:
* Legal AI
* Explainable AI
* Graph Reasoning
* Ethical AI
* Efficient LLM Adaptation
---
|