Text Generation
Transformers
Safetensors
English
qwen3
math
reasoning
long-cot
thinking
sft
distillation
Run this model with HF Jobs
Run 96kevinli29/Qwen3-4B-MathThink-Distill on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/96kevinli29/Qwen3-4B-MathThink-Distill. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/96kevinli29/Qwen3-4B-MathThink-Distill on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/96kevinli29/Qwen3-4B-MathThink-Distill. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/96kevinli29/Qwen3-4B-MathThink-Distill. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use 96kevinli29/Qwen3-4B-MathThink-Distill with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 96kevinli29/Qwen3-4B-MathThink-Distill with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="96kevinli29/Qwen3-4B-MathThink-Distill")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("96kevinli29/Qwen3-4B-MathThink-Distill", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use 96kevinli29/Qwen3-4B-MathThink-Distill with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "96kevinli29/Qwen3-4B-MathThink-Distill" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "96kevinli29/Qwen3-4B-MathThink-Distill", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/96kevinli29/Qwen3-4B-MathThink-Distill
- SGLang
How to use 96kevinli29/Qwen3-4B-MathThink-Distill 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-MathThink-Distill" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "96kevinli29/Qwen3-4B-MathThink-Distill", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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-MathThink-Distill" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "96kevinli29/Qwen3-4B-MathThink-Distill", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use 96kevinli29/Qwen3-4B-MathThink-Distill with Docker Model Runner:
docker model run hf.co/96kevinli29/Qwen3-4B-MathThink-Distill
|
Download README.md from 96kevinli29/Qwen3-4B-MathThink-Distill: direct link, hf CLI and curl.
- Browser
- Download file 2.19 kB
-
https://huggingface.co/96kevinli29/Qwen3-4B-MathThink-Distill/resolve/main/README.md
- Command line
-
hf download hf://96kevinli29/Qwen3-4B-MathThink-Distill/README.md
-
curl -L -o README.md https://huggingface.co/96kevinli29/Qwen3-4B-MathThink-Distill/resolve/main/README.md
2.19 kB
| license: apache-2.0 | |
| base_model: Qwen/Qwen3-4B-Base | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: [qwen3, math, reasoning, long-cot, thinking, sft, distillation] | |
| language: [en] | |
| # Qwen3-4B-MathThink-Distill | |
| Four **Qwen3-4B-Base** models fine-tuned to solve math problems with long step-by-step reasoning, one per source of reasoning traces. | |
| Each model thinks inside a `<think> … </think>` block and then writes a final answer with `\boxed{}`. Each folder is a complete model. | |
| ## Models and results | |
| Accuracy in %: thinking mode, temperature 0.6, top-p 0.95, top-k 20, 16,384-token budget, strict answer matching | |
| (a response cut off before the answer counts as wrong). AIME is avg@32, GPQA Diamond is avg@4. | |
| | Folder | Source of reasoning traces | AIME 2025 | AIME 2026 | GPQA Diamond | | |
| |---|---|---|---|---| | |
| | `deepseek-r1` | DeepSeek-R1 (OpenR1-Math-220k) | 19.8 | 20.6 | 26.5 | | |
| | `qwen3.8-27b` | Qwen3.8-27B | 8.0 | 7.8 | 24.5 | | |
| | `gemma-4-26b-a4b` | Gemma 4 26B-A4B | 8.0 | 8.3 | 6.9 | | |
| | `inkling-2-mini` | Inkling 2 Mini | 8.0 | 5.1 | 16.5 | | |
| ## Training | |
| - Data: 5,314 verified-correct math traces per model. | |
| - Full fine-tuning, 5 epochs (final checkpoint, step 830), batch size 32, learning rate 2e-5, sequence length up to 16k. | |
| - Trainable weights were stored in bfloat16 during training, so many small updates were rounded away. Treat these models as a lower-precision training baseline. | |
| - Prompt suffix: `Please reason step by step, and put your final answer within \boxed{}.` | |
| - End-of-sequence token set to `<|im_end|>`. | |
| ## Usage | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| repo, sub = "96kevinli29/Qwen3-4B-MathThink-Distill", "deepseek-r1" | |
| tok = AutoTokenizer.from_pretrained(repo, subfolder=sub) | |
| model = AutoModelForCausalLM.from_pretrained(repo, subfolder=sub, torch_dtype="bfloat16", device_map="auto") | |
| ``` | |
| For vLLM, download one folder and pass its local path. | |
| ## Limitations | |
| Many responses to hard problems reach the token budget before answering, and some get stuck repeating themselves. | |
| Math-only training; not tuned for chat safety or tool use. The traces come from third-party models; check their terms for your use. | |