Skip to main content

Tinker Cookbook

pytest pyright smoke-test-recipes PyPI

We provide two libraries for the broader community to customize their language models: tinker and tinker-cookbook.

  • tinker is a training SDK for researchers and developers to fine-tune language models. You send API requests to us and we handle the complexities of distributed training.
  • tinker-cookbook includes realistic examples of fine-tuning language models. It builds on the Tinker API and provides common abstractions to fine-tune language models.

Installation

  1. Sign up for Tinker here.
  2. Once you have access, create an API key from the console and export it as environment variable TINKER_API_KEY.
  3. Install tinker-cookbook (includes the tinker SDK as a dependency):
    # 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'
    

Using Inkling

Inkling is Thinking Machines Lab's model tailored for Tinker. It is a general-purpose model that can code, reason, call tools, and process image and audio inputs. Tinker Cookbook supports sampling and post-training Inkling through the standalone tml-renderers library; install it with the inkling extra, which also pulls in the required torch>=2.10:

uv pip install 'tinker-cookbook[inkling]'

Pass model_name="thinkingmachines/Inkling" anywhere the cookbook accepts a model name. The appropriate renderer and tokenizer are selected automatically.

Inkling supports controllable reasoning effort and multimodal audio and image inputs. See the Inkling documentation for setup and usage details.

Tinker

Here we introduce a few Tinker primitives — the basic components to fine-tune LLMs (see the quickstart guide for more details):

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(...)
training_client.load_state(...)

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

See tinker_cookbook/recipes/sl_loop.py and tinker_cookbook/recipes/rl_loop.py for minimal examples of using these primitives to fine-tune LLMs.

Tutorials

New to Tinker? The tutorials/ directory contains 20+ progressive marimo notebooks that walk through core concepts — rendering, loss functions, completers, weight management — and advanced topics such as custom RL environments, DPO, RLHF, and weight export. Run any tutorial with marimo edit tutorials/101_hello_tinker.py. See the tutorials README for the full list, or browse rendered versions on the Tinker docs site.

To download the weights of any model:

rest_client = service_client.create_rest_client()
future = rest_client.get_checkpoint_archive_url_from_tinker_path(sampling_client.model_path)
with open(f"model-checkpoint.tar.gz", "wb") as f:
    f.write(future.result())

Tinker Cookbook

Besides these primitives, we also offer Tinker Cookbook (a.k.a. this repo), a library of a wide range of abstractions to help you customize training environments. tinker_cookbook/recipes/sl_basic.py and tinker_cookbook/recipes/rl_basic.py contain minimal examples to configure supervised learning and reinforcement learning.

We also include more complete examples in the tinker_cookbook/recipes/ folder:

  • Chat SFT: supervised fine-tuning on conversational datasets (e.g., Tulu3).
  • Math RL: reinforcement learning for mathematical reasoning with verifiable rewards.
  • Code RL: RL on competitive programming with sandboxed code execution (DeepCoder replication).
  • Preference learning: DPO and a three-stage RLHF pipeline (SFT, reward model, RL).
  • Distillation: on-policy and off-policy knowledge distillation with single- and multi-teacher configurations.
  • Tool use: RL for retrieval-augmented generation (Search-R1 replication).
  • Multi-agent: multi-agent RL with self-play and cross-play.
  • Audio: SFT and RL for Inkling audio inputs, including speech recognition and speaking-style classification.
  • VLM image classification: supervised training and evaluation for vision-language models.

The recipes README covers all available recipes, including Harbor RL, rubric-based grading, VLM classification, and SDFT. Each recipe includes a README.md with implementation details, launch commands, and expected results.

Evaluation (experimental)

Tinker Cookbook includes a benchmark framework for evaluating trained models:

from tinker_cookbook.eval.benchmarks import run_benchmarks, BenchmarkConfig

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

The framework currently supports 12 benchmarks (GSM8K, MATH-500, MMLU-Pro, MMLU-Redux, GPQA, IFEval, MBPP, C-Eval, SuperGPQA, IFBench, AIME 2025, AIME 2026) with verified scores against published results, plus experimental benchmarks such as LiveCodeBench, Terminal Bench, and SWE-bench. Benchmarks can also serve as inline training evaluators via BenchmarkEvaluator.

Note: Benchmark scores are sensitive to evaluation configuration — system prompts, max_tokens, temperature, and timeout settings can shift results significantly. We document our exact settings alongside all reported scores. This framework is under active development; feedback and contributions are welcome. See the eval README for verified scores, configuration details, and instructions for adding new benchmarks.

Documentation

For the full Tinker documentation, visit tinker-docs.thinkingmachines.ai.

Utilities

Tinker Cookbook also provides reusable building blocks:

  • renderers — bidirectional conversion between token sequences and structured chat messages
  • hyperparam_utils — learning rate and hyperparameter scaling for LoRA training
  • eval — benchmark framework and inline training evaluators (see Evaluation above)

Claude Code Skills

Tinker Cookbook ships with Claude Code skills that teach Claude how to use the Tinker API. Install them so Claude can help you write training code in any project:

/plugin marketplace add thinking-machines-lab/tinker-cookbook

Then install the tinker plugin from the Discover tab (/plugin → Discover). Once installed, two skills are available:

Command What it does
/tinker:research Plan and run post-training experiments — SFT, RL, DPO, distillation, evaluation, hyperparameters, model selection, and more
/tinker:debug Diagnose slow training, hangs, output mismatches, renderer issues, and errors

Skills also trigger automatically based on context — ask Claude to "set up SFT training" and it will load the right skill without a slash command. Skills update automatically when the repo is updated.

Development Setup

uv sync --extra dev
pre-commit install

This installs dev dependencies and registers pre-commit hooks that run ruff formatting and linting on every commit. CI enforces these checks on all pull requests.

Contributing

This project is built in the spirit of open science and collaborative development. We believe that the best tools emerge through community involvement and shared learning.

We welcome PR contributions after our private beta is over. If you have any feedback, please email us at tinker@thinkingmachines.ai.

Citation

If you use Tinker for your research, please cite it as:

Thinking Machines Lab, 2026. Tinker. https://thinkingmachines.ai/tinker/.

Or use this BibTeX citation:

@misc{tml2026tinker,
  author = {Thinking Machines Lab},
  title = {Tinker},
  year = {2026},
  url = {https://thinkingmachines.ai/tinker/},
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tinker_cookbook-0.5.2.tar.gz (4.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tinker_cookbook-0.5.2-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

File details

Details for the file tinker_cookbook-0.5.2.tar.gz.

File metadata

  • Download URL: tinker_cookbook-0.5.2.tar.gz
  • Upload date:
  • Size: 4.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tinker_cookbook-0.5.2.tar.gz
Algorithm Hash digest
SHA256 f4e2cc465d072385c68cb25baff2883fcc2ffe89157d2d7329768e88e4cd06a0
MD5 c47d0f63b9856584870627b56cd87bef
BLAKE2b-256 1fa9586de1daa657aa2d1087e4fa1173524bc93c5a11d598e35e0355233297a0

See more details on using hashes here.

File details

Details for the file tinker_cookbook-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: tinker_cookbook-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tinker_cookbook-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 42554513b8c7a4fe5b124e680345a8883e82eff90345658d4e009f0866654dfa
MD5 1a54de82927c2fa4d310c6649c7ef253
BLAKE2b-256 ebd812ebe2d7fac3835a8bc2d1c23b59b026e7e1389ced92aadf0fcdf746620d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page