--- license: apache-2.0 language: [hi, en] base_model: unsloth/Qwen3.5-9B library_name: transformers pipeline_tag: text-generation datasets: - ai4bharat/indic-instruct-data-v0.1 - CohereForAI/aya_dataset tags: [hindi, qwen3.5, unsloth, lora, instruct, india] widget: - text: "स्वस्थ रहने के तीन उपाय बताइए।" - text: "दीपावली पर एक छोटा निबंध लिखिए।" - text: "चाय बनाने की विधि चरणों में बताइए।" --- # Qwen3.5-9B Hindi Instruct 🇮🇳 **Qwen3.5-9B fine-tuned to answer directly in fluent, native Hindi — no English code-switching, no English "thinking" detours.** Runs on a laptop CPU via the [GGUF version](https://huggingface.co/pankajpandey-dev/qwen3.5-9b-hindi-instruct-GGUF) (~5.7 GB). ## Why this exists Base Qwen3.5-9B knows Hindi, but ask it a Hindi question and it burns hundreds of tokens *thinking in English* inside its think block before answering — and its answers code-switch. This fine-tune closes the think block immediately and replies in pure Devanagari, following instructions tightly. ## Examples (from the release eval) > **प्रश्न:** ऑनलाइन ठगी से बचने के तीन उपाय बताइए। > > **उत्तर:** आपके पास केवल एक कार्ड वाला खाता होना चाहिए (कभी भी अपने पूरे खाते को न दें)। ऐसे फिशिंग ईमेल (जिनमें आपसे पैसा माँगा जाए) पर ध्यान न दें। सभी ऑनलाइन लेनदेन की जांच करें। > **प्रश्न:** 'ईमानदारी सबसे अच्छी नीति है' पर तीन वाक्य लिखिए। > > **उत्तर:** सच्चाई हमेशा सफलता लाती है। सत्य हमेशा सच्चाई से बढ़कर होता है। ईमानदारी सबसे अच्छी नीति है और ईमानदारी हमेशा हमारे साथ रहती है। > **प्रश्न:** मोबाइल फोन के दो लाभ और दो हानियाँ बताइए। > > **उत्तर:** संचार की सुविधा और जानकारी तक पहुंच, पर्यावरण पर प्रभाव, समय बर्बाद करना, अधिकारियों की जिम्मेदारी, संपर्क में आए व्यक्ति का समय बर्बाद करना, सामाजिक रूप से निर्लक्षी बनना ## Quickstart ```python from transformers import AutoModelForCausalLM, AutoTokenizer m = AutoModelForCausalLM.from_pretrained("pankajpandey-dev/qwen3.5-9b-hindi-instruct", torch_dtype="bfloat16", device_map="auto") t = AutoTokenizer.from_pretrained("pankajpandey-dev/qwen3.5-9b-hindi-instruct") msgs = [{"role": "user", "content": "जल संरक्षण के पाँच तरीके बताइए।"}] text = t.apply_chat_template(msgs, add_generation_prompt=True, tokenize=False) out = m.generate(**t(text=text, return_tensors="pt").to(m.device), max_new_tokens=400, repetition_penalty=1.1) print(t.decode(out[0], skip_special_tokens=True)) ``` Use `repetition_penalty=1.1` (set in this repo's generation_config) — long letter/essay outputs can loop without it. The chat template opens a think block; this model closes it immediately — strip `...` from output if present. ## Training recipe (fully reproducible) | | | |---|---| | Base | unsloth/Qwen3.5-9B (bf16) | | Method | LoRA r=16, alpha=16, response-only loss (Unsloth) | | Data | 12,912 Hindi pairs — anudesh 5,000 · dolly-hi 4,000 (chrF++ >= 55) · wikiHow-hi 3,000 · Aya-hi 912 | | Schedule | 2 epochs, LR 1e-4 cosine, effective batch 16, seq 2048 | | Hardware | 1x NVIDIA L40S (48 GB), ~135 min | | Final train loss | 0.938 | Data deduplicated across sources, filtered for length and Latin-script ratio. wikiHow adds long-form step-by-step answers; Aya adds human-written originals. ## Limitations Parts of the data are machine-translated (dolly) or model-generated (anudesh via Llama-2-70B), so occasional unnatural phrasing or factual errors occur. Long formal-letter outputs may repeat without repetition_penalty=1.1. No additional safety tuning. Knowledge cutoff follows base Qwen3.5. ## Licensing Weights: Apache 2.0. Data licenses apply to data, not weights: dolly-hi CC-BY-SA 3.0-derived; anudesh generated by Llama-2-70B (Llama 2 license); Aya Apache 2.0. --- ## 🇮🇳 About the Hindi LLM Series Weekly open releases making small LLMs speak fluent, native Hindi — trained on free/low-cost GPUs, shipped as GGUF for laptops and edge devices. Built by [pankajpandey-dev](https://huggingface.co/pankajpandey-dev) *(contact links on profile)*. **This release:** [Model](https://huggingface.co/pankajpandey-dev/qwen3.5-9b-hindi-instruct) · [GGUF](https://huggingface.co/pankajpandey-dev/qwen3.5-9b-hindi-instruct-GGUF) · [LoRA](https://huggingface.co/pankajpandey-dev/qwen3.5-9b-hindi-instruct-lora) · **Series:** [🇮🇳 Hindi LLM Collection](https://huggingface.co/pankajpandey-dev)