The Evolution of Large Language Models: From Dense Architectures to Sparse Mixture-of-Experts
This article traces the technical evolution of large language models (LLMs), from dense Transformer architectures to sparse mixture-of-experts (MoE) designs. It covers pretraining, supervised fine-tuning (SFT), Direct Preference Optimization (DPO), MoE and attention optimizations, transparent reasoning models, and long-context and agent capabilities. It also offers a model selection checklist and risk considerations for cloud deployment.
1. Why Follow the Technical Route
Large language models (LLMs) are among the fastest-growing areas in artificial intelligence. A typical development pipeline has three steps: pretraining on large-scale mixed Chinese and English corpora, supervised fine-tuning (SFT) so the model learns to follow instructions, and preference optimization to align the model with human preferences.
Understanding how this pipeline evolved helps developers judge which techniques deliver real gains. It also helps enterprises estimate costs when planning deployments. The sections below cover architecture, training, alignment, and the latest capabilities. Specific parameter counts, training data volumes, and benchmark scores should be verified against each model’s official technical report.
2. Dense Models: Capability and Cost Growing Together
2.1 Architectural Foundations
Early large models mostly used the Transformer architecture and were dense models. A dense model activates all of its parameters during every inference pass. Its structure is simple, and the engineering paths for training and deployment are well established. Its main drawback is that as the model grows, the compute and memory required for each inference step also increase.
To ease this inference pressure, the industry commonly uses grouped-query attention (GQA). GQA lets multiple query heads share one set of key-value (KV) heads, which reduces the memory used by the KV cache during inference. In most public experiments, this has little effect on model quality, so it is widely adopted.
2.2 Two Engineering Essentials in Pretraining
Two details in pretraining are often overlooked.
First, deduplication and quality filtering. Large amounts of repeated text in the training corpus can cause the model to memorize specific sentences, which weakens its generalization. Multi-stage deduplication reduces this repetition, but deduplication alone cannot replace quality filtering. Teams also need to filter low-quality web pages, clean malformed content, and control the proportion of data from each domain.
Second, learning rate scheduling. Cosine annealing is a common choice. In long training runs, however, decreasing the learning rate in stages can make the training process easier to control. The following is a runnable illustrative implementation:
def multi_stage_lr(step, base_lr=3e-4, warmup_steps=2000,milestones=(100_000, 200_000),decay_factors=(0.5, 0.2), min_lr=3e-5):# Warmup phase: the learning rate increases linearly from near 0 to base_lrif step < warmup_steps:return base_lr * (step + 1) / warmup_steps# Each time a milestone is passed, multiply the learning rate by its decay factorlr = base_lrfor milestone, factor in zip(milestones, decay_factors):if step >= milestone:lr = base_lr * factorreturn max(lr, min_lr)
This code only demonstrates the scheduling logic. In real training, the milestones, peak learning rate, and warmup steps must be adjusted based on model size and batch size.
2.3 Alignment: SFT and DPO
Alignment typically takes two stages.
- SFT stage: Train the model on a large set of instruction data. The data should cover multi-turn dialogue, mathematical reasoning, code generation, and other scenarios. Data diversity and annotation quality usually affect results more than simply adding more examples.
DPO stage: Direct Preference Optimization (DPO) updates the policy directly from preference pairs, which consist of a better response and a worse response. It does not require training a separate reward model, so the pipeline is simpler and training is more stable. Its core loss function can be written as:
L = -log σ(β · [(log π(y_w|x) - log π_ref(y_w|x)) - (log π(y_l|x) - log π_ref(y_l|x))])
Here, y_w is the preferred response, y_l is the less preferred response, and β controls how far the model may deviate from the reference model.
DPO simplifies the alignment pipeline, but it cannot solve every problem on its own. For example, repetitive generation in multi-turn dialogue often requires adjustments to data cleaning, decoding strategies (such as a repetition penalty), and evaluation sets together. This problem cannot be attributed to the alignment algorithm alone.
3. Mixture-of-Experts and Attention Optimization
3.1 Mixture-of-Experts (MoE) Architecture
MoE splits the feed-forward network layers into multiple “experts.” A routing mechanism then activates only a few experts for each token. As a result, the model’s total parameter count can be very large while the compute per inference step stays manageable.
MoE also has clear limitations:
- Load imbalance: If the router keeps sending requests to a small number of experts, some devices become overloaded while others sit idle.
- Communication overhead: When experts are distributed across devices, tokens must be forwarded between devices, and network bandwidth can become a bottleneck.
- Memory footprint: Even though only a few experts are active during inference, the parameters of all experts usually must still be loaded into memory.
For this reason, MoE suits teams at a certain scale that can handle the added complexity of distributed deployment.
3.2 Multi-Head Latent Attention (MLA)
MLA compresses the KV cache into a low-dimensional latent space. This noticeably reduces memory usage during long-context inference, which benefits scenarios such as RAG and long-document analysis.
MLA requires the attention structure to be redesigned, so it is not a plug-and-play optimization. It usually must be introduced during training, or it requires substantial changes to an existing model. Its implementation is also more complex. MoE and MLA often appear together in the same architectures, but they solve different problems. MoE mainly controls compute, while MLA mainly reduces cache overhead. A specific technique should not be simply mapped to a particular model generation.
3.3 Transparent Reasoning Models
Reasoning models use methods such as reinforcement learning to generate a visible chain of thought. They tend to perform well on tasks that require multi-step derivation, such as mathematics and coding.
These models also have direct costs. Their outputs become longer, which raises inference costs. The reasoning process itself may contain inappropriate content, so it requires additional safety filtering. On some public math and coding benchmarks, certain transparent reasoning models score close to contemporary advanced reasoning models. This conclusion depends on the specific benchmark, model version, and evaluation setup. When selecting a model, reproduce the evaluation on your own task set.
4. Long Context and Agents: The New Competitive Focus
4.1 Long Context
Some models advertise context windows at the million-token level. This suits understanding very long documents and analyzing large codebases. Two points need attention.
First, a supported window length does not equal effective utilization. Models often extract information from the middle of a long text less reliably than from the beginning and end. This phenomenon is often called “lost in the middle.” Second, the longer the context, the higher the compute and cache costs. In many scenarios, RAG remains a lower-cost option. It retrieves relevant passages first and then passes them to the model.
When evaluating, split your own long documents into different lengths. Place questions at different positions relative to the key information, and observe how accuracy changes.
4.2 Agent Capabilities
Agent scenarios focus on a model’s tool calling, multi-step planning, and task decomposition abilities. A practical agent usually needs the following capabilities:
- Selecting the correct tool and generating valid parameters;
- Keeping the goal consistent across multi-step tasks;
- Retrying or changing strategy after a tool call fails.
When evaluating agents, record the task success rate, tool-call accuracy, average number of steps, and failure recovery rate. Scores on general leaderboards alone rarely reflect how a model performs in
