Fine-tuning Learning Rates › Worked Example: Fine-tuning BERT for Sentiment Analysis
Language AI HandbookAll chapters Fine-tuning Learning Rates › Worked Example: Fine-tuning BERT for Sentiment AnalysisOne section · Sections in this chapter7 / 12 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
To make the abstract mechanics concrete, let's trace through a specific scenario: fine-tuning BERT-base-uncased for binary sentiment classification. We will compute the exact learning rates at representative steps throughout the training run and show how the combined schedule behaves in practice.
Setup: 8 epochs over a dataset of 25,000 training examples with batch size 32. This gives us approximately training steps total. We use a 10% warmup (625 steps), base learning rate , LLRD decay factor , and cosine decay.
Step 1: Compute the per-layer peak learning rates (end of warmup)
At the end of warmup, each layer reaches its assigned peak rate. Using the LLRD formula with , , :
Step 2: Compute learning rates at 25% of training (step 1,563)
At this point we have been past warmup for steps. The cosine decay progress fraction is:
The cosine multiplier is:
The task head learning rate at this step is therefore . The embedding rate is .
Step 3: Compute learning rates at 75% of training (step 4,688)
The cosine decay progress fraction is now:
The cosine multiplier drops substantially:
The task head is now at . The embedding rate has dropped to , a tiny fraction of its peak value.
Key observation: By 75% of training, the cosine schedule has reduced all learning rates to about 18% of their peak values. The relative hierarchy between layers is preserved (the task head is always 10x the backbone top rate, which is always higher than the embedding rate), but all rates are scaling down together. This is the combined effect we want: LLRD sets the relative rates at each layer, while the decay schedule controls the global scale over time.