Skip to main content
Hosted pretraining is in beta. Contact Prime support if dispatch is refused.
Run 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

Requires 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’s DocumentTokenizer 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 &lt;|endoftext|&gt;, not <|im_end|>.
This writes tinystories/train/ and tinystories/val/. Keep validation documents in their own folder.

2. Put the shards on a volume

The second command creates 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-level mode = "pretrain" makes this a pretraining run. Save this as pretrain.toml:
  • data.paths lists folders on the volume, relative to its root or as absolute /volume/... paths. Every shard in them forms one token pool, read in seq_len windows in a new random order each epoch.
  • The weights start from the architecture’s own initialization. optim.lr defaults to 1e-3, with a 10-step linear warmup.
  • output_dir is set by the platform; leave it out.
See prime-rl’s Pretraining guide for every [data] and [val] option.

4. Dispatch

The CLI reads mode and validates the config against prime-rl’s pretraining schema before submitting it.

5. Watch it run

The dashboard shows the run as Pretrain, with its training loss, perplexity and validation loss. The walkthrough takes about ten minutes on eight GPUs, and its validation loss falls from about 3.8 at step 150 to about 3.1 at step 250.

Outputs

The run keeps its run directory on the volume at runs/<runId>/, with checkpoints/step_<N>/, logs/ and monitors/. Everything on the volume syncs to cloud storage when the run ends.

Troubleshooting

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.
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.
Pretraining runs are trainer-only: [eval], [inference] and [weight_broadcast] are rejected. Use [val] to track held-out loss instead.
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.paths must 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.