LogoAIAny
Icon for item

Tinker Cookbook

Tinker Cookbook is an open-source library from Thinking Machines Lab for customizing language models via the Tinker API. It offers realistic fine-tuning examples for supervised learning, reinforcement learning, chat, math reasoning, preference learning, tool use, prompt distillation, and multi-agent setups, along with utilities for rendering, hyperparameters, and evaluation.

Introduction

Tinker Cookbook

Tinker Cookbook (this repository) is a comprehensive library designed to empower researchers and developers to fine-tune large language models (LLMs) using the Tinker API from Thinking Machines Lab. It builds upon two core libraries: tinker, a training SDK that abstracts away the complexities of distributed training via simple API requests, and tinker-cookbook, which provides high-level abstractions and realistic examples for various fine-tuning scenarios.

Key Features and Primitives

The tinker SDK offers essential primitives for LLM fine-tuning:

  • Training Client: Create LoRA training clients (e.g., on base models like Llama-3.2-1B), perform forward-backward passes, optimization steps, save/load states.
  • Sampling Client: Generate samples from trained models.
  • Checkpoint Management: Download model weights via REST API.

Example usage is shown in minimal loops for supervised learning (sl_loop.py) and reinforcement learning (rl_loop.py).

Cookbook Recipes

The cookbook includes a diverse set of sophisticated examples in the recipes/ folder:

  1. Chat Supervised Learning: Fine-tune on conversational datasets like Tulu3 (chat_sl/).
  2. Math Reasoning: Reward correct math answers to boost reasoning (math_rl/).
  3. Preference Learning: Full RLHF pipeline—SFT, reward model training, RL (preference/).
  4. Tool Use: Enhance tool retrieval for accurate Q&A (tool_use/).
  5. Prompt Distillation: Internalize complex instructions (prompt_distillation/).
  6. Multi-Agent: Optimize LLMs for self-play or vs. other LLMs (multiplayer_rl/).

Each recipe has a detailed README.md with implementation, run commands, and performance expectations. Start with basics in sl_basic.py and rl_basic.py.

Utilities
  • renderers.py: Convert tokens to/from structured chat messages.
  • hyperparam_utils.py: Compute LoRA hyperparameters.
  • evaluation/: Abstractions for model eval; integrates with InspectAI for benchmarks (inspect_evaluation.py).
Getting Started
  1. Join Tinker waitlist: thinkingmachines.ai/tinker.
  2. Get API key from console, set TINKER_API_KEY.
  3. pip install tinker and pip install -e . (in venv).
  4. See docs for basics.
Community and Citation

Open for PRs post-private beta. Feedback: tinker@thinkingmachines.ai. Cite as:

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

Launched in October 2025 as Thinking Machines Lab's first product, Tinker Cookbook has garnered over 2.3k stars, enabling efficient, API-driven LLM customization without infrastructure hassles.

Information

  • Websitegithub.com
  • AuthorsThinking Machines Lab
  • Published date2025/10/01

Categories

More Items