A Complete Architecture Breakdown of Trillion-Parameter MoE Models
This article breaks down the architecture of a trillion-parameter MoE language model with roughly 1.6T total parameters, about 49B activated parameters, and native million-token context support. It explains the 61-layer three-part layout, the division of labor among heavily compressed attention, compressed sparse attention, and sliding window attention, the dual-channel KV design, standard and hash expert layers, and multi-token prediction, along with practical tuning and deployment considerations.
1. Introduction: Why Long Context and Extreme Sparsity Must Advance Together
Once models reach the trillion-parameter range, the engineering bottleneck shifts from “can we train it” to “is the cost of every layer and every token controllable during inference.” When the context window grows from a few thousand tokens to the million-token scale, three costs scale at the same time: the quadratic complexity of attention, the GPU memory footprint of the KV cache, and the communication overhead of expert routing.
The widely accepted solution is not a single-point optimization. Instead, compression, sparsity, and routing are designed together on the same architecture diagram.
A recently published preview of a trillion-parameter, text-only language model offers a clear example: roughly 1.6T total parameters, about 49B activated parameters, and native support for million-token context inference. The breakdown below uses the decoding stage (sequence length 1, batch size 1) as the default view and walks through the computation flow layer by layer.
2. Overall Architecture: A Three-Part Layout Across 61 Layers
The model has 61 layers, organized into three segments:
- The first 3 layers are hash expert layers, paired with heavily compressed attention, heavily compressed attention, and compressed sparse attention respectively.
- The middle 58 layers are standard mixture-of-experts layers, alternating between heavily compressed attention and compressed sparse attention.
- The final layer uses sliding window attention, followed by a multi-token prediction module that outputs predictions for several future positions at once.
Attention and expert layers are not connected by a plain residual path. They use a hybrid connection with pre-processing and post-processing: normalization and projection happen before entering a sublayer (pre-processing), and a merge step happens after the sublayer output (post-processing). Compared with a single residual connection, this design makes “normalize, project, merge” explicit, which makes it easier to split and reorder the computation graph under large-scale parallelism.
The three attention types are not interchangeable. They are assigned to different layers by role: heavily compressed attention maintains an ultra-long-range information path at very low cost, compressed sparse attention performs fine-grained retrieval on top of compression, and sliding window attention models local detail.
3. Compressed Sparse Attention: Design Trade-offs of the Dual-Channel KV
The core idea of compressed sparse attention is to split the KV into two complementary channels.
The first channel is the sliding window channel. Each token attends only to tokens inside the window, the KV cache is fixed at the window size, and older entries are overwritten in a ring once the window is full. Memory usage is therefore constant rather than growing linearly with sequence length. During decoding, the input shape is [1, hidden_size], and after downsampling the cached shape is [1, head_dim]. The first few dimensions are position-encoded following the rotary position embedding dimensions, while the remaining dimensions are quantized, compressed, and then written to the cache. A sketch:
# Window channel write for a single decoding step (illustrative)x = hidden_state # [1, hidden_size]kv = downsample(x) # [1, head_dim]kv_rope = rope(kv[:, :rope_dim])kv_quant = quantize(kv[:, rope_dim:])window_cache.ring_write(concat(kv_rope, kv_quant)) # ring overwrite
The second channel is the compressed channel. Historical states first enter a compression module, which produces T compressed KV units per step and updates the compressed cache. An index module then scores the T candidates and keeps no more than topK of them for the attention computation. The key trade-off is that the compression ratio sets the coarse granularity of retained information, while topK sets the precision of retrieval. Together they bound the actual compute cost of attention per step.
Three engineering points are worth noting. First, both compression and quantization lose information, so leaving the position-encoding dimensions uncompressed preserves order information. Second, the ring cache requires writes and reads to be strictly aligned; otherwise, cross-window contamination occurs. Third, index scoring is itself an overhead: too small a topK loses accuracy, while too large a topK defeats the purpose of sparsity.
4. Heavily Compressed Attention: The 128:1 Ultra-Sparse Path
Heavily compressed attention pushes the compression ratio to 128:1, making the cache an order of magnitude smaller than in compressed sparse attention. This makes it suitable for shallow layers that act as a “global summary.” The cost is that very little detail is traceable per token, so it is typically arranged alternately with sliding window or compressed sparse attention, forming a coarse-to-fine rhythm across layers. The practical pattern is: shallow layers use heavy compression to control total cache size, deeper layers use compressed sparse attention to restore retrieval capability, and the final layer uses sliding window attention to close out local modeling.
5. Expert Layers: Standard MoE vs. Hash Experts
There are two forms of expert layers. Standard mixture-of-experts layers route tokens with Top-K gating, where the capacity factor, load-balancing loss, and communication partitioning directly determine training stability. Hash experts map tokens to fixed experts with a hash function, giving very low routing overhead and naturally balanced load, but limited expressiveness. They therefore appear only in the first few layers, serving as stable feature preprocessing.
Reproducing a similar training and inference pipeline in the cloud typically relies on a container platform for elastic scheduling, object storage for checkpoints and datasets, a message queue to decouple the data pipeline, and logging plus monitoring and alerting services to track throughput and anomalies. These are all general capability categories and do not involve specific interfaces.
6. Multi-Token Prediction and Deployment Recommendations
The multi-token prediction layer at the end outputs distributions for multiple future positions in a single forward pass. This increases training signal density and provides a natural draft source for speculative decoding.
For deployment, four areas deserve attention: joint tuning of the compression ratio and topK, balancing quantization bit width against precision, concurrency safety of the ring cache, and load-balancing monitoring for expert routing.
Overall, the methodology of this architecture is clear: use heavy compression to hold the long-range path, use compressed sparse attention to recover retrieval precision, use the two expert layer types to balance cost and expressiveness, and use multi-step prediction to raise the output per unit of compute.
