Technical Evolution and Engineering Practices of Open-Source Large Language Models

    This article breaks down the technical evolution and engineering practices behind first-generation open-source large language models. It explains how to apply Scaling Laws correctly through small-scale proxy experiments before committing heavy compute, how sparse Mixture-of-Experts (MoE) architectures expand model capacity without increasing per-token computation, and the key engineering considerations for training and inference, including load balancing, communication overhead, memory management, cost control, and observability.

    1. Background: Why Open-Source LLMs Need a Reusable Technical Roadmap

    The first generation of open-source large language models typically had to answer three questions at once: how to choose the model size, how to balance the data mixture, and how to set training hyperparameters. A common early approach was to collect a large corpus first and then decide the model size based on the remaining compute budget. The result was often insufficient model capacity or data being consumed repeatedly over multiple epochs, with marginal returns decaying quickly. To move past this reactive situation, the relationship among scale, data, and compute needs to be abstracted into measurable patterns, which can then be used to extrapolate large-scale configurations from small-scale experiments.

    The widely accepted Scaling Law in the industry describes how, within a reasonable range, model loss decreases as a power law with increases in parameter count, data volume, and compute. However, this pattern holds only under one condition: data quality must not become the bottleneck. When the corpus contains a large amount of duplicated, low-information-density, or format-noisy content, the returns from continued compute investment are significantly weakened.

    2. Using Scaling Laws Correctly: Validate the Direction First, Then Commit Heavy Compute

    The more reliable engineering path is to set the direction first and the scale second:

    1. Build small-scale proxy experiments and fit a loss curve using a set of progressively larger models;
    2. Once the fit is reliable, extrapolate the optimal parameter count and data mixture under the target compute budget;
    3. Select the better hyperparameters (learning rate, batch size, scheduling strategy, weight decay, and so on) before launching the main training run.

    It is important to emphasize that high-quality data is a necessary condition for the above extrapolation to be valid. If the data cleaning, deduplication, and quality scoring steps are missing, the curve fitting will be distorted and the extrapolation conclusions will be unreliable. Therefore, under the same compute constraints, if data quality is already at a high level, prioritizing an increase in model size is usually more cost-effective than continuing to pile on more data; conversely, if data noise is significant, data governance should be completed first rather than blindly scaling up.

    A schematic experimental workflow can be expressed as:

    1. # Pseudocode: small-scale proxy experiments + curve extrapolation (workflow illustration only)
    2. configs = [(0.1, 1.0), (0.3, 1.4), (0.7, 2.0)] # (parameters in B, training token multiplier)
    3. losses = [train_proxy(cfg) for cfg in configs] # record validation loss
    4. best = extrapolate_and_select(losses, compute_budget=BUDGET)
    5. train_main_model(params=best.params, tokens=best.tokens, hparams=best.hparams)

    3. Sparse Architectures: How Mixture-of-Experts Expands Capacity Without Increasing Compute

    Mixture-of-Experts (MoE) is used to replace the feed-forward network portion of a standard Transformer. Its core value is that the total parameter count can be increased substantially, but each token only activates a subset of those parameters, so the per-token computation and memory footprint remain controllable.

    The conventional approach typically splits the feed-forward layer into a small number of “large experts” and then selects activations via Top-K, for example choosing 2 out of 8 experts. The problem is that each individual expert has too much capacity and is forced to carry multiple types of knowledge internally. Experts easily learn duplicate content, forming parameter redundancy, and routing also becomes more prone to instability.

    A more refined design idea involves two points:

    • Fine-grained expert splitting: split each expert further into multiple smaller experts to increase specialization, while raising the K value in Top-K so that each token is computed by a combination of more small experts;
    • Shared expert isolation of common knowledge: extract general, cross-domain knowledge into a small number of shared experts that all tokens pass through constantly, avoiding repeated learning of the common part by each specialized expert.

    This combination of fine-grained splitting and shared isolation reduces redundancy while keeping the total parameter count unchanged or under controlled growth, and makes routing decisions focus more on differentiated knowledge. The corresponding engineering benefit is that memory is mainly affected by the number of activated parameters and the caching strategy, while the benefit of expansion is reflected in model capacity.

    4. Key Engineering Points for Training and Inference

    • Load balancing: routing has inherent preferences, so auxiliary losses or noise injection and similar techniques are needed to keep expert utilization balanced; otherwise some experts remain idle over the long term;
    • Communication overhead: expert parallelism introduces cross-device dispatch and aggregation communication, which needs to be designed in coordination with pipeline and tensor parallelism;
    • Memory management: activation recomputation, mixed precision, and optimizer state sharding are common techniques;
    • Inference cost control: combining batch scheduling, cache reuse, quantization, and distillation can strike a balance between quality and cost;
    • Observability: incorporating throughput, peak memory, routing distribution, and loss curves into logging services and monitoring/alerting systems makes it easier to quickly locate anomalies.

    If cloud resources are used to host training and inference, container platforms can typically be combined to handle elastic scheduling, object storage can hold the corpus and checkpoints, message queues can decouple the data pipeline, and monitoring/alerting plus logging services can provide full-link observability. The general capability categories that Baidu AI Cloud provides in these scenarios can serve as a reference when selecting infrastructure.

    5. Conclusion

    The experience from the first generation of open-source large models can be condensed into one engineering principle: first use small-scale experiments to confirm the direction of the Scaling Law under the current data conditions, then commit heavy compute in a single pass; at the architecture level, use sparse fine-grained experts plus shared experts to reduce redundancy; and in the deployment stage, ensure stability through load balancing, communication optimization, and observability. By following this path, teams can achieve more predictable scaling returns and more controllable per-unit inference costs within a limited budget.