Skip to main content
Reinforcement fine-tuning trains on prompts with a reward instead of replies to copy. It runs GRPO; the API calls it train_type="grpo". This page is about that managed job: NexCloud runs the loop and a built-in reward scores the replies. To run your own loop with your own reward code, environments or tools, use Serverless RL (Serverless RL, nextron-cloud rl ...). A GRPO job trains on prompts, not on replies to copy. Each round it takes batch_size prompts, the model writes num_generations replies to each, a reward scores every reply, and the model learns from the difference between better and worse replies to the same prompt. Full-parameter only. The models that train it list grpo in client.models()[i].methods; use the job’s train_type="grpo". The reward is built in (boxed, exact: 1 or 0 against the prompt’s answer), or your own code (remote): NexCloud generates and trains, and each round’s replies come to a script you run, which sends back their scores. Your code runs on your machine, never on NexCloud.

Data

One kind per dataset: prompts with answers.
  • answer is a non-empty string (a number is kept as its text). With messages, the last message is the user’s.
  • With tools (Data, on the models that take them) the messages may hold tool calls and results, and may end with a tool’s result.
  • From columns: nextron-cloud datasets prepare data.csv --prompt-column question --answer-column final.
  • check_file reports kind="rl"; after upload dataset.kind == "rl" and dataset.tokens[model]["max"] is the longest prompt. It must be at most the method’s max_prompt_len.
  • A file mixing chat samples and RL samples is refused. A {"question", "answer"} row is a chat sample (the answer is the reply to learn); add prompt or messages to make it RL.

Rewards

The model answers in non-thinking mode (no <think> block), as in SFT.

Your own reward (remote)

Not on the service yet: a model lists the rewards it takes in client.models()[i].methods["grpo"].rewards. Until remote is there, your own reward code runs with Serverless RL (Serverless RL). Start the job with reward="remote", then run your scorer until the job ends:
or nextron-cloud jobs serve-rewards job_... reward.py:reward. Put what the scorer needs in each sample’s answer and optional metadata (any JSON: test cases, a rubric); row is the sample’s position in the dataset.
  • Each round waits for all its scores. A round without them for 10 minutes fails the job, and no checkpoint is saved: start the scorer right after creating the job and keep it running. The time your scorer takes adds to every round; score in parallel (threads, a pool) when it is slow.
  • Replies arrive in batches, one per GPU per round (jobs.rollouts(id) lists those waiting, jobs.score(id, batch, scores) answers one: what serve_rewards does). Scores must be finite, one per reply, in order.
  • Run untrusted model output (generated code) in a sandbox on your side.
  • Scores of any scale work: GRPO compares the replies to the same prompt. The reward_mean metric is the mean of your scores.

Params

num_train_epochs, warmup_ratio, weight_decay, lr_scheduler_type, max_seq_len, val_dataset_id and eval_steps do not apply and are refused.

Plan the first run

GRPO learns only from prompts the model sometimes gets right: when all replies to a prompt score the same, that prompt teaches nothing. Start with a short run (max_steps 2-3) and read its metrics before a long one:
  • reward_mean: the share of replies scored 1. Between about 0.1 and 0.9 the model has room to learn.
  • zero_variance_fraction: the share of prompts whose replies all scored the same. Near 1, nothing is learned: pick harder (or easier) prompts.
  • completion_length_mean close to max_completion_length: many replies are cut before their answer. Raise the limit.
For example, Qwen3.8-27B on DAPO-Math (competition math) starts at reward_mean ~0.81 with ~0.7 of prompts giving no signal: a run there learns from the remaining ~30%.

Cost and time

Billed by tokens at four prices per million (token_prices of the model’s grpo method): prefill for each prompt read in sampling, cached_prefill for a prompt read before, sample for every generated token, train for every trained token (each reply with its prompt). The estimate holds the most a run could train, max_steps x batch_size x num_generations x (longest prompt + max_completion_length) tokens at the old per-token price, and the charge is what was used, usually much less. jobs.billing(id) shows the hold, the tokens charged by kind (usage_charged) and the charge. Measured on Qwen3.8-27B, one 8x H100 node, 64 prompts x 8 replies, replies averaging 3,400 tokens: about 5 minutes a round, ~60% of it generating and ~30% training. jobs.progress counts whole rounds in its time left.

Watch

Each point of jobs.metrics(id) is one round: reward_mean, zero_variance_fraction, completion_length_mean, generation_s and round_time_s, besides the step’s loss. jobs.events has a training.rollout event per round. Trouble looks like: reward_mean falling and staying down over several rounds, replies growing to the limit or shrinking to almost nothing. Rounds draw different prompts, so one round’s reward moves by several points on its own; judge the trend. Cancel with jobs.cancel (charged for the tokens so far). Only the final model is saved, and a cancelled job leaves none: keep runs short and run again with more max_steps once a short one looks right. There is no validation reward during training; measure the checkpoint on held-out prompts afterwards (Checkpoints).