lr-schedule-advisor
Skill9 starsChanged 3 months agoMITView on GitHub
"The learning rate schedule is not a hyperparameter you tune once. It interacts with model size, batch size, sequence length, and even your tokenizer vocabulary size. Most tutorials give you a single number and move on." Key insights: 1. Warmup steps prevent early attention collapse — Q/K/V projections are random at init; high LR scrambles them before they can learn 2. Peak LR scales with batch size — linear scaling rule: if you 2x batch size, 2x LR (approximately) 3.…
In this repository109 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- agent/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- router/CLAUDE.mdCLAUDE.md
- .agents/skills/llms.txtllms.txt
- agent-harnessSkill
- auto-fixSkill
- brain-dumpSkill
- industrial-brutalist-uiSkill
- changelog-enforcerSkill
- checkpoint-strategySkill
- context-primeSkill
- cooldown-resumeSkill
- council-reviewSkill
- data-quality-auditSkill
- debug-tracerSkill
- dependency-auditSkill
- deslopSkill
- docs-syncSkill
- duplicate-threadSkill
- email-triageSkill
- fabric-patternsSkill
- feature-flagSkill
- git-hygieneSkill
- graphifySkill
- implementation-plannerSkill
- insightsSkill
- issue-resolverSkill
- learn-ruleSkill
- local-ai-querySkill
- minimalist-uiSkill
- modularity-reviewSkill
- full-output-enforcementSkill
- parallel-agentsSkill
- parallel-worktreesSkill
- prompt-librarySkill
- prompt-transparencySkill
- pro-workflowSkill
- redesign-existing-projectsSkill
- release-readinessSkill
- replay-learningsSkill
- repo-memory-updaterSkill
- repowise-intelligenceSkill
- researchSkill
- resource-panelSkill
- risky-module-reviewSkill
- sandboxed-execSkill
- scope-guardSkill
- self-improveSkill
- session-handoffSkill
- skill-composerSkill
- smart-commitSkill
- high-end-visual-designSkill
- stitch-design-tasteSkill
- system-prompt-auditSkill
- task-alive-updatesSkill
- task-scoperSkill
- design-taste-frontendSkill
- test-first-executorSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 83
Fine-tuning: Use 10x smaller peak LR than pretraining.
- Distinctive: line 89
No warmup when resuming from checkpoint — the optimizer state is warm but LR resets cold
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: lr-schedule-advisor
Purpose
Advise on learning rate schedules for transformer/LLM training. One of the most under-documented aspects of building LLMs from scratch — the schedule matters as much as the peak LR value.
Trigger
Use when:
- Starting a new training run and unsure about LR settings
- Training is unstable and you suspect LR is the cause
- You want to compare schedule strategies (cosine, linear, constant+decay)
- Fine-tuning a pretrained model and need different LR guidance
Background (Why This Matters)
From practitioners who have built LLMs from scratch:
"The learning rate schedule is not a hyperparameter you tune once. It interacts with model size, batch size, sequence length, and even your tokenizer vocabulary size. Most tutorials give you a single number and move on."
Key insights:
- Warmup steps prevent early attention collapse — Q/K/V projections are random at init; high LR scrambles them before they can learn
- Peak LR scales with batch size — linear scaling rule: if you 2x batch size, 2x LR (approximately)
- Cosine decay outperforms linear for most transformer workloads
- The final LR floor matters — 10% of peak LR is a common floor; going to zero wastes compute
- Cooldown phase — last 10% of training at low LR stabilizes the model for inference
Usage
/lr-schedule-advisor [model_size] [batch_size] [total_steps] [--task pretrain|finetune|rlhf]Output Format
=== LR Schedule Recommendation ===
Model Size: [params]
Batch Size: [tokens or samples]
Total Steps: [N]
Task: [pretrain|finetune|rlhf]
Recommended Schedule:
Peak LR: [value]
Warmup Steps: [N] ([%] of total)
Schedule Type: cosine
Floor LR: [value] ([%] of peak)
Cooldown Steps: [N]
Formula:
lr(step) = ...
Warnings:
- [any detected issues]Schedule Formulas
Cosine with Warmup (Recommended for Pretraining)
def get_lr(step, warmup_steps, total_steps, max_lr, min_lr):
if step < warmup_steps:
# Linear warmup
return max_lr * (step / warmup_steps)
# Cosine decay
progress = (step - warmup_steps) / (total_steps - warmup_steps)
cosine_decay = 0.5 * (1 + math.cos(math.pi * progress))
return min_lr + (max_lr - min_lr) * cosine_decayPeak LR Heuristics by Model Size
| Params | Recommended Peak LR | Notes |
| < 100M | 3e-4 to 6e-4 | Standard transformer small |
| 100M–1B | 1e-4 to 3e-4 | Chinchilla-optimal range |
| 1B–10B | 5e-5 to 1e-4 | Reduce if seeing instability |
| > 10B | 1e-5 to 5e-5 | Requires careful monitoring |
Warmup Step Heuristics
| Training Duration | Warmup % |
| < 10K steps | 5–10% |
| 10K–100K steps | 2–5% |
| > 100K steps | 1–2% |
Fine-tuning vs Pretraining
- Fine-tuning: Use 10x smaller peak LR than pretraining; shorter warmup (0.5–1%)
- RLHF/PPO: LR must be very small (1e-6 to 1e-5); schedule is less critical than stability
- LoRA/PEFT: LR can be higher (1e-4 to 1e-3) since only adapter weights update
Common Mistakes
- Using Adam's default LR (1e-3) for transformers — this is almost always too high
- No warmup when resuming from checkpoint — the optimizer state is warm but LR resets cold
- Forgetting to scale LR when changing batch size mid-training
- Using the same schedule for encoder-only vs decoder-only models
Integration Points
- Pairs with
training-stability-monitorto diagnose LR-related instability - Pairs with
insightsto compare schedule experiments across runs
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

