Modern model architecture: MoE, SSM/Mamba and hybrid architectures

The development of modern neural network architecture not only focuses on how to improve model capabilities, but also pays increasing attention to computational efficiency, memory usage, long sequence modeling and hardware utilization.

Transformer is still an important infrastructure, but standard Transformer faces some cost issues in large-scale models and long context scenarios.

Therefore, several important architectural development lines have emerged in recent years:

  • Mixture of Experts (MoE): Improve the efficiency between model capacity and calculation amount through sparse activation.
  • State Space Models (SSM): Efficient sequence modeling using state update mechanism.
  • Mamba: Improve the modeling ability of SSM for complex sequences through the input-dependent selection mechanism.
  • Hybrid Architectures: Combines the advantages of different modules such as Attention, SSM, MoE.

This article uses Transformer as a reference to focus on the core ideas, computing characteristics and engineering applications of these architectures, without chasing the specific version of each new model.

1. Why is a new neural network architecture needed?

Modern large models need to consider multiple goals simultaneously:

  1. Model Capacity: The model can learn and represent complex patterns.
  2. Training Efficiency: Computational and communication costs required for training.
  3. Inference Efficiency: Generation speed, throughput and latency.
  4. Memory Efficiency: Memory overhead for model weights, activations, and inference states.
  5. Long-context Modeling: The ability to process long sequence information.

There are often trade-offs between these goals.

Main cost of Transformer

Standard Transformer uses Self-Attention to establish information exchange between Token.

For a sequence of length NN:

Q=XWQ,K=XWK,V=XWVQ=XW_Q,\quad K=XW_K,\quad V=XW_V Attention(Q,K,V)=softmax(QKTdk)VAttention(Q,K,V) = softmax\left(\frac{QK^T}{\sqrt{d_k}}\right)V

The shape of the attention score matrix is:

QKT∈RN×NQK^T\in\mathbb R^{N\times N}

Therefore, the core pairwise interaction computation of global Attention typically grows quadratically with sequence length.

However, one needs to distinguish between computational complexity and actual memory footprint: optimization techniques such as FlashAttention avoid explicitly storing the complete N×NN\times N Attention Matrix, significantly reducing intermediate memory requirements, but do not eliminate the full computational cost of the standard global Attention.

Three main directions for improvement

directionMain questionsRepresent technology
Sparse ComputationLarge models have many parameters and high computational costsMoE
Efficient Sequence ModelingLong sequence calculation and state management costSSM、Mamba
Architectural HybridizationIt is difficult for a single architecture to meet all goalsAttention–SSM、Attention–MoE

The three focus on different issues, so they can be used in combination.

2. Dense Models and Sparse Models

Before understanding MoE, you need to distinguish between Dense and Sparse Computation.

Dense Model

In common Dense Transformer, each Token usually goes through the same Attention and Feedforward Network (FFN) structures.

Token
  ↓
Attention
  ↓
FFN
  ↓
Output

Suppose a certain FFN contains a large number of parameters, and each Token performs the calculation of that FFN.

Sparse Model

Sparse Model can activate only some of the learnable modules based on input.

Token
  ↓
Router
  ↓
Selected Experts
  ↓
Weighted Aggregation
  ↓
Output

This increases the total number of parameters while avoiding using all parameters for each Token.

But sparseness does not mean that all calculations in the entire model are sparse. Attention, Embedding, and other Shared Layers may still adopt Dense Computation.

3. MoE:Mixture of Experts

Mixture of Experts (expert hybrid model) combines the model by multiple Expert Networks and one Routing Mechanism.

Basic composition:

  • Experts: Multiple learnable subnetworks.
  • Router / Gating Network: Determines which Experts the input is processed by.
  • Aggregation: Merge the output of selected Experts.

In many Transformer MoE architectures, Expert is often a FFN/MLP subnetwork rather than a complete standalone Transformer.

Dense FFN and MoE FFN

Normal Transformer Block:

Input
  ↓
Self-Attention
  ↓
Dense FFN
  ↓
Output

MoE Transformer Block:

