概念 · 基于 AIF-C01
Overfitting, underfitting and catastrophic forgetting
Read the training and validation curves, pick the matching fix, and protect a fine-tuned model from forgetting.
本课尚未翻译,暂以英文显示。
你在AI Practitioner中已学过
- Underfitting (high bias): poor on training data and on new data.
- Overfitting (high variance): strong on training data, poor on new data.
- Fixes: more data, early stopping, regularization, a simpler or bigger model.
Both losses high
- Diagnosis
- Underfitting
- Fix
- Bigger model, more features, train longer
Low training, high validation
- Diagnosis
- Overfitting
- Fix
- More data, regularize, stop early
Both losses low
- Diagnosis
- Good fit
- Fix
- Keep it
| Curves | Diagnosis | Fix |
|---|---|---|
| Both losses high | Underfitting | Bigger model, more features, train longer |
| Low training, high validation | Overfitting | More data, regularize, stop early |
| Both losses low | Good fit | Keep it |
Data replay
Mix some old or general data into the new data.
Low learning rate
Small updates change the weights less.
PEFT adapters
Train a small adapter. The base stays frozen.
Frozen layers
Keep early layers fixed. Train the top only.
是什么
Plot training loss and validation loss for each epoch. Both high and flat: underfitting, so the model is too simple or under-trained. Training loss keeps falling while validation loss rises or stalls: overfitting. Both low and close together: a good fit.
是什么
Fixes for overfitting: more or more varied training data (data augmentation), regularization (L1 shrinks some weights to zero, which also selects features, and L2 shrinks all weights), dropout (randomly switching off neurons during training), early stopping at the lowest validation loss, a smaller model, and fewer or better features. Fixes for underfitting: a larger or more complex model, more features, longer training and less regularization.
是什么
Catastrophic forgetting happens in fine-tuning: training on a new task overwrites weights, and the model loses skills it had. Reduce it with data replay (mix some original or general data into the new data), a low learning rate, parameter-efficient fine-tuning such as LoRA that keeps the base weights frozen, frozen early layers, and fewer epochs. Evaluate the tuned model on the old tasks too, not only the new one.
要记住
- Training loss low and validation loss high: overfitting.
- Both losses high: underfitting.
- Overfitting fixes: more data, L1 or L2, dropout, early stopping, a smaller model.
- Underfitting fixes: a bigger model, more features, longer training, less regularization.
- L1 can zero out weights. L2 shrinks them.
要记住
- Forgetting: data replay, low learning rate, PEFT, frozen layers. Test the old tasks too.
考试中
- “Training accuracy 99 percent, validation accuracy 70 percent” points to overfitting: add data, regularize or stop earlier.
- “A fine-tuned model lost its general skills” points to catastrophic forgetting: data replay, LoRA or a lower learning rate.
- “Both training and validation error are high” points to a larger model or more features.
本任务内容 · 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