LLM Training Guide: Gains, Catastrophic Forgetting, and MoE Troubleshooting
This guide covers the four main stages of large language model training: pretraining, continual pretraining (CPT), supervised fine-tuning (SFT), and reinforcement learning (RL). For each stage, it describes the expected gains, the main risks, and the metrics to monitor. It also explains how to reduce catastrophic forgetting, how to choose a vision encoder for multimodal models, how to troubleshoot common failures in Mixture of Experts (MoE) training, and how to evaluate embodied AI models.
Introduction
LLM training usually moves through four stages: pretraining, continual pretraining (CPT), supervised fine-tuning (SFT), and reinforcement learning (RL). Each stage changes the model’s capability profile, and changes made in an earlier stage affect the results of later stages. This guide follows the training order. It outlines the gains and risks of each stage, provides metrics you can check directly, and discusses vision encoder selection and the most common failures in MoE training.
1. Gains and Risks of Each Training Stage
Pretraining learns general language patterns and world knowledge from large amounts of unlabeled text. Its gains are most visible early in training and then slow down. To decide whether to keep training, watch the trend on general benchmarks rather than the training loss alone. The training loss may keep falling while downstream task performance stalls.
Continual pretraining injects vertical domain data, such as law, medicine, or code. It improves performance on domain tasks but usually weakens general capabilities. Before you start, define two evaluation sets: a domain set and a general set. Record scores on both throughout training.
Supervised fine-tuning teaches the model instruction formats and response styles. Data quality matters more than data volume. A few thousand high-quality samples often outperform hundreds of thousands of noisy samples.
Reinforcement learning optimizes the model against a reward signal. In early training, it can noticeably improve instruction following. However, if the reward model has loopholes, the model learns to exploit them. For example, it may generate very long answers with little substance. On complex reasoning tasks, performance may also plateau early. During training, regularly sample outputs for manual review. Do not rely on reward scores alone.
The table below summarizes the main risks and monitoring metrics for each stage.
| Stage | Training Objective | Main Gains | Main Risks | Recommended Monitoring Metrics |
|---|---|---|---|---|
| Pretraining | Learn general language patterns | Foundation of general capability | Diminishing returns, wasted compute | General benchmark curves, validation perplexity |
| CPT | Inject domain knowledge | Better domain task performance | Catastrophic forgetting | Dual curves for domain set and general set |
| SFT | Learn instruction formats | Dialogue and instruction following | Overfitting on small datasets | Held-out set performance, response length distribution |
| RL | Optimize reward | Preference alignment | Reward hacking, output mode collapse | Reward scores, manual spot-check results, KL divergence |
2. Mitigating Catastrophic Forgetting
Catastrophic forgetting occurs when a model loses significant prior capabilities after learning new data. The following methods are commonly used to reduce it.
- Replay: Mix a fixed proportion of the original pretraining data into the new training data. Start with 5% to 10%, then adjust based on general benchmark results.
- Learning rate strategy: Use a smaller learning rate for the new stage, with warmup followed by decay. A large learning rate can quickly overwrite existing weights.
- Regularization constraints: Compute the KL divergence between the output distributions of the current model and the base model, and add it to the loss. This limits how far the model drifts from its original behavior.
- Parameter-efficient fine-tuning: Use methods such as LoRA to train only a small set of added parameters and keep the original weights frozen.
Checklist:
- Before each stage begins, record the initial scores on general benchmarks.
- Run evaluations at fixed step intervals. If general performance drops by more than a preset threshold, pause training and investigate the cause.
- Keep checkpoints for each stage so you can roll back.
3. Trade-offs in Vision Encoder Selection
In multimodal models, the vision encoder determines how much visual detail the model can perceive. There are three common approaches.
- Reuse a pretrained encoder and freeze its parameters. This has the lowest training cost and suits small datasets. However, the visual features may not cover the images in your target domain.
- Unfreeze the last few layers of the encoder and continue training them. The features will fit the task more closely, but this requires more data and GPU memory. You also need to prevent the training signal from the language model from damaging the existing visual features.
- Add a small set of trainable modules on top of a frozen encoder, such as adapters or a small projection layer. This approach balances cost and flexibility.
Deployment also affects the choice. If the system separates the vision encoder from the language model’s prefill stage, image features only need to be computed once and can be cached. This suits scenarios where the same image is queried many times. If the vision module is deeply coupled with the language layers, separating it for deployment is difficult. High-resolution images produce a large number of visual tokens. You can compress the token count with pooling or resampling modules, which reduces the prefill compute.
A possible decision order:
- Determine whether the task requires fine-grained visual information.
- Confirm whether the deployment environment can split the vision module.
- Based on the amount of data available, decide whether to unfreeze the encoder.
4. Troubleshooting MoE Training
Mixture of Experts (MoE) models use a routing mechanism to activate only a subset of experts for each token. Their total parameter count can be very large, while the compute per inference pass stays relatively small. The most common problem in MoE training is uneven expert load.
- Load imbalance: A few experts receive most of the tokens, while the others receive almost no training signal. To diagnose this, track the proportion of tokens each expert receives at every step. A common fix is to add a load-balancing auxiliary loss that encourages the router to distribute tokens evenly. The weight of this auxiliary loss must be tuned. If the weight is too large, it hurts model quality. If it is too small, it fails to balance the load.
- Capacity limits: Set a maximum token capacity for each expert. Tokens beyond this limit are dropped or forwarded elsewhere. The capacity factor is a key parameter, and common values range from 1.0 to 1.25. A capacity that is too small loses information from many tokens. A capacity that is too large increases memory use and communication overhead.
- Routing numerical stability: When the router’s logits become very large, the softmax can overflow numerically. You can add a router z-loss and compute the routing step in higher precision.
- Out-of-memory (OOM) errors: Common causes include overly large expert capacity, excessive activation memory, and oversized all-to-all communication buffers. To troubleshoot, first reproduce the problem with a small batch. Then measure how expert capacity, batch size, and activation recomputation settings each affect peak memory, and identify the main source.
- Training instability: If the gradient norm suddenly spikes, lower the learning rate, enable gradient clipping, and check whether the most recent batch contains anomalous samples.
Long training runs will experience node failures and network interruptions. Save checkpoints regularly, and record the random seed and data loader position. This ensures that data order stays consistent when training resumes from a checkpoint. Monitor the loss, gradient norm, per-expert load, per-GPU utilization, and communication time.
5. Evaluating Embodied AI Models
Embodied AI models must carry out tasks in physical or simulated environments. Evaluation should go beyond single-attempt grasping success rates and include the following:
- Long-horizon task completion rate: Tasks contain multiple sub-steps. Record where each step succeeds or fails.
- Recovery from disruption: After the environment is perturbed, check whether the model can replan and complete the task.
- Long-context memory: When a task requires referencing information from dozens of steps earlier, check whether the model uses that information correctly.
Public simulation benchmarks such as CALVIN, LIBERO, ALFRED, and Habitat can serve as references. Task settings and scoring methods differ across benchmarks, so confirm that the evaluation protocols match before comparing results.
World models can predict the outcome of actions in a virtual environment, which reduces the number of trial-and-error attempts on real robots. However, prediction errors accumulate over time. For long-horizon planning, correct the model periodically with real-environment data.
Conclusion
The key to training efficiency is turning the assumptions behind each stage into testable metrics. Define the evaluation sets first, then change the training configuration. Change only one variable at a time so you can tell where a gain comes from.
