본문으로 건너뛰기
cccskills
무료GitHub에 공개

new-recipe

Scaffold a new training recipe for the Tinker cookbook following repo conventions. Use when the user wants to create a new recipe, training script, or experiment.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md5.7 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Create a New Training Recipe

Scaffold a new training recipe in tinker_cookbook/recipes/ following repo conventions.

Step 1: Understand the request

Ask the user:

  • Recipe name: What to call it (becomes the directory/file name under recipes/)
  • Training type: SL, RL, DPO, distillation, or hybrid
  • Key details: Model, dataset, environment, reward signal, etc.

Step 2: Read existing recipes for patterns

Before writing any code, read the most relevant existing recipe:

  • SL-based: Read tinker_cookbook/recipes/sl_basic.py and tinker_cookbook/recipes/chat_sl/train.py
  • RL-based: Read tinker_cookbook/recipes/rl_basic.py and tinker_cookbook/recipes/math_rl/train.py
  • DPO-based: Read tinker_cookbook/recipes/preference/dpo/train.py
  • Distillation-based: Read tinker_cookbook/recipes/distillation/on_policy_distillation.py
  • Multi-turn RL: Read tinker_cookbook/recipes/harbor_rl/train.py

Also read CLAUDE.md for conventions.

Step 3: Follow repo conventions

Every recipe MUST follow these patterns:

File structure

tinker_cookbook/recipes/<recipe_name>/
├── __init__.py        # Empty or minimal
├── train.py           # Main entry point with CLIConfig + cli_main
└── <env_or_data>.py   # Dataset/environment definitions (if needed)

Or for simple recipes: tinker_cookbook/recipes/<recipe_name>.py

CLI pattern (use @chz.chz for config)

@chz.chz
class CLIConfig:
    model_name: str = "meta-llama/Llama-3.1-8B"
    learning_rate: float = 1e-4
    # ... all configurable parameters with defaults

async def cli_main(cli_config: CLIConfig):
    # Build full config from CLI config
    # Call training main function

if __name__ == "__main__":
    cli_config = chz.entrypoint(CLIConfig)
    asyncio.run(cli_main(cli_config))

Required elements

  1. @chz.chz config class with sensible defaults
  2. model_info.get_recommended_renderer_name(model_name) for renderer — never hardcode
  3. cli_utils.check_log_dir() before training to avoid clobbering
  4. checkpoint_utils.resolve_renderer_name_from_checkpoint_or_default_async() if loading checkpoints
  5. Explicit typing — no Any or type: ignore
  6. Auto-generated log paths with model name, hyperparams, and timestamp

Naming conventions

  • Subscript suffixes for tensors: _P (problems), _G (groups), _T (tokens), _D (datums)
  • Use safezip, timed, scope helpers where appropriate
  • Use ml_log.log_metrics for metrics, logtree for transcripts

Entry point

Recipe must be runnable as:

python -m tinker_cookbook.recipes.<recipe_name>.train [chz overrides]

Step 4: Create the recipe

Write the recipe files following the patterns above. Place them in tinker_cookbook/recipes/$ARGUMENTS/.

Step 5: Add tests

The repo has two layers of testing. Both should be added for every new recipe.

Smoke test (required)

Create tests/recipes/test_recipe_<name>.py — a minimal test that runs the recipe for 2 training steps and verifies clean exit. CI auto-discovers these files and runs them daily.

import pytest
from tests.helpers import run_recipe

@pytest.mark.integration
def test_<recipe_name>():
    run_recipe(
        "tinker_cookbook.recipes.<recipe_name>.train",
        [
            "behavior_if_log_dir_exists=delete",
            # Override params to make it fast:
            # "groups_per_batch=4", "group_size=2", "batch_size=16", etc.
        ],
    )

Key conventions:

  • run_recipe() launches the module as a subprocess and automatically passes max_steps=2 (configurable via the max_steps parameter)
  • The recipe runs for 2 training steps and exits naturally — the test passes on clean exit (exit code 0)
  • Always pass behavior_if_log_dir_exists=delete to avoid conflicts in repeated CI runs
  • Override batch sizes / group sizes to small values so the test completes quickly
  • Mark tests with @pytest.mark.integration — these require TINKER_API_KEY
  • See tests/helpers.py for run_recipe() details and tests/conftest.py for fixtures

Unit tests (for testable components)

Place unit tests next to the code they test using the *_test.py naming convention:

tinker_cookbook/recipes/<recipe_name>/<component>_test.py

For example:

  • tinker_cookbook/recipes/math_rl/math_env_test.py — tests environment logic
  • tinker_cookbook/renderers/parsing_test.py — tests parsing helpers

Unit tests should:

  • Run without TINKER_API_KEY (no network calls)
  • Be fast (< 1s per test)
  • Use standard pytest features (fixtures, parametrize, marks)
  • Test picklability if the component needs to be serialized for distributed rollout

Running tests locally

# Unit tests only (no API key needed)
uv run pytest tinker_cookbook/

# Integration / smoke tests (requires TINKER_API_KEY)
uv run pytest tests/recipes/test_recipe_<name>.py -v -x -s

CI integration

  • Unit tests (pytest tinker_cookbook/) run on every PR via .github/workflows/pytest.yaml
  • Integration tests (pytest tests/) run daily and on manual trigger via .github/workflows/smoke-test-recipes.yaml
  • Adding tests/recipes/test_recipe_<name>.py is all that's needed — CI auto-discovers it

Step 6: Verify

  • Ensure the recipe is importable: python -c "from tinker_cookbook.recipes.<name> import train"
  • Check that CLI help works: python -m tinker_cookbook.recipes.<name>.train --help
  • Run the smoke test locally: uv run pytest tests/recipes/test_recipe_<name>.py -v -x -s

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Guide for checkpointing — saving, loading, and resuming training with CheckpointRecord. Use when the user asks about saving weights, resuming training, checkpoint management, or the checkpoint lifecycle.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

uiuc-kang-lab/rlvr_generalization_bounds52026년 5월 13일 업데이트

ci

무료

Guide for testing conventions and CI pipelines — unit tests, integration smoke tests, pytest markers, and GitHub Actions workflows. Use when the user asks about testing, CI, running tests, or adding tests for a recipe.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

uiuc-kang-lab/rlvr_generalization_bounds52026년 5월 13일 업데이트

Guide for using completers — TokenCompleter and MessageCompleter for text generation during RL rollouts and evaluation. Use when the user asks about generating text, completing messages, or using completers in RL environments.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

uiuc-kang-lab/rlvr_generalization_bounds52026년 5월 13일 업데이트

Guide for contributing to the tinker-cookbook repo — development setup, code style, type checking, PR process, and design conventions. Use when the user asks about how to contribute, set up the dev environment, code style, or project conventions.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

uiuc-kang-lab/rlvr_generalization_bounds52026년 5월 13일 업데이트

datasets

무료

Guide for dataset construction — SupervisedDatasetBuilder, RLDatasetBuilder, ChatDatasetBuilder, and custom dataset creation from JSONL, HuggingFace, or conversation data. Use when the user asks about datasets, data loading, data preparation, or custom data formats.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

uiuc-kang-lab/rlvr_generalization_bounds52026년 5월 13일 업데이트

Set up and run knowledge distillation (on-policy, off-policy, or multi-teacher) from a teacher model to a student model using the Tinker API. Use when the user wants to distill knowledge, compress models, or train a student from a teacher.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

uiuc-kang-lab/rlvr_generalization_bounds52026년 5월 13일 업데이트

uiuc-kang-lab의 스킬 모두 보기

이 스킬의 문제 신고