Hosted pretraining is in beta. Contact Prime support if dispatch is refused.
prime-rl pretraining on Prime’s hosted GPU clusters. The trainer starts from randomly initialized weights and learns next-token prediction on text you tokenize ahead of time. You tokenize your corpus into shards, put them on a volume, and dispatch; the trainer reads the shards from the volume.
This walkthrough pretrains a Qwen3-0.6B-sized model on TinyStories on one 8-GPU node. For pretraining on your own infrastructure, see prime-rl’s Pretraining guide.
Prerequisites
prime CLI v0.20.1 or later. Older versions don’t read mode and send a pretraining config as SFT, and it fails validation.
- A Prime account with hosted training access.
- A model in the cluster model cache (
prime train models) whose architecture and tokenizer you want. Pretraining reads only the model’s config and tokenizer, never its weights, so any cached checkpoint of the right architecture works. - datatrove to tokenize your corpus:
pip install "datatrove[io,processing]".
1. Tokenize your corpus
prime-rl does not tokenize. It reads the shards datatrove’sDocumentTokenizer writes: *.ds token files, each with a .ds.index and a .ds.metadata. Tokenize with the same tokenizer as the model you will train, and set eos_token to the tokenizer’s end-of-text token so documents stay separated. For Qwen that is <|endoftext|>, not <|im_end|>.
tinystories/train/ and tinystories/val/. Keep validation documents in their own folder.
2. Put the shards on a volume
datasets/tinystories/train and datasets/tinystories/val on the volume (a trailing / means “into this folder”). Size the volume for the shards plus the checkpoints the run keeps: a checkpoint is about 11 to 12 bytes per parameter, so about 7 GB for a 0.6B model. See Choose a size.
A running run holds its volume’s writer lock: while a run is active on a volume, dispatching a second run against it fails with an “in use by a run” error. Give concurrent runs their own volume (the same dataset can be uploaded to each).
For a corpus too large to upload from your machine, open a shell on the volume (prime volumes ssh research --read-write) and tokenize there, or import it from S3.
3. Write the config
The top-levelmode = "pretrain" makes this a pretraining run. Save this as pretrain.toml:
data.pathslists folders on the volume, relative to its root or as absolute/volume/...paths. Every shard in them forms one token pool, read inseq_lenwindows in a new random order each epoch.- The weights start from the architecture’s own initialization.
optim.lrdefaults to1e-3, with a 10-step linear warmup. output_diris set by the platform; leave it out.
[data] and [val] option.
4. Dispatch
mode and validates the config against prime-rl’s pretraining schema before submitting it.
5. Watch it run
Outputs
The run keeps its run directory on the volume atruns/<runId>/, with checkpoints/step_<N>/, logs/ and monitors/. Everything on the volume syncs to cloud storage when the run ends.
Troubleshooting
data.paths is not on the volume
data.paths is not on the volume
Pretraining reads shards only from the run’s volume. Pass
--volume and list folders on it, relative to the volume root (datasets/<name>/train) or as /volume/... paths.Model not available on this cluster
Model not available on this cluster
The model’s config and tokenizer come from the cluster model cache. Pick a cached model of the architecture you want (
prime train models), or ask Prime support to cache one.Online evals rejected
Online evals rejected
Pretraining runs are trainer-only:
[eval], [inference] and [weight_broadcast] are rejected. Use [val] to track held-out loss instead.Loss does not fall, or the model never stops generating
Loss does not fall, or the model never stops generating
Check that the shards were tokenized with the model’s tokenizer and with
eos_token set to its end-of-text token. Without a separator, documents run together. The trainer warns at startup when shards look like they have none.Limitations
- Requires CLI v0.20.1 or later.
- Trainer-only. No online evals; validation loss comes from
[val]. - Shards on a volume.
data.pathsmust be on the run’s volume. - Dense architectures. prime-rl’s from-scratch initialization is tested on dense models.
Hosted SFT
Fine-tune a pretrained model on a Hugging Face dataset, with the same volume flow.
Volumes
Create volumes, upload data, and get checkpoints back.