Downloads · 30 days
11
19% of all-time downloads
m-beps/qwen3-8b-finetune-multit-mixed
qwen3-8b-finetune-multit-mixed is a text generation model from m-beps. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
Qwen3 8B [V3] is a LoRA adapter fine-tuned on top of Qwen/Qwen3-8B to improve Italian cultural alignment using a hybrid training technique — interleaving thinking-format and non-thinking-format examples in a single SF…
Downloads · 30 days
11
19% of all-time downloads
All-time downloads
58
Public
Repo size
1.8 GB
Likes
0
Public
Click a slice to open those files.
.pt524 MB · 49%
From the Hugging Face model README
Qwen3 8B [V3] is a LoRA adapter fine-tuned on top of Qwen/Qwen3-8B to improve Italian cultural alignment using a hybrid training technique — interleaving thinking-format and non-thinking-format examples in a single SFT pass via ThinkingMode.MIXED. Trained on the Mult-IT dataset and evaluated on the ITALIC benchmark. V3 is the final version in the series and the only configuration where both inference modes improved simultaneously.
Author: Maruf Bepary, King's College London
Research report: Alignment in Large Language Models
| Property | Value |
|---|---|
| Base model | Qwen/Qwen3-8B |
| PEFT type | LoRA |
| Task | Causal language modelling (Italian Q&A / instruction following) |
| Training dataset | Mult-IT (mixed-format samples) |
| Evaluation benchmark | ITALIC (10,000 questions) |
| No Thinking accuracy (V3) | 73.81% (+3.64 pp over baseline) |
| Thinking accuracy (V3) | 77.57% (+3.08 pp over baseline) |
| Trainable parameters | 65,470,464 / 8,256,205,824 (0.79%) |
This model is intended for:
Not recommended for:
The hybrid training technique is the only configuration in the Qwen3 series where both inference modes improved simultaneously:
| Mode | Baseline | V3 | Delta |
|---|---|---|---|
| No Thinking (total) | 70.17% | 73.81% | +3.64 pp |
| Thinking (total) | 74.49% | 77.57% | +3.08 pp |
V1 improved No Thinking but collapsed Thinking (59.33%, −15.16 pp). V2 recovered Thinking (77.87%) but left No Thinking nearly unchanged (70.27%). V3 interleaves both formats in training, allowing the model to simultaneously retain chain-of-thought capability and improve Italian cultural knowledge.
| Version | Training Format | No Thinking Total | Thinking Total | Key Result |
|---|---|---|---|---|
| V1 | Non-thinking only | 73.77% (+3.60) | 59.33% (−15.16) | Thinking collapsed |
| V2 | Thinking only | 70.27% (+0.10) | 77.87% (+3.38) | Thinking recovered |
| V3 | Mixed (both) | 73.81% (+3.64) | 77.57% (+3.08) | Both modes improved |
| Parameter | Value |
|---|---|
LoRA rank (r) | 24 |
| LoRA alpha | 48 |
| LoRA dropout | 0.1 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Bias | none |
| Parameter | Value |
|---|---|
| Training mode | ThinkingMode.MIXED |
| Epochs | 2 |
| Per-device batch size | 4 |
| Sequence packing | Yes (max 2,048 tokens per slot) |
| Peak learning rate | ~4×10⁻⁵ |
| LR schedule | Cosine |
| Warmup steps | ~10% |
| Max sequence length | 2,048 tokens |
| Component | Version / Spec |
|---|---|
| TRL | 0.21.0 |
| PEFT | 0.17.0 |
| Transformers | 4.55.0 |
| PyTorch | 2.5.1+cu121 |
| Hardware | NVIDIA GeForce RTX 3090 |
ThinkingMode.MIXED; thinking-format and non-thinking-format examples interleavedBenchmark: ITALIC (NAACL 2025) — Italian Culture-Aware Natural Language Benchmark
Format: Zero-shot, multiple-choice (12 categories, 10,000 questions)
System prompt: "Sei un assistente utile."
Baseline = Qwen3 8B (No Thinking), no fine-tuning.
| Category | Baseline | V3 | Δ |
|---|---|---|---|
| Art | 69.29 | 71.78 | +2.49 |
| Civic | 73.18 | 75.66 | +2.48 |
| Events | 76.09 | 77.17 | +1.08 |
| Geography | 75.89 | 77.81 | +1.92 |
| History | 71.37 | 74.60 | +3.23 |
| Literature | 64.33 | 69.58 | +5.25 |
| Tourism | 68.27 | 69.98 | +1.71 |
| Lexicon | 84.27 | 86.72 | +2.45 |
| Morphology | 50.71 | 52.86 | +2.15 |
| Orthography | 54.04 | 62.69 | +8.65 |
| Synonyms | 84.04 | 90.71 | +6.67 |
| Syntax | 59.20 | 61.25 | +2.05 |
| Culture (subtotal) | 70.47 | 73.29 | +2.82 |
| Language (subtotal) | 69.73 | 74.58 | +4.85 |
| Total | 70.17 | 73.81 | +3.64 |
Baseline = Qwen3 8B (Thinking), no fine-tuning.
| Category | Baseline | V3 | Δ |
|---|---|---|---|
| Art | 74.85 | 76.77 | +1.92 |
| Civic | 74.07 | 76.26 | +2.19 |
| Events | 76.09 | 76.11 | +0.02 |
| Geography | 81.44 | 83.47 | +2.03 |
| History | 71.26 | 76.62 | +5.36 |
| Literature | 70.06 | 74.08 | +4.02 |
| Tourism | 66.87 | 71.43 | +4.56 |
| Lexicon | 89.82 | 90.12 | +0.30 |
| Morphology | 54.14 | 59.14 | +5.00 |
| Orthography | 68.67 | 71.88 | +3.21 |
| Synonyms | 91.57 | 92.26 | +0.69 |
| Syntax | 59.04 | 65.58 | +6.54 |
| Culture (subtotal) | 73.13 | 76.43 | +3.30 |
| Language (subtotal) | 76.49 | 79.25 | +2.76 |
| Total | 74.49 | 77.57 | +3.08 |
| Model | Total | Parameters |
|---|---|---|
| Llama 3.1 70B | 83.61% | 70B |
| GPT-4o Mini | 82.22% | ~8B |
| Qwen3 14B (No Thinking) | 77.78% | 14B |
| Llama 3.1 8B Ita [V1] | 73.91% | 8B |
| Qwen3 8B (No Thinking) [V3] | 73.81% | 8B |
| Qwen3 8B (No Thinking) [V1] | 73.77% | 8B |
| Qwen3 8B (No Thinking) baseline | 70.17% | 8B |
| Llama 3.1 8B | 66.38% | 8B |
All scores evaluated under identical zero-shot conditions on the ITALIC benchmark.
Both thinking and no-thinking modes work well with this adapter.
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
base_model_id = "Qwen/Qwen3-8B"
adapter_id = "maruf-bepary/qwen3-8b-italian-v3-mixed"
# Load tokeniser and base model
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
# Load LoRA adapter
model = PeftModel.from_pretrained(model, adapter_id)
model.eval()
messages = [
{"role": "system", "content": "Sei un assistente utile."},
{
"role": "user",
"content": (
"Qual è la capitale d'Italia?\n"
"A) Milano\nB) Roma\nC) Napoli\nD) Torino\n\n"
"Rispondi con la lettera della risposta corretta."
),
},
]
# Thinking mode — chain-of-thought is fully functional in V3
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True,
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=1024,
do_sample=False,
)
response = tokenizer.decode(
outputs[0][inputs["input_ids"].shape[-1]:],
skip_special_tokens=True,
)
print(response)
# No Thinking mode — also fully functional in V3
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False,
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=64,
do_sample=False,
temperature=None,
top_p=None,
)
response = tokenizer.decode(
outputs[0][inputs["input_ids"].shape[-1]:],
skip_special_tokens=True,
)
print(response)
# Expected output: "B"
Related resources: