Qwen3-0.6B-qlora-zhtw-thinking
A small chat model that answers in Traditional Chinese (Taiwan usage) and keeps Qwen3's thinking mode.
It is Qwen/Qwen3-0.6B fine-tuned with QLoRA on about 17.6k Traditional Chinese examples: 4.4k human-written Q&A pairs (direct answers) mixed with 13.2k reasoning examples (<think>…</think> and then an answer).
The main effect is script and vocabulary: in our test the base model often answered in Simplified Chinese or with Mainland China terms. After fine-tuning it answers in Traditional Chinese with Taiwan terms. TMMLU+ went up slightly (0.289 → 0.314); the English benchmarks did not change in our small test.
Qwen3 is a hybrid thinking model: the chat template has an enable_thinking switch. This model was trained on both modes, so you can turn thinking on (think first, then answer) or off (answer directly).
Quick start
This repo holds the merged model (LoRA already merged into the base weights), so you can load it directly.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "mikeforai/Qwen3-0.6B-qlora-zhtw-thinking" # change to your repo name
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.float16, device_map="auto")
def chat(question, think=True, max_new_tokens=None):
messages = [{"role": "user", "content": question}]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True, enable_thinking=think
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Sampling settings recommended by Qwen3
sampling = dict(temperature=0.6, top_p=0.95) if think else dict(temperature=0.7, top_p=0.8)
out = model.generate(
**inputs, max_new_tokens=max_new_tokens or (1536 if think else 256), do_sample=True, **sampling
)
text = tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
if "</think>" not in text: # thinking off, or thinking was cut off
return "", text.strip()
thought, answer = text.split("</think>", 1)
return thought.replace("<think>", "").strip(), answer.strip()
thought, answer = chat("電腦開機很慢,可能是什麼原因?", think=True)
print("【思考】", thought)
print("【回答】", answer)
print("【直接回答】", chat("電腦開機很慢,可能是什麼原因?", think=False)[1])
Using the LoRA adapter only
If you have the adapter files instead of the merged model:
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-0.6B", torch_dtype=torch.float16, device_map="auto")
model = PeftModel.from_pretrained(base, "<adapter-path-or-repo>")
Model details
| Base model | Qwen/Qwen3-0.6B (hybrid thinking model) |
| Method | QLoRA (4-bit NF4 base + LoRA adapter), then merged to fp16 |
| Language | Traditional Chinese (zh-TW) |
| Trainable parameters | 10.1M of 606.1M (1.67%) |
| Adapter size | about 39 MB (adapter_model.safetensors) |
| License | Apache 2.0 (base model and Aya dataset); the reasoning dataset is MIT |
Training data
| Source | License | Role |
|---|---|---|
Heng666/Traditional_Chinese-aya_dataset |
Apache 2.0 | Direct-answer Q&A. Human-annotated Chinese Q&A from the Cohere Aya project, already converted to Traditional characters by the dataset author. |
twinkle-ai/tw-reasoning-instruct-50k |
MIT | Reasoning examples with a thinking process (think) and a final answer (output). |
Cleaning steps for Aya:
- Strip leading and trailing whitespace.
- Drop empty answers (
MIN_TARGET_CHARS = 1, so very short answers were kept). - Drop duplicate questions.
The reasoning examples are randomly sampled so that they make up 75% of the training data (REASONING_RATIO = 0.75). This keeps the model from forgetting how to think. Each one is written in the Qwen3 format:
<think>
{think}
</think>
{output}
| Stage | Examples |
|---|---|
| Aya, original | 4,909 |
| Aya, after cleaning | 4,409 |
| Reasoning examples sampled | 13,227 |
| Total (4,409 direct + 13,227 reasoning) | 17,636 |
| Train / validation split (95% / 5%) | 16,754 / 882 |
| After dropping samples longer than 2,048 tokens | 16,745 / 881 |
Long samples are dropped, not truncated: a truncated reasoning example would teach the model half a thought and no final answer.
Prompt format and loss
Each example is formatted with the Qwen3 chat template. The prompt ending depends on the example type, so training matches inference exactly:
| Example type | enable_thinking |
Prompt ends with | Loss is computed on |
|---|---|---|---|
| Direct answer (Aya) | False |
<|im_start|>assistant\n<think>\n\n</think>\n\n |
the answer |
| Reasoning | True |
<|im_start|>assistant\n |
<think>…</think> and the answer |
Loss is computed only on the model's output, not on the question (prompt labels are -100).
Training setup
| Setting | Value |
|---|---|
| Hardware | 2 × Tesla T4 (Kaggle) |
| Training time | about 3 h 48 min (13,687 s) |
| Epochs / steps | 1 / 524 |
| Max sequence length | 2048 |
| Batch size | 1 per device × 16 gradient accumulation (effective batch 16) |
| Learning rate | 2e-4, cosine schedule |
| Optimizer | paged_adamw_8bit |
| Precision | fp16 (T4 does not support bf16) |
| Quantization | 4-bit NF4, double quantization, fp16 compute |
| LoRA | r=16, alpha=32, dropout=0.05, bias="none" |
| LoRA targets | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Gradient checkpointing | on (use_reentrant=False) |
| Frameworks | transformers, peft, bitsandbytes, accelerate, datasets |
Final training loss (average): 3.258. The loss is much higher than in a plain Q&A fine-tune because 75% of the tokens are long reasoning text, which is harder to predict. Do not compare it with the loss of a model trained on short answers only.
Evaluation
Base and fine-tuned models were compared with the same 4-bit model object, switching the adapter on and off, so the quantization is identical.
Taiwan vs. Mainland China wording
20 everyday questions, thinking mode on, sampling with a fixed seed (0) so it can be repeated. We counted 16 Mainland-style terms (視頻, 軟件, 硬件, 質量, 網絡, 默認, 優化, 屏幕, 鼠標, 程序員, 數據庫, 服務器, 打印機, U盤, 博客, 短信) in the final answers (the thinking text is not counted).
| Model | Mainland-style terms |
|---|---|
| Base (Qwen3-0.6B) | 15 |
| This model | 12 |
This count understates the real difference. The keyword list only matches Traditional-character spellings. In the 5 side-by-side rows we inspected, the base model answered in Simplified Chinese (for example "台湾夜市热闹非凡…", "电脑开机慢可能是多种原因造成的…"), and the fine-tuned model answered in Traditional Chinese. Simplified spellings such as 软件 or 视频 are not counted. The count is a rough keyword check, not a quality score, and 12 remaining terms means the model still uses some Mainland wording.
Standard benchmarks
lm-evaluation-harness, 0-shot, only 50 questions per sub-task. These tasks compare option probabilities and do not generate text, so thinking mode does not affect them.
| Task | Metric | Base | This model | Std. error |
|---|---|---|---|---|
| TMMLU+ (Taiwan knowledge, all 66 subjects) | acc | 0.289 | 0.314 | 0.008 |
| ARC-Easy | acc | 0.540 | 0.540 | 0.071 |
| HellaSwag | acc_norm | 0.480 | 0.480 | 0.071 |
TMMLU+ by group:
| Group | Base | This model |
|---|---|---|
| STEM | 0.298 | 0.296 |
| Humanities | 0.254 | 0.291 |
| Social sciences | 0.286 | 0.327 |
| Other | 0.296 | 0.322 |
ARC-Easy and HellaSwag are the same before and after (the difference is far below 2 × the standard error), so we saw no sign of forgetting English commonsense. The +0.025 on TMMLU+ is bigger than its standard error, but each subject has only 50 questions and the absolute scores are close to the 25% chance level of a four-choice test. Treat it as "slightly better", not as a real knowledge gain.
Behavior to expect
In thinking mode the model writes a plan first, then the final answer. Example (question: 請用三句話介紹台灣的夜市文化。):
【思考】 首先,我需要理解台灣夜市的文化特點,並確保這三句話能夠全面且具有吸引力地介紹。台灣夜市以其豐富的美食、多樣的活動和親民的氛圍著稱……
【回答】 台灣的夜市文化充滿了美食的多樣性、活動的豐富性以及親民的氛圍,讓每個人都能找到屬於自己的味蕾享受。
With enable_thinking=False it answers directly:
台灣的夜市文化以其豐富的美食、多樣的表演和獨特的氛圍著稱,成為許多遊客心中的熱門景點。
Things to know:
- Thinking can take many tokens. Give it
max_new_tokensaround 1,536 or more. If it is cut off before</think>, there is no clean split between thinking and answer. In our side-by-side run, one answer (computer start-up question) began with "當我思考如何解決…" and looks like thinking text that was not closed; we did not check whether this was the cause. - The thinking text is not always correct. The 0.6B model can reason in a convincing way and still be wrong. The example above also invents details (for example "夜市舞會").
- Direct mode is trained on short Aya answers, so those answers may be shorter than the base model's. If you want longer answers, ask for them in the prompt (for example "請詳細說明") or use thinking mode.
Limitations
- Very small model (0.6B): it can make mistakes, invent facts, and struggle with math, code, and long reasoning. The thinking process is a style it has learned, not a guarantee of correct reasoning.
- Thinking data is third-party: the reasoning examples come from
twinkle-ai/tw-reasoning-instruct-50k; we did not check their quality ourselves. Follow that dataset's terms if you redistribute the data. - One epoch only: about 16.7k examples, one pass. It is not tuned for any specific domain.
- Limited evaluation: 50 questions per benchmark sub-task, 20 hand-written prompts, one run, no human preference study. The blind A/B files from the notebook were created but not scored. The Mainland-term count misses Simplified-character spellings (see above).
- Sequence length: max 2,048 tokens; longer samples were removed, and longer conversations were not trained on.
- Thinking-off quality was only spot-checked: the 20-question comparison was run with thinking on. The direct-answer mode was only tried on one example.
- Language: built for Traditional Chinese. Other languages may be worse than the base model (not measured).
- The model inherits the biases and limits of the base model and the training data.
Acknowledgements
- Qwen team for the base model
- Heng666 for the Traditional Chinese Aya dataset, and Cohere For AI for the original Aya dataset
- twinkle-ai for the Taiwan reasoning dataset
- Hugging Face
transformers,peft,bitsandbytes, and EleutherAIlm-evaluation-harness
Citation
@misc{qwen3technicalreport,
title = {Qwen3 Technical Report},
author = {Qwen Team},
year = {2025},
eprint = {2505.09388},
archivePrefix = {arXiv}
}
模型讨论
分享经验,帮助他人,建立信任。
正在加载评论…
围绕模型展开讨论。禁止垃圾信息、诈骗和人身攻击。评论和回复中不允许包含链接。 评论规则