Library / SDK
thinking-machines-lab/tinker-cookbook avatar
thinking-machines-lab/tinker-cookbook

Tinker Cookbook: recipes for a hosted fine-tuning API, with Inkling renderers and a pinned transformers range

Post-training with Tinker

4,315 stars571 forksPythonApache-2.0

At a glance

What is it?
tinker-cookbook is the Apache-2.0 Python library of SFT, RL, preference, distillation and audio recipes built on the hosted Tinker training API. It is only useful if you have Tinker access, and its dependency pins show what breaks around tokenizers.
Who is it for?
Use tinker-cookbook if you already have, or plan to get, Tinker API access and want working SFT, RL, preference or distillation recipes instead of writing training loops. Skip it if you need to run training on your own GPUs, because the training runs on Thinking Machines infrastructure.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • thinking-machines-lab/tinker-cookbook4,315 ★ · +170
Star history
Repository2026-09-232026-11-22
thinking-machines-lab/tinker-cookbook4.1k4.3k

170 Stars in the last 60 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Training happens on a remote service, so an API key is the first gate

There are two libraries here. `tinker` is the training SDK: you send API requests and Thinking Machines handles the complexities of distributed training. `tinker-cookbook` is this repository, with realistic fine-tuning examples and common abstractions built on that API. Nothing in the cookbook trains on your local hardware.

Access comes before code. You sign up for Tinker, create an API key in the console and export it as the environment variable `TINKER_API_KEY`. Then you install the cookbook, which pulls in the `tinker` SDK as a dependency:

bash
# Latest stable release from PyPI
uv pip install tinker-cookbook

# Or install the nightly build
uv pip install 'tinker-cookbook @ git+https://github.com/thinking-machines-lab/tinker-cookbook.git@nightly'

The consequence is that the code is open under Apache-2.0 while the compute is not. If your account lacks access, the recipes have nothing to run against.

The SDK primitives are four calls around a LoRA training client

The core loop uses a `ServiceClient` that creates a LoRA training client for a base model with a chosen rank. You then call `forward_backward`, `optim_step` and `save_state`, and resume with `create_training_client_from_state`. To sample from what you trained, you call `save_weights_and_get_sampling_client` and then `sample`.

python
import tinker
service_client = tinker.ServiceClient()
training_client = service_client.create_lora_training_client(
  base_model="meta-llama/Llama-3.2-1B", rank=32,
)
training_client.forward_backward(...)
training_client.optim_step(...)
training_client.save_state(...)
resumed_client = service_client.create_training_client_from_state(...)

sampling_client = training_client.save_weights_and_get_sampling_client()
sampling_client.sample(...)

The minimal complete versions are `tinker_cookbook/recipes/sl_loop.py` and `tinker_cookbook/recipes/rl_loop.py`. The fine-tuning method in this snippet is LoRA, so full-parameter training is not what these primitives show.

Inkling models get their renderer and tokenizer selected from the model name

Inkling is Thinking Machines Lab's model tailored for Tinker. It can code, reason, call tools and process image and audio inputs. Inkling-Small is a smaller, lower-cost model in the same family that shares Inkling's rendering path and reasoning-effort interface.

You pass `model_name="thinkingmachines/Inkling"` or `model_name="thinkingmachines/Inkling-Small"` anywhere the cookbook accepts a model name. The renderer and tokenizer are picked automatically for any `thinkingmachines/Inkling*` model, including the `:peft:` long-context variants. Sampling and post-training go through the standalone `tml-renderers` library, which is part of the default installation together with `torch>=2.10`. That torch floor comes from a comment in pyproject.toml: tml_renderers uses libtorch's stable C ABI, added in 2.10. So even a client that only calls a remote API installs a large local torch dependency.

The recipes folder covers nine training setups, each with its own README

Beyond the minimal `sl_basic.py` and `rl_basic.py` examples, the recipes folder holds fuller setups. Chat SFT does supervised fine-tuning on conversational datasets such as Tulu3. Math RL uses verifiable rewards for mathematical reasoning. Code RL trains on competitive programming with sandboxed code execution and is described as a DeepCoder replication. Preference learning covers DPO and a three-stage RLHF pipeline of SFT, reward model and RL.

