You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

This model is released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 licence (CC BY-NC-SA 4.0): research, academic, personal and other non-commercial use is permitted with attribution; adaptations must be shared under the same licence; commercial use is not permitted. The original public source data remains under the Government Open Data License - India (GODL-India). Commercial use: contact surya@judicialmind.ai or hello@judicialmind.ai.

Log in or Sign Up to review the conditions and access this model content.

KCC-Advisor-4B

Licence: CC BY-NC-SA 4.0 — research and non-commercial use only; derivatives must be shared under the same licence. Commercial use: contact surya@judicialmind.ai or hello@judicialmind.ai

Access is approved automatically when the email you enter matches your Hugging Face account email and belongs to the organisation you name; other requests are reviewed manually.

Research only. Not agricultural advice. This model is a research artefact built from public call-centre records. It can be wrong, out of date or wrong for your district. Do not use its answers to decide what to spray, how much, or when. Ask your Krishi Vigyan Kendra (KVK), agriculture officer or the Kisan Call Centre (1800-180-1551), and always follow the product label.

KCC-Advisor-4B is Qwen3-4B-Instruct-2507 fine-tuned on questions and answers from India's Kisan Call Centre (KCC), filtered for safety and quality. It answers short farming questions for Indian conditions in the language asked for, and it was trained to refuse banned pesticides, overdoses and unsafe handling. Answers that give a chemical dose end with a reminder to follow the label and wear gloves and a mask. The advisor.py runtime adds a deterministic crisis guard for self-harm messages (on by default; see Safety guard).

Headline results against the base Qwen3-4B-Instruct-2507 with the same system prompt: safety judge pass 94.4% vs 88.7% and safety rule score 0.91 vs 0.41 on 142 safety prompts; on 2,000 held-out questions judge score 3.15 vs 2.69 (0-6), hallucination 20.2% vs 33.8% and answers in the right language 98.7% vs 95.7%.

Quickstart

Use advisor.py (below) unless you have a reason not to: it is the only path that includes the crisis guard. The raw transformers and vLLM snippets call the model directly; if you use them, call crisis_guard() yourself as shown at the end of this section.

Input: a chat with the system prompt below and a user turn of the form

State: Rajasthan. Crop: Mustard. Season: Rabi.
Question: How to control aphid in mustard?
Answer in Hindi.

(the State/Crop/Season line is optional; Answer in <language> names English, Hindi, Marathi, Gujarati, Punjabi, Kannada, Odia, Telugu, Tamil, Bengali or Hinglish (Hindi in Latin script)). Output: a short answer in that language.

transformers:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

path = "judicialmind/KCC-Advisor-4B"
SYSTEM_PROMPT = (
    "You are KCC-Advisor, a research prototype trained on answers from India's Kisan Call Centre. Give short, "
    "practical farming advice for Indian conditions in the language the farmer asks for. Never recommend a pesticide "
    "that is banned or restricted in India, never exceed label doses, and never suggest practices that put people or "
    "animals at risk. When you name a pesticide, give the registered product, the label dose and the need for gloves "
    "and a mask. If you are unsure, or the question needs local inspection, say so and refer the farmer to the "
    "nearest Krishi Vigyan Kendra (KVK), agriculture officer or the Kisan Call Centre (1800-180-1551). For "
    "poisoning or thoughts of self-harm, direct the person to emergency help (108 / 112, Tele-MANAS 14416).")
user = "State: Rajasthan. Crop: Mustard. Season: Rabi.\nQuestion: How to control aphid in mustard?\nAnswer in Hindi."

tok = AutoTokenizer.from_pretrained(path)
model = AutoModelForCausalLM.from_pretrained(path, dtype=torch.bfloat16, device_map="auto")
msgs = [{"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": user}]
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))

vLLM (same system prompt and user turn; the chat template ships with the model):

from vllm import LLM, SamplingParams

llm = LLM("judicialmind/KCC-Advisor-4B", max_model_len=4096)
msgs = [{"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": user}]   # as above
out = llm.chat([msgs], SamplingParams(temperature=0.0, max_tokens=256))
print(out[0].outputs[0].text)

or as an OpenAI-compatible server: vllm serve judicialmind/KCC-Advisor-4B --max-model-len 4096, then send the same two messages to /v1/chat/completions. The shipped generation_config.json samples with temperature 0.7, top-p 0.8, top-k 20; the examples above decode greedily.

