DuckTalk
Qwen3-4B LoRA — local text-to-SQL query generator
2 min readupdated
The model turns business questions in English or Roman Urdu into precise SQL queries for the DuckDB database. Thanks to complete autonomy, the model sees only the table structure (schema), while the data itself remains confidential. It is based on the compact Qwen/Qwen3-4B language model with a LoRA adapter (a small fine-tuning add-on for a base model), trained on synthetic retail and wholesale datasets. It features improved execution accuracy and the ability to run directly on a CPU in quantized form. The tool is useful for local business owners, analysts, and developers who need quick SQL analysis without sending data to cloud services.
Key features
- Complete autonomy: works offline, passing only the table schema to the model rather than actual rows
- Dual language support: understands prompts in both English and Roman Urdu (Urdu in Latin script)
- Improved accuracy: outperforms base Qwen3-4B on manual and hidden databases (up to 80.6% EX)
- Flexible quantization: GGUF versions are available for running on regular laptops and processors
What you can do
- Connect to a local script or application to analyze sales via DuckDB using text prompts
- Run a quantized GGUF version (for example, Q6_K) on a processor without using a discrete graphics card
- Use a retail or FMCG distribution schema for quick audits of inventory and payments
Example
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
tok = AutoTokenizer.from_pretrained("techietech22/ducktalk-qwen3-4b-lora")
model = PeftModel.from_pretrained(
AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B", dtype="auto", device_map="auto"),
"techietech22/ducktalk-qwen3-4b-lora"
)Read more
Details• Accuracy on unseen database: 80.6% EX (baseline is 43.3%)
• Hardware requirements: Kaggle Tesla T4 (16 GB) for training; CPU inference via llama.cpp
• Limitations: works best with sales, payment, and customer table structures; requires SQL validation before execution
• Training details: Unsloth, 1 epoch, lr 1e-4, thinking disabled










Comments