You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Qwen3-0.6B Safety & Math Fine-tuned Model

Fine-tuned from Qwen3-0.6B (architecture and parameter count unchanged, ~0.6B params, bf16) to simultaneously improve safety refusal and math reasoning while preserving general ability.

Grading rubric: safety ×40% + math ×30% + general ×30%.

Training

  • Method: QLoRA 4-bit (NF4 + double quant), r=16, alpha=32, dropout=0.05, all linear modules (q/k/v/o/gate/up/down). Response-only label masking (assistant content + <|im_end|>).
  • Config: lr=1e-4, cosine, warmup 5%, 1 epoch, batch=1 + grad_accum=8 (effective 8), gradient checkpointing, bf16, paged_adamw_8bit, max_length=1024. RTX 4060 Laptop (8GB).
  • Data: balanced interleaved mix (safety 23% / math 43% / general 34%):
    • Safety: HH-RLHF(harmless), PKU-SafeRLHF, calibrated refusal templates (refuse + safe alternative), Chinese-SafetyQA, manual boundary examples, Dolly conservative boundary.
    • Math: GSM8K, MATH (7 subtypes), MetaMathQA, AQuA.
    • General: No Robots, COIG-CQIA, OASST1 (en/zh), Dolly-15k.

Evaluation (fixed subset, enable_thinking=False)

Metric Value
Math (96 stratified GSM8K/MATH) 21.9%
HHI balanced accuracy 78%
JBB balanced accuracy 77%
General Chinese MCQ (200) 69.5%

Composite proxy (0.4×safety + 0.3×math + 0.3×general) ≈ 0.584, highest among all candidates.

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("BPXFQ/qwen3-0.6b-safety-math", dtype="bfloat16")
tokenizer = AutoTokenizer.from_pretrained("BPXFQ/qwen3-0.6b-safety-math")
messages = [{"role": "user", "content": "17 * 23 = ?"}]
inputs = tokenizer.apply_chat_template(
    messages, tokenize=True, add_generation_prompt=True,
    enable_thinking=False, return_tensors="pt", return_dict=True,
)
outputs = model.generate(**inputs, max_new_tokens=128, do_sample=False,
                         eos_token_id=tokenizer.eos_token_id, pad_token_id=tokenizer.pad_token_id)
print(tokenizer.decode(outputs[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Downloads last month
-
Safetensors
Model size
0.6B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for BPXFQ/qwen3-0.6b-safety-math

Finetuned
Qwen/Qwen3-0.6B
Finetuned
(1139)
this model