Instructions to use tyzhu/open-loopify-Qwen3-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tyzhu/open-loopify-Qwen3-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tyzhu/open-loopify-Qwen3-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tyzhu/open-loopify-Qwen3-4B") model = AutoModelForCausalLM.from_pretrained("tyzhu/open-loopify-Qwen3-4B", 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 tyzhu/open-loopify-Qwen3-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tyzhu/open-loopify-Qwen3-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tyzhu/open-loopify-Qwen3-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tyzhu/open-loopify-Qwen3-4B
- SGLang
How to use tyzhu/open-loopify-Qwen3-4B 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 "tyzhu/open-loopify-Qwen3-4B" \ --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": "tyzhu/open-loopify-Qwen3-4B", "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 "tyzhu/open-loopify-Qwen3-4B" \ --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": "tyzhu/open-loopify-Qwen3-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tyzhu/open-loopify-Qwen3-4B with Docker Model Runner:
docker model run hf.co/tyzhu/open-loopify-Qwen3-4B
open-loopify-Qwen3-4B
Qwen3-4B-Base with a retrofitted loop — layers 13–21 run three times, 54 blocks of compute per token instead of 36, no new parameters — mid-trained on 1.57B tokens of open reasoning traces.
It ships as an ordinary Qwen3 checkpoint: the loop is unrolled into 54 layers, so transformers and
vLLM load it with no custom code. Trained with open-loopify.
Results
Zero-shot, chat template, temperature 0.6, top-p 0.95, up to 16k generated tokens; AIME, HMMT and AMC averaged over 8 samples per problem. All models scored the same way, with open-loopify's evaluation script.
| model | AIME 2024 | AIME 2025 | HMMT Feb 2025 | AMC 2023 | MATH-500 | GPQA-Diamond |
|---|---|---|---|---|---|---|
| Qwen3-4B-Base | 9.6 | 5.0 | 0.4 | 42.5 | 68.6 | 33.8 |
| open-loopify-Qwen3-4B | 42.5 | 36.7 | 22.5 | 80.3 | 90.4 | 37.9 |
| Qwen3-4B (official, with large-scale RL) | 62.1 | 47.1 | 32.9 | 88.4 | 94.0 | 53.5 |
The model reasons at length; with a 28k-token budget it reaches 50.0 on AIME 2024, 41.2 on AIME 2025 and 24.6 on HMMT Feb 2025.
Use
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "tyzhu/open-loopify-Qwen3-4B"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16).cuda()
question = "What is the sum of all positive divisors of 36?"
prompt = f"{question}\nPlease reason step by step, and put your final answer within \\boxed{{}}."
inputs = tok.apply_chat_template([{"role": "user", "content": prompt}], add_generation_prompt=True,
return_dict=True, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=16384) # samples at temperature 0.6, top-p 0.95 by default
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Or serve it: vllm serve tyzhu/open-loopify-Qwen3-4B.
Give it room to think: answers often run 5k–15k tokens.
Notes
- Use it as shipped. The loop is baked in at three passes, the count it was trained with. Rebuilding it with fewer passes breaks the model (with one pass, AIME 2024 drops below 1%).
- Training: 3000 steps × 524,288 tokens at 16k context, AdamW, learning rate 3e-5 with cosine decay, on OpenThoughts3-1.2M (traces cut off by their generator's 16k limit removed) and OpenR1-Math-220k, 2:1 in tokens.
- Not trained with reinforcement learning; no safety tuning beyond the base model's.
License
Apache-2.0, as Qwen3-4B-Base and the training data.
- Downloads last month
- 9
Model tree for tyzhu/open-loopify-Qwen3-4B
Base model
Qwen/Qwen3-4B-Base