Downloads · 30 days
46
12% of all-time downloads
chhatramani/qwen3-4B-civillaw-en-v1-gguf
qwen3-4B-civillaw-en-v1-gguf is a machine learning model from chhatramani. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
NyayaLM is a specialized large language model fine-tuned for understanding and answering queries related to the Nepal Civil Code. It is based on the Qwen3-4B-Instruct architecture and has been optimized using Unsloth…
Downloads · 30 days
46
12% of all-time downloads
All-time downloads
374
Public
Repo size
2.5 GB
Likes
0
Public
Click a slice to open those files.
.gguf2.5 GB · 100%
From the Hugging Face model README
NyayaLM is a specialized large language model fine-tuned for understanding and answering queries related to the Nepal Civil Code. It is based on the Qwen3-4B-Instruct architecture and has been optimized using Unsloth for efficient 4-bit LoRA (Low-Rank Adaptation) training.
The model is designed to assist in legal reasoning, providing information on civil rights, property laws, family laws, and legal procedures within the context of the Nepalese legal system.
unsloth/Qwen3-4B-Instruct-2507NyayaLM is intended for legal researchers, practitioners, and students in Nepal. It can:
Note: This model is for experimental purposes only and should not be treated as professional legal advice.
The model was trained on a high-quality mixed dataset comprising two distinct types of legal QA:
Dataset Statistics:
The following configuration was used for fine-tuning via Unsloth:
| Parameter | Value |
|---|---|
| LoRA Rank (r) | 16 |
| LoRA Alpha | 32 |
| LoRA Dropout | 0.08 |
| RS-LoRA | Enabled |
| Optimizer | AdamW (8-bit) |
| Learning Rate | 1.2e-4 |
| Max Sequence Length | 2048 |
| Weight Decay | 0.01 |
| Batch Size | 2 (with Gradient Accumulation) |
| Precision | 4-bit NormalFloat (NF4) |
The model was evaluated on 20 specific test cases comparing original context vs. zero-context performance.
| Metric | Score |
|---|---|
| ROUGE-1 | 0.3749 |
| ROUGE-2 | 0.1459 |
| ROUGE-L | 0.2436 |
| BERTScore (F1 Avg) | 0.8808 |
| BERTScore (With Context) | 0.8808 |
Insights: The high BERTScore indicates strong semantic alignment with legal ground truths, even when lexical overlap (ROUGE) varies.
You can run this model using the Unsloth library for 2x faster inference:
from unsloth import FastLanguageModel
import torch
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "your-username/NyayaLM-Nepal-Civil-Law",
max_seq_length = 2048,
load_in_4bit = True,
)
FastLanguageModel.for_inference(model)
# Example Prompt
messages = [
{"role": "system", "content": "You are a legal assistant specializing in Nepal Civil Law."},
{"role": "user", "content": "What is the time limit for registering a birth in Nepal?"}
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
outputs = model.generate(input_ids=inputs, max_new_tokens=512)
print(tokenizer.batch_decode(outputs))
This model was finetuned and converted to GGUF format using Unsloth.
Example usage:
./llama.cpp/llama-cli -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf --jinja./llama.cpp/llama-mtmd-cli -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf --jinjaqwen3-4b-instruct-2507.Q4_K_M.ggufAn Ollama Modelfile is included for easy deployment. This was trained 2x faster with Unsloth