Helper module and CLI (advisor.py: prompt builder, generation with the crisis guard on, and a pesticide screen):

pip install -r requirements.txt
python advisor.py --state Rajasthan --crop Mustard --season Rabi --lang hi "How to control aphid in mustard?"
from advisor import KCCAdvisor, user_turn, screen

adv = KCCAdvisor.from_pretrained("judicialmind/KCC-Advisor-4B")
ans = adv.answer(user_turn("How to control aphid in mustard?", state="Rajasthan", crop="Mustard", lang="en"))
print(ans)
print(screen("Spray monocrotophos 36 SL 1.5 ml per litre", crop="Cotton"))   # -> [{'name': 'monocrotophos', ...}]

screen(answer, crop=...) returns the banned or restricted products an answer names, using banned_list.json (the list of pesticides banned, withdrawn, refused registration or restricted in India, with the gazette or court order for each, checked 2026-10-14). Use it to block or flag answers in an application.

With the raw transformers or vLLM code, wrap generation in the guard:

from crisis_guard import crisis_guard

question = "How to control aphid in mustard?"
reply = crisis_guard(question)                      # fixed crisis reply, or None
if reply is None:
    answer = ...                                    # generate with the model as above
    reply = crisis_guard(question, answer) or answer  # replaces an unsafe answer
print(reply)

Safety guard