Input
  ↓
Self-Attention
  ↓
MoE Layer
  ├── Expert 1
  ├── Expert 2
  ├── Expert 3
  └── Expert N
  ↓
Output

For each Token, Router can select only a few of them Experts.

This is called Sparse MoE.

4. Router and Top-K Routing

Suppose the input Token is expressed as:

x∈Rdx\in\mathbb R^d

There are EE Experts.

Router Calculate the score for each Expert:

r(x)=Wrx+brr(x)=W_rx+b_r

Among them:

r(x)∈REr(x)\in\mathbb R^E

Then get Routing Scores via Softmax:

pi(x)=exp⁡(ri(x))∑jexp⁡(rj(x))p_i(x)=\frac{\exp(r_i(x))} {\sum_j\exp(r_j(x))}

Top-K Routing

Router selects the K Experts with the highest score:

S(x)=TopK(p(x),K)S(x)=TopK(p(x),K)

Final output:

y=∑i∈S(x)gi(x)Ei(x)y=\sum_{i\in S(x)}g_i(x)E_i(x)

Among them:

  • Ei(x)E_i(x): The output of iith Expert.
  • gi(x)g_i(x): The combined weight of the selected Expert.
  • S(x)S(x): The selected Expert set.

The weight is usually calculated according to Routing Scores, and the specific normalization method depends on the implementation.

Top-1 and Top-2

Top-1 Routing

Each Token selects one Expert.

Top-2 Routing

Each Token selects two Experts and combines their results.

For example:

Token A → Expert 1 + Expert 3
Token B → Expert 2 + Expert 4
Token C → Expert 1 + Expert 4

Different Token can choose different Experts.

Models such as Mixtral use Top-2 Routing.

5. Total Parameters and Active Parameters

This is one of the most important engineering concepts to understand MoE.

Suppose a model contains:

  • Shared parameters: 4B.
  • 8 Experts.
  • Each Expert:2B parameter.
  • Each Token selects 2 Experts.

Total number of parameters:

Ptotal=4B+8×2B=20BP_{\text{total}}=4B+8\times2B=20B

The amount of active parameters for each Token can be roughly expressed as:

Pactive=4B+2×2B=8BP_{\text{active}}=4B+2\times2B=8B

Therefore:

Total Parameters: 20B
Active Parameters per Token: 8B

Here is a simplified example, the actual model may also have different layers of Experts, shared Experts and different routing methods.

Why is it important?

The main value of MoE is:

expands the total model capacity without increasing the calculation amount of each Token in the same proportion.

But it needs to be distinguished:

  • Total Parameters。
  • Active Parameters。
  • FLOPs。
  • Model Weight Memory。
  • KV Cache。
  • Runtime Communication。

Does MoE really save video memory?

uncertain.

Even if each Token executes only part of Experts, the model may still need to keep all Expert Weights in GPU or other storage devices.

Therefore:

  • The computational effort of may be relatively low for.
  • weight memory may still be large.
  • communication overhead may increase significantly.

It cannot be simply assumed that a MoE model with a total parameter amount of 100B and an active parameter amount of 10B only requires the same video memory as 10B Dense Model.

6. Load balancing problem of MoE

Sparse Routing will bring up an important question:

What will happen if a large number of Token choose the same batch of Experts?

For example:

Expert 1: 70% Tokens
Expert 2: 20% Tokens
Expert 3:  8% Tokens
Expert 4:  2% Tokens

May produce:

  • Expert Uneven load.
  • Partial GPU counts congestion.
  • Some Experts are undertrained.
  • Token Overflow / Dropping。
  • Distributed communication efficiency decreases.

Load Balancing

MoE often requires a load balancing mechanism to improve Expert usage.

Common solutions:

  • Auxiliary Load Balancing Loss。
  • Capacity Constraints。
  • Expert Choice Routing。
  • Different forms of Routing Regularization.
  • Load balancing strategy without auxiliary loss.

Auxiliary Loss

The training objectives can be summarized as:

