Automated summary
This skill provides formulas and reference values for choosing training hyperparameters (learning rate, LoRA rank, batch size, group size, schedules) across SL, RL, DPO, and distillation.
Strengths
- Gives a model-dependent learning rate formula with a ready-to-use get_lr() helper
- Covers multiple training paradigms (SL, RL, DPO, RLHF, distillation) with concrete value ranges
- Includes quick-start recommendations and scaling rules such as LR ∝ √batch_size
Limitations
- The LR formula is validated on SFT experiments and may be less reliable for other regimes
- Defaults are tied to the tinker_cookbook ecosystem and specific models (Qwen, Llama)
- Offers little guidance on how to tune beyond the indicative ranges
When you need to select or adjust training hyperparameters for supervised fine-tuning, RL, DPO, or distillation.
If you need advice on model architecture, data preparation, or deployment rather than training parameter settings.
Security analysis
SafeThis is a pure reference/documentation skill describing hyperparameter selection for model training. It declares no allowed-tools, contains no executable commands, no network or filesystem operations, and no secrets handling. The only code snippets are benign illustrative Python calls to a helper library (get_lr, get_lora_param_count). There is no meaningful execution risk.
No concerns found
How this analysis is madeExamples
What learning rate should I use to LoRA fine-tune Llama-3.1-8B on chat data?How should I set batch_size and group_size for a GRPO run on math problems if I only have a few hundred problems?Should I use LoRA rank 16 or 64 for adapting a large model to a complex task, and does rank affect the learning rate?name: hyperparams description: 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.
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 formuladocs/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-5M_LoRA = 10(1 for full fine-tuning)H_m= hidden size of the modelP_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 type | Typical LR range | Notes |
|---------------|------------------|-------|
| SL (LoRA) | 1e-4 to 5e-4 | Use get_lr() |
| SL (full FT) | 1e-5 to 5e-5 | LoRA LR / 10 |
| RL | 1e-5 to 4e-5 | Lower than SL |
| DPO | ~1e-5 | Much lower than SL |
| RLHF (RL stage) | ~1e-5 | Same as RL |
| Distillation | ~1e-4 | Similar 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(orgroups_per_batch): Number of unique problems/environments per batchgroup_size: Number of rollouts per problem (advantages centered within group)
total_rollouts = batch_size × group_size
Guidelines:
- If limited problems: increase
group_sizefor 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 sufficientnum_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 teacherkl_discount_factor=0.0— No discounting (increase for long sequences)
Quick-start recommendations
| Scenario | Model | LR | Batch | LoRA Rank |
|----------|-------|-----|-------|-----------|
| SFT on chat data | Llama-3.1-8B | get_lr(model) | 128 | 32 |
| Math GRPO | Llama-3.1-8B-Instruct | 4e-5 | 128×16 | 32 |
| DPO | Llama-3.2-1B | 1e-5 | 256 | 32 |
| Distillation | Qwen3-8B-Base | 1e-4 | 1024×4 | 128 |
| Multi-turn RL | Kimi-K2-Thinking | 1e-5 | 8×4 | 32 |
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
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/hyperparameter-selection-msh3uubh' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/hyperparameter-selection-msh3uubh/download' --output '.skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md.part' && mv '.skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md.part' '.skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md' && test -s '.skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/hyperparams' && cp -R '.skill-downloads/hyperparameter-selection-msh3uubh' '.claude/skills/hyperparams'Cursor
test -f '.skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md' && test -s '.skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/hyperparams' && cp -R '.skill-downloads/hyperparameter-selection-msh3uubh' '.cursor/skills/hyperparams'Codex
test -f '.skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md' && test -s '.skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/hyperparams' && cp -R '.skill-downloads/hyperparameter-selection-msh3uubh' '.agents/skills/hyperparams'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/hyperparameter-selection-msh3uubh'openskills read 'hyperparameter-selection-msh3uubh'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/hyperparameter-selection-msh3uubh/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Create Interactive Maps with kepler.gl
Data & AI
Create interactive map visualizations and export standalone HTML using the keplergl Python package. Use to plot geospatial data from DataFrames, GeoJSON, or CSV.
Agent-Driven Parameter Optimization
Data & AI
Guide for optimizing configurable systems with a measurable objective, using bounded trials and evidence-based recommendations.
ICP Visitor Outreach
Data & AI
Identify signed-up users matching the ideal customer profile but stalled, and draft personalized outreach to re-engage them.