Sparse Layers are Critical to Scaling Looped Language Models
Paper • 2605.09165 • Published
How to use ml-ryanlee/looped-16x2-d640-1e18 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ml-ryanlee/looped-16x2-d640-1e18", trust_remote_code=True) # Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("ml-ryanlee/looped-16x2-d640-1e18", trust_remote_code=True, device_map="auto")How to use ml-ryanlee/looped-16x2-d640-1e18 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ml-ryanlee/looped-16x2-d640-1e18"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ml-ryanlee/looped-16x2-d640-1e18",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/ml-ryanlee/looped-16x2-d640-1e18
How to use ml-ryanlee/looped-16x2-d640-1e18 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ml-ryanlee/looped-16x2-d640-1e18" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ml-ryanlee/looped-16x2-d640-1e18",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "ml-ryanlee/looped-16x2-d640-1e18" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ml-ryanlee/looped-16x2-d640-1e18",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use ml-ryanlee/looped-16x2-d640-1e18 with Docker Model Runner:
docker model run hf.co/ml-ryanlee/looped-16x2-d640-1e18
32-layer compute-optimal checkpoint for Sparse Layers are Critical to Scaling Looped Language Models (arXiv:2605.09165).
| architecture | looped |
| d_model | 640 |
| effective layers | 32 |
| compute budget | 1e18 FLOPs |
| training steps | 45,632 |
| parameters (stored) | 143,627,520 |
| peak LR | 0.005 |
| batch size | 16 |
| muP width_ratio | 2.5 (d_base=256) |
| final val loss | n/a |
This width is the architecture's measured minimum on a ten-rung isoFLOP sweep (d256-d1408) at 1e18 FLOPs.
from transformers import AutoModelForCausalLM, AutoTokenizer
m = AutoModelForCausalLM.from_pretrained(
"ml-ryanlee/looped-32L-d640-1e18", trust_remote_code=True)
tok = AutoTokenizer.from_pretrained("gpt2")
Pass max_length=1024 when evaluating — the RoPE buffer is sized to the training context.