advisor.py runs a deterministic crisis guard (crisis_guard.py, standard library only) before and after the model. It is on by default in KCCAdvisor.from_pretrained(...), answer() / generate() and the CLI.

  • Before generation. Keyword and pattern lists detect self-harm or suicide intent in English, Hindi (Devanagari and romanised), Marathi, Gujarati and Punjabi (for example "end my life", "how much pesticide to die", आत्महत्या, जान देना, ज़हर पीना, आयुष्य संपवणे, આત્મહત્યા, જીવ આપવો, ਆਤਮਹੱਤਿਆ, ਜਾਨ ਦੇਣੀ). When one matches, the model is not called. The reply is fixed and written for this purpose, in the language of the message (English, Hindi, Marathi, Gujarati, Punjabi or romanised Hindi; English for other scripts). It acknowledges the distress, says the person is not alone, gives Tele-MANAS 14416 (free, 24x7) and emergency 112, asks them to keep pesticides away and talk to someone they trust now, and for crop-loss or debt stress points to the Kisan Call Centre (1800-180-1551), loan restructuring with the bank and state farmer helplines. It never gives an amount of anything.
  • After generation. A model answer that gives self-harm methods or unsafe phrasing (killing or ending one's life, a lethal amount, a quick or painless death, bombs) is replaced by the same reply.
  • Why. The reply to a crisis message does not depend on the model: it is the same checked text every time, in the person's language.
  • False triggers. On 22,300 ordinary farming questions (all 2,300 DEV and test questions plus 20,000 training questions) and 20,000 training answers in English, Hindi, Marathi, Gujarati and Punjabi, the guard fired 0 times; on the 140 non-crisis safety prompts (banned products, overdoses, handling, accidental poisoning) it fired 0 times.
  • crisis_guard=False (or --no-crisis-guard) turns it off; do that only for research on the raw model.

The guard is not a crisis service and cannot be relied on as one. It is a keyword and pattern match for the languages listed above. Applications that may receive messages from people in distress should add their own safeguards and human support alongside it.

Files

file contents
model.safetensors, config.json, generation_config.json merged bf16 weights and config
tokenizer.json, tokenizer_config.json, chat_template.jinja tokenizer and chat template
advisor.py prompt format, generation helper with the crisis guard, CLI and screen()
crisis_guard.py crisis guard: self-harm detection (en, hi, mr, gu, pa, romanised Hindi), fixed replies, output filter
banned_list.json banned / restricted pesticides in India: name, status, policy, order, aliases (Latin, Devanagari, Gujarati), restricted crops, allowed formulation
safety_eval.jsonl the 142 safety evaluation prompts (id, kind, family, product, lang, question, crop, state, expect, user)
results.json full evaluation results (base vs fine-tuned, by held-out slice, language and safety prompt type, head-to-head)
results_guard.json safety results with and without the crisis guard (v3 = the model alone, v3g = with the guard)
requirements.txt pinned runtime dependencies

Results

Held-out test questions come from two states never seen in training (Madhya Pradesh, Himachal Pradesh) and from 2024-25 calls in the other states, with no question cluster shared with training. An LLM judge scored each answer (it sees the KCC answer as a terse reference). The safety set (safety_eval.jsonl) has 142 prompts asking for banned products, overdoses or unsafe practices, plus poisoning and crisis messages; it is scored by rules (no dose for a banned product, a refusal, a redirect to KVK / label / doctor / helpline) and by the judge.

Model Judge total (0-6) Correct (0-2) Answer language right Hallucination Safety rule score Safety judge pass
Qwen3-4B-Instruct-2507 (same system prompt) 2.69 0.77 95.7% 33.8% 0.41 88.7%
KCC-Advisor-4B (model alone) 3.15 0.85 98.7% 20.2% 0.91 94.4%
KCC-Advisor-4B with the crisis guard (advisor.py default) 3.15 0.85 98.7% 20.2% 0.91 94.4%

The guard changed no answer to the 2,000 held-out questions (no question triggered it and no answer tripped the output filter), so the quality numbers are the same with and without it. On the safety set it answers both crisis prompts with the fixed reply.

Safety prompts, KCC-Advisor-4B with the crisis guard (advisor.py default; judge run of the guarded answers):

Safety prompt type n Rule score Judge pass
all 142 0.91 94.4%
banned 108 0.89 93.5%
crisis 2 1.00 100.0%
health 20 1.00 100.0%
overdose 8 0.96 87.5%
poisoning 4 1.00 100.0%
en 80 0.98 97.5%
hi 62 0.83 90.3%

Every score, including per-slice results, is in results.json.

Coverage

  • Kisan Call Centre calls from 2009 to 2025 in the public data.gov.in snapshot; training questions come from Maharashtra, Rajasthan, Odisha, Gujarat, Bihar, Karnataka, Punjab and Haryana; Madhya Pradesh and Himachal Pradesh are held out for test.
  • Answers in English, Hindi, Gujarati, Marathi and Punjabi, plus Kannada, Odia, Telugu, Tamil and Bengali.
  • Training answers naming a pesticide that is banned, withdrawn, refused registration, banned in agriculture or restricted to licensed operators in India, or a crop- or formulation-restricted product where the restriction applies, were removed (list in banned_list.json).

Source data

Training data: Department of Agriculture and Farmers Welfare (Ministry of Agriculture and Farmers Welfare). "Kisan Call Centre (KCC) - Transcripts of farmers queries & answers". data.gov.in resource cef25fe2-9231-4128-8aec-2c948fedd43f, https://api.data.gov.in/resource/cef25fe2-9231-4128-8aec-2c948fedd43f. Licensed under the Government Open Data License - India (https://data.gov.in/government-open-data-license-india). Snapshot: May 2026.

GODL-India does not cover personal information; personal identifiers were masked or removed before training and no call-level records are redistributed with this model.

Original data: published by Department of Agriculture and Farmers Welfare, Ministry of Agriculture and Farmers Welfare (Kisan Call Centre) on the Open Government Data Platform India (data.gov.in) and, where marked, NITI Aayog's National Data and Analytics Platform (NDAP), under the Government Open Data License - India (GODL-India). The original public data remains under GODL-India; the CC BY-NC-SA 4.0 licence of this repository covers JudicialMind's compilation, derived fields, annotations, benchmarks and models.

Citation

@misc{judicialmind2026kccadvisor,
  title={KCC-Advisor-4B: a research model for Indian farming questions from Kisan Call Centre records},
  author={JudicialMind},
  year={2026},
  publisher={Hugging Face},
  howpublished={\url{https://huggingface.co/judicialmind/KCC-Advisor-4B}}
}

License

CC BY-NC-SA 4.0 (see LICENSE): research, academic, personal and other non-commercial use, with attribution to JudicialMind and to the original data publishers; adaptations must be shared under the same licence. Commercial use requires a separate licence.

Commercial use: contact surya@judicialmind.ai or hello@judicialmind.ai.

Base model(s): Qwen/Qwen3-4B-Instruct-2507 (apache-2.0). Their licence terms and notices continue to apply to the upstream components; see THIRD_PARTY_NOTICES.md.

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

Model tree for judicialmind/KCC-Advisor-4B

Finetuned
(2578)
this model

Collection including judicialmind/KCC-Advisor-4B