Ltotal=Ltask+λLbalance\mathcal L_{\text{total}} = \mathcal L_{\text{task}} + \lambda\mathcal L_{\text{balance}}

Among them:

  • L_task\mathcal L\_{\text{task}}: Main mission loss.
  • L_balance\mathcal L\_{\text{balance}}: Load balancing related targets.
  • λ\lambda: weight coefficient.

The specific formula depends on MoE implementation.

Expert Specialization

Different Experts may gradually learn different types of representations or computational modes.

But it cannot be assumed that:

Expert 1 = math expert
Expert 2 = Programming expert
Expert 3 = translation expert

Actual expert division of labor can be complex, dynamic, and difficult to explain directly.

The selection of Router usually occurs at the Token level and does not amount to assigning a complete model to every human-understandable task.

7. MoE: PyTorch simplified implementation

The following implements a Sparse MoE for teaching purposes.

Assumptions:

  • 4 Experts.
  • Each Token selects 2 Experts.
  • Every Expert is a MLP.
import torch
import torch.nn as nn
import torch.nn.functional as F


class SimpleMoE(nn.Module):
    def __init__(
        self,
        hidden_size=128,
        num_experts=4,
        top_k=2,
    ):
        super().__init__()

        self.num_experts = num_experts
        self.top_k = top_k

        self.router = nn.Linear(
            hidden_size,
            num_experts,
        )

        self.experts = nn.ModuleList([
            nn.Sequential(
                nn.Linear(hidden_size, hidden_size * 4),
                nn.GELU(),
                nn.Linear(hidden_size * 4, hidden_size),
            )
            for _ in range(num_experts)
        ])

    def forward(self, x):
        # x: [Batch, Sequence, Hidden]
        original_shape = x.shape

        tokens = x.reshape(-1, x.size(-1))

        logits = self.router(tokens)

        top_scores, top_indices = torch.topk(
            logits,
            k=self.top_k,
            dim=-1,
        )

        weights = F.softmax(top_scores, dim=-1)

        output = torch.zeros_like(tokens)

        for expert_id, expert in enumerate(self.experts):
            token_idx, slot_idx = torch.where(
                top_indices == expert_id
            )

            if token_idx.numel() == 0:
                continue

            expert_output = expert(tokens[token_idx])

            output.index_add_(
                0,
                token_idx,
                expert_output * weights[token_idx, slot_idx, None],
            )

        return output.reshape(original_shape)

Test:

moe = SimpleMoE(
    hidden_size=128,
    num_experts=4,
    top_k=2,
)

x = torch.randn(8, 32, 128)

y = moe(x)

print(y.shape)  # [8, 32, 128]

This example is for understanding:

  1. Router calculates Expert Scores.
  2. Top-K selects Experts.
  3. Token is sent to the corresponding Experts.
  4. Expert Outputs performs weighted aggregation.

is not a production-grade MoE implementation.

Practical training usually also requires:

  • Load Balancing。
  • Capacity Management。
  • Expert Parallelism。
  • Efficient Token Dispatch.
  • Distributed All-to-All Communication.
  • Efficient Grouped GEMM / Expert Kernels.

Furthermore, the discrete Top-K selection implemented by this tutorial is not inherently differentiable; the gradient is propagated through continuous computational paths such as Routing Weights for which Expert is selected.

8. Expert Parallelism

Large MoE Usually it is not possible to put all Experts on the same GPU.

Therefore Expert Parallelism (EP) can be used.

For example:

GPU 0: Expert 0, Expert 1
GPU 1: Expert 2, Expert 3
GPU 2: Expert 4, Expert 5
GPU 3: Expert 6, Expert 7

Token is sent to the corresponding device based on the Router result.

All-to-All Communication

When a Token needs to be processed by a Expert on another GPU, data needs to be transferred across devices.

Typical execution process of MoE:

Token Hidden States
       ↓
Router
       ↓
Dispatch / All-to-All
       ↓
Expert Computation
       ↓
Combine / All-to-All
       ↓
Output Hidden States

