LLM Evolution: From Sparse Mixture-of-Experts to Million-Token Context

    This article traces the technical evolution of large language models, moving beyond raw parameter scaling toward systems engineering. It covers how a general-purpose base model is built through disciplined data governance and corpus balancing, how Mixture-of-Experts (MoE) architectures improve capacity efficiency through fine-grained expert segmentation and shared experts, how code and math abilities are strengthened with execution feedback and contamination-resistant evaluation, and how group-relative advantage reinforcement learning reduces training complexity. It also explains vision-language fusion, the engineering required for genuine million-token context, and the cloud infrastructure and observability needed to run large-scale training and long-context inference in production. Readers will learn the boundaries of each technique, the trade-offs involved, and why model capability ultimately depends on coordinated optimization across data, architecture, training strategy, evaluation, and infrastructure.

    I. From Parameter-Scale Competition to Systems-Engineering Competition

    Early narratives around large models usually revolved around parameter scale: bigger models were assumed to deliver stronger language understanding, generation, and reasoning. As training costs, inference costs, and deployment complexity kept rising, however, the marginal gains from simply increasing parameter counts began to shrink. The industry started shifting from “piling on parameters” to more deliberate system design, including data governance, expert structure, reinforcement-learning alignment, long-context support, and multimodal fusion.

    Against this backdrop, a clear technical roadmap has taken shape: first establish foundational capability with a general-purpose language model, then improve capacity efficiency through a Mixture-of-Experts (MoE) architecture, then strengthen reasoning with specialized data such as code and math, then improve task alignment and complex reasoning through reinforcement learning, and finally extend to vision-language and long-context scenarios. The core of this path is not a single breakthrough, but the coordinated optimization of data, model structure, training strategy, and engineering infrastructure.

    II. General-Purpose Language Models: Scale, Data, and Long-Termism

    The general-purpose language model is the foundation of the entire intelligent system. Common practice in this line of research is to build a ladder of model sizes ranging from 7B to 67B and to complete pre-training on a corpus of roughly 2 trillion tokens. Once the model sizes form a gradient, researchers can observe capability curves across parameter scales and determine whether a given capability comes from scaling parameters, improving data quality, or optimizing training strategy.

    More important than parameter scale is the philosophy of data handling. What is often called “long-termism” does not chase rapid gains on short-term benchmarks; instead, it focuses on data cleaning, deduplication, quality filtering, corpus mixing ratios, training stability, and long-term generalization. Short-term metrics are easily affected by benchmark contamination and the incidental nature of task templates. What truly determines a model’s long-term value is the data distribution, knowledge coverage, the proportion of high-quality corpora such as code and math, and stability control during training.

    At the general pre-training stage, several key engineering areas usually demand attention:

    • Data governance: Clean web pages, books, papers, code, and dialogue corpora, removing low-quality, duplicate, and risky content.
    • Corpus mixing: General corpora provide world knowledge, code corpora improve logical and programming ability, math corpora strengthen reasoning, and dialogue corpora improve instruction following.
    • Training stability: Set learning-rate warmup and decay, gradient clipping, mixed-precision training, outlier handling, and checkpoint recovery appropriately.
    • Evaluation system: Look beyond a single task score to overall capability across code, math, commonsense, long text, and multi-turn dialogue.

    When a model at a moderate scale can outperform larger earlier models on code, math, and reasoning tasks and approach the mid-tier level of then-current closed-source models, it signals that data quality, corpus mixing, and training strategy have begun to play a decisive role.

    III. Mixture-of-Experts: From Dense Computation to Fine-Grained Sparse Activation

    A traditional dense model requires all parameters to participate in computation during inference, so the per-token cost grows with model size. Mixture-of-Experts models use a routing mechanism to selectively activate a subset of parameters, decoupling total capacity from the amount of computation performed per token.

    Early MoE architectures typically used a small number of large expert modules, but this tended to run into two problems: first, the experts were large, making routing decisions insufficiently flexible; second, different experts might redundantly learn general knowledge, lowering parameter efficiency. Fine-grained expert segmentation and the shared-expert mechanism offer improvements on both fronts.

    1. Fine-Grained Expert Segmentation

    The core idea of fine-grained expert segmentation is to split the traditional large experts into more numerous, smaller expert units. After passing through the routing network, each token can select and activate several small experts. The benefits include:

    • A larger routing selection space, letting the model compose finer-grained capabilities;
    • Higher expert specialization, making it easier for different experts to handle different language patterns or knowledge types;
    • Higher parameter capacity while keeping the actual per-token computation low.

    This design allows total parameter scale to grow substantially without inference cost rising proportionally.

    2. Shared-Expert Mechanism

    The shared-expert mechanism keeps a subset of experts open to all tokens. Unlike fine-grained experts, shared experts are better suited to carrying general language ability, basic grammar, common factual knowledge, and cross-domain expression patterns. This reduces redundant learning across experts and improves overall parameter efficiency.

    In representative research, one structure has about 145B total parameters but activates only about 28.5% of them per token, ultimately delivering performance comparable to a 67B dense model. This result shows that the value of a sparse model is not merely reduced computation; more importantly, it lies in improving the effective expressive power per activated parameter through a sound structure.

    3. Engineering Challenges

    Although MoE architectures improve capacity efficiency, they also introduce clear engineering challenges:

    • Routing stability: If the routing network fluctuates too much, training can become unstable or expert load can become imbalanced.
    • Load balancing: A few experts must be prevented from being overloaded while most sit idle.
    • Communication overhead: When experts are spread across devices, extra communication arises, requiring compute-communication overlap and topology optimization.
    • Memory management: With many total parameters, techniques such as parameter sharding, tensor parallelism, pipeline parallelism, and gradient checkpointing are needed.
    • Inference optimization: Hot experts should be cached, the number of activated experts controlled, and batch scheduling optimized.

    MoE architecture is therefore not simply “scaling up parameters,” but a systems-engineering effort spanning training, inference, communication, and operations.

    IV. Code and Math Capabilities: Data Mixing, Execution Feedback, and Task Evaluation

    Beyond general language ability, code and math are important measures of a model’s reasoning capability. Code tasks require the model to understand syntax structure, interface semantics, runtime environments, and boundary conditions; math tasks require multi-step reasoning, symbolic transformation, and result verification.

    Improving these capabilities usually calls for the following strategies:

    • High-quality corpora: Code cannot rely on volume alone; it must include comments, documentation, test cases, and different language paradigms.
    • Execution feedback: Code models can form a feedback loop from signals such as run results, compilation errors, and test pass rates.
    • Reasoning-process supervision: Math models need to learn step-by-step reasoning, hypothesis testing, and result verification.
    • Instruction data: Combine open-ended problems with executable tasks to improve usability in real development scenarios.
    • Contamination-resistant evaluation: Benchmarks need periodic updates and a distinction between tasks seen and unseen during training, to avoid memorization-style overfitting.

    In code intelligence scenarios, a model must not only generate code snippets but also understand context dependencies, function calls, exception handling, and cross-file relationships. With the arrival of long context, code intelligence has further extended to repository-level understanding, cross-module call analysis, and maintenance of large projects. This moves code models from “single-file generation” toward “engineering understanding.”

    V. Reinforcement Learning: From Actor-Critic to Group-Relative Advantage

    Pre-training gives a model its foundational capability, while post-training and reinforcement learning make it better aligned with human preferences, task requirements, and complex reasoning goals. Traditional reinforcement learning often uses an actor-critic structure: the actor generates actions while the critic estimates a value function. This approach is effective for preference alignment and policy optimization, but it typically requires maintaining multiple models at once, incurs heavy memory overhead, and complicates the training pipeline.

    A more engineering-efficient path is group-relative advantage optimization. Its core idea is to sample multiple outputs for the same prompt and judge which one is better through in-group comparison, rather than relying on a separate value model.

    A schematic flow looks like this:

    1. def relative_advantage_step(prompts, policy, reward_fn, group_size=8):
    2. for prompt in prompts:
    3. group = [policy.generate(prompt) for _ in range(group_size)]
    4. rewards = [reward_fn(prompt, output) for output in group]
    5. baseline = mean(rewards)
    6. scale = std(rewards) + 1e-6
    7. for output, reward in zip(group, rewards):
    8. advantage = (reward - baseline) / scale
    9. policy.update(prompt, output, advantage)

    Key advantages of this approach include:

    • Lower memory pressure: No separate critic model needs to be maintained;
    • Simplified training pipeline: The reward function can come directly from rules, test pass rates, or verifiable results;
    • Suitability for group comparison: Generating multiple candidates for the same problem makes it easier to judge relative quality;
    • Scalability: On tasks that can be automatically verified, such as code tests, math answer checking, and format constraints, the reward signal is more stable.

    Of course, this approach also places higher demands on reward design. If the reward function has loopholes, the model may learn to “game” the system rather than genuinely improve its capability. It therefore needs to be paired with safety constraints, length control, format constraints, and anti-cheating evaluation.

    VI. Multimodal Capabilities: From Text Understanding to Vision-Language Collaboration

    As single-text models gradually mature, vision-language models become an important direction for the next stage. The goal of a multimodal model is not simply to convert images into text, but to enable the model to jointly understand images, text, layout, and semantics.

    A typical vision-language model usually includes:

    • Visual encoder: Converts images into computable features;
    • Projection or alignment layer: Maps visual features into a representation space the language model can understand;
    • Language model backbone: Handles reasoning, question answering, generation, and instruction following;
    • Instruction data: Helps the model understand tasks such as “describe the image,” “extract a table,” “answer a question,” and “perform visual reasoning.”

    A key difficulty in multimodal training is controlling the number of visual tokens. High-resolution images generate large numbers of visual tokens, and keeping them all significantly raises inference cost. Strategies such as visual token compression, region selection, and adaptive resolution are therefore needed. In scenarios such as documents, receipts, and charts, the model must also recognize layout structure, reading order, and table relationships.

    Once multimodal capability is combined with long-context capability, it can further support long-document question answering, video frame understanding, cross-page information retrieval, and complex-scenario reasoning.

    VII. Million-Token Context: From Long Windows to Effective Context Intelligence

    A “million-token context” is not merely a larger input window. True long-context capability requires the model to maintain key-information localization, cross-section reasoning, and evidence recall within extremely long text.

    Achieving long context usually requires a combination of techniques:

    • Position-encoding extrapolation: Let the model maintain relatively stable positional awareness beyond its training window;
    • Sparse or local attention: Reduce the attention-computation cost of very long sequences;
    • Retrieval augmentation: Retrieve relevant snippets from a long document or knowledge base, then feed them to the model;
    • Hierarchical memory: First generate summaries, tables of contents, or paragraph indexes, then read details on demand;
    • Caching and compression: Compress and store conversation history, long documents, and tool-call results;
    • Chunk indexing: Split long text into retrievable units, combined with semantic ranking and citation localization.

    The engineering cost of long context is clearly higher than that of ordinary context. The longer the input, the more memory usage, first-token latency, and inference cost all rise. It is therefore necessary to distinguish “window length” from “effective context capability”: no matter how long the window is, if the model cannot accurately locate key facts, it cannot truly support complex tasks.

    In scenarios such as code repositories, legal documents, research reports, and multi-turn dialogue, the value of million-token context lies in letting the model reason across many files, chapters, and interaction turns. But this requires the model to also possess retrieval, compression, ranking, and evidence-citation capabilities, rather than passively receiving an extremely long input.

    VIII. Cloud Engineering Practices: Data, Training, Inference, and Observability

    Large-scale model training and long-context inference are inseparable from cloud infrastructure. When enterprises put large-model engineering into practice, they can typically build a complete pipeline using general cloud capabilities:

    • Object storage: Store raw corpora, training data, checkpoints, and log archives;
    • Message queues: Decouple data cleaning, preprocessing, training jobs, and evaluation jobs;
    • Container platforms: Host training, fine-tuning, inference services, and batch jobs;
    • Logging services: Record training loss, routing distributions, request latency, and error messages;
    • Monitoring and alerting: Observe GPU utilization, memory usage, throughput, latency, and job failure rates.

    During training, focus on data throughput, checkpoint frequency, gradient anomalies, and job-recovery capability. During inference, focus on first-token latency, concurrent throughput, KV-cache usage, long-context request cost, and model fallback strategies.

    For enterprise users, model selection should not look only at parameter scale; it should also weigh task accuracy, inference cost, context length, data security, deployment complexity, and maintainability.

    IX. Conclusion: The Essence of LLM Capability Is System Synergy

    From general-purpose language models to fine-grained Mixture-of-Experts, from strengthened code and math abilities to group-relative advantage reinforcement learning, and further to vision-language fusion and million-token context, the evolution of large-model technology is no longer a single-point breakthrough but the system-level synergy of data, algorithms, architecture, evaluation, and infrastructure.

    A truly valuable model is not simply the one with the most parameters or the longest window, but an intelligent system that can reliably complete complex tasks at a controllable cost, continuously absorb new data, adapt to multimodal inputs, and maintain reasoning reliability within long contexts. For developers and enterprises, understanding the boundaries and combinations of these technical paths matters more than chasing a single metric.