Khata AI Qwen3-1.7B POS LoRA
structured shopkeeper notes into JSON
2 min readupdated
This model is a LoRA (small add-on for a base model) for Qwen3-1.7B, fine-tuned on QLoRA. It converts unstructured text notes from shopkeepers in English, Urdu script, or Romanized Urdu into ready-to-use JSON for point-of-sale (POS) systems and wholesale bookkeeping. The model identifies transaction types, items, quantities, packaging, rates, and credit status, and asks for clarification when data is missing. The tool will be useful for developers of financial apps for small businesses and retail automation systems.
Key features
- Retail specialization: recognizes sales, purchases, expenses, returns, and debt statuses (hit).
- Multilingual input: understands English, Urdu text, and Romanized Urdu.
- Uncertainty control: sets a confirmation flag and asks questions instead of guessing when ambiguity arises.
- Lightweight: built on the compact Qwen3-1.7B model using efficient fine-tuning.
What you can do
- Shop automation: integrate into a Telegram bot or mobile app for quickly recording purchases via voice or text.
- Inventory tracking: automatically record stock deliveries, batches, and package sizes from freeform notes.
- Expense analysis: convert scattered financial records into structured reports for accounting.
Example
Sample code to run the model and generate a structure from a note text:
import json, torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_id, adapter_id = "Qwen/Qwen3-1.7B", "waqas0288033/khata-qwen3-1.7b-pos-lora"
tok = AutoTokenizer.from_pretrained(base_id)
model = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype=torch.float16, device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id).eval()
SYSTEM_PROMPT = open("system_prompt.txt").read()
msgs = [{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "5000 rupay 25 kilo laal ata"}]
prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True, enable_thinking=False)
ids = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**ids, max_new_tokens=400, do_sample=False)
print(tok.decode(out[0, ids["input_ids"].shape[1]:], skip_special_tokens=True))Read more
DetailsBenchmarks: full structure match accuracy on the test set increased from 0% (base model) to 96.0% (adapter).
Hardware requirements: training took 39 minutes on a single Kaggle Tesla T4 GPU, peak VRAM consumption was 3.2 GiB.
Limitations: the model is trained on synthetic data, does not calculate totals or balances, and requires human confirmation of operations.










Comments