Therefore, the efficient execution of MoE not only relies on the neural network itself, but also on:

  • GPU Interconnect。
  • Communication Libraries。
  • Token Dispatch。
  • Load Balance。
  • Batch Size。
  • Expert Placement。

This is also an important reason why MoE performance optimization is different from ordinary Dense Transformer.

9. State Space Models: State space model

State Space Models (SSM) originally came from fields such as control theory and signal processing.

Its core idea is:

uses a state vector to describe the internal information of the system and continuously updates the state based on new input.

Continuous-time linear state space form:

dh(t)dt=Ah(t)+Bx(t)\frac{dh(t)}{dt}=Ah(t)+Bx(t) y(t)=Ch(t)+Dx(t)y(t)=Ch(t)+Dx(t)

Among them:

  • x(t)x(t): input.
  • h(t)h(t): hidden state.
  • y(t)y(t): output.
  • AA: state transition matrix.
  • BB: Input to state mapping.
  • CC: State to output mapping.
  • DD: Direct input and output items.

discrete time form

In sequence modeling, the discrete form is often used:

ht=Aˉht−1+Bˉxth_t=\bar Ah_{t-1}+\bar Bx_t yt=Cht+Dxty_t=Ch_t+Dx_t

It has similar ideas to RNN's Hidden State update.

But the state representation, parameter constraints, calculation algorithms, and mathematical structures of modern SSM are often different from traditional RNN.

Core advantages

If a model can represent the sequence history with a fixed-dimensional state, autoregressive inference may not require storing the Key / Value of every past Token.

This provides another possible design for long sequence calculations and state management.

But fixed state also means that information needs to be compressed, which may bring about trade-offs in representation capabilities.

10. The relationship between SSM and RNN, CNN, Attention

Some linear time invariant (Linear Time-Invariant, LTI) SSM can be calculated in different forms.

Recurrent Form

Update status step by time:

x1 → State → x2 → State → x3 → State

Fits Streaming / Autoregressive Inference.

Convolutional Form

For a linear time-invariant system that satisfies the corresponding conditions, the sequence output can be expressed as a convolution:

y=K∗xy=K*x

Among them, KK is the convolution kernel derived from the state space parameters.

This can utilize parallel convolution algorithms to process the entire sequence.

Parallel Scan

When state updates have an appropriate binding structure, the depth of computational dependencies in the sequence dimension can be reduced using the Parallel Scan algorithm.

These are important ideas for understanding modern SSM computational optimization.

Difference from Attention

methodMain mechanism
RNNNonlinear hidden state recursion
SSMStructured status updates
AttentionInteraction between Token based on input content
HybridCombining status updates and explicit information exchange

Not all SSM can be directly converted into the same form of convolution; this depends on conditions such as whether the system parameters change with time or input.

11. Mamba:Selective State Space Models

One limitation of traditional linear time-invariant SSM is that the state update parameters do not change directly based on the current input content.

For discrete sequences such as language, this may limit the model's ability to selectively retain or ignore information.

An important improvement to Mamba is the introduction of Selection Mechanism (selection mechanism).

Input-dependent Parameters

Mamba makes some state space parameters dependent on the current input, for example:

Bt=B(xt)B_t=B(x_t) Ct=C(xt)C_t=C(x_t) Δt=Δ(xt)\Delta_t=\Delta(x_t)

Among them, Δt\Delta_t participates in the discretization of the continuous state model.

This way different inputs Token can affect the way the status is updated.

Selective State Update

Conceptually:

ht=Aˉtht−1+Bˉtxth_t=\bar A_t h_{t-1}+\bar B_t x_t yt=Cthty_t=C_t h_t

Some parameters in the status update will change with the input.

For example:

Token A → retain certain historical information
Token B → Reinforce some new information
Token C → Weaken part of the old state

This selection mechanism enables the model to adapt the way information is delivered based on the content.

But it is not Attention Matrix equivalent to Transformer, nor is it simply LSTM Gate.

12. Computational advantages of Mamba

Mamba mainly combines two ideas:

  1. Selective State Spaces。
  2. Hardware-aware Parallel Scan。

training

During training, longer sequences need to be processed efficiently.

