Instructions to use 96kevinli29/Qwen3-4B-Multilingual-Reasoning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 96kevinli29/Qwen3-4B-Multilingual-Reasoning with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="96kevinli29/Qwen3-4B-Multilingual-Reasoning") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("96kevinli29/Qwen3-4B-Multilingual-Reasoning") model = AutoModelForCausalLM.from_pretrained("96kevinli29/Qwen3-4B-Multilingual-Reasoning") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use 96kevinli29/Qwen3-4B-Multilingual-Reasoning with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "96kevinli29/Qwen3-4B-Multilingual-Reasoning" # 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-Multilingual-Reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/96kevinli29/Qwen3-4B-Multilingual-Reasoning
- SGLang
How to use 96kevinli29/Qwen3-4B-Multilingual-Reasoning 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-Multilingual-Reasoning" \ --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-Multilingual-Reasoning", "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-Multilingual-Reasoning" \ --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-Multilingual-Reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use 96kevinli29/Qwen3-4B-Multilingual-Reasoning with Docker Model Runner:
docker model run hf.co/96kevinli29/Qwen3-4B-Multilingual-Reasoning
Qwen3-4B · Multilingual Reasoning — thinks in 6 languages
A Qwen3-4B whose chain-of-thought is written in the target language — English, Chinese, Spanish,
French, Arabic, Russian — not just the final answer. Standard reasoning models silently think in
English and translate only the result; this model produces its <think>...</think> reasoning natively
in each language, making multilingual math reasoning transparent and language-consistent.
Model details
- Base model:
Qwen/Qwen3-4B(official post-trained), not Qwen3-4B-Base. - Fine-tuning: SFT on a balanced 6-language long chain-of-thought math set (
SFT-Math-45k-mling6, 43k problems, one language per problem, round-robin), 2 epochs. (Internal name:Qwen3-4B-mling6-SFT-ep2.) - Architecture:
Qwen3ForCausalLM, 4B params, 36 layers, hidden 2560, vocab 151,936, context 40,960. - Languages: English, Chinese, Spanish, French, Arabic, Russian.
- Format: thinking model — emits a
<think>...</think>trace, then the answer.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
name = "96kevinli29/Qwen3-4B-Multilingual-Reasoning"
tok = AutoTokenizer.from_pretrained(name)
model = AutoModelForCausalLM.from_pretrained(name, torch_dtype="bfloat16", device_map="auto")
msgs = [{"role": "user", "content": "Решите задачу шаг за шагом, рассуждая полностью на русском языке.\n\n..."}]
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, enable_thinking=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=24576, temperature=0.7)
print(tok.decode(out[0][inputs.shape[1]:]))
To get in-language reasoning, prompt the model in the target language (input language drives the reasoning language).
Notes & limitations
- On some scripts (notably Arabic and Russian) genuine in-language reasoning can exhibit generation-stability issues (looping / not terminating within the token budget). Read accuracy together with generation-completion rate.
- Companion RL prompt set for improving stability:
96kevinli29/DAPO-Math-Multilingual-6Lang.
Training data & attribution
- Base model:
Qwen/Qwen3-4B(official post-trained). - SFT data source: built by translating English long chain-of-thought traces from
OpenR1-Math (
open-r1/OpenR1-Math-220k) (via a 45k English subset) into the five non-English languages with Qwen3-14B (faithful, paragraph-chunked; LaTeX /\boxed{}/<think>tags preserved). English traces pass through unchanged. Please cite Qwen3 and OpenR1-Math as upstream sources.
- Downloads last month
- 189