Recipes

TTT-Discover

TTT-Discover (Learning to Discover at Test Time, arXiv:2601.16175) makes repeated attempts at one hard problem and trains the model while it searches.

What it trains#

The served model's weights, as a LoRA adapter. Each step is a grid of groups-per-step groups of rollouts-per-group sibling rollouts. Each report gives one rollout's score and its place in the grid:

JSON
{"references": ["<inference receipt>"], "score": 1.0,
 "metadata": {"step": 0, "group": 0, "rollout": 0, "groups_per_step": 8, "rollouts_per_group": 64}}

When the grid is complete, the tttd objective trains on it with grouped adaptive-entropic advantages and a KL term to the frozen base model. The step drops each group whose rollouts all have the same reward. The next grid runs on the new weights.

When to use it#

  • One problem with a measurable score and no known answer, such as a packing or a bound to improve.

Use a new scenario for each problem: the model specializes on it. For several independent questions with a checker, use SAO or SDPO.

Requirements#

  • Linux, Docker and the Slime GPU environment of Train model weights.
  • Four GPUs for the example: two train and two serve. The example's README recommends at least 256 GiB of host memory for the 8 by 64 grid.
  • On Tinker instead of Slime: a Tinker account and TINKER_API_KEY. Start with the two-rollout smoke.

Run the example#

Shell
cd recipes/tttd/examples/tttd
./run.sh

run.sh downloads Qwen3-8B on the first run. It runs one step of Erdős minimum overlap with eight groups of 64 rollouts, and exits when Reef has committed the step. TTTD_TASK=circle_packing_26 or circle_packing_32 runs a packing problem in its own scenario and state directory. TTT-Discover on Reef covers the smaller grids, serve-tinker.yaml, the program contracts and restarts.

Guidance-TTT runs on this recipe. It trains a guidance model while a frozen executor writes the programs.

Configuration#

  • recipe.samples.groups-per-step and rollouts-per-group: the grid (8 by 64 by default, TTTDSettings). A report must announce the same grid.
  • recipe.jobs.job-samples: set it to groups times rollouts. On Slime, set global-batch-size to the same product; on Tinker, batch-size must not exceed it.
  • training.options: the LoRA flags (megatron-lora-rank, megatron-lora-alpha) and kl-coef on Slime.

The settings reference describes the other keys. Track the best archived score: the mean reward can fall while it rises.

Results#

  • Formal 8x64 results: one Slime run per task on Qwen3-8B. Erdős minimum overlap reached 0.38094 in 25 steps (paper: 0.38093). Circle packing reached 2.635983 for 26 circles and 2.939573 for 32 circles in 50 steps (paper: 2.635983 and 2.939572).
  • Earlier Erdős experiment: 50 steps with 8 groups of 32 rollouts reached 0.380916.
  • Guidance-TTT: paper results and earlier Reef runs.

The Tinker backend has no measured results.

Files#

Each file holds the part of the method that one service runs:

Text
tttd/
  __init__.py            exports the recipe, its report and its stages
  recipe.py              TTTDRecipe: the class of each step
  report.py              control: TTTDGroupedRolloutReport, one rollout's score and its place in the grid
  samples.py             samples service: TTTDSamples, one rollout as one sample; a step waits for its complete grid
  jobs.py                samples, the data of a job: TTTDJobData, one complete grid as one job, without its constant-reward groups
  advantages.py          training service: the grouped adaptive-entropic advantages that both backends compute
  tinker.py              training service on Tinker: TttdTinkerAlgorithm, the advantages and the KL to the base model
  slime/
    algorithm.py         training service: TttdAlgorithm, the advantages of each job; no torch
    worker.py            GPU workers: the KL to the base model, and the importance-sampling loss
  examples/
    tttd/                Erdős minimum overlap and circle packing as Harbor tasks, with a PUCT search
    guidance_ttt/        Guidance-TTT on four discovery tasks

The tests are in tests/recipes/tttd/.