Mamba uses a parallel computing algorithm designed for the state update structure to avoid performing all calculations Token one by one in the same way as ordinary Python RNN Loop.

inference

During autoregressive inference, the model can reuse the recursive state and update it for the new Token.

This has different characteristics from KV Cache of standard Attention in that state storage grows with sequence length.

complexity

Under the premise of fixing the model dimension and state dimension, the sequence processing calculation of Mamba can achieve a structure that grows approximately linearly with the sequence length.

In contrast, the pairwise Token computation of the standard global Self-Attention grows quadratically with sequence length.

But please note:

  • Linear complexity does not mean faster at any length.
  • Model dimensionality and state size also affect computational cost.
  • GPU Kernel and parallel implementation are important.
  • Inference speed depends on specific Batch Size, hardware and implementation.
  • Fixed status does not guarantee that all long-term information will be saved accurately.

13. Mamba vs. Transformer

FeaturesTransformer AttentionMamba / Selective SSM
core mechanismToken between AttentionSelective status updates
contextual information representationKey / Value etc. representrecursive state
Training in parallelAttention can be calculated across locationsUse algorithms such as efficient scanning
long sequence costStandard global Attention has quadratic interaction costLinear expansion can be achieved in the sequence dimension
autoregressive stateUsually use KV CacheUsually updated SSM State
Explicit access history TokenAttention can interact directlyMainly depends on compression state
Current locationMature critical infrastructureImportant routes to efficient sequence modeling

Why doesn't Mamba simply replace Transformer?

Because efficiency is not the only indicator.

Also consider:

  • Model quality.
  • Information retrieval and reproduction capabilities.
  • Long-context inference performance.
  • Pre-training stability.
  • Scaling Behavior。
  • Toolchain support.
  • Multimodal extension.
  • inference service ecology.

Attention is very expressive when you need to directly access information at different locations in the context.

SSM provides a more compact state modeling path.

This is why hybrid architecture is attractive.

14. Mamba-2 and State Space Duality

One of the important contributions of Mamba-2 is Structured State Space Duality (SSD).

Related research revealed a mathematical link between structured SSM and certain Attention variants.

Its core values include:

  • Understand partial state space calculations and Attention calculations from a unified perspective.
  • Design a matrix calculation form more suitable for GPU.
  • Improve the implementation efficiency of the state space layer.
  • Provide a theoretical basis for further hybrid architecture design.

Need to pay attention to:

State Space Duality does not imply that all standard Transformer are equivalent to any Mamba model.

It studies the connection between models with specific structures and computational forms.

For basic learning, it is enough to understand this idea and there is no need to derive Semiseparable Matrices or SSD Algorithm in depth.

15. PyTorch: Simplified example of status update

The following uses a simple state update model to illustrate the core calculation of SSM.

import torch
import torch.nn as nn


class SimpleStateModel(nn.Module):
    def __init__(self, input_size, state_size):
        super().__init__()

        self.input_proj = nn.Linear(
            input_size,
            state_size,
        )

        self.output_proj = nn.Linear(
            state_size,
            input_size,
        )

        self.decay = nn.Parameter(
            torch.zeros(state_size)
        )

    def forward(self, x):
        # x: [Batch, Sequence, Features]
        batch_size, seq_len, _ = x.shape

        state = x.new_zeros(
            batch_size,
            self.decay.numel(),
        )

        outputs = []

        decay = torch.sigmoid(self.decay)

        for t in range(seq_len):
            u = self.input_proj(x[:, t])

            state = decay * state + u

            y = self.output_proj(state)
            outputs.append(y)

        return torch.stack(outputs, dim=1)

Test:

model = SimpleStateModel(
    input_size=64,
    state_size=128,
)

x = torch.randn(8, 100, 64)

y = model(x)

print(y.shape)  # [8, 100, 64]

This example is for illustration only:

  • Hidden State。
  • State Transition。
  • Input Projection。
  • Output Projection。

is not a complete Mamba implementation.

The real Mamba contains input-dependent state space parameters, specific discretization, local convolution, gating, hardware-optimized Selective Scan and other mechanisms.

