LLM Evolution: From General Language Models to Million-Token Context

    This article reviews the technical evolution from general pretrained language models to sparse MoE architectures, code and mathematical reasoning, multimodal and formal proof capabilities, and million-token context systems. It examines architecture efficiency, training and data engineering, evaluation risks, and practical deployment guidance for building scalable, testable, and governable LLM systems.

    LLM Evolution: From General Language Models to Million-Token Context

    1. Evolution Mainline and Problem Definition

    Public technical reports show that improvements in large model capabilities are not single-point breakthroughs. They result from coordinated progress across general pretraining, sparse architectures, domain-specific data, reinforcement learning, and long-context systems engineering. Early work focused on whether a general model close to closed-source performance could be trained within a reasonable budget. Research then gradually shifted toward parameter efficiency, expert specialization, hard capabilities such as code and mathematics, multimodal understanding, and memory, retrieval, and reasoning under million-token contexts.

    Million-token context is not simply a longer input window. It also introduces challenges in attention computation complexity, key-value cache memory usage, positional encoding extrapolation, long-range dependency decay, training-data construction, and the lack of evaluation frameworks. Understanding this technical path therefore requires attention to model structure, training strategy, data engineering, and inference systems.

    2. Foundation: General Language Models and Long-Term Training

    The starting point of this line of research is usually a general language model: parameter scales ranging from billions to tens of billions, pretraining on trillion-token corpora, and validation on code, mathematics, and reasoning tasks. Its key philosophy is “long-termism”: prioritizing data cleaning, mixture ratios, curriculum learning, and training strategy for long-term returns rather than pursuing short-term benchmark scores only.

    The value of this stage lies in building a reusable training foundation: high-quality corpus processing pipelines, distributed training stability, evaluation set construction, and model scaling experience. General models demonstrate that, under a reasonable budget, open models can approach closed-source models on some tasks, laying the foundation for subsequent research on sparse architectures and vertical capabilities.

    3. Architecture Efficiency: Fine-Grained Mixture of Experts and Shared Experts

    Mixture of Experts (MoE) is an important path for improving parameter efficiency. Traditional MoE uses a small number of large experts, resulting in coarse routing granularity and insufficient expert specialization. Fine-grained expert segmentation splits experts into smaller units, allowing different tokens to activate different expert combinations. A shared expert mechanism lets all tokens share part of the general capability, reducing knowledge fragmentation caused by routing fluctuations.

    A simplified MoE forward pass can be represented as:

    1. def moe_forward(x, experts, shared_experts, top_k):
    2. shared = sum(e(x) for e in shared_experts)
    3. scores = router(x)
    4. selected = topk(scores, top_k)
    5. routed = sum(gate * experts[i](x) for i, gate in selected)
    6. return shared + routed

    The core benefit of this architecture is that total parameters can be very large while only a subset of parameters is activated per token, improving capacity while keeping training and inference costs controllable. Public materials have given an example with about 145B total parameters and about 28.5% activated per token, showing that sparse activation can significantly improve parameter efficiency while approaching the quality of dense models. Engineering work still needs to address load balancing, expert parallelism, communication overhead, and routing stability.

    4. Vertical Capabilities: Code Intelligence and Mathematical Reasoning

    Code intelligence usually starts from training from scratch or continuing pretraining on specialized models, covering dozens of programming languages and learning syntax, API usage, cross-file dependencies, and test patterns from massive code tokens. The difficulty is not only single-line code completion, but also repository-level understanding, cross-file references, type inference, and test generation. Evaluation should cover public code benchmarks, real repository tasks, and manual review.

    Mathematical reasoning places more emphasis on process correctness and verifiability. Early work improved reasoning capabilities through mathematical corpus pretraining and reinforcement learning. Group relative policy optimization is a representative method: it samples multiple outputs for the same problem and estimates advantages using relative rewards within the group, avoiding the need to maintain a separate value network and reducing reinforcement learning memory overhead. Its simplified logic is as follows:

    1. for prompt in batch:
    2. outputs = sample(policy, prompt, n)
    3. rewards = reward_model(prompt, outputs)
    4. adv = (rewards - mean(rewards)) / (std(rewards) + eps)
    5. loss = -sum(logprob(outputs) * adv) + beta * kl
    6. update(policy, loss)

    Such methods later became an important foundation for training reasoning models, but deployment still requires addressing reward hacking, length bias, process supervision, and stability issues.

    5. Multimodal, Formal Proof, and Document Understanding

    Multimodal vision-language models need to align images, layouts, tables, and text. Document understanding especially relies on layout analysis, reading-order recovery, table structure recognition, and OCR fusion. Formal theorem proving requires the model to translate natural language mathematical problems into formal statements and perform closed-loop checking through proof search, policy networks, and verifiers.

    These directions jointly show that a general language model is only the foundation; vertical capabilities require specialized data, task decomposition, and validation mechanisms. For example, code requires compiler and test feedback, mathematics requires result verifiers, formal proof requires proof assistant checking, and document understanding requires layout structure supervision.

    6. Systems Engineering for Million-Token Context Intelligence

    The goal of million-token context is to let a model process hundreds of technical documents, a complete code repository, or long-cycle logs in a single session. Implementation paths usually include low-rank compressed attention to reduce key-value cache overhead; sparse attention and chunked processing to control computation; positional encoding extrapolation and segmented training to improve length generalization; and retrieval augmentation and hierarchical memory to mitigate attention dilution.

    A typical long-context processing pipeline can be abstracted as:

    1. chunks = split(document)
    2. embeddings = encode(chunks)
    3. kv_cache = compress_kv(embeddings)
    4. selected = retrieve(query, kv_cache, top_n)
    5. answer = attention_decode(query, selected)

    Evaluation cannot focus only on needle-in-a-haystack retrieval. It should also cover multi-hop question answering, long-document summarization, cross-file code completion, proof-script consistency, and root-cause analysis of long logs. Engineering work needs to focus on memory, bandwidth, batch scheduling, and cost control. At the training and inference infrastructure layer, general cloud capabilities such as object storage, container platforms, logging, and monitoring can support data management, task orchestration, and observability.

    7. Evaluation, Risks, and Deployment Recommendations

    The main risks of long-context models include position bias, loss of middle information, data contamination, long-range dependency decay, and rising inference costs. It is advisable to build layered evaluation: short-context basic capabilities, long-context retrieval and multi-hop reasoning, real business document tasks, and human review. For deployment, a hybrid approach of “retrieval augmentation + long context” can be used: first retrieve to narrow the scope, then use a long window to complete cross-document synthesis, avoiding a blind pursuit of the maximum window.

    8. Conclusion

    From general language models to mixture of experts, code and mathematical reasoning, multimodality, formal proof, document understanding, and then to million-token context intelligence, the main line of technical evolution is clear: use more efficient architectures to carry larger capacity, use more refined data and reinforcement learning to improve hard capabilities, and use systems engineering to solve memory, retrieval, and cost problems in long contexts. For developers and enterprises, the key is not a single metric, but building a technical system that is testable, governable, and scalable.