Gradient LabSign up free

Trending › Model launch

Qwen4-Max: 2.4 trillion parameters, 71 billion at a time

Alibaba’s Qwen4-Max holds 2.4 trillion parameters but uses only 71 billion for each token: a router sends every token to a few “expert” sub-networks. It also adds 328 billion parameters of N-gram embeddings, a lookup table for common phrases.

Watch it move. This is an animated lesson on Gradient Lab.

Start the animated lesson

Step by step

Concept

Dense models use every weight

In a normal transformer block, every token passes through the whole feed-forward network (MLP). Doubling the parameters doubles the work for every token.

One big block; every token goes through all of it.

Key idea

Many experts, few used

A mixture-of-experts layer replaces the one big network with many smaller experts. A small router scores them for each token and sends the token to only the top few, mixing their outputs with softmax weights. You get the knowledge of a huge model at the running cost of a much smaller one.

The router lights up two experts for this token; the rest stay idle.

Insight

The Qwen4-Max numbers

Alibaba says Qwen4-Max has a 2.4-trillion-parameter backbone with 71 billion active per token, about 3%. That is 25% fewer active parameters than Qwen3.8-Max at the same total size. It reads text, images and video with a 1M-token context, and unlike Qwen3.8-Max its weights are not released.

The wide slab stands for all 2.4T parameters; the tower for the 71B used on each token (about 3%).

Build

N-gram embeddings: a phrase lookup table

Qwen4-Max also has 328 billion N-gram embedding parameters outside the backbone. The idea: common short phrases and local patterns get their own stored embedding that is simply looked up, so the expensive layers don’t have to rebuild them each time. Looking up a row costs almost nothing, even if the table is huge.

The last few tokens index a giant table; one row is fetched and added in.

Practice

The trade-off

Mixture of experts saves compute, not memory: all 2.4T parameters still have to sit in GPU memory somewhere, and routing tokens between GPUs takes engineering. That is why most giant MoE models are served from big clusters, and why Alibaba says smaller Qwen4 models will be the ones with open weights.

Cheap per token, expensive to host.

Quick check: In a mixture-of-experts model, what does the router do?

Pseudocode

# dense layer: every token uses every weight
y = mlp(x)

# mixture-of-experts layer
scores = router(x)                 # one score per expert
top = top_k(scores, k)             # pick a few experts
y = sum(softmax(scores[top])[i] * experts[i](x) for i in top)

# Qwen4-Max (reported): 2.4T total, 71B active per token
# plus N-gram embeddings: look up common phrases directly
y += ngram_table[last_few_tokens]

Go deeper

Sources

  1. The New Stack: With Qwen4-Max, Alibaba puts the open source jacket back on the hanger
  2. Modal model library: Qwen4-Max
  3. Let’s Data Science: Qwen4-Max is closed