Instructions to use 96kevinli29/Qwen3-4B-SFT-Math-Multilingual with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 96kevinli29/Qwen3-4B-SFT-Math-Multilingual with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="96kevinli29/Qwen3-4B-SFT-Math-Multilingual") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("96kevinli29/Qwen3-4B-SFT-Math-Multilingual") model = AutoModelForCausalLM.from_pretrained("96kevinli29/Qwen3-4B-SFT-Math-Multilingual", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use 96kevinli29/Qwen3-4B-SFT-Math-Multilingual with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "96kevinli29/Qwen3-4B-SFT-Math-Multilingual" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "96kevinli29/Qwen3-4B-SFT-Math-Multilingual", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/96kevinli29/Qwen3-4B-SFT-Math-Multilingual
- SGLang
How to use 96kevinli29/Qwen3-4B-SFT-Math-Multilingual 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 "96kevinli29/Qwen3-4B-SFT-Math-Multilingual" \ --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": "96kevinli29/Qwen3-4B-SFT-Math-Multilingual", "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 "96kevinli29/Qwen3-4B-SFT-Math-Multilingual" \ --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": "96kevinli29/Qwen3-4B-SFT-Math-Multilingual", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use 96kevinli29/Qwen3-4B-SFT-Math-Multilingual with Docker Model Runner:
docker model run hf.co/96kevinli29/Qwen3-4B-SFT-Math-Multilingual
Mean over Chinese, Spanish, French, Arabic and Russian · 70 problems × 16 samples per language
- What it is. Qwen3-4B after full-parameter fine-tuning on SFT-Math-Multilingual-43k: 43,218 long chain-of-thought math solutions in six languages. Epoch-2 checkpoint.
- What it fixes. The released model solves Spanish, French and Arabic problems but writes its reasoning in English. This one reasons in the requested language: 39.8% → 99.4% of non-English responses, and best-of-16 delivery goes from 35.7% to 84.6%.
- What to use it for. A warm start for RL. On its own, 21.1% of non-English responses fall into a repetition loop; Qwen3-4B-MathRL-Multilingual-Gated and Qwen3-4B-MathRL-Multilingual-Additive remove that.
Results
| Released | SFT | RL additive | RL gated | |
|---|---|---|---|---|
| Answer correct | 76.2% | 61.4% | 60.1% | 61.7% |
| Reasoning in the requested language | 39.8% | 99.4% | 99.6% | 99.7% |
| Did not finish | 4.7% | 21.1% | 1.2% | 1.8% |
| Delivered (J@1) | 28.6% | 60.2% | 59.8% | 61.4% |
| Delivered, best of 16 (J@16) | 35.7% | 84.6% | 83.1% | 83.7% |
| Median response, tokens | 5,824 | 7,673 | 4,072 | 4,463 |
70 competition problems (30 AIME-2026 + 40 AMC-2023) per language from Multilingual-Math-Reasoning-Eval, 16 samples each at temperature 0.7, 24,576-token budget. A response is delivered when the answer is correct, the visible reasoning is in the requested language, and it terminates (J = C ∧ L ∧ T, scored per response). Tables show the mean over Chinese, Spanish, French, Arabic and Russian.
Per language · other benchmarks
| Correct | In language | Did not finish | J@1 | J@16 | Median tokens | |
|---|---|---|---|---|---|---|
| English | 71.8% | 100.0% | 3.2% | 71.7% | 94.3% | 5,369 |
| Chinese | 57.5% | 99.9% | 20.8% | 57.3% | 85.7% | 5,946 |
| Spanish | 64.8% | 99.6% | 12.3% | 64.6% | 87.1% | 7,044 |
| French | 64.9% | 99.0% | 12.9% | 64.6% | 87.1% | 7,512 |
| Arabic | 56.1% | 98.4% | 31.7% | 53.6% | 80.0% | 9,103 |
| Russian | 63.9% | 99.9% | 27.5% | 61.2% | 82.9% | 8,760 |
| Delivered (J), non-English mean | Released | SFT | RL additive | RL gated |
|---|---|---|---|---|
| PolyMath, 444 problems | 16.8% | 34.1% | 35.4% | 36.8% |
| MMLU-ProX-Lite, 588 questions | 24.0% | 49.0% | 56.2% | 55.5% |
Quick start
from datasets import load_dataset
from transformers import AutoModelForCausalLM, AutoTokenizer
name = "96kevinli29/Qwen3-4B-SFT-Math-Multilingual"
tok = AutoTokenizer.from_pretrained(name)
model = AutoModelForCausalLM.from_pretrained(name, torch_dtype="auto", device_map="auto")
# a French problem with a French instruction: "…en raisonnant entièrement en français."
prompt = load_dataset("96kevinli29/Multilingual-Math-Reasoning-Eval", "fr")["amc23"][0]["prompt"]
text = tok.apply_chat_template([{"role": "user", "content": prompt}], tokenize=False, add_generation_prompt=True)
inputs = tok(text, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=24576, do_sample=True, temperature=0.7)
print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
Qwen3 chat template with thinking on; the reasoning appears inside <think> … </think>. Give hard problems a large max_new_tokens. Loads with transformers 4.x and 5.x.
Prompt format in six languages
| Instruction that opens the user turn | |
|---|---|
| English | Solve the following math problem step by step, reasoning entirely in English. |
| Chinese | 请全程用中文逐步推理并解决以下数学问题。 |
| Spanish | Resuelve el siguiente problema matemático paso a paso, razonando enteramente en español. |
| French | Résous le problème de mathématiques suivant étape par étape, en raisonnant entièrement en français. |
| Arabic | حل المسألة الرياضية التالية خطوة بخطوة مع التفكير بالكامل باللغة العربية. |
| Russian | Решите следующую математическую задачу шаг за шагом, рассуждая полностью на русском языке. |
The full prompts (instruction, problem and answer format, all in the target language) are in the evaluation set.
Model family
| Stage | Checkpoint | |
|---|---|---|
| I · Release | Qwen/Qwen3-4B · Qwen/Qwen3-8B | solves the problem, reasons in English |
| II · SFT | Qwen3-4B-SFT-Math-Multilingual ← this model | reasons in the requested language, sometimes loops |
| II · SFT | Qwen3-8B-SFT-Math-Multilingual | the same result at 8B |
| III · RL | Qwen3-4B-MathRL-Multilingual-Gated | keeps the language, stops the looping |
| III · RL | Qwen3-4B-MathRL-Multilingual-Additive | keeps the language, stops the looping |
Data: SFT-Math-Multilingual-43k · SFT-Math-Multilingual-56k · DAPO-Math-Multilingual-6Lang · Multilingual-Math-Reasoning-Eval
Training
Each of 45K English OpenR1-Math traces is assigned one of six languages, translated by a locally served Qwen3-14B and filtered by quality gates. 5 epochs configured; epoch 2 is released, where held-out loss has flattened and looping is still moderate. Code: base-model-sft-verl.
Full recipe
| Objective | token-level cross-entropy over the whole response, reasoning included |
| Optimizer | AdamW, lr 2e-5 with cosine decay to 0.1×, warmup ratio 0.01, weight decay 0.1 |
| Batch · context | 16 traces · up to 32,768 tokens |
| Precision · clip | bfloat16 · gradient clip 1.0 |
| Hardware | 16 × A100-40GB on 4 nodes, MeluXina (LuxProvide) |
| Framework | verl SFT trainer, FSDP, full-parameter |
Limitations
- Looping: 21.1% of non-English responses do not finish within 24,576 tokens (31.7% in Arabic).
- Accuracy is below the released Qwen3-4B on the same problems (76.2% → 61.4%). The same drop appears after English-only SFT, so it is not caused by the multilingual mixture.
- Mathematics and six languages only; machine-translated training data; one seed.
Citation
@article{li2026posttraining,
title = {What Does Post-Training Change in Multilingual Reasoning?},
author = {Li, Hongyang and Li, Xiao and Wu, Caesar and Danoy, Gr{\'e}goire and Bouvry, Pascal},
journal = {arXiv preprint arXiv:2609.37104},
year = {2026}
}
@misc{qwen3-4b-sft-math-multilingual-2026,
title = {{Qwen3-4B-SFT-Math-Multilingual}: six-language long chain-of-thought math SFT of {Qwen3-4B}},
author = {Li, Hongyang and Li, Xiao and Wu, Caesar and Danoy, Gr{\'e}goire and Bouvry, Pascal and {Sea-Fill Community}},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/96kevinli29/Qwen3-4B-SFT-Math-Multilingual}},
note = {Maintained by Sea-Fill Community.}
}
Built and released by the authors together with the Sea-Fill Community, which maintains this release.
- Downloads last month
- 51
Model tree for 96kevinli29/Qwen3-4B-SFT-Math-Multilingual
Datasets used to train 96kevinli29/Qwen3-4B-SFT-Math-Multilingual
96kevinli29/SFT-Math-Multilingual-43k
Paper for 96kevinli29/Qwen3-4B-SFT-Math-Multilingual
Evaluation results
- Delivered J@1 (correct, in the requested language, terminated) on AIME-2026 + AMC-2023, five non-English languages (zh, es, fr, ar, ru)self-reported60.200
- Answer accuracy on AIME-2026 + AMC-2023, five non-English languages (zh, es, fr, ar, ru)self-reported61.400
- Reasoning in the requested language on AIME-2026 + AMC-2023, five non-English languages (zh, es, fr, ar, ru)self-reported99.400