Instructions to use AmareshHebbar/ShortThink_Qwen3_1.7B_DPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AmareshHebbar/ShortThink_Qwen3_1.7B_DPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AmareshHebbar/ShortThink_Qwen3_1.7B_DPO") 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("AmareshHebbar/ShortThink_Qwen3_1.7B_DPO") model = AutoModelForCausalLM.from_pretrained("AmareshHebbar/ShortThink_Qwen3_1.7B_DPO", 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 AmareshHebbar/ShortThink_Qwen3_1.7B_DPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AmareshHebbar/ShortThink_Qwen3_1.7B_DPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AmareshHebbar/ShortThink_Qwen3_1.7B_DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AmareshHebbar/ShortThink_Qwen3_1.7B_DPO
- SGLang
How to use AmareshHebbar/ShortThink_Qwen3_1.7B_DPO 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 "AmareshHebbar/ShortThink_Qwen3_1.7B_DPO" \ --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": "AmareshHebbar/ShortThink_Qwen3_1.7B_DPO", "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 "AmareshHebbar/ShortThink_Qwen3_1.7B_DPO" \ --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": "AmareshHebbar/ShortThink_Qwen3_1.7B_DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AmareshHebbar/ShortThink_Qwen3_1.7B_DPO with Docker Model Runner:
docker model run hf.co/AmareshHebbar/ShortThink_Qwen3_1.7B_DPO
ShortThink DPO (Qwen3 1.7B)
Reasoning models spend far more tokens than they need on easy problems. ShortThink teaches Qwen/Qwen3-1.7B to keep its accuracy while thinking less, and to compress easy problems more than hard ones. This model is one of six in the ShortThink collection, all trained on the same self generated data with a different algorithm, and all evaluated on the same table.
Method
Direct Preference Optimization on top of the SFT model. Chosen is the shortest correct trace, rejected is the longest correct trace for the same question, with the SFT model as the frozen reference.
Training data: AmareshHebbar/ShortThink_Traces_Qwen3_1.7B. Weights: LoRA on all linear layers, merged into full bf16 safetensors.
Why finetune instead of prompting
A prompt can ask for brevity, and the base model can switch thinking off entirely. The table below includes both of those, plus budget forcing (cap the thinking at 1024 tokens and force an answer), so you can see exactly what training buys over prompting.
Results
All rows use the same prompts, sampling settings and math_verify grading. MATH500 and GSM8K use 1 samples per problem, AIME 2024 uses 4. Tokens are generated tokens including the thinking. Tokens per correct is total tokens divided by correct answers, averaged over MATH500 and GSM8K. Latency is measured at batch size 1 with vLLM; cost assumes $1.0/hour GPU at the measured batched throughput.
| Model | MATH500 acc | MATH500 tokens | GSM8K acc | GSM8K tokens | Tokens per correct | Token change vs thinking base | AIME24 acc | MMLU | Latency p50 (s) | Cost per 1k queries (USD) |
|---|---|---|---|---|---|---|---|---|---|---|
| Qwen3 1.7B (thinking) | 70.0 | 3958 | 87.5 | 2205 | 4087 | same | 36.8 | 0.419 | ||
| Qwen3 1.7B (thinking + concise prompt) | 78.6 | 3061 | 88.6 | 1370 | 2721 | 28.1% fewer | 23.4 | 0.277 | ||
| Qwen3 1.7B (no thinking) | 72.8 | 901 | 80.4 | 313 | 813 | 80.3% fewer | 6.3 | 0.056 | ||
| Qwen3 1.7B (budget forcing 1024) | 45.4 | 1473 | 70.0 | 1219 | 2494 | 56.3% fewer | 10.6 | 0.101 | ||
| ShortThink SFT | 73.4 | 3767 | 89.0 | 2041 | 3713 | 5.8% fewer | 44.2 | 0.386 | ||
| ShortThink DPO | 81.8 | 2831 | 88.9 | 1288 | 2455 | 33.2% fewer | 27.9 | 0.236 | ||
| ShortThink GRPO | 83.0 | 2016 | 85.7 | 612 | 1571 | 57.4% fewer | 15.4 | 0.132 | ||
| ShortThink TIES | 83.0 | 2204 | 87.8 | 818 | 1793 | 51.0% fewer | 12.3 | 0.160 |
Compression by difficulty (MATH500)
| MATH level | Base acc | This model acc | Base tokens | This model tokens | Token change |
|---|---|---|---|---|---|
| Level 1 | 95.3 | 95.3 | 2507 | 1388 | 44.6% fewer |
| Level 2 | 91.1 | 94.4 | 2935 | 1822 | 37.9% fewer |
| Level 3 | 78.1 | 91.4 | 3687 | 2313 | 37.3% fewer |
| Level 4 | 67.2 | 82.0 | 4176 | 3076 | 26.3% fewer |
| Level 5 | 44.0 | 61.2 | 5114 | 4146 | 18.9% fewer |
Training hyperparameters
| init | sft |
| mode | lora |
| lr | 5e-06 |
| epochs | 1 |
| micro_batch | 1 |
| grad_accum | 16 |
| warmup_ratio | 0.05 |
| max_len | 4608 |
| logits_chunk | 1024 |
| beta | 0.1 |
| max_examples | 1500 |
| lora_r | 64 |
| lora_alpha | 128 |
| lora_dropout | 0.0 |
Usage
from vllm import LLM, SamplingParams
llm = LLM("AmareshHebbar/ShortThink_Qwen3_1.7B_DPO")
tok = llm.get_tokenizer()
question = "What is 15% of 80?"
msgs = [{"role": "user", "content": question + "\nPlease reason step by step, and put your final answer within \\boxed{}."}]
prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True, enable_thinking=True)
out = llm.generate([prompt], SamplingParams(temperature=0.6, top_p=0.95, top_k=20, max_tokens=8192))
print(out[0].outputs[0].text)
Use the same prompt format and sampling settings as the base model's thinking mode.
Files
The repository root holds merged bf16 safetensors. adapter/ holds the LoRA adapter where one was trained, training/ holds loss curves and logs, and eval/ holds raw evaluation results and sample generations.
- Downloads last month
- 279
Model tree for AmareshHebbar/ShortThink_Qwen3_1.7B_DPO
Base model
Qwen/Qwen3-1.7B-Base
