Instructions to use junshim/When2Think-1.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use junshim/When2Think-1.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="junshim/When2Think-1.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("junshim/When2Think-1.5B") model = AutoModelForCausalLM.from_pretrained("junshim/When2Think-1.5B", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use junshim/When2Think-1.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "junshim/When2Think-1.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "junshim/When2Think-1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/junshim/When2Think-1.5B
- SGLang
How to use junshim/When2Think-1.5B 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 "junshim/When2Think-1.5B" \ --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": "junshim/When2Think-1.5B", "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 "junshim/When2Think-1.5B" \ --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": "junshim/When2Think-1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use junshim/When2Think-1.5B with Docker Model Runner:
docker model run hf.co/junshim/When2Think-1.5B
When2Think
When2Think-1.5B is a post-trained hybrid reasoning model that learns both whether to reason explicitly and how much reasoning to allocate to each problem.
The model encourages direct answering on easier instances while preserving extended reasoning on harder ones. Unlike uniform length-compression methods, When2Think treats reasoning depth as an instance-adaptive resource.
Highlights
- Adaptive Think/NoThink Behavior: Learns when to answer directly and when to invoke explicit multi-step reasoning.
- Accuracy-Efficiency Trade-off: Reduces unnecessary reasoning without uniformly suppressing useful reasoning on difficult problems.
- Standalone Deployment: Requires only the released checkpoint for generation.
Model Details
Model Description
When2Think-1.5B is an RLVR-post-trained version of deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B The model learns two reasoning behaviors:
- NoThink: Direct answering without an extended explicit reasoning trace
- Think: Explicit multi-step reasoning followed by a final answer
When2Think is trained with Instance-level Difficulty-Aware Control (IDAC), which regulates reasoning depth using pre-computed reference accuracy and token-usage statistics. Batch-Wise Standardization (BWS) converts the resulting trajectory rewards into standardized advantages, enabling stable critic-free PPO-style optimization.
Importance sampling is used during post-training to balance exploration between Think and NoThink. These training components are not required at inference time. The released model generates its learned hybrid reasoning behavior as a standalone causal language model.
Model Sources
Uses
Direct Use
When2Think-1.5B is intended for:
- Mathematical problem solving
- Adaptive direct-answer and explicit-reasoning generation
- Research on efficient reasoning models
- Analysis of Think/NoThink mode selection
The model can be loaded as a standard causal language model using Hugging Face Transformers. No separate router, verifier, critic, difficulty estimator, reward model, or reference policy is required for inference.
Downstream Use
The checkpoint may be used as a starting point for:
- Continued post-training on verifiable reasoning tasks
- Adaptation to mathematical, symbolic, coding, or scientific reasoning
- Research on adaptive reasoning policies
- Studies of direct-answer and explicit-reasoning behavior
Additional fine-tuning may alter the learned Think/NoThink balance, response length, and reasoning-depth behavior.
How to Get Started with the Model
Use the code below to get started with the model.
by Transformers Pipeline
from transformers import pipeline
model_path = "junshim/When2Think-1.5B"
prompt = "Find the value of $x$ that satisfies the equation $4x+5 = 6x+7$."
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": prompt}
]
generator = pipeline(
"text-generation",
model=model_path,
device_map="auto",
dtype="auto"
)
outputs = generator(
messages,
max_new_tokens=512,
clean_up_tokenization_spaces=False
)
by Transformers
from accelerate import Accelerator
from transformers import AutoModelForCausalLM, AutoTokenizer
accelerator = Accelerator()
device = accelerator.device
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype="auto",
device_map=device
)
tokenizer = AutoTokenizer.from_pretrained(model_path)
print(model.generation_config, device)
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer([text], return_tensors="pt").to(device)
generated_ids = model.generate(
**inputs,
max_new_tokens=512
)
output_text = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
Output Parsing
import re
ASSISTANT_RE = re.compile(
r"<|Assistant|>(.*?)(?=<|User|>|<|end of sentence|>|$)",
re.DOTALL,
)
THINK_RE = re.compile(r"<think>(.*?)</think>", re.DOTALL)
def parse_deepseek_r1(text: str) -> list[dict]:
dialogue = []
for match in ASSISTANT_RE.finditer(text):
assistant = match.group(1).strip()
think = THINK_RE.search(assistant)
if think:
reasoning = think.group(1).strip()
content = (
assistant[:think.start()] + assistant[think.end():]
).strip()
else:
reasoning = None
content = assistant
dialogue.append({
"reasoning": reasoning,
"content": content,
})
return dialogue
parse_deepseek_r1(output_text)
Evaluation
Testing Data, Factors & Metrics
Testing Data
[More Information Needed]
Factors
[More Information Needed]
Metrics
[More Information Needed]
Results
[More Information Needed]
Summary
Citation
BibTeX:
@misc{shim2026when2think,
title = {When2Think: Learning Difficulty-Aware Length Control for Efficient Hybrid Reasoning Models},
author = {Jaejun Shim and HyunJin Kim and Young Jin Kim and JinYeong Bak},
year = {2026},
eprint = {2609.19671},
url = {https://arxiv.org/abs/2609.19671}
}
More Information
- Begin of Sentence: <|begin▁of▁sentence|>
- End of Sentence: <|end▁of▁sentence|>
- Pad: <|end▁of▁sentence|>
- Begin of Thinking:
- End of Thinking:
- User Role: <|User|>
- Assistant: <|Assistant|>
- Max position embeddings (length): 131072
Model Card Contact
[More Information Needed]
- Downloads last month
- -
Model tree for junshim/When2Think-1.5B
Base model
deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B