Skip to main content
The post-training cookbook is a public Python library of ready-made training recipes built on the Together Python SDK, covering supervised fine-tuning (SFT), direct preference optimization (DPO), and group relative policy optimization (GRPO). Each recipe is a complete training loop that handles dataset loading, tokenization, validation, checkpoints, and logging, plus reward scoring for GRPO, so you start a run by editing a config instead of writing a loop. The cookbook’s chat-template and sample helpers also work on their own, inside a loop you write with the SDK.

How the cookbook relates to the SDK

Post-training code works at three levels: recipes, helpers, and the SDK. The cookbook supplies the recipes and helpers, and both call the SDK to train: Some features exist only in the cookbook’s recipes, not in the post-training service, so a loop you write with the SDK has them only if you implement them:

Install

Clone to run recipes

Recipes and notebooks run from a checkout of the repository. Clone it and install its dependencies, including the Together Python SDK, with uv:
The notebooks in notebooks/ walk step by step through GRPO, SFT, and training several low-rank adapters (LoRAs) on one model resource, using the SDK’s async calls. To add a notebook kernel, run uv sync --locked --group notebooks in your checkout.

Install as a library

To import the helpers into your own project, install the cookbook from GitHub, since it isn’t published to PyPI. It requires Python 3.11 or later and pulls in PyTorch, Transformers, and version 3 of the Together Python SDK as dependencies:
Import the cookbook as post_training_cookbook.

Recipes

Run a recipe with uv run python <path> from a cookbook checkout. Each recipe is a single script with its config at the top. To change a run, edit the config. To start a new recipe, copy an existing one.

Run outputs

Run artifacts

Every cookbook recipe writes a record of the run to a run directory, runs/<run_name>/:
The cookbook always writes metrics.jsonl, so you can analyze a run offline without W&B. To see what the model is producing, read the per-step step_NNNN_*.json files.

Weights & Biases

When a config sets wandb_project, the cookbook logs every step to that project. GRPOConfig defaults it to post-training-cookbook. SFTConfig and DPOConfig leave it unset.
Set WANDB_API_KEY before you launch a run that logs to W&B. The cookbook calls wandb.init only after it provisions the model resource, so a missing key fails the run after provisioning. In an interactive terminal, wandb.init waits at a login prompt instead, and the resource bills while it waits.
To run without a W&B account, set WANDB_MODE=offline to keep the W&B logs on disk, or set wandb_project=None to turn W&B off. To compare related runs side by side, such as the arms of a sweep, give them the same wandb_group. The cookbook forwards wandb_project, wandb_entity, wandb_group, and wandb_run_name to the session as metadata, and the console shows them on the session’s page. It doesn’t send the run’s ID or URL, so the page doesn’t link to the run. To open the run, use the W&B URL in manifest.json.

Next steps

Run GRPO recipes

Train a GRPO recipe on a built-in dataset or your own.

Run multi-turn GRPO recipes

Train a tool-use agent on an environment you write.

Monitor training runs

Watch a run in the console and read the metrics each recipe logs.

Cookbook config reference

Look up every config field and its default.