Run this model with HF Jobs
Run CharlesDDDD/DRV-Qwen3-1.7B-loop2 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/CharlesDDDD/DRV-Qwen3-1.7B-loop2. 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/CharlesDDDD/DRV-Qwen3-1.7B-loop2 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/CharlesDDDD/DRV-Qwen3-1.7B-loop2. 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/CharlesDDDD/DRV-Qwen3-1.7B-loop2. 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 CharlesDDDD/DRV-Qwen3-1.7B-loop2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CharlesDDDD/DRV-Qwen3-1.7B-loop2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CharlesDDDD/DRV-Qwen3-1.7B-loop2", trust_remote_code=True) 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("CharlesDDDD/DRV-Qwen3-1.7B-loop2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CharlesDDDD/DRV-Qwen3-1.7B-loop2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CharlesDDDD/DRV-Qwen3-1.7B-loop2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CharlesDDDD/DRV-Qwen3-1.7B-loop2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CharlesDDDD/DRV-Qwen3-1.7B-loop2
- SGLang
How to use CharlesDDDD/DRV-Qwen3-1.7B-loop2 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 "CharlesDDDD/DRV-Qwen3-1.7B-loop2" \ --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": "CharlesDDDD/DRV-Qwen3-1.7B-loop2", "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 "CharlesDDDD/DRV-Qwen3-1.7B-loop2" \ --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": "CharlesDDDD/DRV-Qwen3-1.7B-loop2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CharlesDDDD/DRV-Qwen3-1.7B-loop2 with Docker Model Runner:
docker model run hf.co/CharlesDDDD/DRV-Qwen3-1.7B-loop2
DRV-Qwen3-1.7B-loop2
Main. Block repeated 2 times.
What this is
Qwen3-1.7B-Base, continued-pretrained for about 20B tokens (one pass over a web / PDF / code / agent-trajectory mix, 16K-token sequences, AdamW, peak LR 3e-4 with cosine decay). In the looped models, layers 8-19 (12 of the 28 layers, counting from 0) form a block that runs several times in a row with the same weights, so the model gets more computation per token without more parameters. Layers 0-7 run once before the block, layers 20-27 once after it.
How passes are connected: the first pass reads the output e of layer 7. Every later pass
reads e + g * (previous pass output - e), where g is one learned number per hidden
channel (model.loop_gate). With g = 0 the model is exactly the original Qwen3. The
ablation-loop3-chained* models connect passes differently (see their description).
Unless the description says otherwise, training also put a small loss (weight 0.0555) on the prediction made after each intermediate pass, so stopping early still gives sensible output.
Part of the Depth Recurrent Vector collection; the reference model without looping
is CharlesDDDD/DRV-Qwen3-1.7B-midtrain-noloop.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
name = "CharlesDDDD/DRV-Qwen3-1.7B-loop2"
tok = AutoTokenizer.from_pretrained(name)
model = AutoModelForCausalLM.from_pretrained(name, dtype="bfloat16", trust_remote_code=True).cuda()
ids = tok("The capital of France is", return_tensors="pt").input_ids.cuda()
out = model.generate(ids, max_new_tokens=20) # trained number of passes
out = model.generate(ids, max_new_tokens=20, num_loops=4) # any other number of passes
- Requires
trust_remote_code=True(tested with transformers 5.14). Each pass keeps its own KV cache, so with 3 passes the cache is about 1.9x that of a standard Qwen3-1.7B. - vLLM and other serving engines do not support this architecture yet.
- These are base models (no instruction tuning). The HF implementation matches our training code to within 0.003 nats of loss at every number of passes.
Test loss by number of passes (trained with 2)
| passes | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| loss | 1.1832 | 1.1242 | 1.1295 | 1.1333 | 1.1368 | 1.1387 | 1.1399 | 1.1407 |
Held-out test set from the training data mix; lower is better. The control without looping gets 1.1460.
Averaged-weights version (ema branch)
The ema branch of this repo holds a running average of the weights over training, which is
usually slightly better than the final weights. Recent steps count more than early ones (power
EMA with gamma = 36.7: step t gets weight proportional to t^36.7, so the average effectively
covers the last few percent of training). For models that average several runs, the ema
branch averages those runs' averaged weights. Same architecture and code, only the weights differ:
model = AutoModelForCausalLM.from_pretrained("CharlesDDDD/DRV-Qwen3-1.7B-loop2", revision="ema", dtype="bfloat16", trust_remote_code=True)
| passes | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
final weights (main) |
1.1832 | 1.1242 | 1.1295 | 1.1333 | 1.1368 | 1.1387 | 1.1399 | 1.1407 |
averaged weights (ema) |
1.1798 | 1.1208 | 1.1260 | 1.1296 | 1.1330 | 1.1348 | 1.1360 | 1.1368 |
- Downloads last month
- 312
Model tree for CharlesDDDD/DRV-Qwen3-1.7B-loop2
Base model
Qwen/Qwen3-1.7B-Base