Deep Dive into Ultra-Scale MoE Architecture: Structural Compression for Attention and Expert Routing
This article analyzes an ultra-scale Mixture-of-Experts (MoE) language model with roughly 1.6T total parameters, about 49B activated parameters per token, and native support for million-token contexts. It explains how the 61-layer design combines heavy-compression attention, compressed sparse attention, sliding window attention, hash-based expert routing, mHC connections, and a multi-token prediction head, and it summarizes practical guidance on memory budgeting, Top-k scaling, precision separation, operator fusion, and observability.
1. Why It Matters: From More Parameters to More Architectural Efficiency
A preview version of an ultra-scale Mixture-of-Experts (MoE) language model recently appeared in an open-source community. It has roughly 1.6T parameters, activates about 49B parameters per token, natively supports million-level contexts, and is a pure language model without multimodal branches. What deserves attention is not the parameter count itself, but the fact that the architecture applies structural compression along two dimensions at once: attention and expert routing.
Over the past two years, mainstream long-context approaches have relied on sparsification: letting only some queries attend to some keys. This architecture moves compression forward into the representation layer—it first shortens the token sequence, then performs sparse selection on the compressed sequence. This “compress first, then sparsify” combination brings attention cost back from a roughly quadratic relationship with context length into a near-linear, controllable range. For engineering teams, this means the memory and compute budget for long-context inference becomes predictable for the first time.
2. Overall Compute Flow: How the 61 Layers Are Arranged
The model has 61 layers, divided into three segments:
- Layers 1 to 3: hash-based expert routing (hash-MoE), paired with heavy-compression attention, heavy-compression attention, and compressed sparse attention respectively.
- Layers 4 to 60: standard MoE, with heavy-compression attention and compressed sparse attention alternating.
- Layer 61: sliding window attention, responsible for local fine-grained modeling in the deep layers.
- A multi-token prediction (MTP) head is attached at the end to predict multiple future tokens in a single forward pass.
The logic behind this arrangement is “layered representation”: shallow layers use hash routing to guarantee absolute load balance and avoid early representation collapse; middle layers alternate compressed attention to cover both global and local scope; deep layers use sliding windows to narrow the receptive field and reduce numerical noise; and the MTP head at the end increases training signal density while providing a draft source for speculative decoding.
The connection between attention and MoE is not an ordinary residual but an mHC connection: compared with a standard residual, it adds preprocessing on the input side and postprocessing on the output side, renormalizing the sublayer output before injecting it back into the main path. The benefit is more stable activation scales when stacking deep layers, at the cost of two extra element-wise operations—a typical case of trading a small amount of compute for training stability.
Schematically, a single layer’s forward pass can be abstracted as:
# Pseudocode: expresses the data flow only, not a real interfaceh = hc_pre(x) # Pre-residual processingattn_out = attention[kind](h, cache) # kind ∈ {hca, csa, swa}h = hc_post(attn_out) + x # Post-residual processing and mergem = hc_pre(h)routed = hash_route(m) if layer < 3 else topk_route(m)h = hc_post(routed) + h
3. CSA: Compressed Sparse Attention
CSA consists of two independently replaceable components.
Token-level compressor (4:1 compression ratio): aggregates the keys and values of every 4 consecutive tokens into one compressed unit, typically by concatenating them and then applying a small projection or pooling to produce the compressed KV. The compressor usually has learnable parameters, so different layers can learn different aggregation granularities.
Index module: scores the compressed sequence for each query and selects the Top-k compressed units to participate in exact attention. Index scoring typically uses a lightweight dot product rather than a full attention matrix, so its cost is negligible. Two engineering points matter: first, the numerical precision of the index and the main attention should ideally be set separately, and the index can use lower precision; second, the Top-k value needs to scale with context length, otherwise recall is insufficient in long-document scenarios.
4. HCA and SWA: 128:1 Heavy Compression and Local Windows
HCA pushes the compression ratio to 128:1. Its compressor has the same structure as CSA’s but uses a longer aggregation window, usually paired with a larger k. It serves as a “global summary”: a very small number of compressed units can cover a million-token context, at the cost of losing detail, which makes it unsuitable for shallow layers and the final layer.
SWA performs neither compression nor indexing and computes only within a fixed window, with complexity linear in context length. Placed in the last layer, it is equivalent to adding a layer of local sharpening on top of the global summary.
The division of labor can be summarized as: HCA provides breadth, CSA provides mid-granularity selection, and SWA provides detail.
5. MoE and Hash Routing
The first 3 layers use hash routing: tokens are deterministically mapped to experts based on a hash of the token ID or position, without learning a gate. The advantages are zero routing fluctuation, naturally balanced load, and a fixed communication pattern; the drawback is that it cannot allocate by semantics, so it is only suitable for shallow layers. The remaining layers use standard Top-k gating, where load balancing loss, expert capacity factor, and cross-device all-to-all communication overhead need attention.
6. Implementation Checklist
- Estimate the memory budget based on the compressed KV length rather than the original context length.
- Scale the index Top-k linearly with length, and evaluate recall offline.
- Handle precision and operator fusion separately for the compressor and the index module.
- The mHC pre- and postprocessing are element-wise operators; fuse them with adjacent operators to avoid a bandwidth bottleneck.
- The MTP head can be used for speculative decoding, but its acceptance rate needs separate evaluation.
- If you use a cloud container platform with monitoring, alerting, and logging services, consider compression ratio, routing load, and expert capacity as core observability metrics.
