Run spec and manifest schema¶
Every field of the training manifest that arena experiments submit and ArenaClient.submit_experiment take. The page is generated from the agilerl version Arena currently supports. arena manifest template prints a manifest with Arena’s defaults to start from, and arena manifest validate checks one before you submit. arena manifest schema prints the same contract as JSON Schema.
A manifest is a YAML or JSON file with these top-level sections:
Section |
What it holds |
|---|---|
|
Contract version the manifest is written against. Defaults to |
Which algorithm trains ( |
|
The dataset or environment the model trains on. |
|
How long to train, evaluation, checkpoints and rollout layout. |
|
The base model and its LoRA settings. |
|
Where rollouts wait before the trainer learns from them. |
Fields a model leaves out take the defaults shown. Fields marked as picked from the memory estimate are set by Arena; a manifest cannot set them.
algorithm¶
algorithm.name picks the algorithm: GRPO, GSPO, CISPO, LLMPPO, LLMREINFORCE, OPD, DPO or SFT. Which one fits which data is on Algorithms. Every algorithm takes the common fields below. The model itself goes under network: pretrained_model_name_or_path, max_context_length and lora_config.
- class LLMAlgorithmSpec¶
LLM fine-tuning algorithms.
pretrained_model_name_or_path,weights_path,max_model_lenandlora_configare written under the manifest’snetworksection and lifted onto the algorithm when the manifest is validated.- field answer_continuation: bool = False¶
After the thinking budget runs out, continue into the answer instead of ending the episode.
- field batch_size: int = 16¶
Prompts sampled per step; the rollout batch is batch_size x group_size.
- field beta: float = 0.001¶
Weight on the KL penalty holding the policy near the reference model. 0 disables the penalty entirely.
- field calc_position_embeddings: bool = True¶
Compute position embeddings in the forward pass. Turn off only for models that build their own.
- field constrain_answer_pattern: str | None = None¶
Regex grammar for vLLM structured outputs on each turn, or on an answer continuation when answer_continuation is enabled.
- field fsdp: Annotated[FSDPConfig | None, WithJsonSchema(FSDP_JSON_SCHEMA)] = None¶
FSDP2 shard config. Omitted, true or {}: the run trains the faster plan that fits, DDP when the model fits one GPU with an equal-or-cheaper plan, else FSDP. Setting ep or tp above 1 keeps FSDP.
- field gradient_checkpointing: bool | None = None¶
Recompute block activations during the backward pass instead of storing them. Affects only memory and speed, not what the run learns. Picked from the memory estimate together with the micro-batch and fsdp.checkpoint_every_n_blocks, least recompute that fits; on when the run has no estimate. Manifests cannot set it.
- field max_grad_norm: float = 0.1¶
Gradients are clipped to this global norm before each step.
- field micro_batch_size_per_gpu: int | None = None¶
Trajectories per backward pass, per GPU. Affects only memory: it changes what fits, not what the run learns. Picked from the memory estimate as the largest that fits; manifests cannot set it.
- field mini_batch_size: int | None = None¶
Trajectories one optimizer step covers, per rank. Must be a whole number of micro-batches. This is a learning-cadence decision, not a memory one: it sets how often the policy moves.
- field quantization: str | dict[str, Any] | None = None¶
Trainer-side bitsandbytes quantization: a preset name such as ‘nf4’, or BitsAndBytesConfig keyword arguments.
- field routed_expert_chunk_mib: int | None = None¶
MiB of the widest activation of one routed-expert row chunk under DDP; FSDP runs use fsdp.routed_expert_chunk_mib. Picked from the memory estimate; manifests cannot set it. None on a MoE model picks the largest of 512/256/128/64 whose estimated training peak fits; unpicked, the trainer uses 64.
- field seed: int = 42¶
Seed for sampling, data order and initialization.
- field thinking_token_budget: int | None = None¶
Tokens the model may spend reasoning before it has to answer. Unset leaves reasoning length unconstrained.
- field update_epochs: int = 1¶
Optimizer passes over each batch of collected rollouts.
- field use_separate_reference_adapter: bool = True¶
Hold the reference policy in its own frozen LoRA adapter rather than the base weights.
- field vllm_engine_args: dict[str, Any] [Optional]¶
Engine arguments forwarded to vLLM verbatim.
- field vllm_lora_export_dir: str | None = None¶
Directory the trainer writes LoRA adapters to for vLLM to pick up. Unset uses the run’s default adapter root.
Reinforcement learning algorithms¶
GRPO, GSPO, CISPO, OPD, LLMPPO and LLMREINFORCE generate answers and learn from their rewards. They share these fields on top of the common ones.
- class RolloutLLMSpec¶
Bases:
LLMAlgorithmSpecShared surface for the LLM algorithms that generate their own rollouts.
- field beta: float = 0.001¶
Weight on the KL penalty holding the policy near the reference model. 0 disables the penalty entirely.
- field cosine_lr_schedule_config: CosineLRScheduleConfig | None = None¶
Learning-rate schedule stepped once per training step: linear warmup to each learning rate (actor and critic alike), then cosine decay to min_lr_ratio of it. The LLMPPO actor’s schedule starts after critic_warmup_steps. On the cluster, unset or null warms up over 5% of training.max_steps and decays to 10%. For a constant learning rate, set warmup_proportion 0 and min_lr_ratio 1.0.
- field max_output_tokens: int | None = None¶
Hard cap on tokens generated per completion.
- field max_row_tokens: int | None = None¶
Longest training row, prompt plus completion, that the trainer’s memory estimate sizes for. Unset uses max_model_len. An environment with segment_prompt_tokens sets it to segment_prompt_tokens plus max_output_tokens (twice max_output_tokens with answer_continuation), capped at max_model_len; rollouts never produce a longer row.
- field micro_batch_size_per_gpu: int | None = None¶
Trajectories per backward pass, per GPU. Affects only memory: it changes what fits, not what the run learns. Picked from the memory estimate as the largest that fits; manifests cannot set it.
- field micro_batch_tokens_per_gpu: int | None = None¶
Tokens per packed backward pass, per GPU, when the forward packs sequences. Rows fill each pass up to this many tokens; a longer row runs alone. Affects only memory and speed, not what the run learns. Picked from the memory estimate as the fastest budget that fits; manifests cannot set it.
- field min_output_tokens: int | None = None¶
Floor on tokens generated per completion. Unset lets the model stop as soon as it emits an end-of-sequence token.
- field min_p: float = 0.0¶
Drop tokens whose probability is below this fraction of the most likely token’s probability.
- field mini_batch_size: int | None = None¶
Trajectories one optimizer step covers, per rank. Must be a whole number of micro-batches. This is a learning-cadence decision, not a memory one: it sets how often the policy moves.
- field reference_update_interval: int | None = None¶
Optimizer steps between copies of the policy onto the reference model the KL penalty holds it near. Unset keeps the reference fixed.
- field repetition_penalty: float = 1.0¶
Penalty applied to tokens already generated, to discourage loops.
- field temperature: float = 0.9¶
Sampling temperature for generation. Higher values diversify rollouts. The trainer divides logits by this, so it has to be above 0.
- field top_k: int = 50¶
Keep only the K most likely next tokens at each generation step.
- field top_p: float = 1.0¶
Nucleus sampling: keep the smallest set of tokens whose probability sums to this value.
- field vllm_config: VLLMConfig | None = None¶
vLLM engine settings for generation.
- field vllm_importance_sampling_cap: float = 2.0¶
Trainer/vLLM ratio at which the sampling-mismatch metrics count a token as clipped.
- field vllm_max_clip_fraction: float = 0.02¶
Warn when the share of tokens whose trainer/vLLM ratio reaches the importance-sampling cap exceeds this. bf16 engines usually stay under 0.01.
- field vllm_max_logprob_gap: float = 0.1¶
Warn when the mean per-token log-prob gap between vLLM and the trainer exceeds this, in nats. bf16 engines usually sit near 0.01-0.03.
- class CosineLRScheduleConfig¶
Model specification for cosine LR schedule configuration.
- field min_lr_ratio: float = 0.1¶
Floor as a fraction of the peak learning rate, held after num_steps.
- field num_steps: int [Required]¶
Training steps (learn calls) from the start of warmup to the floor.
- field warmup_proportion: float = 0.0¶
Fraction of num_steps spent ramping the learning rate up to its peak.
- class VLLMConfig¶
Model specification for vLLM configuration.
- field dtype: str | None = None¶
Weight dtype for generation, e.g. bfloat16. Unset lets vLLM choose.
- field frequency_penalty: float = 0.0¶
Penalty on tokens in proportion to how often they appeared.
- field gpu_memory_utilization: float | None = None¶
Share of GPU memory vLLM reserves for weights and KV cache. When generation is colocated with training, this has to leave room for the trainer. Unset is 0.9 on a rollout engine, which has its GPUs to itself, and 0.3 colocated.
- field kv_cache_dtype: str | None = None¶
KV cache dtype, e.g. fp8. Fits a longer context into the same memory.
- field limit_mm_per_prompt: dict[str, Annotated[int, Field(ge=0)]] | None = None¶
Most items of each modality one prompt may carry, e.g. {image: 4, video: 0}. Unset keeps vLLM’s limit.
- field lora_staging_dir: str | None = None¶
Directory the engine reads LoRA adapters from.
- field max_num_batched_tokens: int | None = None¶
Tokens vLLM may process in one scheduler pass. Unset lets the trainer size it; raising it speeds up long prefills but costs memory.
- field max_num_seqs: int | None = None¶
Sequences vLLM decodes concurrently. Set it to at least group_size so a GRPO group does not queue. Unset gives colocated generation 16 and each rollout engine one sequence per episode it runs at once (rollout_batch_size / rollout_engines_per_agent, rounded up, x group_size).
- field presence_penalty: float = 0.0¶
Penalty on tokens that already appeared, at any count.
- field quantization: str | None = None¶
Quantization applied to the generation engine, e.g. fp8. Unset or none serves unquantized weights.
- field stop_sequences: list[str] | None = None¶
Strings that end a completion when generated.
- field tensor_parallel_size: int | None = None¶
GPUs the model is sharded across for generation. Unset until the allocation’s memory estimate chooses a width. An explicit integer is kept.
- field vllm_model_name_or_path: str | None = None¶
Serve generation from a different checkpoint than the trainer fine-tunes.
Fields for each algorithm¶
Each algorithm adds the fields below to those of the class it builds on.
- class GRPOSpec¶
Bases:
RolloutLLMSpecGroup Relative Policy Optimization.
- field adv_clip_range: float | None = None¶
Clip advantages to +/- this value. Unset leaves them unclipped.
- field adv_filter_eps: float = 0.0¶
With filter_zero_adv, also drop groups whose largest absolute advantage is below this threshold.
- field adv_norm: Literal['mean_only', 'mean_std'] = 'mean_only'¶
How group advantages are normalized. ‘mean_only’ subtracts the group mean; ‘mean_std’ also divides by its standard deviation.
- field advantage_granularity: Literal['auto', 'trajectory', 'turn'] = 'auto'¶
Level the advantage is computed at. ‘auto’ follows the environment: per-turn for multi-turn, per-trajectory otherwise.
- field clip_coef: float = 0.2¶
Clipping range of the policy-ratio surrogate. Caps how far one update may move the policy from the behaviour that collected the data.
- field filter_zero_adv: bool = False¶
Drop groups whose completions all scored the same. They contribute no gradient, so training on them only costs compute.
- field group_size: int = 8¶
Completions sampled per prompt. The group is what the advantage is computed relative to, so this is the main GRPO setting to tune.
- field importance_sampling_level: Literal['token', 'turn', 'trajectory'] | None = None¶
Level the importance-sampling ratio is computed at. Coarser levels are lower variance but a blunter correction. Turn-level uses a geometric-mean ratio per reply.
- field kl_clamp: float | None = 10.0¶
Per-token bound on the K3 KL penalty. 10 is the policy about 2.6 nats below the reference on a token; tokens further below get no KL gradient, so one diverged token cannot set the step’s gradient norm. Tokens above the reference keep their KL pull. Unset removes the bound.
- field loss_norm: Literal['micro_batch', 'accumulation_window', 'episode'] = 'accumulation_window'¶
Token count the loss is averaged over: the whole accumulation window across all data-parallel ranks (default), or each micro-batch on its own. The window is the unbiased choice when micro-batches have uneven lengths. ‘episode’ gives every episode of the window the same total policy weight, averaging tokens within an episode, so long episodes do not outweigh short ones.
- field loss_type: Literal['grpo', 'gspo', 'cispo'] = 'grpo'¶
Policy-gradient loss variant. GSPO and CISPO pin this on their own specs.
- field lr: float = 5e-07¶
Optimizer learning rate.
- field off_policy_sequence_mask_threshold: float | None = 0.03¶
Drop the policy and KL gradient of negative-advantage completions whose mean log(sampling / current) log-prob gap exceeds this (DeepSeek-V3.2 off-policy sequence masking). Set null to mask nothing. GSPO leaves this unset.
- field off_policy_token_mask_bounds: tuple[float, float] | None = (0.5, 5.0)¶
(low, high) band on each token’s ratio of the current policy to the policy that sampled it. Tokens outside get no policy or KL gradient (IcePop). Set null to mask nothing. GSPO leaves this unset.
- field profiling_config: ProfilingConfig | None = None¶
Opt-in learn profiling: CUDA memory snapshot on OOM and a torch.profiler trace of one micro-batch. Unset profiles nothing.
- field turn_advantage_trajectory_fallback: bool = True¶
Fall back to a trajectory-level advantage when per-turn credit cannot be assigned.
- field use_bias_correction_kl: bool = True¶
Weight the per-token KL by the importance ratio to the old policy so its gradient is unbiased off-policy (DeepSeek-V3.2).
- field use_kl_advantage_shaping: bool = False¶
Fold the KL penalty into the advantage instead of adding it as a separate loss term.
- field whiten_advantages: bool = False¶
Normalize advantages to zero mean and unit variance across the batch.
- class GSPOSpec¶
Bases:
GRPOSpecGRPO with the GSPO sequence-level loss.
- field loss_type: Literal['gspo'] = 'gspo'¶
GSPO’s sequence-level loss.
- class CISPOSpec¶
Bases:
GRPOSpecGRPO with the CISPO loss and asymmetric clip bounds.
- field loss_type: Literal['cispo'] = 'cispo'¶
CISPO’s clipped importance-sampling loss.
- class LLMPPOSpec¶
Bases:
RolloutLLMSpecProximal policy optimization for LLM fine-tuning, with a value head.
- field advantage_granularity: Literal['turn', 'token', 'auto'] = 'auto'¶
Level the advantage is computed at. ‘turn’ enforces turn-level updates, ‘token’ token-level, and ‘auto’ uses token-level only when every sample is single-turn.
- field beta: float = 0.001¶
Weight on the KL penalty holding the policy near the reference model. 0 disables the penalty entirely.
- field clip_coef: float = 0.2¶
Clipping range of the policy-ratio surrogate. Caps how far one update may move the policy from the behaviour that collected the data.
- field critic_warmup_steps: int = 0¶
Learn steps at the start of training that train only the critic, on Monte Carlo returns of the fixed initial policy, before LLMPPO updates the policy. Resuming from a checkpoint continues the count.
- field gae_lambda: float = 1.0¶
Generalized advantage estimation trace decay, trading bias against variance. 1.0 is plain Monte-Carlo returns.
- field gamma: float = 1.0¶
Discount factor applied across turns.
- field importance_sampling_level: Literal['auto', 'token', 'turn', 'trajectory'] = 'auto'¶
Level the importance-sampling ratio is computed at. Coarser levels are lower variance but a blunter correction. Turn-level uses a geometric-mean ratio per reply.
- field kl_clamp: float | None = 10.0¶
Per-token bound on the K3 KL penalty. 10 is the policy about 2.6 nats below the reference on a token; tokens further below get no KL gradient, so one diverged token cannot set the step’s gradient norm. Tokens above the reference keep their KL pull. Unset removes the bound.
- field lr_actor: float = 1e-05¶
Optimizer learning rate for the actor (policy) network.
- field lr_critic: float | None = 0.0001¶
Optimizer learning rate for the critic (value) network.
- field max_grad_norm: float = 1.0¶
Actor and critic gradients are each clipped to this norm before each step.
- field off_policy_token_mask_bounds: tuple[float, float] | None = (0.5, 5.0)¶
(low, high) band on each token’s ratio of the current policy to the rollout policy that sampled it. Tokens outside get no policy gradient (IcePop). Set null to mask nothing.
Clip actor and critic gradients by one coefficient from their combined norm.
- field temperature: float = 1.0¶
Sampling temperature for generation. Higher values diversify rollouts. The trainer divides logits by this, so it has to be above 0.
- field top_p: float = 1.0¶
Nucleus sampling: keep the smallest set of tokens whose probability sums to this value.
- field turn_level_clip: bool = True¶
Apply the surrogate clip per turn rather than per token.
- field vf_coef: float = 0.5¶
Weight on the value-function loss in the combined objective.
- field whiten_advantages: bool = True¶
Normalize advantages to zero mean and unit variance across the batch.
- class LLMREINFORCESpec¶
Bases:
RolloutLLMSpecREINFORCE with return batch normalization.
- field advantage_granularity: Literal['turn', 'token', 'auto'] = 'auto'¶
Level the advantage is computed at. ‘turn’ enforces turn-level updates, ‘token’ token-level, and ‘auto’ uses token-level only when every sample is single-turn.
- field beta: float = 0.001¶
Weight on the KL penalty holding the policy near the reference model. 0 disables the penalty entirely.
- field clip_coef: float = 0.2¶
Clipping range of the policy-ratio surrogate. Caps how far one update may move the policy from the behaviour that collected the data.
- field gamma: float = 1.0¶
Discount factor applied across turns.
- field importance_sampling_level: Literal['token', 'turn', 'trajectory'] = 'token'¶
Level the importance-sampling ratio is computed at. Coarser levels are lower variance but a blunter correction. Turn-level uses a geometric-mean ratio per reply.
- field lr: float = 1e-05¶
Optimizer learning rate.
- field max_grad_norm: float = 1.0¶
Gradients are clipped to this global norm before each step.
- field off_policy_token_mask_bounds: tuple[float, float] | None = (0.5, 5.0)¶
(low, high) band on each token’s ratio of the current policy to the rollout policy that sampled it. Tokens outside get no policy gradient (IcePop). Set null to mask nothing.
- field temperature: float = 1.0¶
Sampling temperature for generation. Higher values diversify rollouts. The trainer divides logits by this, so it has to be above 0.
- field top_p: float = 1.0¶
Nucleus sampling: keep the smallest set of tokens whose probability sums to this value.
- class OPDSpec¶
Bases:
GRPOSpecGRPO whose per-token advantage adds the teacher’s log-prob gap to the policy’s.
- field beta: float = 0.0¶
Weight on the KL penalty holding the policy near the reference model. 0 disables the penalty entirely.
- field group_size: int = 4¶
Completions sampled per prompt. The group is what the advantage is computed relative to, so this is the main GRPO setting to tune. With no task reward the teacher term is the whole update, and a group of 1 spends the same samples on more prompts.
- field teacher: DistillationTeacherConfig [Optional]¶
The model that scores every rollout: by default the live policy, given each task’s reference trace; else teacher.adapter, teacher.base or teacher.model. The per-token gap is added to the task advantage.
- field temperature: float = 1.0¶
Sampling temperature. The teacher scores the unmodified policy, so this stays 1.
- field top_k: int = 0¶
Keep only the K most likely next tokens at each generation step.
- class DistillationTeacherConfig¶
The model that scores each rollout; the per-token gap is the distillation advantage.
By default the teacher is the live policy, given each task’s reference trace in a leading system message. With
adapterit is the student’s base model under that frozen LoRA adapter, served beside the policy’s adapter in the rollout engines. Withbaseit is the student’s base weights without any LoRA, which keeps the policy close to the model it started from. Withmodelit is that model, in its own vLLM engine beside each rollout engine. Acontext_keygives any of them the reference.- field adapter: str | None = None¶
LoRA adapter of the student’s base model that scores rollouts, such as a GRPO run’s checkpoint: a local or s3:// directory holding adapter_config.json, or a checkpoint holding it under actor/. Its rank must fit the student’s network.lora_config.lora_r. The rollout engines serve it frozen beside the policy’s adapter, so weight sync always sends the adapter.
- field base: bool = False¶
Score rollouts with the student’s base weights, without any LoRA, so the policy is pulled back towards the model it started from, such as to recover behaviour an SFT checkpoint lost. Needs no extra GPUs; weight sync always sends the adapter.
- field coef: float = 1.0¶
Weight of the per-token teacher-minus-student log-prob on the advantage.
- field context_key: str | None = None¶
Key of the env reset info holding the task’s reference trace. A dataset-backed rollout reads the dataset column of that name. Unset is ‘reference_trace’ for the live policy, and no reference with a teacher model, adapter or base.
- field max_context_tokens: int = 8192¶
Token budget of the teacher’s system message. A longer reference is cut to fit, and rollout engines reserve this much extra context.
- field max_token_gap: float | None = 10.0¶
Bound, in nats, on each token’s teacher-minus-student log-prob before coef scales it. Tokens the teacher finds near impossible otherwise outweigh the rest of the batch. Null leaves it unbounded.
- field model: DistillationTeacherModel | None = None¶
A separate, usually larger, teacher model. Unset scores in the rollout engines, with teacher.adapter, teacher.base or the live policy.
- field template: str = 'A reference solution to the task that follows is given below. Solve the task as that reference does.\n\n{reference}'¶
System message the teacher reads before the rollout; ‘{reference}’ is replaced with the reference trace.
- class DistillationTeacherModel¶
A separately hosted model that scores the student’s rollouts.
- field pretrained_model_name_or_path: str [Required]¶
Hub id of the teacher, from the model catalog. It must share the student’s tokenizer vocabulary, since it scores the student’s token ids.
- field vllm_config: VLLMConfig [Optional]¶
vLLM settings of the teacher engine. tensor_parallel_size is the GPUs each rollout engine’s teacher adds to the run; unset, the run sizes it from the teacher and the GPU.
- field weights_path: str | None = None¶
Local or s3:// directory to load the teacher’s weights and tokenizer from. pretrained_model_name_or_path then names the catalog model with the same architecture.
- class DPOSpec¶
Bases:
LLMAlgorithmSpecDirect Preference Optimization.
- field answer_continuation: bool = False¶
Unused: DPO trains on dataset rows, with no rollout to continue.
- field beta: float = 0.1¶
Weight on the KL penalty holding the policy near the reference model. 0 disables the penalty entirely.
- field lr: float = 5e-06¶
Optimizer learning rate.
- field nll_alpha: float = 1.0¶
Weight on the auxiliary likelihood term over chosen responses, which keeps the model fluent while preferences are optimized.
- field reference_update_interval: int | None = None¶
Optimizer steps between copies of the policy onto the reference model the KL penalty holds it near. Unset keeps the reference fixed.
- class SFTSpec¶
Bases:
LLMAlgorithmSpecSupervised fine-tuning. No reference model, so no KL penalty.
- field answer_continuation: bool = False¶
Unused: SFT trains on dataset rows, with no rollout to continue.
- field beta: float = 0.001¶
Unused: SFT has no reference policy to penalise against.
- field lr: float = 5e-05¶
Optimizer learning rate.
- field use_separate_reference_adapter: bool = False¶
Always off: SFT has no reference policy to hold in an adapter.
environment¶
When you submit, dataset names the registered dataset Arena trains on. Without dataset, Arena trains on whatever name names: a dataset, or an environment. With dataset set, name is only a label, unless it names a different registered dataset, which submit refuses. Set name to the same dataset, or leave it out.
- class LLMEnvSpec¶
The dataset or interactive environment an LLM algorithm fine-tunes against.
A
rolloutenv is generative and comes from exactly one source:dataset rows plus a rubric — a single-turn env over labelled rows;
entrypoint— a callable returning a text env, run where training runs (or on env hosts under the hosting fields, which need the Ray runtime);env_url— an OpenEnv service someone else hosts;env_image— a prebuilt env image the Ray runtime runs as its own Pod.
A built-in (
BUNDLED_ENVIRONMENTS) may name no source.A
datasetenv is teacher-forced over the rows;objectivepicks the loss.- field action_error_field: str = ''¶
Observation field holding the error text of the action just taken. A restarted context lists it after that action. Empty lists the actions alone.
- field action_field: str | None = None¶
The action field an env receives the model’s text in — message by default, but code or action_str elsewhere; for an MCP tool it is the argument name.
- field action_processor: str | None = None¶
module:fn entrypoint that turns the post-</think> action text into what the env receives. Unset sends that text unchanged.
- field adaptive_task_sampling: bool = True¶
Draw each group’s task row in proportion to how often that row’s recent groups had differing rewards, so tasks that keep giving tied groups are drawn less (Ray async rollouts over task rows only). false keeps the per-epoch shuffle.
- field answer_tool: str | None = None¶
For an MCP-backed env, one of its real tools receiving a turn’s prose when the turn has no tool call. Unset answers such a turn with retry feedback.
- field apply_chat_template: bool = True¶
Render prompts through the tokenizer chat template. Digit-token multi-turn probes set this false and encode observations raw.
- field chat_template_kwargs: dict[str, Any] [Optional]¶
Defaults injected into apply_chat_template, e.g. {‘enable_thinking’: false}.
- field chat_template_path: str | None = None¶
Jinja file whose template replaces the tokenizer’s own.
- field columns: dict[str, str] | None = None¶
Maps your dataset’s column names onto the ones the run expects (question, answer; prompt, target, or multi-turn messages and tools for SFT). Unset assumes they already match.
- field cpus_per_env_host: float | None = None¶
CPUs reserved per env host; an env_image Pod requests them with no CPU limit.
- field dataset: str | None = None¶
HuggingFace dataset id, or a Parquet or JSONL path, for the dataset sources.
- field dataset_format: Literal['traces'] | None = None¶
traces: rows are recorded session segments, OpenAI chat messages in a messages column with optional tools. A rollout renders each target assistant turn’s history as a single-turn prompt and needs no prompt_template; with no rubric_file_path it scores 0, which OPD trains on as pure distillation. objective sft trains every target assistant turn. Takes no columns mapping.
- field dataset_path: str | None = None¶
Object-store path to a user-supplied dataset.
- field entrypoint: str | None = None¶
The env to build: a registry id, or module:Class (or module:attr constructor) for a custom upload.
- field env_config: dict[str, Any] | None = None¶
Keyword arguments forwarded to the factory or constructor after the env id. Not a place for env_id. system_prompt is reserved and set on the built env.
- field env_host_memory_bytes: int | None = None¶
Memory reserved per env host.
- field env_host_memory_limit_bytes: int | None = None¶
Memory limit per env_image Pod. Unset sets no limit.
- field env_host_ready_timeout_s: float | None = None¶
Seconds each env_image session Pod may take to become ready, image pull included. Unset is 600.
- field env_host_resource: str | None = None¶
Where env hosts land: a custom Ray resource, or (for env_image) the Pod nodeSelector — key=value, or a bare pool name.
- field env_hosts: int | None = None¶
Number of env hosts to serve the env on (Ray runtime only). Unset with no image or packages runs an entrypoint in-process in each rollout slot, unless cpus_per_env_host, env_host_memory_bytes or env_host_resource is set, which asks for one host.
- field env_image: str | None = None¶
Prebuilt env image run verbatim as its own Pod per host, serving on env_port (Ray runtime only).
- field env_packages: dict[str, Any] | None = None¶
What the entrypoint needs installed, as {‘uv’: […]} or {‘pip’: […]}. Installed where the env runs the first time the entrypoint is not importable.
- field env_port: int | None = None¶
TCP port the env_image server listens on.
- field env_services: list[EnvServiceSpec] [Optional]¶
Backing services the env_image sessions share, started with the job and deleted with it (Ray runtime on Kubernetes only).
- field env_session_ports: dict[str, int] [Optional]¶
Container environment set to base + session index in each session container, so sessions sharing a Pod bind distinct ports.
- field env_sessions_per_host: int | None = None¶
Sessions per env_image Pod: one container each, serving on env_port, env_port + 1, … Unset is 1. More than 1 needs env_session_ports.
- field env_type: Literal['rollout', 'dataset'] [Required]¶
Which LLM regime drives the run: a generative environment the model acts in (rollout), or teacher-forced learning over dataset rows (dataset).
- field env_url: str | list[str] | None = None¶
URL of an already-hosted OpenEnv service. A list is a set of interchangeable replicas dealt across rollout slots.
- field env_vars: dict[str, str] [Optional]¶
Container environment for each env_image Pod.
- field factory: str | None = None¶
Optional module:attr callable that receives the entrypoint as its first argument, e.g. gem:make. Unset constructs entrypoint as a class or callable.
- field goal_images_field: str | None = None¶
Observation field holding the task images that follow the first prompt. Empty or unset reads none.
- field group_rubric_name: str | None = None¶
Name of a GroupRubric in the rubric_file_path module. It scores each finished group of completions together, and each score is added to that completion’s final-turn reward. Leave rubric_name unset to keep the env’s own turn reward. Group replay is off with a group rubric.
- field hf_dataset_id: str | None = None¶
HuggingFace dataset id, when set apart from dataset.
- field include_reasoning: bool | None = None¶
Send the env each turn’s reasoning with its markers, not only the text after the reasoning ends; a Rubric class reads that text as TurnAction.message. Unset sends it over dataset rows and not to an env that runs the action. A reward function gets the whole turn as completion either way.
- field judge: JudgeSpec | None = None¶
LLM judge handed to the rubric: a Rubric class whose __init__ takes judge is built with it. Needs rubric_file_path.
- field max_concurrent_resets: int | None = None¶
Env resets one rollout engine runs at once (Ray runtime only). Unset runs every reset at once; set it to what the env’s backing services can serve.
- field max_reward: float | None = None¶
Reward at which a rollout counts as solved, used for the success metric.
- field max_turns: int | None = None¶
Turn budget per episode. Unset puts no cap on turns: the episode ends when the env terminates or truncates, or when the next prompt no longer fits the model’s context. Required with env_url, segment_prompt_tokens or segment_max_images.
- field min_reward: float | None = None¶
Lowest reward the env gives. Scores a turn whose tool calls are malformed or missing, which never reaches the env. Unset scores 0.
- field modality: Literal['text', 'vision'] | None = None¶
What the env’s observations carry: text only, or text and images (vision). text lets a vision-language model’s rollout engine skip its multimodal towers. Unset is unknown and keeps them.
- field name: str | None = None¶
Catalog / dataset label only. Not the env id.
- field num_envs: int | None = None¶
Ignored for LLM runs: rollout concurrency comes from the batch and group size.
- field objective: Literal['preference', 'sft'] | None = None¶
Teacher-forced loss, required with env_type dataset: sft, or preference (DPO) over chosen/rejected pairs.
- field observation_field: str | None = None¶
The field an env’s observation carries its text in. Unset reads the standard shapes, or the single text field the observation carries.
- field observation_processor: str | None = None¶
module:fn entrypoint rendering an observation payload to prompt text, for envs that need more than a field lookup. Mutually exclusive with observation_field.
- field prompt_template: dict[str, Any] | None = None¶
Conversation template, keyed ‘role_index’ (system_0, user_1, …) so ordering is explicit. Values may use {question} and {answer}, filled from the mapped columns; other braces are literal. Required for a rollout over dataset rows, except traces.
- field repeat_system_prompt: bool = False¶
Also put env_config.system_prompt after the first observation and after each image observation, ahead of a trailing ‘Question:’ block. False sends each observation unchanged.
- field request_timeout_s: float | None = None¶
Per-message client timeout in seconds for an env reached over HTTP. Unset applies a 300 s bound; 0 disables the bound.
- field response_column: str | None = None¶
Column holding the target response. SFT only.
- field restart_keep_turns: int = 0¶
Turns a restarted context repeats word for word (the model’s tokens and the observation after each), oldest dropped to leave room for one more turn under segment_prompt_tokens. Must be below segment_max_images. 0 keeps only the list of past actions.
- field restart_older_images: bool = True¶
Whether kept turns before the latest keep their images in a restarted context. False needs restart_keep_turns of 2 or more.
- field restart_older_obs_field: str = ''¶
Observation field a restarted context shows, as ‘field: value’, for each kept turn before the latest, in place of that turn’s full observation text. Needs restart_keep_turns of 2 or more. Empty repeats every kept observation in full.
- field reward: RewardSpec | None = None¶
Built-in reward scoring each turn, in place of rubric_file_path.
- field rubric_file_path: str | None = None¶
Path to the Python module holding the rubric (or reward function) that scores every turn. Required for a rollout over dataset rows, except under OPD, where unset scores every turn 0; on an env, its score replaces the env’s reward, which it can read as an input.
- field rubric_name: str | None = None¶
Name of the rubric (or reward callable) to import from that module.
- field screenshot_field: str | None = None¶
Observation field holding the page image. Empty or unset reads no page image. A field named image is always read when present.
- field segment_max_images: int | None = None¶
Restart the episode’s context when the next prompt would carry more than this many images; set it to the engine’s limit_mm_per_prompt image count. Unset puts no image limit on a segment.
- field segment_prompt_tokens: int | None = None¶
Restart the episode’s context when the next prompt would exceed this many tokens; each segment trains as its own row. Unset keeps one row per episode.
- field strict_chat_template_boundary: bool | None = None¶
Fail when the chat template cannot render a clean multi-turn boundary, rather than falling back to ChatML markers.
- field task_family_field: str | None = None¶
Field of each env_config.tasks row naming the row’s family, such as a template id. Under adaptive_task_sampling, a row with few groups is drawn by its family’s pooled rate of differing rewards. The field is not sent to the env. Unset puts no row in a family.
- field task_family_prior_strength: float = 1.0¶
Groups’ worth of weight a family’s rate carries in a row’s estimate; a row with more groups than this is drawn mostly by its own rate.
- field train_test_split: float | None = None¶
Fraction of the dataset used for training; the rest is held out for evaluation.
- class JudgeSpec¶
The LLM a rubric’s judge calls: provider, model, endpoint and limits.
- field api_key_env: str | None = None¶
Name of the environment variable holding the API key; never the key itself. Unset sends no key (a local endpoint).
- field base_url: str | None = None¶
http(s) endpoint. A URL with a path is the API root, used as given (https://openrouter.ai/api/v1); a bare host gets the client’s default path. Unset uses the provider’s hosted API, which needs api_key_env.
- field max_concurrency: int = 16¶
Judge requests in flight per process.
- field max_tokens: int = 4096¶
Verdict token budget. A thinking judge spends it on its thinking too, so a low budget cuts the verdict off.
- field model: str [Required]¶
Judge model id; for bedrock, the Bedrock model id (deepseek.v3.2).
- field provider: Literal['openai', 'anthropic', 'bedrock'] = 'openai'¶
API the judge speaks. openai covers any OpenAI-compatible endpoint: OpenRouter, Together, Groq or self-hosted vLLM, through base_url. bedrock calls Amazon Bedrock’s Converse API with the machine’s own AWS credentials.
- field region: str | None = None¶
AWS region a bedrock judge’s model runs in (us-east-1).
- field temperature: float = 0.0¶
Judge sampling temperature. Anthropic judges take none: leave it unset.
- field timeout_s: float = 120.0¶
Seconds one request attempt may take; the provider SDK retries it.
- class EnvServiceSpec¶
A backing service the env sessions share: one Pod behind a stable DNS name.
- field containers: list[EnvContainerSpec] [Required]¶
Containers of the service Pod; they share its network.
- field host_volumes: list[EnvHostVolume] [Optional]¶
Node directories mounted read-only into every container, for data the node provides (a disk the cluster attaches) rather than the image.
- field name: str [Required]¶
Service name, unique within the environment.
- field ready_timeout_s: float = 600.0¶
How long the service may take to become ready.
- field url_env: str [Required]¶
Environment variable carrying the service URL into every env session and service container.
- class EnvContainerSpec¶
One container of an
env_servicesPod.- field command: list[str] | None = None¶
Replaces the image ENTRYPOINT. Required with memory_rootfs.
- field cpu: str = '10m'¶
CPU request, as a Kubernetes quantity. No CPU limit is set.
- field env: dict[str, str] [Optional]¶
Container environment, in order. A value may reference an earlier variable or any service’s url_env as $(NAME).
- field ephemeral_storage: str | None = None¶
Ephemeral-storage request, so the Pod lands on a node with room for a large image.
- field image: str [Required]¶
Container image.
- field memory: str | None = None¶
Memory request.
- field memory_limit: str | None = None¶
Memory limit.
- field memory_rootfs: str | None = None¶
Size of a memory-backed volume the image is unpacked into, for an image larger than a node’s disk. The container then runs command under chroot in a privileged container: the image’s ENTRYPOINT, ENV and WORKDIR do not apply, so set command and env. The unpack uses the Pod’s image pull secrets.
- field name: str [Required]¶
Container name, unique within its service.
- field port: int | None = None¶
Port this container serves the service on. Exactly one container of a service sets it.
- field readiness_command: list[str] | None = None¶
Exec readiness probe. Unset probes TCP on port, if set.
- field readiness_path: str | None = None¶
HTTP GET readiness probe on port.
- field setup_command: list[str] | None = None¶
Runs once the container starts; the service is not ready until it exits 0, and a failure restarts the container. Output goes to the container log.
- class EnvHostVolume¶
A node directory mounted read-only into every container of a service.
- field host_path: str [Required]¶
Directory on the node under /var/cache/agilerl-, where the platform mounts the data it provides. The Pod does not start on a node without it.
- field mount_path: str [Required]¶
Where the containers see the directory.
- field name: str [Required]¶
Volume name, unique within its service.
training¶
- class TrainingSpec¶
The manifest’s
trainingsection.- field checkpoint_export: CheckpointExportSpec | None = None¶
Adapter-only save by default, or a merged Hugging Face export when format is merged and trigger matches.
- field checkpoint_optimizer: bool = True¶
Store the optimizer state in LLM checkpoints so a resumed run keeps its Adam moments. Adds about twice the adapter’s size.
- field checkpoint_path: str | None = None¶
Where checkpoints are written.
- field checkpoint_steps: int | None = None¶
Steps between checkpoints. Unset never writes.
- field env_resource_ratio: float | None = None¶
Share of each node’s CPU reserved for environment workers.
- field eval_greedy: bool = True¶
Also run eval_loop near-greedy passes over the held-out tasks under async rollout. With eval_samples_per_task set they report as eval_score_greedy and eval_accuracy_greedy.
- field eval_loop: int = 1¶
Evaluation passes averaged into each eval score. More passes give a steadier score.
- field eval_max_concurrent_episodes: int | None = None¶
Held-out episodes one rollout engine runs at once; the rest wait in a queue. They share the engine’s episode slots with training. Unset lets them take every free slot.
- field eval_samples_per_task: int = 0¶
Held-out episodes per task sampled at the algorithm’s temperature and top_p under async rollout. Their mean is eval_score and eval_accuracy. 0 reports the near-greedy pass there instead.
- field eval_steps: SkipJsonSchema[int | None] = None¶
Steps per evaluation episode. Unset runs a full episode.
- field evaluation_interval: int | None = None¶
Steps between evaluations during LLM fine-tuning.
- field evo_steps: int | None = None¶
Steps between evaluation rounds, also spelled metrics_interval. Unset resolves to the algorithm’s own cadence.
- field max_steps: int = 1000000¶
Total steps to train for. The run stops here. Unset on an LLM run over dataset rows trains one pass over the dataset.
- field max_wall_seconds: float | None = None¶
Wall-clock limit for the run. Unset trains to max_steps.
- field name: str | None = None¶
Label for the training loop in logs.
- field num_epochs: SkipJsonSchema[int | None] = None¶
Passes over the dataset, when the loop is epoch-driven rather than step-driven. Not for LLM runs: they set max_steps.
- field overwrite_checkpoints: bool = False¶
Overwrite the previous checkpoint instead of keeping each one.
- field reporting_interval: int = 1024¶
Steps between metric reports.
- field rollout_batch_size: int | None = None¶
Rollout groups per cycle, in total across all of a member’s rollout engines, rounded up to a multiple of the engine count; each engine runs an equal share. Must divide evenly by training_gpus_per_agent so every learner shard gets data. Unset is the algorithm’s batch_size rounded up to a multiple of both training_gpus_per_agent and the engine count, so the engines keep one learn step of groups in flight.
- field rollout_engines_per_agent: int | Literal['auto'] = 0¶
Generation engines per trainer, one GPU each. ‘auto’ takes every GPU the trainers leave over. Unset under async rollout with training_gpus_per_agent also unset, the trainer / engine split is picked by the throughput model; unset otherwise is ‘auto’.
- field rollout_mode: RolloutMode = 'colocated'¶
Where generation runs. ‘colocated’ alternates generation and learning on the same GPU, for local runs; ‘async’ moves generation onto dedicated rollout engines that run continuously. Arena runs every rollout LLM job async. replay_buffer.max_rollout_version_lag bounds staleness.
- field rollout_version_stamp: RolloutVersionStamp | None = None¶
Which weight version a published group is fenced by. ‘oldest_turn’ ages a group by how long it ran, so long episodes are dropped first; ‘publish’ makes buffer residency independent of episode duration.
- field target_score: float | None = None¶
Stop early once the eval score reaches this. Unset trains to max_steps.
- field training_gpus_per_agent: int = 1¶
Data-parallel trainer GPUs. The replay buffer shards rollouts across them.
- field weight_sync_interval: int | None = None¶
Learn chunks between rollout weight syncs under async rollout. Unset resolves to 1: fresh weights every cycle.
- class CheckpointExportSpec¶
When to write a merged Hugging Face package next to adapter checkpoints.
- Parameters:
format –
adapterwrites LoRA weights only;mergedalso writesmerged/after a durable adapter save whentriggermatches.trigger –
final(last durable save of the run),best(best checkpoint if the trainer marks one, otherwisefinal),on_demand(no merge during train), orevery(after every adapter save).
- field format: CheckpointExportFormat = 'adapter'¶
adapter writes LoRA weights only; merged also writes merged/ after a durable adapter save when trigger matches.
- field trigger: CheckpointExportTrigger = 'final'¶
final (last durable save of the run), best (best checkpoint if the trainer marks one, otherwise final), on_demand (no merge during train), or every (after every adapter save).
network¶
- class FinetuningNetworkSpec¶
Model specification for LLM finetuning networks.
- field lora_config: LoraConfigDict [Optional]¶
LoRA adapter configuration. Unset or null trains the model’s catalog default adapter; Arena has no full finetune.
- field max_context_length: int [Required]¶
Context window the run is sized for, prompt plus completion.
- field pretrained_model_name_or_path: str [Required]¶
HuggingFace model id or local path to fine-tune.
- field weights_path: str | None = None¶
Local or s3:// directory to load the weights and tokenizer from. pretrained_model_name_or_path then names the catalog model with the same architecture, which sizes and configures the run.
- class LoraConfigDict¶
Model specification for LLM LoRA configuration.
It names no modules: Arena trains LoRA on the catalog’s modules for the model (
catalog_lora_modules()).- field lora_alpha: int = 32¶
LoRA scaling. Conventionally set to twice the rank.
- field lora_dropout: float = 0.0¶
Dropout on the adapter. Must be 0 when target_parameters is set. Rollout algorithms (GRPO, CISPO, GSPO, LLMPPO, LLMREINFORCE) sample with vLLM, which applies no dropout.
- field lora_r: int = 16¶
LoRA rank. Higher adapts more of the model, at proportional memory cost.
- field target_parameters: list[str] | None = None¶
Packed MoE expert parameter paths to adapt, e.g. block_sparse_moe.experts.gate_up_proj. Requires lora_dropout=0.
- field task_type: str = 'CAUSAL_LM'¶
PEFT task type for the adapter.
replay_buffer¶
- class LLMRolloutBufferSpec¶
LLM branch of the
replay_buffersection: the async rollout deque.- field drop_uninformative_groups: bool = True¶
Discard groups whose completions all got identical rewards before they reach a learner, and wait until each learner’s batch is full of groups whose rewards differ. Tied groups have zero advantage, so training on them only costs compute, but each trained step then generates more groups than it trains. No effect when group_size is 1.
- field group_replay_max_age: int = 20¶
Policy versions (weight syncs) a stored completion stays eligible for group replay; 0 turns group replay off. Group replay keeps each task’s most recent completion for each episode return seen (up to 4 returns per task). When every completion in a new group for that task gets the same return, swap one of them for the stored completion with the highest other return, so the group still has a reward difference to learn from: a group that all failed gets a past success, one that all succeeded gets a past failure. The replayed completion keeps the token log-probabilities it was sampled with, and the algorithm’s ratio clipping bounds its update. Applies to async rollout over a dataset-backed task list; no effect when group_size is 1. The store is in memory only and refills from new rollouts after a resume.
- field max_rollout_version_lag: int = 2¶
Weight-sync versions a group may fall behind before it is dropped as too off-policy: the sync to version v keeps groups generated at version v - lag or later. 0 is strictly on-policy; the default 2 also keeps groups started under the two previous weight versions.
- field max_size: int = 10000¶
Rollout groups queued per learner shard before the oldest is evicted. Counts generated groups, not RL transitions.
- field name: str | None = None¶
Label for the buffer in logs.