An RL run is a model loaded on a node of GPUs, kept for you until you stop it. Your loop, environments and reward code run on your machine; NexCloud
samples with vLLM and trains all of the model’s weights (not an adapter) on the same GPUs. There are two ways to drive
one: NexCloud’s own calls (below, the default) and Tinker’s API, for code already written for the
tinker SDK.
A model that has Serverless RL lists interactive under its methods in nextron-cloud models, with its
token_prices; rl start answers “coming soon” for one without it.
Start and stop
token_prices of the model’s interactive method, US
cents; rl start without --yes prints them): prefill for the prompt tokens a sample reads, cached_prefill for
those it had read before (a fifth of prefill), sample for the tokens it generates, train for the tokens a
training step trains (a forward pass that only scores counts as train). Starting holds credits for --max-hours;
when the run stops, the hold is returned and its tokens are charged. rl.get(id).usage is its tokens so far by kind.
Loading the model and idle time are not billed.
Your loop with this SDK: sample, score, train
sample: a prompt is a string (one user message), a list of chat messages, or{"messages": [...], "tools": [...]}; the run renders it with the model’s chat template, so you need no tokenizer. All prompts of a call are generated together.batch[i][j]is replyjto prompti:.text,.finish_reason(stoporlength),.tokens.train: one reward per reply. The run kept each reply’s tokens and sampler logprobs, so only the rewards travel. The advantage of a reply is its reward minus the mean reward of the replies to the same prompt (advantage="centered");"normalized"also divides by their standard deviation,"raw"uses the reward as it is.- Several turns (tools, an environment that answers): sample each turn with the conversation so far as the prompt,
then train on episodes:
live.train(episodes=[Episode([turn1, turn2], reward=1.0, group="task-7")], ...). An episode has one reward;groupnames the episodes it is compared with. - Per call:
learning_rate(required),loss(importance_sampling,ppo,cispo;clip_low/clip_high),substeps(optimizer steps the episodes are split over),beta1,beta2,eps,weight_decay. - The weights change with every
train: replies sampled before it cannot be trained after it. resultis the step’s record, and the run keeps one per training call (client.rl.metrics(run_id)):- how it went:
reward_mean,reward_std,zero_variance_fraction(groups whose replies all got the same reward teach nothing: mostlyall_best_fractionmeans the task is too easy,all_worst_fractiontoo hard),truncated_fraction(replies cut bymax_tokens),completion_length_mean,kl_sample_train(near 0 when the sampler and the trainer agree; a rising value says the learning rate is too high); - where the time went:
idle_sbefore the step, thenstep_s=generation_s+train_s+client_s.client_sis the run waiting for you (scoring, the network), and it is billed like the rest: speed up your reward code if it is large; - what was trained:
tokens,tokens_per_s_per_gpu,rows,row_fill; andsession_s, about what is billed so far.
- how it went:
- Look at what the model writes:
nextron-cloud rl rollouts rl_...(client.rl.rollouts(id, step=N)) shows the best and the worst group of a training call with their rewards, kept by the run itself. - Keep a record of the run:
client.rl.connect(id, log_dir="runs/math-1")appends every step’s record tometrics.jsonland the first groups it trained (prompts, replies, rewards) torollouts.jsonl. Read a few rollouts every so often: a reward that rises while the replies get worse is the model gaming your reward code. For Weights & Biases,wandb.log(result.model_dump())after eachtrain. - Size your steps to fill the trainer’s rows. A step’s sequences are packed into rows of at most
result.row_tokenstokens on each GPU, and a row costs a few seconds however full it is.result.row_fillsays how full they were: aim for 0.9 or more by samplinggpus * rows * row_tokenstokens a step (prompts included) for a whole number ofrows. Just over a multiple is the worst case: one more row on every GPU, each partly empty.row_tokensdiffers by model, and a mixture-of-experts model (gemma-4-26b-a4b) pads every row to a fixed length: there a partly filled row costs as much as a full one, and the first step at a row length takes 20-50 s longer than the ones after it. - An open
LiveRuntells the run you are alive every 20 seconds, so slow reward code is fine; if your process dies the run stops 3 minutes later.
With the tinker SDK
An RL run also serves Tinker’s HTTP API: code written for thetinker SDK (your own, or
tinker-cookbook’s loops and recipes) runs unchanged once
two environment variables point at the run. It sends one request per prompt and the sampled tokens back with
every step, so a step takes longer on the wire than with the calls above.
os.environ.update(client.rl.env(run.id)) before import tinker (it holds your key: do not
print it). nextron-cookbook has tested settings for cookbook
recipes (nextron-cookbook run math), measured results and the full compatibility table.
Rules
- An RL run costs money from the moment it is ready until it is stopped, whether or not anything trains. Show the
owner the price first (
rl startwithout--yes), and always stop it: when your loop ends, and when it fails. - It also stops itself: when your training client ends its session (with the
tinkerSDK: the end of awith tinker.ServiceClient() as service:block, orservice.close("success").result(); the state becomesclosingwithin about 15 seconds), after--max-hours, and after--idle-timeoutseconds (default 1800) without a sample or a training step. A client that goes away without ending its session leaves the run ready, and billed, until 3 minutes after its last heartbeat: a killed process, and also a script that made a baretinker.ServiceClient()and returned (thetinkerSDK does not end the session when the process exits). Stop it yourself to stop billing sooner, and in scripts stop it in atraporfinally. - Billing stops when the run begins to stop (state
closing): yourrl stop, the client finishing, or the limits above. The engine then saves the model if it trained and releases the GPUs about a minute later (closed). A new run of the same model may wait inqueueduntil then. - One training loop per RL run, driven one way: a second training client is refused, and so is the
tinkerSDK on a run used throughrl.connect(and the other way round). Start another RL run for another loop. rl envnever prints your key (its line refers to$NEXTRON_API_KEY).client.rl.env()returns it foros.environ: never print or log that value.- Learning rates are for full-parameter training: 1e-6 to 2e-6 for RL on a 27B model, about 10x below LoRA defaults.
Settings
Per step, from your loop: Adam’s
learning_rate, beta1, beta2, eps, weight_decay and the loss
(importance_sampling, ppo, cispo with their clip thresholds; through Tinker’s API also cross_entropy).
States and the trained model
queued -> starting (the model loads, 6-8 minutes; not billed) -> ready -> closing (not billed) -> closed, or
failed. rl get shows billable_seconds. A failed run is not charged.
Two kinds of id appear: rl_... is the RL run, for every nextron-cloud command. The tinker SDK prints its own
ids and paths (nx-..., tinker://nx-.../weights/final); they are not arguments to anything here.
Prompts with images and videos
The models whoseinput lists image (or video) take them in a run’s prompts; Images and videos has the
models, the format and the limits. Start the run with images=True (nextron-cloud rl start ... --images) and write
an image or a video as a content part of a user message, as in a dataset:
add_imagestakes image files and MP4 videos (a path ending in.mp4is sent as a video). The run must have a file before a prompt uses it:add_imagesuploads the files it lacks as one dataset, the server checks and decodes them, and the run fetches them, a minute or two (more for thousands).sampledoes the same for files it has not seen, so a loop that adds new ones every round waits every round: send the whole set first.- Each upload is a dataset of the organisation (named
images of rl_..., kindimages), deleted once the run has ended. An uploaded dataset with images can be given to a run without a new upload:POST /v1/training/sessions/{id}/images {"dataset_id": ...}, then name its imagessha256:<hex>. - Images and videos count as tokens of the run’s context (Images and videos), and are billed as the prompt tokens they are. Videos are sampled by the run’s video settings (
rl.start(video_fps=...)). - Not with images or videos: tools in the same prompt, and Tinker’s API (
rl.connectonly).
nextron-cloud jobs wait-checkpoint rl_..., jobs download rl_...,
jobs logs rl_....
What is not there yet
Either way: sampling from earlier weights, named checkpoints during a run, LoRA, a second model in the same run, per-token advantages. Throughrl.connect: supervised steps (cross_entropy) and scoring text without
training; Tinker’s API has both. Through Tinker’s API: loss_fn=stable_reinforce (pass importance_sampling to
cookbook recipes whose default it is), kl_penalty_coef, custom losses. Unsupported calls fail with a message that
says so.