--- 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 🇮🇳 *Text-only fine-tune of a multimodal base — use for text generation as shown below (ignore the auto-suggested image examples).* **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) > **प्रश्न:** अपनी माँ के लिए धन्यवाद व्यक्त करते हुए चार पंक्तियाँ लिखिए। > > **उत्तर:** माँ, शब्दों में क्या कहूँ, आपने मेरे लिए सब कुछ किया है। > आप मेरी बुद्धि, मेरी ताकत, मेरा आशीर्वाद और मेरी प्रेरणा हैं। > आपका प्यार मुझे हर दिन बढ़ने और आगे बढ़ने में मदद करता है। > आपके बिना मैं कुछ नहीं हूँ। > **प्रश्न:** चाय बनाने की विधि बताइए। > > **उत्तर:** पानी के बर्तन में पानी उबालें और चाय के पत्ते डाल दें। 5 से 7 मिनट तक उबलने दें, फिर चाय को छान लें। एक कप या चम्मच चीनी या मिश्रण जोड़ें और चाय का आनंद लें। > **प्रश्न:** भारत की राजधानी क्या है? एक वाक्य में उत्तर दीजिए। > > **उत्तर:** भारत की राजधानी नई दिल्ली है। ## 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/collections/pankajpandey-dev/hindi-llm-series)