A simple Python loop cannot reflect the parallel computing advantages of Mamba training.

Practical use of Mamba should be given in preference to mature implementations rather than handwriting Selective Scan Kernel from scratch.

16. Hybrid Architectures: Hybrid Architecture

Hybrid Architectures combines different neural network modules to take advantage of their respective strengths.

For modern sequence models, an important direction is:

Attention + SSM / Mamba + MoE。

These components solve different problems:

componentsMain contributions
AttentionDirectly establish information interaction between different Token in the context
SSM / MambaEfficient state updates and sequence representation
MoEExpand parameter capacity while maintaining sparse computations
Dense FFNStable and versatile nonlinear feature transformation

Attention–SSM Hybrid

A model can alternately take Attention and SSM Layers:

Input Tokens
      ↓
Embedding
      ↓
Mamba / SSM Block
      ↓
Mamba / SSM Block
      ↓
Attention Block
      ↓
Mamba / SSM Block
      ↓
Output Head

Attention can provide explicit information exchange across Token, while SSM Layers can undertake part of the sequence modeling calculations.

Attention–MoE Hybrid

You can also use MoE FFN inside Transformer:

Attention
   ↓
MoE FFN
   ↓
Attention
   ↓
MoE FFN

This type of architecture still mainly belongs to the Transformer family.

Attention–SSM–MoE Hybrid

Furthermore, you can combine all three at the same time:

Input
  ↓
SSM Block
  ↓
Attention Block
  ↓
MoE Block
  ↓
SSM Block
  ↓
Output

This is just a conceptual representation, real models can use different number of layers, arrangements and module proportions.

17. Jamba: Hybrid architecture example

Jamba is a representative Transformer–Mamba–MoE hybrid architecture.

The main idea is:

  • Use Mamba Layers to improve sequence calculation and state management efficiency.
  • Use Attention Layers to preserve explicit context interaction capabilities.
  • Use MoE to expand model capacity and control some of the computational overhead.

Therefore, Jamba is not simply Mamba Model, nor is it the standard Dense Transformer.

It shows an idea of modern architectural design:

It is not necessary to have one module take on all functions, and different calculation mechanisms can be combined according to actual performance goals.

Subsequent mixed model research and inference frameworks have been developed along similar lines.

18. Inference state of Hybrid Model

Hybrid architecture places new requirements on inference engines.

Traditional Transformer inference usually primarily manages KV Cache.

SSM / Mamba requires management of Recurrent State.

A hybrid model may have both:

Attention Layers
       ↓
KV Cache

SSM / Mamba Layers
       ↓
Recurrent State

KV Cache

The standard autoregressive Attention saves the previous Key / Value representation of Token.

The cache usually grows with the context length.

SSM State

SSM uses recursive state to maintain historical information.

Under a fixed architecture configuration, the size of the core recursive state of a single layer and a single sequence usually does not need to continue to grow with the number of Token processed.

But specific models may also require convolution state, additional cache, and other runtime data.

Hybrid State Management

The hybrid inference engine needs to handle both:

  • KV Cache Allocation。
  • SSM State Allocation。
  • Continuous Batching。
  • Applicable scope of Prefix Caching.
  • Request Scheduling。
  • Memory Management。
  • Chunked Prefill。
  • Different execution order of Layer Type.

This is where modern model architecture is deeply related to LLM Serving.

For model deployment engineers, the hybrid architecture not only affects the accuracy and calculation amount, but also affects the state management method of the inference service.

19. Performance comparison of modern architectures

When evaluating a new architecture, don't just look at the number of parameters or theoretical complexity.

Should be compared separately:

Model Quality

  • Language Modeling Loss / Perplexity。
  • Downstream Task Accuracy。
  • Reasoning。
  • Long-context Retrieval。
  • Multimodal Performance。

Training Efficiency

  • Training FLOPs。
  • Tokens / Second。
  • GPU Utilization。
  • Peak GPU Memory。
  • Communication Overhead。
  • Training Stability。

