Key Practices for Training and Iterating Extremely Large Language Models
This article outlines the main challenges in training models with tens of billions or more parameters, covering compute capacity, training stability, data engineering, and system coordination. It also examines improvements across pretraining, annealing, post-training, inference serving, and capability evaluation, with practical guidance on routing, cost measurement, safety, and deployment readiness.
1. Define the Boundaries of the Training Challenge
In this article, “extremely large-scale” refers to models with tens of billions of parameters or more, where training requires the coordinated use of hundreds of accelerators. At this scale, the main challenges fall into four categories: compute capacity, training stability, data engineering, and system coordination.
| Challenge | Typical Symptoms | Observable Metrics | Common Mitigations |
|---|---|---|---|
| Compute capacity | Limited available accelerators or insufficient interconnect bandwidth | Model FLOPs utilization (MFU), communication time ratio | Plan parallelism around the network topology and reduce cross-node communication |
| Training stability | A single device failure or communication fluctuation interrupts the entire job | Mean time between failures, checkpoint recovery time | Save checkpoints regularly and automatically restart and resume training after failures |
| Data engineering | Duplicate or inconsistent-quality data limits model capabilities | Deduplication rate, validation loss curve | Adjust data mixtures by training stage and filter low-quality samples |
| System coordination | The parallelism strategy does not match the network topology | Step time, time spent waiting for communication | Optimize the combination of tensor, pipeline, data, and expert parallelism based on the topology |
The values in this table depend on the hardware and model architecture and should not be applied without validation. Teams should benchmark their own clusters, record measured results, and then determine the training configuration.
2. Iterative Development: Improvements on the Training Side
Large language model development often starts with a flagship version that establishes a capability baseline. Later versions then target specific weaknesses. Training improvements can be analyzed by stage:
| Training Stage | Improvement Target | Example Data or Method Adjustments | Validation Metrics | Common Failure Modes |
|---|---|---|---|---|
| Pretraining | Expand general-purpose and reasoning capabilities | Increase the proportion of code and mathematical text through small, incremental adjustments | Evaluate general benchmarks separately from code and mathematics subsets | Overweighting one domain causes clear degradation in other capabilities |
| Annealing | Improve performance on difficult tasks | Add high-quality synthetic data and difficulty-stratified samples as the learning rate declines | Accuracy on difficult subsets and signs of overfitting | Low-quality synthetic data causes errors to be amplified by the model |
| Post-training | Reduce error accumulation in long reasoning chains | Combine reinforcement learning with process supervision and validate the reward signal | Multi-step task success rate and step-level error rate | The model exploits weaknesses in the reward function, producing longer answers without improving accuracy |
Changes to the data mixture should be validated through ablation studies. Change only one variable at a time so that the effect of each modification can be identified reliably.
3. Inference and Serving Optimization
Training a capable model is only the first step. Whether the model can handle a large volume of requests at an acceptable cost is equally important for production adoption. Common optimization directions and their trade-offs include:
| Optimization | Suitable Scenarios | Benefit Metrics | Main Risks |
|---|---|---|---|
| Upgrading the inference engine, such as using efficient attention implementations and operator fusion | All online requests | Time to first token and generated tokens per second | Numerical behavior may change, requiring regression testing |
| Speculative decoding | Long outputs where the draft and target models have a high match rate | Throughput improvement, primarily determined by draft-token acceptance rate | Overall performance may decrease when the acceptance rate is low |
| Prefix caching | Many requests share a system prompt or the same document | Cache hit rate and prefill time | Caches consume GPU memory, and sensitive data must be isolated |
| Elastic scaling | Workloads with significant traffic fluctuations | Resource utilization and queueing time | Scaling has latency; capacity limits and fallback strategies are required |
The following example demonstrates request routing by workload type. It includes timeout handling, retries, and fallback paths and can run directly. The routing conditions should be replaced with rules appropriate for the target system.
import asynciofrom dataclasses import dataclassfrom typing import Awaitable, Callable@dataclassclass Request:prompt: strneeds_long_context: bool = False # Determined by whether the token count exceeds the long-context pool thresholdis_simple_task: bool = False # Validate through offline labeling instead of relying only on keywords@dataclassclass Result:text: strpool: strdegraded: bool = False # True means that the fallback path was usedHandler = Callable[[Request], Awaitable[str]]async def route_request(req: Request,pools: dict[str, Handler],timeout_s: float = 30.0,retries: int = 2,) -> Result:# Select the primary and fallback pools. Long-context requests have no fallback# to avoid hard truncation by a short-context model.if req.needs_long_context:primary, fallback = "long_context", Noneelif req.is_simple_task:primary, fallback = "speculative", "standard"else:primary, fallback = "standard", Nonelast_error: Exception | None = None# Call the primary pool and retry on timeout or connection failure.for _ in range(retries + 1):try:text = await asyncio.wait_for(pools[primary](req), timeout=timeout_s)return Result(text=text, pool=primary)except (asyncio.TimeoutError, ConnectionError) as exc:last_error = exc# Call the fallback pool only for requests that support degradation.if fallback is not None:try:text = await asyncio.wait_for(pools[fallback](req), timeout=timeout_s)return Result(text=text, pool=fallback, degraded=True)except (asyncio.TimeoutError, ConnectionError) as exc:last_error = excraise RuntimeError(f"All available pools failed; primary pool: {primary}") from last_error
When using this code, keep three points in mind:
- The
poolsmapping must contain all three pool names. A missing entry raisesKeyError, so validate the configuration during startup. - Retries increase downstream load. The long-context pool should use a separate timeout where necessary.
- Every fallback event should be logged and counted in metrics. Otherwise, a persistent degradation path may go unnoticed.
4. Capability Areas: Evaluation Methods and Risks
How should long-context capability be evaluated?
A common approach is the “needle-in-a-haystack” test. Embed key facts at different positions and depths within documents of varying lengths, then ask the model to retrieve them. Results should be reported in two dimensions—document length and information depth—to form a heat map.
Three common pitfalls deserve attention:
- Testing retrieval without testing reasoning based on the retrieved context.
- Using evaluation text that may already have appeared in the training data, which can inflate results.
- Underrepresenting information in the middle of the context, where models are more likely to overlook it.
What should be considered when evaluating agent tool use?
At minimum, track four metrics:
- Tool-selection accuracy
- Parameter-format validity rate
- End-to-end task success rate
- Average number of tool calls
Safety boundaries are equally important. Tools should use allowlists, and write operations such as deletion, money transfers, or message sending should require human confirmation. Tool responses may contain embedded instructions. If the model treats those instructions as commands, they can create security risks. Tool outputs should therefore be isolated from the model’s instruction channel and handled with appropriate controls.
How can structured output be made reliable?
For JSON and other structured formats, measure the proportion of outputs that pass schema validation. When validation fails, return the error information to the model for a retry. Inference engines that support constrained decoding can also directly restrict the output format.
A syntactically valid response does not necessarily have correct semantics. For example, an incorrect unit or reversed field meaning can still break downstream systems. Semantic verification should therefore be performed through sampling or additional validation.
How should multimodal capabilities be evaluated?
Use tasks such as reading values from charts and locating interface elements, then measure accuracy. Small text and low-resolution images are easy to misread, so the evaluation set should include these difficult cases.
5. Production Readiness Checklist
Before deployment, verify the following items:
- Define the applicable use case: custom pretraining, fine-tuning, or calling a hosted model API.
- Confirm prerequisites: accelerator count, interconnect bandwidth, and storage throughput have all been measured in the target environment.
- Evaluate using task sets from your own business domain, and record both quality and cost metrics.
- Establish the cost model by accounting for input and output tokens separately, including retry costs and cache misses.
- Manage training and evaluation data by access level. De-identify sensitive data, encrypt storage, and retain audit records for access.
- Call models through a unified application interface while preserving the ability to switch models and roll back.
- Use gradual rollouts, monitor quality and latency, and roll back immediately when anomalies occur.
Model versions change quickly. Teams should focus on three priorities: establish an evaluation baseline using their own task sets, calculate token costs based on real request volumes, and isolate model dependencies behind a unified interface. Completing these three tasks substantially reduces the cost of adopting a new model version.
