Instructions to use chhatramani/qwen3-4B-civillaw-en-v1-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use chhatramani/qwen3-4B-civillaw-en-v1-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
Use Docker
docker model run hf.co/chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use chhatramani/qwen3-4B-civillaw-en-v1-gguf with Ollama:
ollama run hf.co/chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
- Unsloth Desktop
- Pi
How to use chhatramani/qwen3-4B-civillaw-en-v1-gguf with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use chhatramani/qwen3-4B-civillaw-en-v1-gguf with Docker Model Runner:
docker model run hf.co/chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
- Lemonade
How to use chhatramani/qwen3-4B-civillaw-en-v1-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
Run and chat with the model
lemonade run user.qwen3-4B-civillaw-en-v1-gguf-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use chhatramani/qwen3-4B-civillaw-en-v1-gguf with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use chhatramani/qwen3-4B-civillaw-en-v1-gguf with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "chhatramani/qwen3-4B-civillaw-en-v1-gguf:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Nepal Civil Law Q&A (Qwen3-4B-Instruct Fine-Tuned)
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.
Model Details
- Developed by: [Chhatramani Yadav]
- Base Model:
unsloth/Qwen3-4B-Instruct-2507 - Language(s): English (Legal Domain)
- License: Apache-2.0
- Fine-tuning Technique: LoRA (Rank-Stabilized - RS-LoRA)
- Quantization: 4-bit (via Unsloth/bitsandbytes)
Intended Use
NyayaLM is intended for legal researchers, practitioners, and students in Nepal. It can:
- Answer specific questions based on the Nepal Civil Code.
- Provide legal context for various civil scenarios.
- Assist in drafting and summarizing legal principles.
Note: This model is for experimental purposes only and should not be treated as professional legal advice.
Training Data
The model was trained on a high-quality mixed dataset comprising two distinct types of legal QA:
- Real-World Civil Code Legal QA (Type 2): 2,991 examples focusing on practical legal applications.
- Conversational Civil Code QA (Type 3): 2,386 examples curated for multi-turn dialogue.
Dataset Statistics:
- Total Raw Samples: 5,377
- Mixing Ratio: 70% Real-World QA / 30% Conversational QA
- Final Mixed Dataset Size: 4,272 examples
- Split: 90% Training (3,844 samples), 10% Evaluation (428 samples)
Training Hyperparameters
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) |
Evaluation Results
The model was evaluated on 20 specific test cases comparing original context vs. zero-context performance.
Fine-tune Model Evaluation Metrics
| 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.
How to Use
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))
qwen3-4B-civillaw-en-v1-gguf : GGUF
This model was finetuned and converted to GGUF format using Unsloth.
Example usage:
- For text only LLMs:
./llama.cpp/llama-cli -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf --jinja - For multimodal models:
./llama.cpp/llama-mtmd-cli -hf chhatramani/qwen3-4B-civillaw-en-v1-gguf --jinja
Available Model files:
qwen3-4b-instruct-2507.Q4_K_M.gguf
Ollama
An Ollama Modelfile is included for easy deployment. This was trained 2x faster with Unsloth
- Downloads last month
- 27
4-bit
Model tree for chhatramani/qwen3-4B-civillaw-en-v1-gguf
Base model
Qwen/Qwen3-4B-Instruct-2507