---
language:
- en
license: apache-2.0
base_model: unsloth/Qwen2.5-1.5B-Instruct-bnb-4bit
tags:
- legal
- indian-law
- BNS
- BNSS
- BSA
- criminal-law
- qwen
- qwen2.5
- gguf
- llama.cpp
- ollama
- qlora
- unsloth
- domain-adaptation
- instruction-tuning
- question-answering
- law
- india
datasets:
- GSMS-B/Indian-Legal-QA-BNS-BNSS-BSA
pipeline_tag: text-generation
---
# โ๏ธ๐ Indian Legal Qwen 2.5 โ 1.5B (GGUF)
> ๐ก **This is the GGUF-quantized version** โ for CPU inference via Ollama or llama.cpp. For full-precision inference see the [Merged Model](https://huggingface.co/GSMS-B/Indian-Legal-Qwen2.5-1.5B) ยท For lightweight adapter loading see the [Adapter](https://huggingface.co/GSMS-B/Indian-Legal-Qwen2.5-1.5B-Adapter).
---
## ๐ Model Description
**Indian Legal Qwen 2.5 โ 1.5B (GGUF)** is a quantized, CPU-friendly version of [`GSMS-B/Indian-Legal-Qwen2.5-1.5B`](https://huggingface.co/GSMS-B/Indian-Legal-Qwen2.5-1.5B), a domain-adapted model fine-tuned using QLoRA on a structured question-answer dataset covering all **1,059 sections** of India's three landmark 2023 criminal justice reform acts:
| Act | Full Name | Replaces | Sections |
|---|---|---|---|
| ๐ **BNS 2023** | Bharatiya Nyaya Sanhita | IPC 1860 | 358 |
| ๐ **BNSS 2023** | Bharatiya Nagarik Suraksha Sanhita | CrPC 1973 | 531 |
| ๐ **BSA 2023** | Bharatiya Sakshya Adhiniyam | Indian Evidence Act 1872 | 170 |
Trained on **6,354 instruction-format QA pairs** โ 6 question types per section covering definitions, scenarios, legal elements, exceptions, and consequences โ giving it broad, structured coverage of India's reformed criminal law framework. As the smallest model in the family, this GGUF build is ideal for fast, fully offline CPU inference.
---
## ๐ Model Family โ Qwen 2.5 1.5B
| Variant | Repo | Best For |
|---|---|---|
| ๐ข **Merged** | [GSMS-B/Indian-Legal-Qwen2.5-1.5B](https://huggingface.co/GSMS-B/Indian-Legal-Qwen2.5-1.5B) | Out-of-the-box inference, Gradio / API deployment |
| ๐ต **LoRA Adapter** | [GSMS-B/Indian-Legal-Qwen2.5-1.5B-Adapter](https://huggingface.co/GSMS-B/Indian-Legal-Qwen2.5-1.5B-Adapter) | Lightweight loading on top of base model |
| ๐ก **GGUF (this repo)** | `GSMS-B/Indian-Legal-Qwen2.5-1.5B-GGUF` | CPU inference via Ollama / llama.cpp |
---
## ๐ Quick Start
### ๐ป Run with Ollama
```bash
ollama run hf.co/GSMS-B/Indian-Legal-Qwen2.5-1.5B-GGUF
```
### โ๏ธ Run with llama.cpp
```bash
./llama-cli \
-hf GSMS-B/Indian-Legal-Qwen2.5-1.5B-GGUF \
-p "What is a Zero FIR under BNSS 2023?" \
-n 300 \
--temp 0.1
```
### ๐ Run with llama-cpp-python
```python
from llama_cpp import Llama
llm = Llama.from_pretrained(
repo_id="GSMS-B/Indian-Legal-Qwen2.5-1.5B-GGUF",
filename="*.gguf",
)
SYSTEM = "You are an expert legal assistant specializing in Indian criminal law โ BNS, BNSS, and BSA 2023."
response = llm.create_chat_completion(
messages=[
{"role": "system", "content": SYSTEM},
{"role": "user", "content": "What is a Zero FIR under BNSS 2023?"}
],
temperature=0.1,
max_tokens=300
)
print(response["choices"][0]["message"]["content"])
```
---
## ๐ฏ Recommended Use Cases
> โ ๏ธ **Important Note:** This model has been domain-adapted on structured QA data and works best as a **component in a larger pipeline** rather than a standalone answer engine. Direct usage without retrieval context may produce incomplete or imprecise answers on complex legal queries.
### โ
Where this model excels
| Use Case | ๐ก How to Use |
|---|---|
| ๐ **RAG Pipeline** | Pair with a BM25 or vector retriever over BNS/BNSS/BSA texts; feed retrieved sections as context for grounded, citation-backed answers |
| ๐ค **Legal Chatbot Backend** | Use as the generation backbone of a legal assistant app with a ChromaDB / FAISS document store |
| ๐ **Legal Education Tool** | Build interactive Q&A apps for law students and practitioners learning the 2023 criminal justice reforms |
| ๐ **Section Lookup Assistant** | Combine with a section index to surface the exact BNS / BNSS / BSA provision relevant to a given situation |
| ๐ป **Offline / Edge Deployment** | Smallest model in the family, runnable on consumer CPUs without a GPU โ ideal for local apps, kiosks, or low-resource environments |
| ๐ **Structured Legal Summarization** | Summarize individual sections when the section text is supplied as input context |
| ๐๏ธ **Legal NLP Research** | Benchmark Indian criminal law understanding across model families (Qwen vs Llama) |
| โ๏ธ **Comparative Law Analysis** | Highlight differences between old acts (IPC/CrPC/IEA) and their 2023 replacements |
### โ Not recommended for
- Standalone legal advice without a retrieval component
- High-stakes legal decisions without qualified human review
- Jurisdictions or acts outside BNS / BNSS / BSA 2023
---
## ๐๏ธ Training Details
| Property | Value |
|---|---|
| ๐ค Base model | `unsloth/Qwen2.5-1.5B-Instruct-bnb-4bit` |
| ๐ง Fine-tuning method | QLoRA |
| ๐๏ธ LoRA rank | 64 |
| ๐๏ธ LoRA alpha | 128 |
| ๐งฉ Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| ๐ Training data | 6,354 QA pairs โ 1,059 sections ร 6 question types |
| ๐ Epochs | 3 |
| ๐ฆ Batch size (per device) | 4 |
| ๐ Learning rate | 2e-4 |
| โ๏ธ Optimizer | adamw_8bit |
| ๐ป Hardware | Google Colab T4 GPU |
| ๐ ๏ธ Framework | Unsloth + TRL SFTTrainer |
| ๐ฌ Prompt format | ChatML |
| ๐๏ธ Quantization | GGUF (converted from merged FP16 model) |
---
## ๐ Training Dataset
| ๐ Dataset | ๐ Link |
|---|---|
| Indian Legal QA โ BNS + BNSS + BSA 2023 | [GSMS-B/Indian-Legal-QA-BNS-BNSS-BSA](https://huggingface.co/datasets/GSMS-B/Indian-Legal-QA-BNS-BNSS-BSA) |
**6 question types per section:**
`definitional_topic` ยท `definitional_section` ยท `scenario` ยท `elements` ยท `exceptions` ยท `consequence`
---
## ๐ค Author
**GSMS-B** โ Bugatha Ganasyam Mani Sankar
๐ค [Hugging Face Profile](https://huggingface.co/GSMS-B)
---
## โ ๏ธ Disclaimer
This model is intended for **research and educational purposes only**. It does not constitute legal advice. Outputs should not be relied upon for any legal decision without review by a qualified legal professional. The model's responses reflect patterns in training data and may contain errors or omissions.
---
*โก Fine-tuned using [Unsloth](https://github.com/unslothai/unsloth) for training efficiency.*