Inference Efficiency

  • Time to First Token(TTFT)。
  • Time per Output Token(TPOT)。
  • Tokens / Second。
  • Request Throughput。
  • Memory Usage。
  • Long context performance.

Special evaluation for MoE

Also need to observe:

  • Total / Active Parameters。
  • Expert Utilization。
  • Load Balance。
  • All-to-All Communication。
  • Token Dropping / Overflow。
  • Expert Parallelism Efficiency。

Special evaluation for SSM / Hybrid

Also need to observe:

  • Recurrent State Size。
  • The combined cost of KV Cache and SSM State.
  • Long-context Quality。
  • Streaming Inference。
  • Throughput and latency when sequence length varies.

Why does theoretical complexity not represent actual speed?

Because actual performance also depends on:

  • GPU Memory Bandwidth。
  • Kernel Launch Overhead。
  • Tensor Core Utilization。
  • Batch Size。
  • Sequence Length。
  • Parallelism Strategy。
  • CUDA / Triton Kernels。
  • Distributed Communication。

A model with theoretically lower computational complexity may also be slower than a highly optimized Transformer in small Batch or short sequence scenarios.

20. Key trade-offs in modern architecture

ArchitectureMain advantagesMain limitations
Dense TransformerMature, strong expressive ability, complete ecologyLarge model calculations and KV Cache costs
MoE TransformerExpand parameter capacity and control active calculationsWeight memory, routing, and communication are complex
Pure SSM / MambaEfficient state modeling, long sequence potentialHistorical information compression, task performance and ecological differences
Attention–SSM HybridCombine explicit interaction with state modelingMultiple inference states and complex execution
Attention–SSM–MoECombining Capacity, Contextual Interaction and State EfficiencyTraining and inference systems are more complex

There is no absolute optimal architecture here.

The best choice for different models depends on:

  • data and tasks.
  • Model size.
  • Context length.
  • Training budget.
  • inference load.
  • GPU configuration.
  • Available inference frameworks.

21. Current technology positioning

MoE: Mature and important engineering routes

MoE is no longer just a research concept.

Sparse expert routing has found practical applications in several large model families.

Need to focus on mastering:

  • Top-K Routing。
  • Total vs Active Parameters。
  • Load Balancing。
  • Expert Parallelism。

Mamba/SSM: Architecture routes worth paying attention to

The core value of SSM lies in efficient sequence status update.

Mamba enhances input-dependent information processing capabilities through Selective State Space.

But for the universal LLM, it should not be simply considered that Pure SSM has completely replaced Transformer.

Hybrid Architectures: Important development direction

The hybrid architecture finds a new balance between expressive power, computational efficiency, and system complexity by combining Attention, SSM, and MoE.

Its importance is not only in model design, but also in the deployment framework's support for heterogeneous Layer and different Cache / State types.


Summary

Knowledge pointsimportance
Dense vs Sparse Computationcore
MoE / Experts / Routercore
Top-K Routingcore
Total vs Active Parameterscore
Load Balancingcore
Expert Parallelism / All-to-Allimportant
SSM / State Updatecore
Recurrent / Convolution / Scanimportant
Mamba / Selection Mechanismcore
Mamba-2 / SSDUnderstand
Attention vs SSMcore
Hybrid Architecturescore
JambaTypical cases
KV Cache vs SSM Statecore
Training / Inference Trade-offscore

The five most important concepts of modern neural network architecture:

  1. Sparse Computation: MoE improves efficiency between total parameter capacity and computational effort per Token by selectively activating Experts.
  2. Routing & Load Balancing: The performance of MoE depends not only on Expert capabilities, but also on Token allocation and distributed communication.
  3. State Space Modeling: SSM uses structured state updates to represent sequence information, providing a different computational route than standard Attention.
  4. Selective State Spaces:Mamba uses input-dependent parameters to adjust information transfer and enables sequence calculations through efficient scanning.
  5. Hybrid Architectures: Modern architectures can combine Attention, SSM, and MoE simultaneously to balance model power, computational efficiency, memory, and deployment complexity.

Reference documentation

Back to top