သဘောတရား · AIF-C01 အပေါ် ဆက်လေ့လာရန်
Epochs, steps, batch size and learning rate
How epoch, step, batch size, learning rate and optimizer shape convergence.
ဒီသင်ခန်းစာကို မြန်မာဘာသာ မပြန်ရသေးလို့ အင်္ဂလိပ်လို ပြထားပါတယ်။
AI Practitioner မှ သင်သိပြီးသားများ
- Learning rate: the size of each step. Batch size: examples per step. Epoch: one pass over the data.
- Hyperparameters are set before training. Weights are learned.
- Wrong values lead to overfitting or underfitting.
Epoch
- Meaning
- One pass over all data
- Example
- 10,000 examples seen once
Step
- Meaning
- One batch, one update
- Example
- 100 steps at batch size 100
Batch size
- Meaning
- Examples per step
- Example
- 32 or 256
Learning rate
- Meaning
- Size of each update
- Example
- 0.001
Warm-up and decay
- Meaning
- Ramp up, then lower the rate
- Example
- Start small, end small
Optimizer
- Meaning
- How gradients become updates
- Example
- Adam, SGD
| Term | Meaning | Example |
|---|---|---|
| Epoch | One pass over all data | 10,000 examples seen once |
| Step | One batch, one update | 100 steps at batch size 100 |
| Batch size | Examples per step | 32 or 256 |
| Learning rate | Size of each update | 0.001 |
| Warm-up and decay | Ramp up, then lower the rate | Start small, end small |
| Optimizer | How gradients become updates | Adam, SGD |
1 / 2
Epoch
- Meaning
- One pass over all data
- Example
- 10,000 examples seen once
Step
- Meaning
- One batch, one update
- Example
- 100 steps at batch size 100
Batch size
- Meaning
- Examples per step
- Example
- 32 or 256
| Term | Meaning | Example |
|---|---|---|
| Epoch | One pass over all data | 10,000 examples seen once |
| Step | One batch, one update | 100 steps at batch size 100 |
| Batch size | Examples per step | 32 or 256 |
2 / 2
Learning rate
- Meaning
- Size of each update
- Example
- 0.001
Warm-up and decay
- Meaning
- Ramp up, then lower the rate
- Example
- Start small, end small
Optimizer
- Meaning
- How gradients become updates
- Example
- Adam, SGD
| Term | Meaning | Example |
|---|---|---|
| Learning rate | Size of each update | 0.001 |
| Warm-up and decay | Ramp up, then lower the rate | Start small, end small |
| Optimizer | How gradients become updates | Adam, SGD |
Learning rate
- Too high
- Loss bounces or diverges
- Too low
- Slow or stuck
Batch size
- Too high
- Out of memory, weaker generalization
- Too low
- Noisy and slow epochs
Epochs
- Too high
- Overfits
- Too low
- Underfits
| Setting | Too high | Too low |
|---|---|---|
| Learning rate | Loss bounces or diverges | Slow or stuck |
| Batch size | Out of memory, weaker generalization | Noisy and slow epochs |
| Epochs | Overfits | Underfits |
ဘာလဲ
One step (or iteration) processes one batch and updates the weights once. One epoch is a full pass over the training data. With 10,000 examples and a batch size of 100, an epoch has 100 steps. Training length is set in epochs or in a total number of steps. Fine-tuning of large language models is often set in steps.
Batch size trades speed, memory and quality. A bigger batch uses the GPU better and gives a steadier gradient, but needs more memory and can generalize worse. A smaller batch is noisier, which acts as light regularization, but each epoch takes longer. If you raise the batch size, raise the learning rate roughly along with it.
ဘာလဲ
The learning rate sets how big each update is. Too high: the loss bounces or diverges. Too low: training crawls or stalls. Warm-up starts with a tiny rate and ramps up, which keeps early steps stable, and it matters for transformers. Decay lowers the rate over time, so the model settles near a good point. The optimizer, such as SGD, Adam or AdamW, decides how gradients turn into updates. Adam adapts the rate for each weight and is a common default.
ဘာလဲ
For FM fine-tuning use a small learning rate and a few epochs, so you adapt the model without overwriting what it knows. Too many epochs on a small data set overfit. In Amazon Bedrock customization you set epochs, batch size and learning rate (and warm-up steps) for the job.
မှတ်ထားရန်
- Step: one batch and one update. Epoch: one pass over the data.
- Steps per epoch: examples divided by batch size.
- A bigger batch: faster epochs and more memory, and it may generalize worse.
- A learning rate too high diverges. Too low is slow.
- Warm-up ramps the rate up. Decay lowers it.
မှတ်ထားရန်
- FM fine-tuning: a low learning rate and a few epochs.
စာမေးပွဲမှာ
- “The loss jumps up and down and never settles” points to a learning rate that is too high.
- “Each epoch takes too long and GPU memory is free” points to a larger batch size.
- “A fine-tuned FM overfits a small data set” points to fewer epochs or a lower learning rate.
ဒီ task ထဲမှာ · 2.2
- Built-in algorithms for tabular data
- Built-in algorithms: clustering, dimensionality reduction, anomaly
- Built-in algorithms: text, sequence and forecasting
- Built-in algorithms: image and video
- Training jobs, script mode and ML libraries
SageMaker AMT
- Reducing training time
- Distributed training and HyperPod
- Overfitting, underfitting and catastrophic forgetting
- Combining models
- Epochs, steps, batch size and learning rate
- Task-specific prompt engineering
- Fine-tuning and continued pre-training in Bedrock
- PEFT, LoRA and fine-tuning on SageMaker
- Model distillation
- Optimizing retrieval and embedding models