Large Language Models: Engineering Practices from Architecture Design to Efficient Training

    This article covers the core engineering problems in building large language models. It discusses Mixture-of-Experts architecture trade-offs, cost control in pretraining, reinforcement learning post-training, open-weight release strategies, and practical recommendations for developers and enterprises.

    Recent competition among large language model developers has changed substantially. A foundation model research lab founded in mid-2023 and headquartered in Hangzhou, with a team that has a quantitative investment background, has built on its compute and algorithm experience. In less than two years, the lab completed several iterations, from its first general-purpose model to reasoning-enhanced models. Its technical approach and engineering methodology offer a valuable reference point for the industry. This article uses that case as a starting point to break down the core engineering problems in large language model development.

    1. Mixture-of-Experts: Balancing Parameter Scale and Inference Cost

    When a model’s total parameter count approaches several hundred billion, the inference cost of a dense architecture becomes hard to sustain. The Mixture-of-Experts (MoE) architecture has become the mainstream solution. The model contains many “expert” subnetworks, and each forward pass activates only a small subset of them.

    Take a model with 671B total parameters as an example. A single inference pass typically activates only about 5% of the total parameters. The model can therefore hold a very large amount of knowledge while keeping inference overhead close to that of a dense model with a few billion parameters.

    In engineering practice, MoE presents several key challenges:

    • Routing balance: The gating network must learn to distribute tokens across experts effectively. Without this, some experts become overloaded while others sit idle, a failure known as “routing collapse.” Common approaches include an auxiliary load-balancing loss or a bias-adjustment strategy that does not require an auxiliary loss.
    • Communication overhead: In distributed training, experts sit on different devices, so routing and gathering tokens generate heavy cross-device communication. Good expert-parallel partitioning and overlapping communication with computation directly determine training throughput.
    • Fine-grained expert segmentation: Splitting experts into smaller units and pairing them with a small number of shared experts can improve the expressive power of expert combinations. Several recent open-source models have validated this design.

    2. Controlling Pretraining Cost: The Value of Systems Engineering

    The industry once widely assumed that training a frontier large model required tens or even hundreds of millions of dollars in compute. Recent practice shows that hardware-software co-optimization can reduce that cost by an order of magnitude. One example is the pretraining of a model with several hundred billion parameters for roughly US$5.57 million. That result rests on a set of cost-control methods:

    1. Low-precision training: The approach uses an FP8 mixed-precision scheme. Compute-intensive operators such as matrix multiplication run in low precision, while sensitive stages such as normalization and accumulation keep higher precision. This balances numerical stability against hardware efficiency.
    2. Pipeline parallelism optimization: A bidirectional pipeline schedule overlaps computation and communication, hiding most of the communication latency that expert parallelism introduces.
    3. Careful memory management: The memory used by gradients, optimizer states, and activations needs precise budgeting. Recomputation and sharding reduce wasted memory.
    4. Load forecasting and cluster scheduling: Fault recovery and checkpoint-based resumption must be reliable in the training cluster. In long training runs, any unexpected interruption carries a real financial cost.

    These lessons show that training large models is not only an algorithm problem. It is also a large-scale distributed systems engineering problem.

    3. Reinforcement Learning Post-Training: A New Paradigm for Reasoning

    Pretraining gives a model its knowledge. Post-training determines whether the model can apply that knowledge effectively. One of the most significant recent directions is large-scale reinforcement learning post-training. It uses verifiable rewards, such as whether a math answer is correct or whether code passes its test cases. Through trial and error, the model develops long chain-of-thought reasoning, self-reflection, and error correction on its own.

    A typical training pipeline has several stages:

    • Cold-start stage: The base model is fine-tuned on a small set of high-quality long reasoning chains so that it learns the format for reasoning output.
    • Reasoning-oriented reinforcement learning: Reinforcement learning is applied at scale on tasks with clear right and wrong answers, such as math, code, and logic. The reasoning length and accuracy of the model keep improving as training steps increase.
    • General capability alignment: Data generated through rejection sampling is combined with human preference rewards to strengthen general abilities such as writing and question answering.
    • Distillation: The reasoning ability of a large model is distilled into smaller dense models, so the smaller models also reach a useful level of reasoning. This matters a great deal for real-world deployment.

    The core insight of this paradigm is that, when reward signals are verifiable and training runs long enough, reasoning ability can emerge mainly from reinforcement learning. It does not depend entirely on large volumes of manually annotated chain-of-thought data.

    4. Open Strategy and Commercialization as Two Parallel Drivers

    Releasing model weights and technical reports under permissive licenses is reshaping the industry ecosystem. Open weights let companies and developers deploy models privately on their own infrastructure, which helps them meet data compliance requirements. Detailed technical reports turn engineering experience into shared knowledge and lower the trial-and-error cost for the whole industry.

    Commercialization typically follows several paths:

    • Application products: Consumer-facing AI assistant apps build brand awareness and validate use cases.
    • Open platforms: Developers access the model through APIs billed by usage, which creates a steady revenue stream.
    • Ecosystem integration: Model capabilities can be offered through the model services, container platforms, and serverless computing products of various cloud platforms. This lowers the barrier to adoption for enterprises.

    Funding activity among leading foundation model companies has also accelerated. Reported milestones include investment from a state-backed industrial fund, several increases in registered capital, preparations for a listing on China’s STAR Market, and record-setting funding rounds. These events suggest that the market is strategically reassessing foundation model assets. For practitioners, model capabilities will keep evolving quickly. The application layer should therefore stay model-agnostic, so teams can switch to and upgrade the underlying model with minimal effort.

    5. Practical Recommendations for Developers and Enterprises

    Based on the technical trends above, the following recommendations are practical starting points:

    1. Validate with open-weight models in private deployments first. Assess the capability boundaries while keeping data inside your own environment.
    2. Design limits and cost controls for long-conversation scenarios. Reasoning models produce long chains of thought that significantly increase token consumption. Manage usage and trim context at the product level.
    3. Consider distilled models. Most business scenarios do not need the full-size model. Smaller reasoning models offer clear advantages in latency and cost.
    4. Build a unified model access layer. Use an adapter pattern to encapsulate the calling differences between models, which leaves room for rapid iteration.

    Competition among large language models is far from over, but engineering methodology is converging quickly. MoE architecture, low-precision training, reinforcement learning post-training, and the open-source ecosystem form the most solid technical mainline at this stage. Understanding and mastering this mainline is essential for every AI engineer.