Distillation supports on-policy and off-policy knowledge distillation with single and multiple teachers. Tool use is a Search-R1 replication for retrieval-augmented generation. Multi-agent RL runs self-play and cross-play. Audio does SFT and RL for Inkling audio inputs, including speech recognition and speaking-style classification, and VLM image classification trains and evaluates vision-language models. Each recipe has a README with implementation details, launch commands and expected results, and the recipes README also names Harbor RL, rubric-based grading and SDFT.

Twenty-plus marimo notebooks teach the pieces in order

The `tutorials/` directory holds 20 or more progressive marimo notebooks. They start with core concepts such as rendering, loss functions, completers and weight management, and move to custom RL environments, DPO, RLHF and weight export. Open one with:

bash
marimo edit tutorials/101_hello_tinker.py

Rendered versions are also on the Tinker docs site. If you want your weights back, the cookbook shows a REST client path: create a REST client, ask for a checkpoint archive URL from `sampling_client.model_path`, and write the result to `model-checkpoint.tar.gz`. A pyproject comment says pyrage handles age decryption of temporary external weights exports, which is what makes that download usable on your side.

Pinned transformers versions record real tokenizer bugs

The dependency list requires Python 3.11 or newer and `tinker>=0.35.0`, and its transformers line is the most informative one: `transformers>=4.57.6,!=5.3.0,!=5.4.*,!=5.5.0,!=5.5.1,!=5.5.2,!=5.5.3,!=5.6.*`. The comments say known-bad releases are excluded rather than capping the upper bound.

The reasons are specific. In 5.3.0 and 5.6.x, AutoTokenizer resolves DeepSeek V3 to LlamaTokenizer, which drops spaces on decode. In 5.4.x, Qwen VL image processing requires torchvision. In 5.4.0 to 5.5.3, AutoTokenizer resolved Kimi K2 to the wrong class on some platforms. A separate comment notes that tiktoken is required for the Kimi tokenizer. If you force one of the excluded transformers versions, expect broken decoding rather than a clean install error.

The evaluation framework is marked experimental

A benchmark framework lives under `tinker_cookbook/eval/`, and its section is labeled experimental. You call `run_benchmarks` with benchmark names, a sampling client and a renderer, plus a `BenchmarkConfig` with a save directory:

python
from tinker_cookbook import cli_utils
from tinker_cookbook.eval.benchmarks import run_benchmarks, BenchmarkConfig

results = await run_benchmarks(
    ["gsm8k", "mmlu_pro", "ifeval"],
    sampling_client, renderer,
    BenchmarkConfig(save_dir=cli_utils.runs_path("evals", "step500")),
)

The framework currently supports 12 benchmarks, with GSM8K, MMLU-Pro and IFEval used in the example. Because of the experimental label, treat the API as one that can change between releases. The latest tagged releases are v0.5.8 and v0.5.9, plus a nightly build, so a pin to an exact version protects scripts you rely on.

Editorial conclusion

Use tinker-cookbook if you already have, or plan to get, Tinker API access and want working SFT, RL, preference or distillation recipes instead of writing training loops. Skip it if you need to run training on your own GPUs, because the training runs on Thinking Machines infrastructure. Before starting, confirm the per-model pricing and context lengths on the Models and Pricing page, since the repository carries no cost figures.

Frequently asked questions

How much does Tinker cost?

The repository gives no prices. It points to the Models and Pricing page of the Tinker docs for per-model context lengths and pricing, and describes Inkling-Small as a lower-cost model than Inkling.

How does Thinking Machines Tinker work?

You send API requests with the tinker SDK and Thinking Machines handles the complexities of distributed training. The cookbook builds recipes on that API, and you need a TINKER_API_KEY from the console.

Can you list the models Tinker supports?

The repository names Inkling and Inkling-Small as its own models and uses meta-llama/Llama-3.2-1B in its example. Its dependency notes also mention DeepSeek V3, Qwen VL and Kimi K2 tokenizers, and the Models and Pricing page has the full list.

Official sources

  1. Issues
  2. License: Apache-2.0
  3. README
  4. Releases
  5. thinking-machines-lab/tinker-cookbook on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/thinking-machines-lab-tinker-cookbook.svg)](https://hysenlabs.com/projects/thinking-machines-lab-tinker-cookbook)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/thinking-machines-lab-tinker-cookbook.svg)](https://hysenlabs.com/projects/thinking-machines-lab-tinker-cookbook)

Was this useful?