Files in this repo: urdish-v2-4b-q4_k_m.gguf (2.5 GB, recommended), urdish-v2-4b-q8_0.gguf (4.3 GB), merged/ (16-bit safetensors).
Code, data and evaluation: https://github.com/Nauman0x/urdish-support-qwen
A small Qwen3 model that answers WhatsApp-style customer messages for any small business. The business pastes its policy card (prices, delivery, returns, timings), and the model:
TAG: {"intent": "delivery", "order_id": "5512", "handoff": false}.It runs on a CPU. The recommended model is a 2.5 GB file that replies in about 3 to 5 seconds on an ordinary desktop CPU with no GPU.
We ran it live on real WhatsApp. A customer messaged a shop's WhatsApp number, the message reached the model on our PC through a small bridge, and the reply was back on the customer's phone about 4 seconds later. How it works and what happened.
Team Pixie · Qwen Local Hackathon 2026
| Demo video | Watch on X |
| Recommended model | Nauman0x/Urdish-Support-Qwen3-4B (urdish-v2-4b-q4_k_m.gguf, 2.5 GB) |
| Lighter model | Nauman0x/Urdish-Support-Qwen3-1.7B (prefer q8_0, 1.8 GB, over q4_k_m; see results) |
| Base models | Qwen3-4B and Qwen3-1.7B (Apache-2.0), non-thinking mode |
| Method | QLoRA with Unsloth, loss on the reply only |
| Runtime | llama.cpp (GGUF), CPU only |
| Live test | Real WhatsApp chat through whatsapp/bridge.py (WaSender webhook → local model → reply) |
Small Pakistani shops, academies, salons and rental services answer customers on WhatsApp and Instagram all day, mostly in Roman Urdu, sometimes in Urdu script or English. They can't afford a support team or per-message cloud APIs, and customer chats are private, so running locally matters.
Small base models fail this job in specific, measurable ways. On our held-out test the base Qwen3 models:
These are behaviours rather than knowledge, which is what fine-tuning on a few hundred examples teaches well. The policy card stays in the prompt, so one model serves any business without retraining.
#4521).| Split | Businesses | Chats | Used for |
|---|---|---|---|
| train | 18 | 482 | training |
| validation | 2 (pet shop, tour operator) | 40 | choosing epochs and the data version |
| test (held out) | 3 business types never seen in training: pharmacy, online tuition academy, car rental | 60 | reported results only; each final model scored once |
Files: data/src/ (one JSONL per business), data/businesses.json (cards and splits), recipe/data/ (chat format used for training).
SFTTrainer, on a local RTX 5070 12 GB under WSL2. The script is scripts/train_qlora.py, adapted from finetune-anywhere's train_unsloth.py.train_on_responses_only), so the model learns to answer rather than to reproduce policy cards.unsloth/Qwen3-4B @ bbe12eb, unsloth/Qwen3-1.7B @ a972f43 (the same weights as Qwen/Qwen3-*).convert_hf_to_gguf.py → llama-quantize to Q8_0 and Q4_K_M (scripts/make_gguf.sh). The chat template is set to non-thinking mode, so no /no_think is needed.CPU only; no GPU needed. The 4B Q4 needs about 3 GB of RAM (the 1.7B Q8 about 2 GB). A context of 2048 is plenty.
# 1. Get llama.cpp (a prebuilt release or your own build) and the model
pip install -U huggingface_hub
hf download Nauman0x/Urdish-Support-Qwen3-4B urdish-v2-4b-q4_k_m.gguf --local-dir models
# 2. Serve it (OpenAI-compatible API on port 8080)
llama-server -m models/urdish-v2-4b-q4_k_m.gguf --ctx-size 2048 --threads 4 --n-gpu-layers 0 --jinja --temp 0
# 3. Optional side-by-side demo page (base vs fine-tuned) on http://127.0.0.1:7860
git clone https://github.com/Nauman0x/urdish-support-qwen && cd urdish-support-qwen
bash demo/run_demo.sh <base Qwen3-4B Q4_K_M .gguf> ../models/urdish-v2-4b-q4_k_m.gguf 4
Prompt format. Use SYSTEM_PROMPT from scripts/common.py exactly as the system message. The user message is:
POLICY:
<your business's policy card, a few bullet lines>
CUSTOMER:
<the customer's message>
The model returns the reply plus a last line TAG: {...}; split_output() in common.py parses it.
whatsapp/bridge.py connects a shop's WhatsApp number to the local model through WaSender. The model still runs on the shop's own computer; only the WhatsApp transport goes through WaSender.
flowchart LR
C[Customer on WhatsApp] -->|message| W[WaSender]
W -->|webhook, HTTPS| T[cloudflared tunnel]
T --> B[bridge.py<br/>on the shop's PC]
B -->|POLICY + CUSTOMER| L[llama-server<br/>fine-tuned Qwen3, CPU]
L -->|reply + TAG| B
B -->|send-message API| W
W -->|reply| C
B -.->|TAG handoff = true| O[Owner's WhatsApp<br/>optional]
What the bridge does:
X-Webhook-Signature) and rejects anything else.--notify-owner, chats the model hands off (handoff: true) are forwarded to the owner's number with the intent and order ID.Live test on 27 Nov 2026. We connected a spare WhatsApp number, ran the 4B Q4 model on the CPU and messaged it from another phone like a real customer.
| Step | What happened | What we did |
|---|---|---|
| 1st message | The webhook arrived and the model answered in 2.9 s, but WaSender's API refused to send the reply (403, Cloudflare error 1010: it blocks Python's default user agent as a bot) |
Sent a proper User-Agent header from the bridge |
| "Panadol cf stock mein hai?" with the short test card | Reply on the customer's phone 4 s later: "Maazrat, hamari policy mein medicines ki stock ki maloomat nahi hai. Hamari team jald aap se rabta karegi." (handoff: true). This is correct, because the card has no stock information, but it's not very helpful to a customer |
Wrote a fuller pharmacy card, the way a real shop would: common medicines with prices, same-day delivery, payment and return rules (whatsapp/cards/shifa_pharmacy_full.txt) |
| Same kind of questions with the fuller card | "Panadol CF Rs 60 per strip hai. Delivery Lahore mein 24 ghante mein hoti hai…"; for a medicine not on the list (Augmentin) it asks for the name or a photo and says the team will confirm stock and price | Kept it as the WhatsApp demo card |
| Several messages in a row | WaSender's free trial sends only 1 message per minute | The bridge queues replies; the model itself is not the bottleneck |
The main lesson from the live run: the bot is only as informative as the policy card. With a thin card it correctly hands off; with a card written like a real shop's, it answers most questions itself and still hands off what isn't there.
WASENDER_API_KEY and WASENDER_WEBHOOK_SECRET in .env (see .env.example; .env is git-ignored).demo/run_demo.sh) and install cloudflared.bash whatsapp/run_whatsapp.sh --card whatsapp/cards/shifa_pharmacy_full.txt (or --card my_policy.txt for your own business), then paste the printed https://….trycloudflare.com/webhook URL into the WaSender session's webhook settings.WaSender links a WhatsApp account the way WhatsApp Web does; it is not Meta's official API, so use a spare number. whatsapp/test_bridge.sh tests the bridge locally with fake webhooks and sends nothing.
All numbers come from the held-out test set (60 chats from 3 business types never seen in training), on CPU only (Ryzen 7 7800X3D, 8 threads, llama.cpp, temperature 0). Settings were picked on validation before scoring.
Format and routing, scored automatically by scripts/evaluate.py. "All correct" means right script, right intent, order ID copied exactly and the right handoff decision, all in the same reply.
| Model (GGUF) | All correct | Customer's script | Intent | Handoff | Speed |
|---|---|---|---|---|---|
| Qwen3-4B base, Q4_K_M | 16.7% | 61.7% | 45.0% | 70.0% | 18.7 tok/s |
| Ours 4B, Q4_K_M | 63.3% | 96.7% | 76.7% | 81.7% | 18.9 tok/s |
| Qwen3-1.7B base, Q4_K_M | 15.0% | 51.7% | 40.0% | 73.3% | 40.2 tok/s |
| Ours 1.7B, Q8_0 | 68.3% | 98.3% | 76.7% | 85.0% | 26.9 tok/s |
| Ours 1.7B, Q4_K_M | 51.7% | 96.7% | 71.7% | 70.0% | 41.0 tok/s |
At 4 threads (closer to a laptop) generation speed barely drops: 4B Q4 17.5 tok/s, 1.7B Q4 34.5 tok/s (llama-bench).
Facts. Format scores can hide wrong answers, so every test reply was also graded against its policy card as ok (every claim supported and correctly applied), wrong (contradicts the card or invents something) or empty (blank, an echo of the question, or the card pasted back). Grading was blind: the six models' replies were shuffled per chat, and the grader didn't know which model wrote which (scripts/fact_packets.py, eval/facts/). The grader was Claude, in two independent passes of 30 chats each, not a human, so treat these as estimates.
| Model (Q4_K_M) | Facts ok | Wrong | Empty |
|---|---|---|---|
| Qwen3-4B base | 51.7% | 15 | 14 |
| Ours 4B | 81.7% | 9 | 2 |
| Qwen3-1.7B base | 45.0% | 26 | 7 |
| Ours 1.7B | 53.3% | 28 | 0 |
One held-out example (pharmacy, never seen in training). The card says delivery Rs 150, free above Rs 3,000.
Customer: bhai apki site pe parha tha 2000 se upar delivery free hai, mera order 2500 ka hai to Rs 150 q laga rahe ho??
Qwen3-4B base: Yes, your order is above 2000, so delivery should be free. However, since your order is 2500, we will charge Rs 150 for delivery.
TAG: {"intent": "payment", "order_id": "2500", "handoff": false}Wrong language, contradicts itself, wrong intent, and puts the amount in the order ID.Ours 4B: Maazrat, delivery Rs 150 ke saath hoti hai, aur Rs 3,000 se upar ke orders par delivery free hoti hai. Aap ke order 2500 ka hai, is liye delivery Rs 150 ke saath hoti hai.
TAG: {"intent": "delivery", "order_id": null, "handoff": false}
More pairs, where the base model invents policy and ours hands off (rider card machine, teacher's gender, decorated wedding car), are in eval/results/: compare base-4b-q4_k_m.jsonl and urdish-v2-4b-q4_k_m.jsonl, which share row order.
Failures and limits:
| v1 (392 rows) | v2 (482 rows) | |
|---|---|---|
| 4B Q4: all correct | 60.0% | 63.3% |
| 4B Q4: English customers answered in English | 12/15 | 15/15 |
| 4B Q4: card-silent questions handed off | 8/12 | 11/12 |
| 1.7B Q8: all correct | 61.7% | 68.3% |
| 1.7B Q4: all correct | 58.3% | 51.7% |
v2 was chosen on validation (1.7B: 52.5% → 70.0%) and fixed the targeted problems on the test set. The 1.7B Q4 went down, and we report it as is. 4. Our first metric hid a real problem. The automatic score looked fine for the 1.7B while its facts were often wrong. The blind fact check is what made us switch the recommended model to the 4B. 5. Quantization is nearly free for the 4B on CPU. In our v1 runs Q4 scored as well as BF16 (60.0% vs 56.7%) at 2.6× the speed. 6. A live run teaches things a test set doesn't. On real WhatsApp the first reply was blocked by the messaging API (fixed with one header), and a thin policy card made the bot hand off almost everything. A realistic card turned the same model into a useful assistant, so the card matters as much as the model (details).
Still uncertain: the fact grades come from Claude rather than human reviewers, the test set is small, and the data is synthetic, so real customer chats may be messier than ours.
In WSL2 or Linux with an NVIDIA GPU for training; any CPU for evaluation:
python scripts/check_src.py && python scripts/build_data.py # validate and build the splits
bash scripts/final_v2.sh # train 4B and 1.7B, export GGUF, score on the test set
bash scripts/run_eval.sh <model.gguf> <name> # score any GGUF on the test set (CPU)
EVAL_FILE=recipe/valid_scored.jsonl bash scripts/sweep.sh unsloth/Qwen3-4B tag 1 2 # epoch sweep on validation
Team Pixie:
Credits: Qwen3 by the Qwen team (Apache-2.0); finetune-anywhere (training script base, MIT); Unsloth, TRL and llama.cpp. Training chats drafted with Claude, validated by script and spot-checked by the team.
License: code and data MIT. Model weights follow the Qwen3 Apache-2.0 license.
Qwen/Qwen3-4B