The Technical Evolution of Large Language Models: From Pretraining to Architectural Innovation

    This article traces the technical evolution of large language models across three stages: foundational pretraining choices such as Transformer backbones, Grouped Query Attention, data deduplication, and multi-stage learning rate scheduling; alignment techniques moving from Supervised Fine-Tuning to Direct Preference Optimization; and architectural innovations including Mixture of Experts, Multi-head Latent Attention for long-context support, and transparent reasoning chains. It also covers engineering considerations such as parallel training strategies and domain-specific fine-tuning, offering developers a systematic framework for understanding how modern LLMs balance efficiency, capability, and alignment.

    The Technical Evolution of Large Language Models: From Pretraining to Architectural Innovation

    Introduction

    The development of large language models (LLMs) has shifted from simply scaling up parameter counts to fine-grained refinement of architecture design, training strategies, and alignment techniques. Looking at the iteration paths of mainstream models over the past two years, a clear evolutionary curve emerges: from dense architectures to Mixture of Experts (MoE) architectures, from simple supervised fine-tuning to multi-stage alignment, and from short-text processing to support for million-token-scale long context. This article maps out the technical logic behind this path to help developers build a systematic understanding of how these models evolve.

    1. Technical Foundations of First-Generation Models

    1.1 Pretraining Architecture Choices

    Early large language models generally adopted the standard Transformer architecture as their backbone, and this choice was no accident. The self-attention mechanism in Transformers is naturally suited to handling long-range sequence dependencies, while its parallel computation properties facilitate large-scale distributed training. In practice, many models incorporate Grouped Query Attention (GQA), a technique that balances multi-head attention and multi-query attention. By grouping query heads and sharing key-value heads, GQA preserves the model’s expressive capacity while significantly reducing memory usage and computational overhead during inference.

    1.2 Trade-offs Between Data Scale and Quality

    Pretraining datasets typically reach the scale of trillions of tokens, covering mixed Chinese-English corpora. One detail that is easy to overlook: data scale is not the sole determining factor, and the rigor of deduplication strategies is equally critical. Excessive repetition in training samples can cause the model to overfit to specific patterns, weakening generalization. As a result, aggressive deduplication strategies, meaning stricter filtering of near-duplicate and templated content, have become standard practice for improving data quality.

    1.3 Engineering Details of Learning Rate Scheduling

    In terms of training stability, the choice of learning rate scheduling strategy directly affects convergence speed and final model performance. Compared to traditional cosine annealing schedulers, multi-stage learning rate schedulers, which divide the training process into multiple phases with different decay strategies applied at each phase, can more flexibly adapt to the gradient characteristics of different training stages, showing better convergence efficiency at extremely large parameter scales.

    2. From Supervised Fine-Tuning to Preference Alignment

    2.1 Supervised Fine-Tuning (SFT) Stage

    After pretraining, a model needs supervised fine-tuning to align its behavior with the task formats expected by humans. This stage typically involves collecting hundreds of thousands to millions of instruction samples, covering dimensions such as question answering, reasoning, code generation, and safety judgment. The quality and diversity of instruction data often matter more to fine-tuning outcomes than simply increasing data volume.

    2.2 Introducing Direct Preference Optimization (DPO)

    Introducing Direct Preference Optimization (DPO) after SFT is a key step in current mainstream alignment pipelines. Compared to traditional Reinforcement Learning from Human Feedback (RLHF), DPO eliminates the need to train a separate reward model. It optimizes the policy model directly through preference data comparisons, resulting in a simpler process and more stable training. This technique is particularly effective at addressing issues like repetitive generation and context drift that commonly arise in multi-turn conversations.

    A simplified DPO loss function can be expressed as:

    1. def dpo_loss(policy_logps, ref_logps, chosen_idx, rejected_idx, beta=0.1):
    2. # policy_logps: log probabilities of responses from the policy model
    3. # ref_logps: log probabilities of responses from the reference model
    4. pi_logratios = policy_logps[chosen_idx] - policy_logps[rejected_idx]
    5. ref_logratios = ref_logps[chosen_idx] - ref_logps[rejected_idx]
    6. logits = pi_logratios - ref_logratios
    7. loss = -log_sigmoid(beta * logits)
    8. return loss

    This alignment pipeline is typically carried out in two stages: first establishing baseline capabilities through SFT, then further refining conversational quality and safety boundaries through DPO on a dataset of millions of instructions.

    3. Architectural Innovation: Mixture of Experts and Long-Context Processing

    3.1 Introducing Mixture of Experts (MoE) Architecture

    As model parameter counts continue to grow, the computational cost of dense architectures becomes an increasingly pressing issue. Mixture of Experts architecture splits the model into multiple expert sub-networks and uses a dynamic routing mechanism to selectively activate a subset of experts for each input token. This keeps the actual computational cost of inference within a reasonable range even as total parameter count grows enormous. This design philosophy of “high capacity, low activation cost” is a core mechanism that allows today’s ultra-large-scale models to balance performance and efficiency.

    The basic logic of the routing mechanism can be summarized as follows:

    1. def moe_routing(token_embedding, experts, top_k=2):
    2. # Compute routing scores for each expert
    3. router_logits = router_network(token_embedding)
    4. top_k_scores, top_k_indices = topk(router_logits, k=top_k)
    5. # Only activate the top-k highest-scoring experts
    6. output = sum(
    7. softmax(top_k_scores)[i] * experts[top_k_indices[i]](token_embedding)
    8. for i in range(top_k)
    9. )
    10. return output

    3.2 Multi-head Latent Attention and Long-Context Efficiency

    In traditional multi-head attention mechanisms, the memory footprint of the key-value cache (KV Cache) grows linearly with sequence length when processing long sequences, becoming a bottleneck that constrains context length expansion. Multi-head Latent Attention (MLA) projects key-value vectors into a lower-dimensional latent space before caching them, substantially compressing memory usage and allowing models to support longer context windows at lower hardware cost. This technical innovation is a crucial enabler for achieving million-token-scale context capabilities.

    3.3 Transparent Reasoning and Complex Task Handling

    Another important direction of technical evolution is making the reasoning process transparent. By having the model output its complete intermediate reasoning steps before producing a final answer, this approach not only improves accuracy on complex logical tasks such as mathematical proofs and code debugging, but also gives users a reviewable path for understanding how the model reaches its conclusions. This “think first, answer second” pattern, combined with reinforcement learning to further refine the quality of the reasoning chain, has become a common technical approach for models aiming for advanced reasoning capability.

    Building on this, enhanced agent capabilities, meaning a model’s ability to call external tools, break down multi-step tasks, and maintain long-range state, further extend the applicability of language models to complex business scenarios.

    4. Key Engineering Considerations

    4.1 Parallel Optimization in Training Frameworks

    The underlying frameworks that support training at an extremely large scale need to combine multiple parallelization strategies, including data parallelism, tensor parallelism, and pipeline parallelism, along with operator-level optimizations for attention computation, such as Flash Attention-type techniques, in order to complete pretraining on trillions of tokens within an acceptable time and cost budget.

    4.2 Vertical Domain Customization and Fine-Tuning

    When general-purpose large models are deployed in specific industries, such as financial risk control or medical consultation, they typically require incremental pretraining on domain-specific corpora or parameter-efficient fine-tuning methods such as Low-Rank Adaptation (LoRA). This injects domain knowledge while preserving general capabilities, and is an essential step for enterprise-level deployment.

    Conclusion

    From dense Transformers to Mixture of Experts architectures, from cosine annealing to multi-stage learning rate scheduling, from simple SFT to two-stage SFT+DPO alignment, and on to transparent reasoning chains and support for million-token-scale long context, the technical evolution of large language models follows a clear throughline: prioritizing efficiency, expanding capability, and refining alignment. Understanding this evolutionary path helps developers make more informed decisions when selecting models, and provides a useful methodological framework for those training or fine-tuning their own models.