Instructions to use oahzxl/LoopRes-Qwen3-1.7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use oahzxl/LoopRes-Qwen3-1.7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="oahzxl/LoopRes-Qwen3-1.7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("oahzxl/LoopRes-Qwen3-1.7B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use oahzxl/LoopRes-Qwen3-1.7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "oahzxl/LoopRes-Qwen3-1.7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "oahzxl/LoopRes-Qwen3-1.7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/oahzxl/LoopRes-Qwen3-1.7B
- SGLang
How to use oahzxl/LoopRes-Qwen3-1.7B 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 "oahzxl/LoopRes-Qwen3-1.7B" \ --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": "oahzxl/LoopRes-Qwen3-1.7B", "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 "oahzxl/LoopRes-Qwen3-1.7B" \ --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": "oahzxl/LoopRes-Qwen3-1.7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use oahzxl/LoopRes-Qwen3-1.7B with Docker Model Runner:
docker model run hf.co/oahzxl/LoopRes-Qwen3-1.7B
LoopRes-Qwen3-1.7B
A looped transformer on Qwen3-1.7B-Base. LoopRes applies a block of decoder layers several loop steps per token: a prelude runs once, the core layers loop under block attention residuals whose sources carry trained static keys and value queries, and a coda reads the last step out. This checkpoint runs 3 loop steps over layers 7-21 in 2 blocks of 7, each read reaching the previous step's blocks, and was trained for 12,000 steps at 16k tokens on the Qwen3-8B replies of LoopRes-Qwen3-SFT.
Use
The checkpoint loads through the LoopRes repository's loopres package (pip install -e . there), which
registers the loopres model type with transformers:
import loopres # registers LoopResForCausalLM; without it the config's model type is unknown
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("oahzxl/LoopRes-Qwen3-1.7B", torch_dtype="auto").cuda().eval()
tokenizer = AutoTokenizer.from_pretrained("oahzxl/LoopRes-Qwen3-1.7B")
text = tokenizer.apply_chat_template(
[{"role": "user", "content": "What is the remainder when $2^{2024}$ is divided by $7$?"}],
tokenize=False, add_generation_prompt=True, enable_thinking=True,
)
inputs = tokenizer(text, add_special_tokens=False, return_tensors="pt").to(model.device)
print(tokenizer.decode(model.generate(
**inputs, do_sample=True, temperature=0.6, top_p=0.95, top_k=20, max_new_tokens=32768,
)[0, inputs.input_ids.shape[1]:]))
Scores
At 32,768 new tokens, temperature 0.6, top-p 0.95, top-k 20; math benchmarks through math_verify,
HumanEval+ / MBPP+ pass@1 through EvalPlus. SFT is Qwen3-1.7B-Base trained on the same data at one step.
| benchmark | samples | SFT | LoopRes |
|---|---|---|---|
| AIME 2025 | 16 | 13.8 | 26.9 |
| AIME 2026 | 16 | 10.8 | 21.7 |
| AMC 2023 | 16 | 46.7 | 61.3 |
| OlympiadBench | 1 | 43.6 | 53.0 |
| MATH-500 | 1 | 73.8 | 82.2 |
| HumanEval+ (base/plus) | 4 | 62.7 / 57.6 | 75.5 / 71.2 |
| MBPP+ (base/plus) | 2 | 64.4 / 55.4 | 79.4 / 67.3 |
- Downloads last month
- -
Model tree for oahzxl/LoopRes-Qwen3-1.7B
Base model
Qwen/Qwen3-1.7B-Base