# tinker_cookbook.preference.Config

## _class_ [**tinker_cookbook.preference.Config**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L31)()

Configuration for Direct Preference Optimization (DPO) training.

This is a `chz` dataclass that holds all hyperparameters, infrastructure
settings, and checkpointing options for a DPO training run.

```
config = Config(
    log_path="~/logs/dpo_run",
    model_name="Qwen/Qwen3.5-9B",
    renderer_name="qwen3_5_disable_thinking",
    dataset_builder=my_dpo_dataset_builder,
    dpo_beta=0.1,
    learning_rate=1e-5,
)
main(config)
```

**Fields:**

- [**log_path**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L92) ( _str_)
- [**model_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L93) ( _str_)
- [**recipe_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L94) ( _str_)
- [**dataset_builder**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L95) ( _[ChatDatasetBuilder](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/supervised/chatdatasetbuilder/)_)
- [**load_checkpoint_path**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L96) ( _str | None_, default: `None`)
- [**renderer_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L97) ( _str | None_, default: `None`)
- [**learning_rate**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L101) ( _float_, default: `1e-05`)
- [**lr_schedule**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L102) ( _LRSchedule_, default: `'linear'`)
- [**num_epochs**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L103) ( _int_, default: `1`)
- [**dpo_beta**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L104) ( _float_, default: `0.1`)
- [**lora_rank**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L107) ( _int_, default: `32`)
- [**num_replicas**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L110) ( _int_, default: `8`)
- [**base_url**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L111) ( _str | None_, default: `None`)
- [**evaluator_builders**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L114) ( _list[EvaluatorBuilder]_, default: `[]`) – Checkpointing and evaluation (0 = disabled for *_every fields)
- [**infrequent_evaluator_builders**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L115) ( _list[EvaluatorBuilder]_, default: `[]`)
- [**save_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L116) ( _int_, default: `20`)
- [**eval_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L117) ( _int_, default: `10`)
- [**infrequent_eval_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L118) ( _int_, default: `100`)
- [**ttl_seconds**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L119) ( _int | None_, default: `604800`) – 7 days
- [**rolling_save_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L122) ( _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/main/tinker_cookbook/preference/train_dpo.py#L124) ( _int_, default: `7200`) – 2 hours
- [**adam_beta1**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L127) ( _float_, default: `0.9`)
- [**adam_beta2**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L128) ( _float_, default: `0.95`)
- [**adam_eps**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L129) ( _float_, default: `1e-08`)
- [**wandb_project**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L132) ( _str | None_, default: `None`)
- [**wandb_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L133) ( _str | None_, default: `None`)
- [**enable_trace**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L136) ( _bool_, default: `False`) – Profiling
- [**span_chart_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L137) ( _int_, default: `0`)
- [**reference_model_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L140) ( _str | None_, default: `None`)
- [**max_steps**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/preference/train_dpo.py#L143) ( _int | None_, default: `None`) – Maximum number of training steps. If None, train for num_epochs * n_batches.
