Instructions to use m-beps/qwen3-8b-finetune-multit-mixed with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use m-beps/qwen3-8b-finetune-multit-mixed with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B") model = PeftModel.from_pretrained(base_model, "m-beps/qwen3-8b-finetune-multit-mixed") - Transformers
How to use m-beps/qwen3-8b-finetune-multit-mixed with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="m-beps/qwen3-8b-finetune-multit-mixed") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("m-beps/qwen3-8b-finetune-multit-mixed", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use m-beps/qwen3-8b-finetune-multit-mixed with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "m-beps/qwen3-8b-finetune-multit-mixed" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "m-beps/qwen3-8b-finetune-multit-mixed", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/m-beps/qwen3-8b-finetune-multit-mixed
- SGLang
How to use m-beps/qwen3-8b-finetune-multit-mixed with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "m-beps/qwen3-8b-finetune-multit-mixed" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "m-beps/qwen3-8b-finetune-multit-mixed", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "m-beps/qwen3-8b-finetune-multit-mixed" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "m-beps/qwen3-8b-finetune-multit-mixed", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use m-beps/qwen3-8b-finetune-multit-mixed with Docker Model Runner:
docker model run hf.co/m-beps/qwen3-8b-finetune-multit-mixed
Qwen3 8B β Italian Cultural Alignment [V3 β Mixed Training]
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
Model Summary
| 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%) |
Intended Use
This model is intended for:
- Italian language understanding β multiple-choice Q&A, cultural knowledge, and general instruction following in Italian. Both inference modes (No Thinking and Thinking) are fully functional.
- Research β studying hybrid training techniques for preserving dual-mode capabilities in reasoning language models; demonstrating that simultaneous improvement across both inference modes is achievable.
- Benchmarking β comparing Italian cultural alignment and reasoning performance across model sizes and training strategies.
Not recommended for:
- High-stakes or safety-critical applications.
- Languages other than Italian.
- Tasks requiring peak No Thinking performance only β V1 marginally outperforms V3 in No Thinking mode (73.77% vs 73.81%).
Key Finding β Dual-Mode Improvement
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 Series
| 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 |
Training Details
LoRA Configuration
| 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 |
Training Hyperparameters
| 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 |
Framework & Hardware
| 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 |
Training Dataset β Mult-IT (Mixed Format)
- Dataset: Mult-IT β Multiple Choice Questions on Multiple Topics in Italian
- Source: CALAMITA Shared Task @ CLiC-it 2024
- Language: Italian
- Format: Single SFT pass with
ThinkingMode.MIXED; thinking-format and non-thinking-format examples interleaved - Reference: Mult-IT: Multiple Choice Questions on Multiple Topics in Italian (2024)
ITALIC Benchmark Results
Benchmark: 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."
No Thinking Mode β V3 vs Baseline
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 |
Thinking Mode β V3 vs Baseline
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 |
Comparison with Other Models (No Thinking, ITALIC Total)
| 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.
Usage
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"
Limitations
- Thinking mode in V3 (77.57%) is marginally below V2 (77.87%) β the mixed objective slightly dilutes peak thinking-mode gains relative to thinking-only training.
- No Thinking mode in V3 (73.81%) is only marginally above V1 (73.77%) β mixing adds negligible overhead for this mode.
- Morphology remains the weakest No Thinking category (52.86%), suggesting limited syntactic generalisation.
- Benchmark scope β evaluation was conducted solely on ITALIC; Italian cultural performance on other benchmarks (e.g. MMLU-IT, HellaSwag-IT) is unverified.
- Single-GPU training β training used one RTX 3090; larger batch sizes or multi-GPU configurations may yield different results.
- Dataset bias β Mult-IT is a multiple-choice dataset; the model may not generalise equally well to open-ended Italian generation tasks.
References
Related resources:
- Research report: Alignment in Large Language Models
- Base model: Qwen/Qwen3-8B
- ITALIC benchmark: RiTA-nlp/ITALIC
- Mult-IT dataset: sapienzanlp/Mult-IT
- PEFT documentation: huggingface.co/docs/peft
- Downloads last month
- -