GitHub - NousResearch/tinker-atropos: Standalone repo for our Atropos integration with Thinking Machines Tinker API (https://thinkingmachines.ai/tinker/)
Key Points
- 1`tinker-atropos` integrates Atropos environments with the Thinking Machines Tinker API, streamlining model training.
- 2This integration abstracts away compute management and infrastructure concerns, enabling seamless training from local machines.
- 3It leverages a unified YAML configuration for both training and environment settings, allowing existing Atropos environments to be used with Tinker, including support for LORA and custom reward functions.
The tinker-atropos project serves as an integration layer connecting the Atropos framework, designed for Reinforcement Learning from Human Feedback (RLHF), with the Thinking Machines Tinker API. Its primary objective is to abstract away compute management and infrastructure complexities, enabling seamless RLHF model training from a local machine via the Tinker cloud platform.
The core methodology revolves around a coordinated execution of three components: an Atropos API server, an Atropos environment, and the tinker-atropos trainer.
- Atropos API Server: This component, typically started with
run-api, acts as an inference server for the base large language model (LLM), facilitating the generation of responses during the RLHF process. - Atropos Environment: This Python script (e.g.,
gsm8k_tinker.pyor any existing Atropos environment likemath_server.py) defines the interaction loop, data loading, and custom reward functions for the RLHF task. It exposes aserveendpoint, which thetinker-atropostrainer interacts with. Crucially, Atropos environments leverage amanaged_serverpattern, ensuring compatibility with the training process by handling tokenizer loading and allowing for the specification ofstopsequences (e.g., ) inchat_completioncalls. - Tinker-Atropos Trainer: Launched via
launch_training.py, this component orchestrates the training process by communicating with the Tinker API. It uses the Atropos environment to generate samples, collect rewards, and perform parameter updates on the LLM. The training typically involves Low-Rank Adaptation (LoRA) fine-tuning of the base model.
Configuration is central to the tinker-atropos pipeline and is managed via YAML files that adhere to a specific structure, extending the standard Atropos format with a dedicated tinker section.
- The
envsection specifies parameters for the Atropos environment, such asgroup_size,batch_size, andtokenizer_name. These settings dictate how the environment generates and processes data. - The
openaisection configures the inference server, includingmodel_nameandbase_urlfor communication. - The
tinkersection contains parameters specifically consumed by thetinker-atropostrainer and ignored by the Atropos environment. These include LoRA-specific settings likelora_rank, optimization parameters such aslearning_rate, and training control parameters likemax_token_trainer_length,checkpoint_dir,save_checkpoint_interval, and Weights & Biases (W&B) integration details (wandb_project,wandb_group,wandb_run_name).
During a training run, the launch_training.py script initializes a TinkerAtroposTrainer instance, providing it with the comprehensive configuration. The trainer then interacts with the Tinker API to provision compute and execute the training loop, which involves iterative calls to the Atropos environment for data and reward signals. The environment, in turn, interacts with the local or remote Atropos API server for model inference. Upon completion, the trained LoRA weights are made available via a Tinker path (e.g., ) for download.
The tinker-atropos project supports both CLI-based usage for quick starts and overrides, as well as programmatic access through TinkerAtroposConfig and TinkerAtroposTrainer classes, allowing for more granular control and integration into existing Python workflows. This architecture effectively decouples the RLHF logic defined in Atropos from the underlying compute infrastructure, leveraging the Tinker API for scalable and managed training.