Large Language Model Architectures and Parameter Scales Explained

    This article breaks down the main architecture paradigms behind modern large language models, including dense feed-forward designs, sparse mixture-of-experts (MoE), attention optimizations, and long-context techniques. It explains how parameter scale relates to compute cost, memory usage, and deployment choices, then offers practical guidance on inference constraints, evaluation, and model selection. Readers will gain a clear framework for reasoning about the trade-offs among model structure, total versus activated parameters, and serving requirements.

    1. Introduction: Why Architecture and Parameter Scale Are the Starting Point

    In engineering practice, judging whether a model is “good” usually starts with two questions: which architecture family it belongs to, and what order of magnitude its parameter count sits at. Architecture determines the baseline shape of compute complexity, memory footprint, and inference throughput. Parameter scale determines the order of magnitude of both capacity ceiling and training cost. Together, they constrain the feasible range in which a model can balance quality, latency, and cost.

    It is worth emphasizing that total parameter count is not the same as the amount of computation actually performed per inference. A large body of recent work has moved models from “dense, fully activated” designs toward “sparse, conditional computation,” creating a clear separation between total parameters and activated parameters. This shift is key to understanding the current technical landscape.

    2. Four Main Architecture Paradigms

    2.1 Dense Feed-Forward Architecture

    The most classic implementation is a stack of Transformer decoder layers. Each layer contains normalization, an attention sub-layer, and a feed-forward sub-layer, where the feed-forward block is typically two linear transformations with a non-linear activation in between. The defining trait of a dense architecture is that every token passes through all parameters, making training and inference behavior predictable and the engineering implementation mature. This makes it well suited to latency-sensitive, high-concurrency online scenarios. The trade-off is that parameter growth and compute cost rise roughly in linear lockstep.

    2.2 Sparse Mixture-of-Experts (MoE)

    Sparse architectures replace the feed-forward sub-layer with several “expert” networks, and a routing module selects a few experts to participate in computation for each token. This introduces two metrics: total parameters and activated parameters. Total parameters determine knowledge capacity, while activated parameters determine the compute cost per token. The real engineering difficulty lies not in the structure itself but in load balancing, routing jitter, communication overhead under expert parallelism, and memory-residency strategies during inference.

    Illustrative pseudocode (expressing only the routing and aggregation logic, not any specific implementation):

    1. logits = router(hidden) # [tokens, num_experts]
    2. weights, expert_ids = top_k(logits, k=2)
    3. weights = softmax(weights, dim=-1)
    4. out = zeros_like(hidden)
    5. for e in unique(expert_ids):
    6. mask = (expert_ids == e)
    7. out[mask] += weights[mask] * expert_e(e, hidden[mask])

    2.3 Engineering Improvements to Attention

    Optimizing attention has become a standard direction, with widely accepted practices including: low-rank compression of multi-head attention to reduce the key-value cache during inference; grouped-query and multi-query sharing, where a small number of key-value heads serve a large number of query heads; and various sparse or sliding-window attention schemes that push the quadratic complexity of long sequences close to linear. In addition, moving position encoding from fixed schemes to extrapolatable rotary schemes is a foundational prerequisite for supporting long-context capability.

    2.4 Long Context and Position Extrapolation

    Extending the context window is not simply a matter of “making the window larger.” It is the combined result of training strategy, position-encoding extrapolation, attention implementation, and memory management. Common engineering techniques include progressive window expansion in stages during training, cache paging and reuse during inference, and applying different cache precision to high-frequency and low-frequency access layers.

    3. Parameter Scale: Orders of Magnitude and Trade-Offs

    From an engineering perspective, parameter scale can be roughly divided into several orders of magnitude, each corresponding to a different deployment form:

    • Below one billion: suited to on-device or high-frequency lightweight tasks, emphasizing extremely low latency and low power consumption.
    • One billion to tens of billions: the main range for general dialogue and structured extraction, which a single GPU or a small number of GPUs can handle.
    • Tens of billions to hundreds of billions: complex reasoning, long-document understanding, and multi-tool coordination, usually requiring multi-GPU parallelism combined with quantization.
    • Above hundreds of billions with a sparse architecture: trading “large total parameters plus small activated parameters” for a balance of capacity and throughput, placing higher demands on memory capacity and interconnect bandwidth.

    Three principles are recommended when choosing: first, determine the minimum viable scale based on task complexity; second, estimate the compute budget using activated parameters rather than total parameters; and finally, work backward from memory capacity rather than parameter count to decide the deployment form.

    4. Key Engineering Constraints for Inference Deployment

    Memory usage can be approximately broken into four parts: weights, the key-value cache, activations and temporary buffers, and framework and communication overhead. In practice, the most effective cost-reduction measures are usually weight quantization, cache quantization and paging management, and the throughput gains from continuous batching. For sparse architectures, you must additionally account for expert residency strategies and the irregular memory access introduced by routing.

    When deploying in the cloud, you can combine general-purpose capability categories: a container platform to host elastically scaling inference services, object storage to hold models and datasets, a message queue to smooth request spikes, and logging and monitoring with alerting for observability and capacity forecasting. This lets you build a portable, rollback-capable inference pipeline without binding to a specific implementation.

    5. An Actionable Checklist for Evaluation and Selection

    1. Define the task distribution: extraction, summarization, code, and multi-turn dialogue differ in their sensitivity to architecture.
    2. Measure time-to-first-token and steady-state throughput separately, avoiding reliance on a single metric.
    3. Run small-scale controlled experiments on real business samples, fixing decoding parameters to eliminate randomness.
    4. Record peak memory usage and the maximum batch size as a baseline for capacity planning.
    5. Establish a regression set to prevent quality drift caused by version upgrades.

    6. Conclusion

    Understanding modern large language models is fundamentally about understanding the coupling among three factors: architecture paradigm, parameter scale, and deployment constraints. Dense architectures win on determinism, sparse architectures win on balancing capacity and throughput, and improvements to attention and position encoding determine the ceiling for long context and inference efficiency. Once these three layers are clearly separated, model selection and tuning stop being guesswork based on experience and become measurable, reproducible engineering decisions.