Nyaya-3B — the model component of the Nyaya legal guidance system

⚖️ Not legal advice. Nyaya provides legal information. The practice of law in India is reserved to advocates enrolled under the Advocates Act, 1961. Consult a licensed advocate for anything consequential. Free legal aid is available through NALSA / DLSA (Legal Services Authorities Act, 1987).

📋 Non-commercial licence. The base model Qwen/Qwen2.5-3B-Instruct is released under the Qwen Research Licensenot Apache-2.0. The 3B is one of the Qwen2.5 sizes carrying the restricted licence, and these merged weights inherit it: research / non-commercial use only.

What this is, stated plainly

This is the model that reads retrieved statute sections and writes a cited answer. On the project's own benchmark its accuracy is statistically tied with the base model it was fine-tuned from. The system's measured gains come from retrieval, not from these weights.

It is published because a single download that works — model, prompt format and citation style already aligned with the Nyaya retriever — is more useful than assembling the pieces yourself. It is not published as an improvement over Qwen/Qwen2.5-3B-Instruct, because it is not one.

Use it with NyayaLabs98/nyaya-statute-db and the retriever from the repository. Used bare, without retrieval, it behaves close to the base model.

Evaluation

Nyaya-Eval-v1, 409 gradeable questions, paired comparison, 10,000-round bootstrap. Same retriever, same questions — only the weights differ.

fact recall citation accuracy
Qwen2.5-3B-Instruct + RAG 34.3% 52.8%
Nyaya-3B-v3 + RAG 32.9% 50.3%

95% CI on the paired difference spans zero → statistically indistinguishable.

Where the accuracy actually comes from

retrieval outcome n fact recall
gold statute retrieved 94 63.2%
gold statute missed 43 17.1%

That 46-point gap is why this project's effort moved to retrieval. Adding a cross-encoder reranker put the correct section in the top result for 58.5% of questions, up from 45.8% — validated on records never used for tuning.

Fine-tuning attempts, for the record

fact recall vs base
base 34.3%
v3 (this model, RAFT) 32.9% tied
v5 (grounded citation data) 24.0% worse, CI [−13.5, −7.2]
v6 (v5 + answer-style fix) 23.4% worse, CI [−14.0, −7.8]

None beat base. v5 and v6 regressed because training on short templated targets shortened the answers (173 → 90 → 57 words), and shorter answers carry fewer of the facts being scored.

Honest status

  • No external benchmark comparison has been run. No claim is made against any other legal model.
  • No human evaluation has been passed.
  • The project's earlier benchmark (Eval-v0) scored its own gold answers at 10.7%, so any accuracy figure derived from it is meaningless — including numbers previously shown on this card.
  • Coverage is limited to the 16 acts in the statute DB.

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer

tok = AutoTokenizer.from_pretrained("NyayaLabs98/nyaya-3b-v3")
model = AutoModelForCausalLM.from_pretrained("NyayaLabs98/nyaya-3b-v3", device_map="auto")

system = (
    "You are Nyaya, an Indian legal information model. You provide accurate, "
    "plain-language legal guidance for Indian citizens, cite specific sections of "
    "current law (BNS/BNSS/BSA and other acts in force), clearly state uncertainty, "
    "and recommend consulting a licensed advocate for anything consequential. "
    "You provide legal information, not legal advice."
)
# Prepend retrieved statute passages to the user turn — that is where the
# accuracy comes from. See the repo's nyaya.retrieval.build_rag_prompt.
messages = [
    {"role": "system", "content": system},
    {"role": "user", "content": "Police FIR nahi likh rahi, kya karu?"},
]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=512)
print(tok.decode(out[0][inputs.shape[1]:], skip_special_tokens=True))

Licence & attribution

Research / non-commercial only. Merged LoRA derivative of Qwen/Qwen2.5-3B-Instruct (qwen-research). The training/eval code is Apache-2.0; that licence does not extend to these weights.

Statutory text is Government of India material, public domain under Section 52(1)(q) of the Copyright Act, 1957.

Code, evaluation harness, and the full record of what did and did not work: github.com/JitendraJha98/nyaya-model

Downloads last month
596
Safetensors
Model size
3B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for NyayaLabs98/nyaya-3b-v3

Base model

Qwen/Qwen2.5-3B
Finetuned
(1509)
this model
Quantizations
1 model