# tinker_cookbook.distillation.sdft.Config

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

Configuration for SDFT training.

**Key parameters:**
- `topk`: Number of top tokens for distillation (default 20). Set to 0 for the importance-sampling fallback. K=20 matches full-vocabulary KL in practice.
- `learning_rate`: For LoRA, use 5e-4 to 1e-3. The top-K CE loss produces larger gradients than SFT at the same LR due to more completion tokens per step (on-policy generation), so use the lower end of the range.
- `teacher_sync_every`: Optional periodic hard-sync of student weights into the teacher (approximating EMA). `None` = static frozen teacher, which works comparably to EMA in our experiments.

See `main` for the training loop.

**Fields:**
- [**model_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L756) ( _str_) – Model
- [**recipe_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L757) ( _str_)
- [**renderer_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L758) ( _str | None_, default: `None`)
- [**lora_rank**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L759) ( _int_, default: `128`)
- [**base_url**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L760) ( _str | None_, default: `None`)
- [**learning_rate**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L763) ( _float_, default: `2e-05`) – Training
- [**max_tokens**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L764) ( _int_, default: `2048`)
- [**temperature**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L765) ( _float_, default: `1.0`)
- [**loss_fn**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L766) ( _LossFnType_, default: `'cross_entropy'`)
- [**topk**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L769) ( _int_, default: `20`) – SDFT-specific
- [**reverse**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L770) ( _bool_, default: `False`)
- [**demo_template**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L771) ( _str_, default: `DEFAULT_DEMO_TEMPLATE`)
- [**system_prompt**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L772) ( _str | None_, default: `None`)
- [**teacher_sync_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L773) ( _int | None_, default: `None`)
- [**max_context_length**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L774) ( _int_, default: `32768`)
- [**evaluator_builders**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L777) ( _list[SamplingClientEvaluatorBuilder]_, default: `[]`) – Evaluation
- [**eval_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L778) ( _int_, default: `20`)
- [**save_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L779) ( _int_, default: `20`)
- [**num_substeps**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L782) ( _int_, default: `1`) – Standard infra
- [**log_path**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L783) ( _str_)
- [**wandb_project**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L784) ( _str | None_, default: `None`)
- [**wandb_name**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L785) ( _str | None_, default: `None`)
- [**load_checkpoint_path**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L786) ( _str | None_, default: `None`)
- [**max_steps**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L787) ( _int | None_, default: `None`)
- [**enable_trace**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L789) ( _bool_, default: `False`)
- [**span_chart_every**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/distillation/sdft.py#L790) ( _int_, default: `0`)
