# tinker_cookbook.rl.Config *Generated from tinker-cookbook at commit [`8bf7dd6`](https://github.com/thinking-machines-lab/tinker-cookbook/tree/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83). Source links point at that snapshot.* ## *class* [**tinker_cookbook.rl.Config**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L588)() Configuration for RL training. This is the main configuration object for `main`. It controls the model, dataset, optimizer, loss function, KL penalty, evaluation cadence, checkpointing, logging, and execution mode (sync, async, or streaming minibatch). All fields use `chz` dataclass semantics and can be overridden via CLI or YAML configuration files. **Fields:** - [**learning_rate**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L604) (*float*) – Base learning rate used by Adam. - [**dataset_builder**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L606) (*[RLDatasetBuilder](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/rldatasetbuilder/index.md)*) – Builds the RL dataset; also determines number of groups per batch. - [**model_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L608) (*str*) – Model name (base weights) to train. - [**recipe_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L612) (*str*) – training/sampling calls inherit it. - [**max_tokens**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L614) (*int*) – Maximum number of generated tokens per rollout trajectory. - [**log_path**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L616) (*str*) – Directory for checkpoints, logs, and traces. - [**eval_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L618) (*int*, default: `20`) – Evaluation cadence in training iterations (0 = disabled). - [**save_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L620) (*int*, default: `20`) – Checkpoint cadence in training iterations (0 = disabled). - [**evaluator_builders**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L622) (*list[SamplingClientEvaluatorBuilder]*, default: `[]`) – Optional evaluators run during training. - [**load_checkpoint_path**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L624) (*str | None*, default: `None`) – Start training from weights at this checkpoint (fresh optimizer state). - [**renderer_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L626) (*str | None*, default: `None`) – Renderer used by the training dataset/environment. - [**wandb_project**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L628) (*str | None*, default: `None`) – Optional W&B project and run name. - [**wandb_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L629) (*str | None*, default: `None`) - [**session_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L631) (*str | None*, default: `None`) – Display name for the Tinker session; defaults to wandb_name when set. - [**kl_penalty_coef**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L637) (*float*, default: `0.0`) – KL penalty coefficient against reference policy (0 = disabled). - [**kl_discount_factor**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L639) (*float*, default: `0.0`) – Optional position discount for KL penalty terms. - [**kl_reference_config**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L641) (*KLReferenceConfig | None*, default: `None`) – Required when kl_penalty_coef > 0. - [**loss_fn**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L649) (*LossFnType*, default: `'importance_sampling'`) – Async runs use AsyncConfig.loss_fn (default "stable_reinforce") instead. - [**loss_fn_config**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L650) (*dict[str, Any] | None*, default: `None`) - [**num_substeps**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L654) (*int*, default: `1`) – Useful for very large batch sizes. - [**lora_rank**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L656) (*int*, default: `32`) – LoRA rank for the training adapter. - [**temperature**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L664) (*float*, default: `1.0`) – well with KL penalty. - [**compute_post_kl**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L666) (*bool*, default: `False`) – Compute extra post-update KL metrics (adds overhead). - [**remove_constant_reward_groups**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L668) (*bool*, default: `False`) – Remove groups where all trajectories have identical reward. - [**rollout_error_tolerance**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L676) (*bool | [RolloutStrategy](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/rolloutstrategy/index.md) | None*, default: `None`) – RolloutStrategy instance: custom strategy (e.g. RetryOnFailure(max_retries=5)). - [**termination**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L686) (*TerminationRewardPolicy | None*, default: `None`) – envs are built (e.g. build_agent_tool_env(rollout_config=...)). - [**enable_trace**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L688) (*bool*, default: `False`) – Emit async trace events for debugging/profiling. - [**span_chart_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L690) (*int*, default: `0`) – Save a Gantt chart HTML every N iterations (0 = disabled). Requires plotly. - [**async_config**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L695) (*[AsyncConfig](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/asyncconfig/index.md) | None*, default: `None`) – Enable async/off-policy training mode when set. - [**stream_minibatch_config**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L697) (*[StreamMinibatchConfig](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/streamminibatchconfig/index.md) | None*, default: `None`) – Enable sync training with streaming minibatches when set. - [**base_url**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L699) (*str | None*, default: `None`) – Optional service base URL override (primarily internal/dev use). - [**ttl_seconds**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L706) (*int | None*, default: `604800`) – 7 days - [**rolling_save_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L709) (*int*, default: `0`) – but skips the sampler-weight export, making it cheaper than periodic checkpoints. - [**rolling_ttl_seconds**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L711) (*int*, default: `7200`) – 2 hours - [**num_groups_to_log**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L712) (*int*, default: `4`) – Number of groups to log per iteration (0 = disable logging) - [**rollout_json_export**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L713) (*bool*, default: `True`) - [**num_epochs**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L718) (*int*, default: `1`) – global step across epochs. - [**max_steps**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L722) (*int | None*, default: `None`) – max_steps alone stops early, with a warning at startup). ### [**training_loss_fn**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L724)() The loss this run trains with: `async_config.loss_fn` for async runs, `loss_fn` otherwise. **Returns:** *LossFnType* ### [**records_stability_info**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L729)() Whether sampling must record the information StableReinforce trains on. **Returns:** *bool* ### [**sampling_client_kind**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L733)() The kind of sampling client each training step publishes for rollouts: `"inflight"` for async runs with `inflight_weight_updates` whose `sampling_steps_ahead` is above 0, `"snapshot"` otherwise. With an on-policy buffer no rollout runs during a train step, so inflight clients would only add sampler saves. **Returns:** *SamplingClientKind* ### [**async_groups_per_step**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L747)() Trajectory groups an async run trains per step: `stream_minibatch_config.groups_per_batch` with streaming minibatches, `async_config.groups_per_batch` otherwise. **Returns:** *int* ### [**async_group_buffer_size**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L757)() The maximum number of trajectory groups an async run keeps started but not yet trained: `groups_per_step * (sampling_steps_ahead + 1)`. **Returns:** *int* ### [**effective_termination**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L764)() The termination policy this run trains with. `termination=None` (the default) resolves via `~tinker_cookbook.rl.rollout_presets.default_rollout_config_for_model`, so `thinkingmachines/Inkling` models get the agentic grade-then-clamp policy and other models get no reward adjustment. An explicit policy wins. **Returns:** *TerminationRewardPolicy | None* ### [**effective_rollout_strategy**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/8bf7dd6192a3f1fa64640a04ec54a7f6866bbd83/tinker_cookbook/rl/train.py#L777)() The group rollout strategy this run trains with. `rollout_error_tolerance=None` (the default) resolves via `~tinker_cookbook.rl.rollout_presets.default_rollout_strategy_for_model` (`MinViableGroup` for `thinkingmachines/Inkling` models, [`FailFast`](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/failfast/index.md) otherwise). Explicit values — `False`, `True`, or a strategy instance — win over the model default. **Returns:** *[RolloutStrategy](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/rolloutstrategy/index.md)*