Full reference

Train a policy with reinforcement learning

Configure a supported environment and reward, preview the compute selection, then inspect a bounded training job and evaluate its policy separately.

Updated

Reviewed against Console v0.2.2. Available actions depend on project access and runtime configuration; check your installed CLI version for command differences.

Choose managed or runtime execution

Managed jobs use /api/v1/lab/train/rl and the platform job lifecycle. A direct runtime request uses the selected runtime’s training route. The managed preview path checks cost and admission without launching work.

Define the training contract

SettingWhy it matters
Family and policySelect the supported base model and policy representation
Environment and promptsDefine the task distribution and reward source
Group size and learning rateControl optimization behavior
Checkpoint, seed and KL settingSupport comparison and constrain the update
Compute, duration and cost limitsBound resource use

Use the actual installed CLI help and supported runtime family. A syntactically accepted configuration is not evidence that its reward represents the outcome you want.

Preview before submission

bash
stimulir lab train rl \
  --family <supported-family> \
  --compute-offer <offer-id> --region <offered-region> \
  --max-duration-hours 1 --max-cost-gbp 10 \
  --preview --json

These are illustrative budget limits, not a price estimate. Read the returned preview and blockers. To submit, use the reviewed settings without --preview; retain the returned job ID.

Inspect progress and evaluate the policy

bash
stimulir lab jobs get <job-id> --json

Check terminal status, checkpoint location and reported errors. Use stimulir lab eval rl with comparable evaluation settings to assess the resulting policy. See Training jobs for cancellation behavior.

Command catalogue

Expand a command for its arguments. These commands follow the released CLI source; check stimulir --version and the command’s --help for your installation. Required flags are marked; some operations also validate combinations of inputs.

stimulir lab eval rl

Score a policy on an RL environment and report reward statistics.

--family, -f required
Base model family: qwen3-4b, qwen3-0.6b, or mistral-7b.
--environment
RL environment (e.g. niah).
--policy
Policy to score: base, hypernet, or peft-lora.
--checkpoint-dir, -c
Trained checkpoint directory (required for non-base policies).
--tasks
Number of eval tasks (sent as num_tasks).
--max-new-tokens
Generation cap per task.
--temperature
Sampling temperature.
--seed
Seed for reproducible task generation.
--pass-threshold
Reward threshold above which a task counts as passed.
--device
auto, metal, cuda, or cpu.
--endpoint
HybrIE runtime URL (bypasses the console proxy).
--json
Emit raw JSON output (includes the per_task list).
stimulir lab train rl

Submit an RL training job.

--family, -f required
See the installed command’s --help for accepted values.
--environment
RL environment (e.g. niah).
--prompts
Number of training prompts.
--group-size
Rollout group size per prompt.
--policy
Policy to train: hypernet or peft-lora.
--lora-rank
LoRA rank for peft-lora policies.
--init-checkpoint-dir
Checkpoint directory to initialise the policy from.
--lr
Learning rate.
--kl-beta
KL penalty coefficient.
--seed
Seed for reproducible rollouts.
--device
Target device (auto, metal, cuda, cpu).
--checkpoint-dir
Directory to write the trained checkpoint into.
--compute-offer
Managed GPU offer id.
--region
Managed GPU region.
--gpus
Managed GPU instance count.
--spot
Use spot pricing when the offer supports it.
--compute-provider
Managed compute provider.
--max-duration-hours
Hard managed-run time ceiling.
--max-cost-gbp
Optional GPU-spend ceiling.
--preview
Validate and price only; create no job and launch nothing.
--endpoint
HybrIE runtime URL (bypasses the console proxy).
--json
Emit raw JSON output.

SDK method catalogue

Expand a client to inspect public methods and parameter names. Read each operation’s task guide before supplying a payload or starting work. The SDK returns platform responses; handle errors and inspect completion state before using a result.

client.lab_trainLabTrainClient
d2l(family, examples, eval_examples, epochs, lr, seed, checkpoint_dir, device, compute, timeout)
Doc-to-LoRA (hypernetwork context internalisation) training job.
sft(family, lora_rank, init_adapter_dir, examples, epochs, lr, l1_coef, eval_examples, min_blocks, max_blocks, log_every, seed, device, checkpoint_dir, dataset, split_ratio, split_seed, eval_cohort, compute, timeout)
Supervised fine-tuning of a plain PEFT LoRA adapter (sft-peft-lora).
rl(family, environment, prompts, group_size, policy, lora_rank, init_checkpoint_dir, lr, kl_beta, seed, device, checkpoint_dir, compute, timeout)
RL (GRPO-style) training job on an RL environment.
internalize(document_text, compute, name, session_key, ttl_seconds, pin, timeout)
Internalize a document on an explicitly selected managed worker.