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:
- Chat Supervised Learning: Fine-tune on conversational datasets like Tulu3 (
chat_sl/). - Math Reasoning: Reward correct math answers to boost reasoning (
math_rl/). - Preference Learning: Full RLHF pipeline—SFT, reward model training, RL (
preference/). - Tool Use: Enhance tool retrieval for accurate Q&A (
tool_use/). - Prompt Distillation: Internalize complex instructions (
prompt_distillation/). - 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
- Join Tinker waitlist: thinkingmachines.ai/tinker.
- Get API key from console, set
TINKER_API_KEY. pip install tinkerandpip install -e .(in venv).- 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.
