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

hyperparams

Guide for hyperparameter selection — learning rate formulas, LoRA rank, batch size, group size, schedules, and model-specific tuning. Use when the user asks about learning rate, batch size, hyperparameter tuning, or how to configure training parameters.

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

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.6 KB

SKILL.md(원문)

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

Hyperparameter Selection

Guide for choosing training hyperparameters across SL, RL, DPO, and distillation.

Reference

  • docs/supervised-learning/sl-hyperparams.mdx — SL hyperparameter guide with LR formula
  • docs/rl/rl-hyperparams.mdx — RL hyperparameters (batch_size, group_size, num_substeps, async)
  • tinker_cookbook/hyperparam_utils.py — LR formulas and model-specific calculations

Learning rate

The formula

The recommended LR for a model m with LoRA:

LR(m) = lr_base × M_LoRA × (2000 / H_m) ^ P_m

Where:

  • lr_base = 5e-5
  • M_LoRA = 10 (1 for full fine-tuning)
  • H_m = hidden size of the model
  • P_m = model-specific exponent (0.0775 for Qwen, 0.781 for Llama)

Use the helper function

from tinker_cookbook.hyperparam_utils import get_lr

lr = get_lr("meta-llama/Llama-3.1-8B", is_lora=True)
# Returns model-specific recommended LR

This formula gives <0.5% regret vs exhaustive sweeps across diverse SFT experiments.

Rules of thumb

Training typeTypical LR rangeNotes
SL (LoRA)1e-4 to 5e-4Use get_lr()
SL (full FT)1e-5 to 5e-5LoRA LR / 10
RL1e-5 to 4e-5Lower than SL
DPO~1e-5Much lower than SL
RLHF (RL stage)~1e-5Same as RL
Distillation~1e-4Similar to SL

LoRA rank

  • Default: 32 for most tasks
  • Higher rank (64–128): More capacity, needed for complex tasks or large models
  • Lower rank (8–16): Faster, sufficient for simple adaptations
  • LR is independent of LoRA rank (validated empirically)
from tinker_cookbook.hyperparam_utils import get_lora_param_count

# Check parameter count for a given rank
params = get_lora_param_count("meta-llama/Llama-3.1-8B", lora_rank=32)

Batch size

SL batch size

  • Measured in tokens, not examples
  • Recommended: Start with 128
  • Smaller batch sizes often give better final performance at cost of longer training
  • Scale LR proportionally: LR ∝ √batch_size
  • Aim for at least 100 training steps (best results with 1000+)

RL batch size and group size

Two parameters control RL batch composition:

  • batch_size (or groups_per_batch): Number of unique problems/environments per batch
  • group_size: Number of rollouts per problem (advantages centered within group)
total_rollouts = batch_size × group_size

Guidelines:

  • If limited problems: increase group_size for more training signal
  • Scale LR with batch_size: LR ∝ √batch_size
  • Start small for debugging (groups_per_batch=4, group_size=2)

Learning rate schedule

Available schedules:

  • "linear" — Linear decay to 0 (most common)
  • "cosine" — Cosine annealing
  • "constant" — No decay

Set via lr_schedule parameter in config.

num_substeps (RL)

Controls how many optimizer updates per sampling iteration:

  • num_substeps=1 (default): One update per batch — simplest, usually sufficient
  • num_substeps>1: Splits batch into mini-batches, one update each. Requires PPO objective.
  • Start with 2–4 if experimenting; decrease LR with higher values

DPO-specific

  • dpo_beta=0.1 — Well-tested default. Controls deviation from reference model.
  • Lower beta = more aggressive optimization
  • Higher beta = stays closer to reference

Distillation-specific

  • kl_penalty_coef=1.0 — Weight of KL penalty from teacher
  • kl_discount_factor=0.0 — No discounting (increase for long sequences)

Quick-start recommendations

ScenarioModelLRBatchLoRA Rank
SFT on chat dataLlama-3.1-8Bget_lr(model)12832
Math GRPOLlama-3.1-8B-Instruct4e-5128×1632
DPOLlama-3.2-1B1e-525632
DistillationQwen3-8B-Base1e-41024×4128
Multi-turn RLKimi-K2-Thinking1e-58×432

Common pitfalls

  • LoRA needs ~10x higher LR than full fine-tuning — use get_lr() to get it right
  • get_lr() currently only supports Llama and Qwen families — other models need manual tuning
  • DPO LR should be much lower than SFT (1e-5 vs 2e-4)
  • RL LR should be lower than SFT — too aggressive updates destabilize the policy
  • Batch size too small = noisy gradients; too large = diminishing returns
  • Monitor KL divergence in RL — training is stable when KL < 0.01

리뷰

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

댓글

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

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

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. 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의 스킬 모두 보기

이 스킬의 문제 신고