Run this model with HF Jobs
Run OpenModel-Labs/TinyLM-1-Preview 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/OpenModel-Labs/TinyLM-1-Preview. 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/OpenModel-Labs/TinyLM-1-Preview 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/OpenModel-Labs/TinyLM-1-Preview. 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/OpenModel-Labs/TinyLM-1-Preview. 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 OpenModel-Labs/TinyLM-1-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenModel-Labs/TinyLM-1-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpenModel-Labs/TinyLM-1-Preview", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("OpenModel-Labs/TinyLM-1-Preview", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenModel-Labs/TinyLM-1-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenModel-Labs/TinyLM-1-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenModel-Labs/TinyLM-1-Preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OpenModel-Labs/TinyLM-1-Preview
- SGLang
How to use OpenModel-Labs/TinyLM-1-Preview 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 "OpenModel-Labs/TinyLM-1-Preview" \ --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": "OpenModel-Labs/TinyLM-1-Preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "OpenModel-Labs/TinyLM-1-Preview" \ --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": "OpenModel-Labs/TinyLM-1-Preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use OpenModel-Labs/TinyLM-1-Preview with Docker Model Runner:
docker model run hf.co/OpenModel-Labs/TinyLM-1-Preview
TinyLM-1-Preview
122.6M-parameter decoder-only LM with a hybrid GDN + NSA attention pattern, 32K context. Preview release: weights exported from an in-progress training run (step 46,226 ≈ 24.24B tokens).
Architecture
| Layers | 16, pattern GGGNGGGNGGGNGGGN (12× GatedDeltaNet, 4× NSA) |
| d_model | 768 |
| FFN | 1408 (SwiGLU-half, gated RMSNorm) |
| GDN heads | 6 × 128 dim (fla GatedDeltaNet, chunk mode, short conv 4) |
| NSA heads | 16 Q / 2 KV × 64 dim, 3-way gated branches |
| NSA branches | compressed (block 32, stride 16) + selected (block 64, top-16) + sliding window 512 |
| Context | 32,768 tokens |
| Vocab | 32,768 BPE (custom tokenizer, 32 special tokens) |
| Params | 122,573,200 |
| Precision | bf16 weights (A_log / dt_bias kept fp32, as in training) |
Each NSA layer scores compressed blocks, force-includes the initial + 2 local blocks, and selects 16 blocks per token via an own Triton kernel (fp32 torch reference fallback included). GDN layers are linear-time sequence mixers from flash-linear-attention.
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("Bc-AI/TinyLM-1-Preview")
model = AutoModelForCausalLM.from_pretrained(
"Bc-AI/TinyLM-1-Preview",
torch_dtype=torch.bfloat16,
trust_remote_code=True,
).cuda()
ids = tok.encode("The quick brown fox", return_tensors="pt").cuda()
out = model.generate(ids, max_new_tokens=64, do_sample=False)
print(tok.decode(out[0]))
Requirements: torch>=2.5, transformers>=4.46 (tested with 5.25). flash-linear-attention (tested with 0.6) is optional — used as a fast path when installed; otherwise a built-in pure-PyTorch GDN fallback runs on CPU or GPU. triton is only needed for the fla fast path (CUDA).
Generation re-processes the full sequence each step (no KV cache — use_cache=False by design);
this is a preview, not a serving build.
Training (stage 1, in progress)
- Token budget 25B @ 524,288 tokens/step, warmup 1000, flat LR 1.5e-3 (WSD, no decay yet)
- Optimizer: Muon (matrices ≥64², Newton–Schulz 5-step) + AdamW (embeddings/scalars), fp32 masters
- Data mix: 50% web (
IFM/TxT360-v2), 25% code (openbmb/UltraData-Code), 25% math (openbmb/UltraData-Math) - Loss: chunked CE + 1e-4 z-loss
- Checkpoint this export came from: ModelScope
Bc_AI_official/tinylm-1-checkpoints, rungdn-nsa-120m-s1,LATEST.json→ step 46226 / 24,235,737,088 tokens
Files
| File | What |
|---|---|
model.safetensors |
weights only, 245 MB, 278 tensors |
config.json |
model_type: tinylm + auto_map (remote code) |
configuration_TinyLM.py / modeling_TinyLM.py |
transformers remote code |
tokenizer.json + configs |
32K BPE, `< |
Notes
- Training/monitoring checkpoints (masters + optimizer, ~1.08 GB each) stay on ModelScope; this repo carries inference weights only.
- Not aligned/instruct-tuned. Base LM preview — outputs will be raw internet/code/math continuation.
- Downloads last month
- -
docker model run hf.co/OpenModel-Labs/TinyLM-1-Preview