← 返回首页
READING NOTE / 022完整原文 · 分块对照

The Big LLM Architecture Comparison

大语言模型架构全面比较

14,290 个英文词 · 47 个原文块 · 75 张保存图片

总结

Sebastian Raschka 从 DeepSeek V3/R1 到 Gemma 4,比较 23 组开放模型架构。全文以注意力、归一化、专家结构、位置编码及混合状态更新为主线,保留完整原文、中英对照与保存件中的 75 张图片。

MLA、GQA、滑动窗口和 MoE 分别改变缓存表示、键值共享、读取范围与活跃计算,不能把它们都简化成同一种“省内存”。后半篇进一步讨论 Gated DeltaNet、KDA、Mamba 混合结构、潜在专家以及用于推测解码的多 token 预测。

作者强调,架构之外还有数据、训练与推理设置,单靠结构图不能确定模型表现的原因。文章多次更新,原文中数量、日期、型号和单位不一致之处完整保留,并在“判断”中单独提示;图中基准属于其原始来源,未在本次重新跑分。

  • 大模型架构
  • 注意力
  • 混合专家
  • 归一化
  • 推理效率

英文原文 01

289 词 · 1 张图

Last updated: Apr 2, 2026 (added Gemma 4 in section 23)

It has been seven years since the original GPT architecture was developed. At first glance, looking back at GPT-2 (2019) and forward to DeepSeek V3 and Llama 4 (2024-2025), one might be surprised at how structurally similar these models still are.

Sure, positional embeddings have evolved from absolute to rotational (RoPE), Multi-Head Attention has largely given way to Grouped-Query Attention, and the more efficient SwiGLU has replaced activation functions like GELU. But beneath these minor refinements, have we truly seen groundbreaking changes, or are we simply polishing the same architectural foundations?

Comparing LLMs to determine the key ingredients that contribute to their good (or not-so-good) performance is notoriously challenging: datasets, training techniques, and hyperparameters vary widely and are often not well documented.

However, I think that there is still a lot of value in examining the structural changes of the architectures themselves to see what LLM developers are up to in 2025. (A subset of them are shown in Figure 1 below.)

Figure 1: A subset of the architectures covered in this article.

So, in this article, rather than writing about benchmark performance or training algorithms, I will focus on the architectural developments that define today's flagship open models.

(As you may remember, I wrote about multimodal LLMs not too long ago; in this article, I will focus on the text capabilities of recent models and leave the discussion of multimodal capabilities for another time.)

Tip: This is a fairly comprehensive article, so I recommend using the navigation bar to access the table of contents (just hover over the left side of the Substack page).


Optional: The video below is a narrated and abridged version of this article.


中文译文 01

415 字

最后更新:2026 年 4 月 2 日(第 23 节新增 Gemma 4)

最初的 GPT 架构问世至今已有七年。回看 GPT-2(2019 年),再看 DeepSeek V3 和 Llama 4(2024—2025 年),乍看之下,人们或许会惊讶于这些模型在结构上依然如此相似。

当然,位置嵌入已从绝对位置演进为旋转位置嵌入(RoPE),多头注意力在很大程度上让位于分组查询注意力,更高效的 SwiGLU 也取代了 GELU 等激活函数。但在这些细微改进之下,我们真的见到了突破性的变化,还是只是在打磨同一套架构基础?

比较大语言模型,找出使其表现出色(或不够出色)的关键因素,向来很困难:数据集、训练技术和超参数差异很大,而且往往缺少充分记录。

不过,我认为研究架构本身的结构变化,了解 2025 年的大模型开发者在做什么,仍然很有价值。(下方图 1 展示了其中一部分架构。)

图 1:本文涉及的部分架构。

因此,本文将聚焦于当今旗舰开放模型的架构进展,而不是基准测试表现或训练算法。

(你或许还记得,我不久前写过多模态大模型;本文将专注于近期模型的文本能力,多模态能力留待以后讨论。) [1]

提示:本文内容相当全面,建议使用导航栏访问目录(将鼠标悬停在 Substack 页面左侧即可)。


可选阅读:下方视频是本文带旁白的精简版。


英文原文 02

325 词 · 2 张图

1. DeepSeek V3/R1

As you have probably heard more than once by now, DeepSeek R1 made a big impact when it was released in January 2025. DeepSeek R1 is a reasoning model built on top of the DeepSeek V3 architecture, which was introduced in December 2024.

While my focus here is on architectures released in 2025, I think it’s reasonable to include DeepSeek V3, since it only gained widespread attention and adoption following the launch of DeepSeek R1 in 2025.

If you are interested in the training of DeepSeek R1 specifically, you may also find my article from earlier this year useful:

In this section, I’ll focus on two key architectural techniques introduced in DeepSeek V3 that improved its computational efficiency and distinguish it from many other LLMs:

  • Multi-Head Latent Attention (MLA)

  • Mixture-of-Experts (MoE)

1.1 Multi-Head Latent Attention (MLA)

Before discussing Multi-Head Latent Attention (MLA), let's briefly go over some background to motivate why it's used. For that, let's start with Grouped-Query Attention (GQA), which has become the new standard replacement for a more compute- and parameter-efficient alternative to Multi-Head Attention (MHA) in recent years.

So, here's a brief GQA summary. Unlike MHA, where each head also has its own set of keys and values, to reduce memory usage, GQA groups multiple heads to share the same key and value projections.

For example, as further illustrated in Figure 2 below, if there are 2 key-value groups and 4 attention heads, then heads 1 and 2 might share one set of keys and values, while heads 3 and 4 share another. This reduces the total number of key and value computations, which leads to lower memory usage and improved efficiency (without noticeably affecting the modeling performance, according to ablation studies).

Figure 2: A comparison between MHA and GQA. Here, the group size is 2, where a key and value pair is shared among 2 queries.

中文译文 02

457 字

1. DeepSeek V3/R1

你可能已经多次听说,DeepSeek R1 于 2025 年 1 月发布时引起了巨大反响。它是一款推理模型,基于 2024 年 12 月推出的 DeepSeek V3 架构构建。 [1] [2]

虽然本文主要关注 2025 年发布的架构,但我认为纳入 DeepSeek V3 是合理的,因为它是在 2025 年 DeepSeek R1 发布后才获得广泛关注和采用的。

如果你特别关注 DeepSeek R1 的训练,也可以参考我今年早些时候写的这篇文章:

本节将聚焦 DeepSeek V3 引入的两项关键架构技术:它们提高了计算效率,也使其区别于许多其他大模型:

  • 多头潜在注意力(MLA)

  • 混合专家(MoE)

1.1 多头潜在注意力(MLA)

在讨论多头潜在注意力(MLA)之前,先简要回顾一些背景,理解使用它的动机。我们从分组查询注意力(GQA)开始:近年来,它已成为取代多头注意力(MHA)的新标准,计算和参数效率更高。

下面简要介绍 GQA。MHA 的每个注意力头都有自己的一组键和值;GQA 则让多个头分组共享相同的键投影和值投影,以减少内存使用。

例如,下方图 2 进一步说明:若有 2 个键值组和 4 个注意力头,那么头 1、2 可以共享一组键和值,头 3、4 共享另一组。这样减少了键和值的总计算量,降低内存使用并提高效率;消融研究表明,这不会明显影响建模表现。

图 2:MHA 与 GQA 的对比。这里组大小为 2,即每对键和值由 2 个查询共享。

英文原文 03

288 词 · 2 张图

So, the core idea behind GQA is to reduce the number of key and value heads by sharing them across multiple query heads. This (1) lowers the model's parameter count and (2) reduces the memory bandwidth usage for key and value tensors during inference since fewer keys and values need to be stored and retrieved from the KV cache.

(If you are curious how GQA looks in code, see my GPT-2 to Llama 3 conversion guide for a version without KV cache and my KV-cache variant here.)

While GQA is mainly a computational-efficiency workaround for MHA, ablation studies (such as those in the original GQA paper and the Llama 2 paper) show it performs comparably to standard MHA in terms of LLM modeling performance.

Now, Multi-Head Latent Attention (MLA) offers a different memory-saving strategy that also pairs particularly well with KV caching. Instead of sharing key and value heads like GQA, MLA compresses the key and value tensors into a lower-dimensional space before storing them in the KV cache.

At inference time, these compressed tensors are projected back to their original size before being used, as shown in the Figure 3 below. This adds an extra matrix multiplication but reduces memory usage.

Figure 3: Comparison between MLA (used in DeepSeek V3 and R1) and regular MHA.

(As a side note, the queries are also compressed, but only during training, not inference.)

By the way, MLA is not new in DeepSeek V3, as its DeepSeek-V2 predecessor also used (and even introduced) it. Also, the V2 paper contains a few interesting ablation studies that may explain why the DeepSeek team chose MLA over GQA (see Figure 4 below).

Figure 4: Annotated tables from the DeepSeek-V2 paper, https://arxiv.org/abs/2405.04434

中文译文 03

412 字

因此,GQA 的核心思想是让多个查询头共享键头和值头,从而减少键头和值头的数量。这会(1)减少模型参数量;(2)降低推理时键值张量的内存带宽占用,因为需要存入 KV 缓存并从中读取的键和值更少。

(如果你好奇 GQA 的代码实现,可参考我的 GPT-2 到 Llama 3 转换指南中的无 KV 缓存版本,以及这里带 KV 缓存的版本。) [1] [2]

GQA 主要是为提高计算效率而对 MHA 作出的变通,但原始 GQA 论文及 Llama 2 论文等消融研究显示,在大模型建模表现方面,它与标准 MHA 相当。 [1] [2]

多头潜在注意力(MLA)采用另一种节省内存的策略,而且特别适合与 KV 缓存配合。它不像 GQA 那样共享键头和值头,而是在将键值张量存入 KV 缓存前,把它们压缩到低维空间。

推理时,再将这些压缩张量投影回原始大小后使用,如下方图 3 所示。这会增加一次矩阵乘法,但能减少内存使用。

图 3:DeepSeek V3、R1 使用的 MLA 与常规 MHA 的对比。

(顺便说一下,查询也会被压缩,但只在训练时如此,推理时不会。)

另外,MLA 并非 DeepSeek V3 首创,其前代 DeepSeek-V2 就已使用并首次提出了它。V2 论文还包含一些有趣的消融研究,或许能解释 DeepSeek 团队为什么选择 MLA 而非 GQA(见下方图 4)。 [1]

图 4:DeepSeek-V2 论文中的表格,附有批注。https://arxiv.org/abs/2405.04434

英文原文 04

270 词 · 1 张图

As shown in Figure 4 above, GQA appears to perform worse than MHA, whereas MLA offers better modeling performance than MHA, which is likely why the DeepSeek team chose MLA over GQA. (It would have been interesting to see the "KV Cache per Token" savings comparison between MLA and GQA as well!)

To summarize this section before we move on to the next architecture component, MLA is a clever trick to reduce KV cache memory use while even slightly outperforming MHA in terms of modeling performance.

1.2 Mixture-of-Experts (MoE)

The other major architectural component in DeepSeek worth highlighting is its use of Mixture-of-Experts (MoE) layers. While DeepSeek did not invent MoE, it has seen a resurgence this year, and many of the architectures we will cover later also adopt it.

You are likely already familiar with MoE, but a quick recap may be helpful.

The core idea in MoE is to replace each FeedForward module in a transformer block with multiple expert layers, where each of these expert layers is also a FeedForward module. This means that we swap a single FeedForward block for multiple FeedForward blocks, as illustrated in the Figure 5 below.

Figure 5: An illustration of the Mixture-of-Experts (MoE) module in DeepSeek V3/R1 (right) compared to an LLM with a standard FeedForward block (left).

The FeedForward block inside a transformer block (shown as the dark gray block in the figure above) typically contains a large number of the model's total parameters. (Note that the transformer block, and thereby the FeedForward block, is repeated many times in an LLM; in the case of DeepSeek V3, 61 times.)

中文译文 04

354 字

如上方图 4 所示,GQA 的表现似乎不如 MHA,而 MLA 的建模表现优于 MHA;这很可能就是 DeepSeek 团队选择 MLA 而非 GQA 的原因。(如果还能比较一下 MLA 与 GQA 在“每个 token 的 KV 缓存”上的节省幅度,就更有意思了!)

在进入下一个架构组件之前,总结一下:MLA 是一种巧妙的技巧,既减少 KV 缓存的内存使用,又在建模表现上略微超过 MHA。

1.2 混合专家(MoE)

DeepSeek 中另一项值得强调的主要架构组件,是混合专家(MoE)层。MoE 并非 DeepSeek 发明,但它在今年重新受到关注,我们后面讨论的许多架构也采用了它。

你可能已熟悉 MoE,但简单回顾一下仍有帮助。

MoE 的核心思想,是将 Transformer 块里的每个前馈模块替换为多个专家层,而每个专家层本身也是前馈模块。也就是说,用多个前馈块替换单个前馈块,如下方图 5 所示。

图 5:DeepSeek V3/R1 中的混合专家(MoE)模块(右),与使用标准前馈块的大模型(左)对比。

Transformer 块内部的前馈块(上图中的深灰色块)通常占模型总参数的很大一部分。(注意,大模型会重复堆叠 Transformer 块,因此也重复前馈块;DeepSeek V3 重复了 61 次。)

英文原文 05

314 词 · 1 张图

So, replacing a single FeedForward block with multiple FeedForward blocks (as done in a MoE setup) substantially increases the model's total parameter count. However, the key trick is that we don't use ("activate") all experts for every token. Instead, a router selects only a small subset of experts per token. (In the interest of time, or rather article space, I'll cover the router in more detail another time.)

Because only a few experts are active at a time, MoE modules are often referred to as sparse, in contrast to dense modules that always use the full parameter set. However, the large total number of parameters via an MoE increases the capacity of the LLM, which means it can take up more knowledge during training. The sparsity keeps inference efficient, though, as we don't use all the parameters at the same time.

For example, DeepSeek V3 has 256 experts per MoE module and a total of 671 billion parameters. Yet during inference, only 9 experts are active at a time (1 shared expert plus 8 selected by the router). This means just 37 billion parameters are used per inference step as opposed to all 671 billion.

One notable feature of DeepSeek V3's MoE design is the use of a shared expert. This is an expert that is always active for every token. This idea is not new and was already introduced in the DeepSeek 2024 MoE and 2022 DeepSpeedMoE papers.

Figure 6: An annotated figure from "DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models", https://arxiv.org/abs/2401.06066

The benefit of having a shared expert was first noted in the DeepSpeedMoE paper, where they found that it boosts overall modeling performance compared to no shared experts. This is likely because common or repeated patterns don't have to be learned by multiple individual experts, which leaves them with more room for learning more specialized patterns.

中文译文 05

409 字

因此,以多个前馈块替换单个前馈块(即 MoE 的做法),会显著增加模型总参数量。但关键技巧在于:不会对每个 token 都使用、也就是“激活”所有专家;路由器只为每个 token 选择少量专家。(受时间,或者说篇幅所限,路由器留待以后详细介绍。)

由于每次只激活少数专家,MoE 模块通常称为稀疏模块,与始终使用全部参数的稠密模块相对。MoE 带来的大量总参数提高了大模型的容量,使它在训练中能吸收更多知识;稀疏性则让推理保持高效,因为并不会同时使用全部参数。

例如,DeepSeek V3 的每个 MoE 模块有 256 个专家,总参数量为 6710 亿。但推理时,每次只激活 9 个专家:1 个共享专家,加上路由器选出的 8 个专家。因此,每个推理步骤使用的只是 370 亿参数,而非全部 6710 亿。

DeepSeek V3 的 MoE 设计有一个显著特点:使用共享专家。该专家对每个 token 始终激活。这一思想并不新,2024 年的 DeepSeek MoE 论文和 2022 年的 DeepSpeedMoE 论文中就已提出。 [1] [2]

图 6:《DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models》中的插图,附有批注。https://arxiv.org/abs/2401.06066

DeepSpeedMoE 论文首先指出了共享专家的好处:相比没有共享专家,它能提高整体建模表现。可能的原因是,多个独立专家无需重复学习常见模式,从而有更多空间学习更专门的模式。 [1]

英文原文 06

342 词 · 1 张图

1.3 DeepSeek Summary

To summarize, DeepSeek V3 is a massive 671-billion-parameter model that, at launch, outperformed other open-weight models, including the 405B Llama 3. Despite being larger, it is much more efficient at inference time thanks to its Mixture-of-Experts (MoE) architecture, which activates only a small subset of (just 37B) parameters per token.

Another key distinguishing feature is DeepSeek V3's use of Multi-Head Latent Attention (MLA) instead of Grouped-Query Attention (GQA). Both MLA and GQA are inference-efficient alternatives to standard Multi-Head Attention (MHA), particularly when using KV caching. While MLA is more complex to implement, a study in the DeepSeek-V2 paper has shown it delivers better modeling performance than GQA.

2. OLMo 2

The OLMo series of models by the non-profit Allen Institute for AI is noteworthy due to its transparency in terms of training data and code, as well as the relatively detailed technical reports.

While you probably won’t find OLMo models at the top of any benchmark or leaderboard, they are pretty clean and, more importantly, a great blueprint for developing LLMs, thanks to their transparency.

And while OLMo models are popular because of their transparency, they are not that bad either. In fact, at the time of release in January (before Llama 4, Gemma 3, and Qwen 3), OLMo 2 models were sitting at the Pareto frontier of compute to performance, as shown in Figure 7 below.

Figure 7: Modeling benchmark performance (higher is better) vs pre-training cost (FLOPs; lower is better) for different LLMs. This is an annotated figure from the OLMo 2 paper, https://arxiv.org/abs/2501.00656

As mentioned earlier in this article, I aim to focus only on the LLM architecture details (not training or data) to keep it at a manageable length. So, what were the interesting architectural design choices in OLMo2 ? It mainly comes down to normalizations: the placement of RMSNorm layers as well as the addition of a QK-norm, which I will discuss below.

Another thing worth mentioning is that OLMo 2 still uses traditional Multi-Head Attention (MHA) instead of MLA or GQA.

中文译文 06

482 字

1.3 DeepSeek 小结

总的来说,DeepSeek V3 是一款拥有 6710 亿参数的大模型,发布时表现超过了其他开放权重模型,包括 4050 亿参数的 Llama 3。尽管体量更大,它的混合专家(MoE)架构让每个 token 只激活少量参数——370 亿,因此推理效率高得多。

DeepSeek V3 的另一项关键区别,是采用多头潜在注意力(MLA),而非分组查询注意力(GQA)。两者都是标准多头注意力(MHA)的高效推理替代方案,尤其适用于 KV 缓存。虽然 MLA 实现起来更复杂,但 DeepSeek-V2 论文的一项研究表明,其建模表现优于 GQA。

2. OLMo 2

非营利机构艾伦人工智能研究所的 OLMo 系列模型值得关注,因为其训练数据与代码透明,技术报告也相对详细。

虽然你大概不会在基准测试或排行榜首位看到 OLMo,但这些模型设计清晰;更重要的是,凭借透明性,它们是开发大模型的优秀参考蓝本。

OLMo 因透明而受欢迎,但表现其实也不差。事实上,1 月发布时(早于 Llama 4、Gemma 3 和 Qwen 3),OLMo 2 位于计算量与性能的帕累托前沿,如下方图 7 所示。 [1]

图 7:不同大模型的基准测试表现(越高越好)与预训练成本(FLOPs,越低越好)的对比。此图取自 OLMo 2 论文并附有批注。https://arxiv.org/abs/2501.00656

如前所述,为控制篇幅,本文只讨论大模型架构细节,不涉及训练或数据。那么,OLMo 2 有哪些有趣的架构选择?主要围绕归一化:RMSNorm 层的位置,以及新增的 QK 归一化。下面将具体讨论。

另一个值得一提的细节是,OLMo 2 仍使用传统多头注意力(MHA),而非 MLA 或 GQA。

英文原文 07

297 词 · 1 张图

2.1 Normalization Layer Placement

Overall, OLMo 2 largely follows the architecture of the original GPT model, similar to other contemporary LLMs. However, there are some noteworthy deviations. Let's start with the normalization layers.

Similar to Llama, Gemma, and most other LLMs, OLMo 2 switched from LayerNorm to RMSNorm.

But since RMSNorm is old hat (it's basically a simplified version of LayerNorm with fewer trainable parameters), I will skip the discussion of RMSNorm vs LayerNorm. (Curious readers can find an RMSNorm code implementation in my GPT-2 to Llama conversion guide.)

However, it's worth discussing the placement of the RMSNorm layer. The original transformer (from the "Attention is all you need" paper) placed the two normalization layers in the transformer block after the attention module and the FeedForward module, respectively.

This is also known as Post-LN or Post-Norm.

GPT and most other LLMs that came after placed the normalization layers before the attention and FeedForward modules, which is known as Pre-LN or Pre-Norm. A comparison between Post- and Pre-Norm is shown in the figure below.

Figure 8: A comparison of Post-Norm, Pre-Norm, and OLMo 2's flavor of Post-Norm.

In 2020, Xiong et al. showed that Pre-LN results in more well-behaved gradients at initialization. Furthermore, the researchers mentioned that Pre-LN even works well without careful learning rate warm-up, which is otherwise a crucial tool for Post-LN.

Now, the reason I am mentioning that is that OLMo 2 adopted a form of Post-LN (but with RMSNorm instead of LayerNorm, so I am calling it Post-Norm).

In OLMo 2, instead of placing the normalization layers before the attention and FeedForward layers, they place them after, as shown in the figure above. However, notice that in contrast to the original transformer architecture, the normalization layers are still inside the residual layers (skip connections).

中文译文 07

453 字

2.1 归一化层的位置

总体而言,OLMo 2 与其他当代大模型一样,大体沿用原始 GPT 模型的架构。不过也存在一些值得注意的差别,先从归一化层说起。

与 Llama、Gemma 及大多数其他大模型相似,OLMo 2 从 LayerNorm 转向了 RMSNorm。

但 RMSNorm 已不是什么新鲜事——它基本是可训练参数更少的简化版 LayerNorm——因此这里不再讨论两者的差别。(感兴趣的读者可在我的 GPT-2 到 Llama 转换指南中找到 RMSNorm 的代码实现。) [1]

不过,RMSNorm 层的位置值得讨论。最初的 Transformer,即《Attention Is All You Need》论文中的架构,将块内两个归一化层分别放在注意力模块和前馈模块之后。 [1]

这种方式也称为 Post-LN 或后置归一化(Post-Norm)。

GPT 及随后大多数大模型,则将归一化层放在注意力模块和前馈模块之前,称为 Pre-LN 或前置归一化(Pre-Norm)。下图对比了后置与前置归一化。

图 8:后置归一化、前置归一化,以及 OLMo 2 所用后置归一化变体的对比。

2020 年,Xiong 等人证明,Pre-LN 在初始化时能产生性质更良好的梯度。研究者还指出,即便没有仔细安排学习率预热,Pre-LN 也能良好工作;而预热对 Post-LN 通常十分关键。 [1]

这里提及它,是因为 OLMo 2 采用了一种 Post-LN 形式;但它用的是 RMSNorm 而非 LayerNorm,因此我将其称为 Post-Norm。

如上图所示,OLMo 2 将归一化层放在注意力层和前馈层之后,而非之前。但要注意,与最初的 Transformer 架构不同,这些归一化层仍位于残差分支,也就是跳跃连接的内部。

英文原文 08

316 词 · 1 张图

So, why did they move the position of the normalization layers? The reason is that it helped with training stability, as shown in the figure below.

Figure 9: A plot showing the training stability for Pre-Norm (like in GPT-2, Llama 3, and many others) versus OLMo 2's flavor of Post-Norm. This is an annotated figure from the OLMo 2 paper, https://arxiv.org/abs/2501.00656

Unfortunately this figure shows the results of the reordering together with QK-Norm, which is a separate concept. So, it’s hard to tell how much the normalization layer reordering contributed by itself.

2.2 QK-Norm

Since the previous section already mentioned the QK-norm, and other LLMs we discuss later, such as Gemma 2 and Gemma 3, also use QK-norm, let's briefly discuss what this is.

QK-Norm is essentially yet another RMSNorm layer. It's placed inside the Multi-Head Attention (MHA) module and applied to the queries (q) and keys (k) before applying RoPE. To illustrate this, below is an excerpt of a Grouped-Query Attention (GQA) layer I wrote for my Qwen3 from-scratch implementation (the QK-norm application in GQA is similar to MHA in OLMo):

class GroupedQueryAttention(nn.Module):
    def __init__(
        self, d_in, num_heads, num_kv_groups,
        head_dim=None, qk_norm=False, dtype=None
    ):
        # ...

        if qk_norm:
            self.q_norm = RMSNorm(head_dim, eps=1e-6)
            self.k_norm = RMSNorm(head_dim, eps=1e-6)
        else:
            self.q_norm = self.k_norm = None

    def forward(self, x, mask, cos, sin):
        b, num_tokens, _ = x.shape

        # Apply projections
        queries = self.W_query(x) 
        keys = self.W_key(x)
        values = self.W_value(x) 

        # ...

        # Optional normalization
        if self.q_norm:
            queries = self.q_norm(queries)
        if self.k_norm:
            keys = self.k_norm(keys)

        # Apply RoPE
        queries = apply_rope(queries, cos, sin)
        keys = apply_rope(keys, cos, sin)

        # Expand K and V to match number of heads
        keys = keys.repeat_interleave(self.group_size, dim=1)
        values = values.repeat_interleave(self.group_size, dim=1)

        # Attention
        attn_scores = queries @ keys.transpose(2, 3)
        # ...

As mentioned earlier, together with Post-Norm, QK-Norm stabilizes the training. Note that QK-Norm was not invented by OLMo 2 but goes back to the 2023 Scaling Vision Transformers paper.

中文译文 08

395 字

为什么要移动归一化层的位置?原因在于这有助于稳定训练,如下图所示。

图 9:Pre-Norm(如 GPT-2、Llama 3 及许多其他模型所用)与 OLMo 2 后置归一化变体的训练稳定性对比。此图取自 OLMo 2 论文并附有批注。https://arxiv.org/abs/2501.00656

遗憾的是,该图展示的是调整顺序与 QK-Norm 同时使用的结果,而 QK-Norm 是另一个独立概念。因此,很难判断仅改变归一化层顺序贡献了多少。

2.2 QK 归一化

上一节已提到 QK-Norm,后面讨论的 Gemma 2、Gemma 3 等大模型也使用它,因此这里简要介绍一下。

QK-Norm 本质上是又一层 RMSNorm,放在多头注意力(MHA)模块内部,在应用 RoPE 之前分别作用于查询 q 和键 k。下面摘录了我为 Qwen3 从零实现所写的一个分组查询注意力(GQA)层,展示这一过程;GQA 中 QK-Norm 的用法,与 OLMo 的 MHA 类似: [1]

class GroupedQueryAttention(nn.Module):
    def __init__(
        self, d_in, num_heads, num_kv_groups,
        head_dim=None, qk_norm=False, dtype=None
    ):
        # ...

        if qk_norm:
            self.q_norm = RMSNorm(head_dim, eps=1e-6)
            self.k_norm = RMSNorm(head_dim, eps=1e-6)
        else:
            self.q_norm = self.k_norm = None

    def forward(self, x, mask, cos, sin):
        b, num_tokens, _ = x.shape

        # Apply projections
        queries = self.W_query(x) 
        keys = self.W_key(x)
        values = self.W_value(x) 

        # ...

        # Optional normalization
        if self.q_norm:
            queries = self.q_norm(queries)
        if self.k_norm:
            keys = self.k_norm(keys)

        # Apply RoPE
        queries = apply_rope(queries, cos, sin)
        keys = apply_rope(keys, cos, sin)

        # Expand K and V to match number of heads
        keys = keys.repeat_interleave(self.group_size, dim=1)
        values = values.repeat_interleave(self.group_size, dim=1)

        # Attention
        attn_scores = queries @ keys.transpose(2, 3)
        # ...

如前所述,QK-Norm 与 Post-Norm 一起使用,能稳定训练。注意,QK-Norm 并非 OLMo 2 首创,可以追溯到 2023 年的《Scaling Vision Transformers》论文。 [1]

英文原文 09

293 词 · 1 张图

2.3 OLMo 2 Summary

In short, the noteworthy OLMo 2 architecture design decisions are primarily the RMSNorm placements: RMSNorm after instead of before the attention and FeedForward modules (a flavor of Post-Norm), as well as the addition of RMSNorm for the queries and keys inside the attention mechanism (QK-Norm), which both, together, help stabilize the training loss.

Below is a figure that further compares OLMo 2 to Llama 3 side by side; as one can see, the architectures are otherwise relatively similar except for the fact that OLMo 2 still uses the traditional MHA instead of GQA. (However, the OLMo 2 team released a 32B variant 3 months later that uses GQA.)

Figure 10: An architecture comparison between Llama 3 and OLMo 2.

3. Gemma 3

Google's Gemma models have always been really good, and I think they have always been a bit underhyped compared to other popular models, like the Llama series.

One of the distinguishing aspects of Gemma is the rather large vocabulary size (to support multiple languages better), and the stronger focus on the 27B size (versus 8B or 70B). But note that Gemma 2 also comes in smaller sizes: 1B, 4B, and 12B.

The 27B size hits a really nice sweet spot: it's much more capable than an 8B model but not as resource-intensive as a 70B model, and it runs just fine locally on my Mac Mini.

So, what else is interesting in Gemma 3? As discussed earlier, other models like Deepseek V3/R1 use a Mixture-of-Experts (MoE) architecture to reduce memory requirements at inference, given a fixed model size. (The MoE approach is also used by several other models we will discuss later.)

Gemma 3 uses a different "trick" to reduce computational costs, namely sliding window attention.

中文译文 09

409 字

2.3 OLMo 2 小结

简而言之,OLMo 2 值得关注的架构决策主要在于 RMSNorm 的位置:将其放在注意力和前馈模块之后而非之前,构成一种 Post-Norm 变体;同时在注意力机制内部为查询和键增加 RMSNorm,即 QK-Norm。两者结合有助于稳定训练损失。

下图进一步并排比较 OLMo 2 与 Llama 3。可以看到,两者架构总体相似,另一个区别是 OLMo 2 仍使用传统 MHA,而非 GQA。(不过,OLMo 2 团队三个月后发布了采用 GQA 的 320 亿参数版本。) [1]

图 10:Llama 3 与 OLMo 2 的架构对比。

3. Gemma 3

Google 的 Gemma 模型一直表现很好;我认为,相比 Llama 系列等热门模型,它们受到的关注始终稍显不足。

Gemma 的一个特点是词表较大,以便更好地支持多语言;另一个特点是更侧重 270 亿参数这一规模,而非 80 亿或 700 亿。但要注意,Gemma 2 也有更小的版本:10 亿、40 亿和 120 亿参数。

270 亿参数是一个很合适的平衡点:能力远强于 80 亿参数模型,却不像 700 亿参数模型那么消耗资源,在我的 Mac Mini 上本地运行也很顺畅。

那么,Gemma 3 还有什么有趣之处?前面已讨论,DeepSeek V3/R1 等模型使用混合专家(MoE)架构,在给定模型规模下减少推理所需内存。(后面还将讨论几款采用 MoE 的模型。) [1]

Gemma 3 用另一种“技巧”降低计算成本,即滑动窗口注意力。

英文原文 10

268 词 · 2 张图

3.1 Sliding Window Attention

With sliding window attention (originally introduced in the LongFormer paper in 2020 and also already used by Gemma 2), the Gemma 3 team was able to reduce the memory requirements in the KV cache by a substantial amount, as shown in the figure below.

Figure 11: An annotated figure from Gemma 3 paper (https://arxiv.org/abs/2503.19786) showing the KV cache memory savings via sliding window attention.

So, what is sliding window attention? If we think of regular self-attention as a global attention mechanism, since each sequence element can access every other sequence element, then we can think of sliding window attention as local attention, because here we restrict the context size around the current query position. This is illustrated in the figure below.

Figure 12: A comparison between regular attention (left) and sliding window attention (right).

Please note that sliding window attention can be used with both Multi-Head Attention and Grouped-Query Attention; Gemma 3 uses grouped-query attention.

As mentioned above, sliding window attention is also referred to as local attention because the local window surrounds and moves with the current query position. In contrast, regular attention is global as each token can access all other tokens.

Now, as briefly mentioned above, the Gemma 2 predecessor architecture also used sliding window attention before. The difference in Gemma 3 is that they adjusted the ratio between global (regular) and local (sliding) attention.

For instance, Gemma 2 uses a hybrid attention mechanism that combines sliding window (local) and global attention in a 1:1 ratio. Each token can attend to a 4k-token window of nearby context.

中文译文 10

392 字

3.1 滑动窗口注意力

借助滑动窗口注意力——最初由 2020 年的 LongFormer 论文提出,Gemma 2 也已使用——Gemma 3 团队大幅降低了 KV 缓存的内存需求,如下图所示。 [1] [2]

图 11:Gemma 3 论文中的插图,附有批注,展示滑动窗口注意力节省的 KV 缓存内存。https://arxiv.org/abs/2503.19786

什么是滑动窗口注意力?常规自注意力中,每个序列元素都能访问所有其他元素,因此可视为全局注意力;滑动窗口注意力则限制当前查询位置周围的上下文范围,因此可视为局部注意力。下图展示了两者区别。

图 12:常规注意力(左)与滑动窗口注意力(右)的对比。

请注意,滑动窗口既能用于多头注意力,也能用于分组查询注意力;Gemma 3 使用的是分组查询注意力。

如上所述,滑动窗口注意力也称为局部注意力,因为局部窗口围绕当前查询位置,并随之移动;常规注意力则是全局的,每个 token 都能访问所有其他 token。

前面简要提过,前代 Gemma 2 已使用滑动窗口注意力。Gemma 3 的区别,是调整了全局(常规)注意力与局部(滑动窗口)注意力的比例。

例如,Gemma 2 采用局部滑动窗口与全局注意力按 1∶1 组合的混合机制。每个 token 可以关注附近 4k 个 token 的上下文窗口。

英文原文 11

320 词 · 2 张图

Where Gemma 2 used sliding window attention in every other layer, Gemma 3 now has a 5:1 ratio, meaning there's only 1 full attention layer for every 5 sliding windows (local) attention layers; moreover, the sliding window size was reduced from 4096 (Gemma 2) to just 1024 (Gemma 3). This shifts the model's focus towards more efficient, localized computations.

According to their ablation study, the use of sliding window attention has minimal impact on modeling performance, as shown in the figure below.

Figure 13: An annotated figure from Gemma 3 paper (https://arxiv.org/abs/2503.19786) showing that sliding window attention has little to no impact on the LLM-generated output perplexity.

While sliding window attention is the most notable architecture aspect of Gemma 3, I want to also briefly go over the placement of the normalization layers as a follow-up to the previous OLMo 2 section.

3.2 Normalization Layer Placement in Gemma 3

A small but interesting tidbit to highlight is that Gemma 3 uses RMSNorm in both a Pre-Norm and Post-Norm setting around its grouped-query attention module.

This is similar to Gemma 2 but still worth highlighting, as it differs from (1) the Post-Norm used in the original transformer (“Attention is all you need”), (2) the Pre-Norm, which was popularized by GPT-2 and used in many other architectures afterwards, and (3) the Post-Norm flavor in OLMo 2 that we saw earlier.

Figure 14: An architecture comparison between OLMo2 and Gemma 3; note the additional normalization layers in Gemma 3.

I think this normalization layer placement is a relatively intuitive approach as it gets the best of both worlds: Pre-Norm and Post-Norm. In my opinion, a bit of extra normalization can't hurt. In the worst case, if the extra normalization is redundant, this adds a bit of inefficiency through redundancy. In practice, since RMSNorm is relatively cheap in the grand scheme of things, this shouldn't have any noticeable impact, though.

中文译文 11

409 字

Gemma 2 每隔一层使用滑动窗口注意力,Gemma 3 则采用 5∶1 的比例,即每 5 层局部滑动窗口注意力配 1 层完整注意力;同时,窗口从 Gemma 2 的 4096 缩小到 Gemma 3 的 1024。这让模型更侧重高效的局部计算。

其消融研究显示,使用滑动窗口注意力对建模表现影响极小,如下图所示。

图 13:Gemma 3 论文中的插图,附有批注,显示滑动窗口注意力对大模型生成输出的困惑度几乎没有影响。https://arxiv.org/abs/2503.19786

虽然滑动窗口注意力是 Gemma 3 最显著的架构特点,我还想接着前面对 OLMo 2 的讨论,简要介绍归一化层的位置。

3.2 Gemma 3 中归一化层的位置

一个小而有趣的细节是,Gemma 3 在分组查询注意力模块前后都使用 RMSNorm,同时采用了 Pre-Norm 和 Post-Norm。

这与 Gemma 2 类似,但仍值得强调,因为它不同于(1)最初 Transformer《Attention Is All You Need》的 Post-Norm;(2)由 GPT-2 推广、后来许多架构沿用的 Pre-Norm;以及(3)前面看到的 OLMo 2 的 Post-Norm 变体。

图 14:OLMo 2 与 Gemma 3 的架构对比。注意 Gemma 3 增加的归一化层。

我认为这种位置安排相当直观,因为它兼得 Pre-Norm 与 Post-Norm 的好处。在我看来,多一点归一化不会有坏处;最坏也只是额外归一化存在冗余,带来一点效率损失。但从整体看,RMSNorm 的成本相对很低,实际应该不会造成明显影响。

英文原文 12

333 词 · 1 张图

3.3 Gemma 3 Summary

Gemma 3 is a well-performing open-weight LLM that, in my opinion, is a bit underappreciated in the open-source circles. The most interesting part is the use of sliding window attention to improve efficiency (it will be interesting to combine it with MoE in the future).

Also, Gemma 3 has a unique normalization layer placement, placing RMSNorm layers both before and after the attention and FeedForward modules.

3.4 Bonus: Gemma 3n

A few months after the Gemma 3 release, Google shared Gemma 3n, which is a Gemma 3 model that has been optimized for small-device efficiency with the goal of running on phones.

One of the changes in Gemma 3n to achieve better efficiency is the so-called Per-Layer Embedding (PLE) parameters layer. The key idea here is to keep only a subset of the model's parameters in GPU memory. Token-layer specific embeddings, such as those for text, audio, and vision modalities, are then streamed from the CPU or SSD on demand.

The figure below illustrates the PLE memory savings, listing 5.44 billion parameters for a standard Gemma 3 model. This likely refers to the Gemma 3 4-billion variant.

Figure 15: An annotated figure from Google's Gemma 3n blog (https://developers.googleblog.com/en/introducing-gemma-3n/) illustrating the PLE memory savings.

The 5.44 vs. 4 billion parameter discrepancy is because Google has an interesting way of reporting parameter counts in LLMs. They often exclude embedding parameters to make the model appear smaller, except in cases like this, where it is convenient to include them to make the model appear larger. This is not unique to Google, as this approach has become a common practice across the field.

Another interesting trick is the MatFormer concept (short for Matryoshka Transformer). For instance, Gemma 3n uses a single shared LLM (transformer) architecture that can be sliced into smaller, independently usable models. Each slice is trained to function on its own, so at inference time, we can run just the part you need (instead of the large model).

中文译文 12

466 字

3.3 Gemma 3 小结

Gemma 3 是一款表现出色的开放权重大模型;在我看来,它在开源圈中稍显被低估。最有趣的部分,是通过滑动窗口注意力提升效率;未来若能结合 MoE,将很值得关注。

此外,Gemma 3 有独特的归一化层布局:在注意力模块和前馈模块的前后都放置 RMSNorm。

3.4 补充:Gemma 3n

Gemma 3 发布数月后,Google 推出了 Gemma 3n。它是在 Gemma 3 基础上为小型设备效率优化的模型,目标是在手机上运行。 [1]

为提高效率,Gemma 3n 的一项变化是所谓逐层嵌入(PLE)参数层。其核心思想是只将部分模型参数放在 GPU 内存中;文本、音频、视觉等模态的 token 与层特定嵌入,再按需从 CPU 或 SSD 流式载入。

下图展示了 PLE 节省的内存,其中标准 Gemma 3 模型标为 54.4 亿参数。这很可能指 Gemma 3 的 40 亿参数版本。

图 15:Google Gemma 3n 博客中的插图,附有批注,展示 PLE 节省的内存。https://developers.googleblog.com/en/introducing-gemma-3n/

54.4 亿与 40 亿参数的差异,源于 Google 有一种有趣的参数报告方式:它们经常不计嵌入参数,让模型显得更小;但在这里这样的场景,计入嵌入参数更方便让模型显得更大时,又将其计入。这并非 Google 独有,这种做法已在业界相当普遍。

另一个有趣的技巧是 MatFormer,即 Matryoshka Transformer,意为套娃式 Transformer。例如,Gemma 3n 使用单个共享的大模型(Transformer)架构,可以切分为独立可用的更小模型。每个切片都经过单独起作用的训练,因此推理时可以只运行所需部分,而不必运行整个大模型。 [1]

英文原文 13

286 词 · 2 张图

4. Mistral Small 3.1

Mistral Small 3.1 24B, which was released in March shortly after Gemma 3, is noteworthy for outperforming Gemma 3 27B on several benchmarks (except for math) while being faster.

The reasons for the lower inference latency of Mistral Small 3.1 over Gemma 3 are likely due to their custom tokenizer, as well as shrinking the KV cache and layer count. Otherwise, it's a standard architecture as shown in the figure below.

Figure 16: An architecture comparison between Gemma 3 27B and Mistral 3.1 Small 24B.

Interestingly, earlier Mistral models had utilized sliding window attention, but they appear to have abandoned it in Mistral Small 3.1 if we consider the default setting (“sliding_window”: null) in the official Model Hub configuration file. Also, the model card makes no mention of it.

So, since Mistral uses regular Grouped-Query Attention instead of Grouped-Query Attention with a sliding window as in Gemma 3, maybe there are additional inference compute savings due to being able to use more optimized code (i.e., FlashAttention). For instance, I speculate that while sliding window attention reduces memory usage, it doesn't necessarily reduce inference latency, which is what Mistral Small 3.1 is focused on.

5. Llama 4

The extensive introductory discussion on Mixture-of-Experts (MoE) earlier in this article pays off again. Llama 4 has also adopted an MoE approach and otherwise follows a relatively standard architecture that is very similar to DeepSeek V3, as shown in the figure below. (Llama 4 includes native multimodal support, similar to models like Gemma and Mistral. However, since this article focuses on language modeling, we only focus on the text model.)

Figure 17: An architecture comparison between DeepSeek V3 (671-billion parameters) and Llama 4 Maverick (400-billion parameters).

中文译文 13

364 字

4. Mistral Small 3.1

Mistral Small 3.1 24B 在 3 月、紧随 Gemma 3 之后发布。它值得关注的原因是:在多项基准测试中超过 Gemma 3 27B,数学除外,同时速度更快。 [1]

Mistral Small 3.1 的推理延迟低于 Gemma 3,可能与定制分词器、缩小 KV 缓存及减少层数有关。除此之外,它属于标准架构,如下图所示。

图 16:Gemma 3 27B 与 Mistral Small 3.1 24B 的架构对比。

有趣的是,早期 Mistral 模型用过滑动窗口注意力,但从官方 Model Hub 配置文件的默认设置“sliding_window”: null 看,Mistral Small 3.1 似乎放弃了它。模型卡也没有提及。 [1] [2]

因此,Mistral 使用常规 GQA,而不是 Gemma 3 那种带滑动窗口的 GQA,或许还能因使用更优化的代码,例如 FlashAttention,而进一步节省推理计算。我猜测,滑动窗口注意力虽然节省内存,却未必能降低推理延迟,而降低延迟正是 Mistral Small 3.1 关注的目标。

5. Llama 4

前面关于混合专家(MoE)的详尽介绍在此再次派上用场。Llama 4 也采用了 MoE,其余部分相对标准,与 DeepSeek V3 非常相似,如下图所示。(Llama 4 与 Gemma、Mistral 等模型一样,原生支持多模态。但本文关注语言建模,因此只讨论文本模型。) [1]

图 17:DeepSeek V3(6710 亿参数)与 Llama 4 Maverick(4000 亿参数)的架构对比。

英文原文 14

284 词

While the Llama 4 Maverick architecture looks very similar to DeepSeek V3 overall, there are some interesting differences worth highlighting.

First, Llama 4 uses Grouped-Query Attention similar to its predecessors, whereas DeepSeek V3 uses Multi-Head Latent Attention, which we discussed at the beginning of this article. Now, both DeepSeek V3 and Llama 4 Maverick are very large architectures, with DeepSeek V3 being approximately 68% larger in its total parameter count. However, with 37 billion active parameters, DeepSeek V3 has more than twice as many active parameters as Llama 4 Maverick (17B).

Llama 4 Maverick uses a more classic MoE setup with fewer but larger experts (2 active experts with 8,192 hidden size each) compared to DeepSeek V3 (9 active experts with 2,048 hidden size each). Also, DeepSeek uses MoE layers in each transformer block (except the first 3), whereas Llama 4 alternates MoE and dense modules in every other transformer block.

Given the many small differences between architectures, it is difficult to determine their exact impact on final model performance. The main takeaway, however, is that MoE architectures have seen a significant rise in popularity in 2025.

6. Qwen3

The Qwen team consistently delivers high-quality open-weight LLMs. When I helped co-advising the LLM efficiency challenge at NeurIPS 2023, I remember that the top winning solutions were all Qwen2-based.

Now, Qwen3 is another hit model series at the top of the leaderboards for their size classes. There are 7 dense models: 0.6B, 1.7B, 4B, 8B, 14B, and 32B. And there are 2 MoE models: 30B-A3B, and 235B-A22B.

(By the way, note that the missing whitespace in "Qwen3" is not a typo; I simply try to preserve the original spelling the Qwen developers chose.)

中文译文 14

366 字

虽然 Llama 4 Maverick 整体看起来与 DeepSeek V3 很相似,仍有一些有趣区别值得强调。

首先,Llama 4 与前代一样使用 GQA,而 DeepSeek V3 使用本文开头讨论的 MLA。两者架构都很庞大,DeepSeek V3 的总参数量还要多约 68%。不过,DeepSeek V3 的活跃参数为 370 亿,是 Llama 4 Maverick 的 170 亿的两倍多。

Llama 4 Maverick 的 MoE 更传统:专家较少但更大,激活 2 个专家,每个隐藏维度 8192;DeepSeek V3 则激活 9 个更小的专家,每个隐藏维度 2048。此外,DeepSeek 除前 3 个 Transformer 块外,每块都使用 MoE;Llama 4 则每隔一个块,在 MoE 模块与稠密模块之间交替。

架构之间有许多细微区别,很难确定它们对最终模型表现各自有多大影响。不过,主要结论是,MoE 架构在 2025 年变得明显更加流行。

6. Qwen3

Qwen 团队持续推出高质量开放权重大模型。我在 NeurIPS 2023 协助指导大模型效率挑战赛时,记得排名最前的获胜方案都基于 Qwen2。

如今,Qwen3 又成为在各自规模组别排行榜上名列前茅的热门系列。它有 7 款稠密模型:0.6B、1.7B、4B、8B、14B 和 32B;还有 2 款 MoE 模型:30B-A3B 和 235B-A22B。

(顺便说明,“Qwen3”中间没有空格并非笔误;我只是尽量保留开发者选择的原始拼写。)

英文原文 15

301 词 · 1 张图

6.1 Qwen3 (Dense)

Let's discuss the dense model architecture first. As of this writing, the 0.6B model may well be the smallest current-generation open-weight model out there. And based on my personal experience, it performs really well given its small size. It has great token/sec throughput and a low memory footprint if you are planning to run it locally. But what's more, it's also easy to train locally (for educational purposes) due to its small size.

So, Qwen3 0.6B has replaced Llama 3 1B for me for most purposes. A comparison between these two architectures is shown below.

Figure 18: An architecture comparison between Qwen3 0.6B and Llama 3 1B; notice that Qwen3 is a deeper architecture with more layers, whereas Llama 3 is a wider architecture with more attention heads.

If you are interested in a human-readable Qwen3 implementation without external third-party LLM library dependencies, I recently implemented Qwen3 from scratch (in pure PyTorch).

The computational performance numbers in the figure above are based on my from-scratch PyTorch implementations when run on an A100 GPU. As one can see, Qwen3 has a smaller memory footprint as it is a smaller architecture overall, but also uses smaller hidden layers and fewer attention heads. However, it uses more transformer blocks than Llama 3, which leads to a slower runtime (lower tokens/sec generation speed).

6.2 Qwen3 (MoE)

As mentioned earlier, Qwen3 also comes in two MoE flavors: 30B-A3B and 235B-A22B. Why do some architectures, like Qwen3, come as regular (dense) and MoE (sparse) variants?

As mentioned at the beginning of this article, MoE variants help reduce inference costs for large base models. Offering both dense and MoE versions gives users flexibility depending on their goals and constraints.

Dense models are typically more straightforward to fine-tune, deploy, and optimize across various hardware.

中文译文 15

396 字

6.1 Qwen3(稠密模型)

先讨论稠密模型架构。截至写作时,0.6B 或许是这一代最小的开放权重模型。根据我的个人体验,考虑到如此小的规模,它表现很好。如果打算本地运行,它每秒生成 token 的吞吐量高,内存占用低;而且由于规模小,也很容易在本地进行教学用途的训练。

因此,对我来说,Qwen3 0.6B 在大多数用途上取代了 Llama 3 1B。下图比较两者架构。

图 18:Qwen3 0.6B 与 Llama 3 1B 的架构对比。注意,Qwen3 更深、层数更多;Llama 3 则更宽、注意力头更多。

如果你想看不依赖第三方大模型库、便于人类阅读的 Qwen3 实现,我最近使用纯 PyTorch 从零实现了它。 [1]

上图的计算性能数据,来自我用 PyTorch 从零实现、在 A100 GPU 上运行的结果。可以看到,Qwen3 整体架构更小,隐藏层更小、注意力头更少,因此内存占用更低。但它的 Transformer 块比 Llama 3 更多,导致运行更慢,即每秒生成的 token 更少。

6.2 Qwen3(MoE)

如前所述,Qwen3 还有两款 MoE:30B-A3B 和 235B-A22B。为什么 Qwen3 等架构会同时提供常规稠密版与 MoE 稀疏版?

正如本文开头所述,MoE 有助于降低大型基础模型的推理成本。同时提供两类版本,可以让用户根据目标与约束灵活选择。

稠密模型通常更容易微调、部署,并针对各种硬件优化。

英文原文 16

281 词 · 1 张图

On the other hand, MoE models are optimized for scaling inference. For instance, at a fixed inference budget, they can achieve a higher overall model capacity (i.e., knowledge uptake during training due to being larger) without proportionally increasing inference costs.

By releasing both types, the Qwen3 series can support a broader range of use cases: dense models for robustness, simplicity, and fine-tuning, and MoE models for efficient serving at scale.

To round up this section, let's look at Qwen3 235B-A22B (note that the A22B stands for "22B active parameters) to DeepSeek V3, which has almost twice as many active parameters (37B).

Figure 19: An architecture comparison between DeepSeek V3 and Qwen3 235B-A22B.

As shown in the figure above, the DeepSeek V3 and Qwen3 235B-A22B architectures are remarkably similar. What's noteworthy, though, is that the Qwen3 model moved away from using a shared expert (earlier Qwen models, such as Qwen2.5-MoE did use a shared expert).

Unfortunately, the Qwen3 team did not disclose any reason as to why they moved away from shared experts. If I had to guess, it was perhaps simply not necessary for training stability for their setup when they increased the experts from 2 (in Qwen2.5-MoE) to 8 (in Qwen3). And then they were able to save the extra compute/memory cost by using only 8 instead of 8+1 experts. (However, this doesn't explain why DeepSeek V3 is still keeping their shared expert.)

Update. Junyang Lin, one of the developers of Qwen3, responded as follows:

At that moment we did not find significant enough improvement on shared expert and we were worrying about the optimization for inference caused by shared expert. No straight answer to this question honestly.

中文译文 16

393 字

另一方面,MoE 模型针对大规模推理优化。例如,在固定推理预算下,它能获得更大的整体模型容量——更大的模型在训练中能吸收更多知识——而不会让推理成本按同等比例增加。

因此,同时发布两类模型,能让 Qwen3 系列覆盖更广泛的场景:稠密模型适合稳健性、简洁性与微调,MoE 则适合大规模高效服务。

最后,比较一下 Qwen3 235B-A22B 与 DeepSeek V3。A22B 表示“220 亿活跃参数”;DeepSeek V3 的活跃参数为 370 亿,接近前者的两倍。

图 19:DeepSeek V3 与 Qwen3 235B-A22B 的架构对比。

如上图所示,两者架构十分相似。不过值得注意的是,Qwen3 不再使用共享专家,而 Qwen2.5-MoE 等早期 Qwen 模型曾使用共享专家。 [1]

遗憾的是,Qwen3 团队未披露取消共享专家的原因。如果让我猜,可能是将激活专家数从 Qwen2.5-MoE 的 2 个提高到 Qwen3 的 8 个后,在其配置下已不再需要共享专家来稳定训练;只用 8 个而非 8+1 个专家,也节省了额外计算和内存成本。(但这仍解释不了为什么 DeepSeek V3 保留了共享专家。)

更新:Qwen3 开发者之一林俊旸回应如下: [1]

当时,我们没有发现共享专家能带来足够显著的提升,同时也担心它会给推理优化带来问题。坦白说,这个问题并没有一个直接明确的答案。

英文原文 17

261 词 · 3 张图

7. SmolLM3

SmolLM3 is perhaps not as nearly as popular as the other LLMs covered in this article, but I thought it is still an interesting model to include as it offers really good modeling performance at a relatively small and convenient 3-billion parameter model size that sits between the 1.7B and 4B Qwen3 model, as shown in the figure below.

Moreover, it also shared a lot of the training details, similar to OLMo, which is rare and always appreciated!

Figure 20: An annotated figure from the SmolLM3 announcement post, https://huggingface.co/blog/smollm3, comparing the SmolLM3 win rate to Qwen3 1.7B and 4B as well as Llama 3 3B and Gemma 3 4B.

As shown in the architecture comparison figure below, the SmolLM3 architecture looks fairly standard. The perhaps most interesting aspect is its use of NoPE (No Positional Embeddings), though.

Figure 21: A side-by-side architecture comparison between Qwen3 4B and SmolLM3 3B.

7.1 No Positional Embeddings (NoPE)

NoPE is, in LLM contexts, an older idea that goes back to a 2023 paper (The Impact of Positional Encoding on Length Generalization in Transformers) to remove explicit positional information injection (like through classic absolute positional embedding layers in early GPT architectures or nowadays RoPE).

In transformer-based LLMs, positional encoding is typically necessary because self-attention treats tokens independently of order. Absolute position embeddings solve this by adding an additional embedding layer that adds information to the token embeddings.

Figure 22: A modified figure from my Build A Large Language Model (From Scratch) book (https://www.amazon.com/Build-Large-Language-Model-Scratch/dp/1633437167) illustrating absolute positional embeddings.

中文译文 17

358 字

7. SmolLM3

SmolLM3 可能远没有本文其他大模型那么热门,但我仍认为值得纳入:它以相对小巧、方便的 30 亿参数规模,提供了很好的建模表现,规模介于 Qwen3 的 17 亿与 40 亿参数版本之间,如下图所示。 [1]

而且,它像 OLMo 一样公开了大量训练细节;这很少见,也总是值得肯定!

图 20:SmolLM3 发布博客中的插图,附有批注,对比了它相对于 Qwen3 1.7B、4B,以及 Llama 3 3B、Gemma 3 4B 的胜率。https://huggingface.co/blog/smollm3

如下方架构对比图所示,SmolLM3 总体相当标准。其中或许最有趣的特点,是使用 NoPE,也就是不使用位置嵌入。

图 21:Qwen3 4B 与 SmolLM3 3B 的并排架构对比。

7.1 无位置嵌入(NoPE)

在大模型领域,NoPE 是一个较早的思想,可追溯到 2023 年的《The Impact of Positional Encoding on Length Generalization in Transformers》论文:移除显式位置信息的注入,例如早期 GPT 的经典绝对位置嵌入层,或如今的 RoPE。 [1]

基于 Transformer 的大模型通常需要位置编码,因为自注意力对待 token 时不考虑顺序。绝对位置嵌入通过增加一个嵌入层,将位置信息加入 token 嵌入来解决这一问题。

图 22:改编自我的《Build a Large Language Model (From Scratch)》,展示绝对位置嵌入。https://www.amazon.com/Build-Large-Language-Model-Scratch/dp/1633437167

英文原文 18

260 词 · 1 张图

RoPE, on the other hand, solves this by rotating the query and key vectors relative to their token position.

In NoPE layers, however, no such positional signal is added at all: not fixed, not learned, not relative. Nothing.

Even though there is no positional embedding, the model still knows which tokens come before, thanks to the causal attention mask. This mask prevents each token from attending to future ones. As a result, a token at position t can only see tokens at positions ≤ t, which preserves the autoregressive ordering.

So while there is no positional information that is explicitly added, there is still an implicit sense of direction baked into the model's structure, and the LLM, in the regular gradient-descent-based training, can learn to exploit it if it finds it beneficial for the optimization objective. (Check out the NoPE paper's theorems for more information.)

So, overall, the NoPE paper not only found that no positional information injection is necessary, but it also found that NoPE has better length generalization, which means that LLM answering performance deteriorates less with increased sequence length, as shown in the figure below.

Figure 23: An annotated figure from the NoPE paper (https://arxiv.org/abs/2305.19466) showing better length generalization with NoPE.

Note that the experiments shown above were conducted with a relatively small GPT-style model of approximately 100 million parameters and relatively small context sizes. It is unclear how well these findings generalize to larger, contemporary LLMs.

For this reason, the SmolLM3 team likely only "applied" NoPE (or rather omitted RoPE) in every 4th layer.

中文译文 18

359 字

RoPE 则根据 token 位置旋转查询向量与键向量,解决这一问题。

但在 NoPE 层中,完全不添加这种位置信号:既没有固定的、可学习的,也没有相对的位置信号,什么都不加。

尽管没有位置嵌入,模型仍借助因果注意力掩码知道哪些 token 在前。掩码阻止每个 token 关注未来的 token,因此位置 t 的 token 只能看到位置 ≤ t 的 token,保留了自回归顺序。

所以,即使不显式添加位置信息,模型结构仍内置了隐含方向。在常规梯度下降训练中,如果利用这种方向有助于优化目标,大模型就可以学会利用它。(更多信息见 NoPE 论文中的定理。)

总体而言,NoPE 论文不仅发现无需注入位置信息,还发现 NoPE 的长度泛化更好:随着序列变长,模型回答表现的下降更小,如下图所示。 [1]

图 23:NoPE 论文中的插图,附有批注,展示其更好的长度泛化。https://arxiv.org/abs/2305.19466

注意,上述实验使用的是约 1 亿参数的小型 GPT 风格模型,上下文也较短。这些发现能否推广到更大的当代大模型,尚不清楚。

因此,SmolLM3 团队很可能才只在每第 4 层“应用”NoPE,更准确地说,在该层省略 RoPE。

英文原文 19

349 词 · 2 张图

8. Kimi K2 and Kimi K2 Thinking

Kimi K2 recently made big waves in the AI community due to being an open-weight model with an incredibly good performance. According to benchmarks, it's on par with the best proprietary models like Google's Gemini, Anthropic's Claude, and OpenAI's ChatGPT models.

A notable aspect is its use of a variant of the relatively new Muon optimizer over AdamW. As far as I know, this is the first time Muon was used over AdamW for any production model of this size (previously, it has only been shown to scale up to 16B). This resulted in very nice training loss curves, which probably helped catapult this model to the top of the aforementioned benchmarks.

While people commented that the loss was exceptionally smooth (due to the lack of spikes), I think it's not exceptionally smooth (e.g., see the OLMo 2 loss curve in the figure below; also, the L2 norm of the gradient would probably be a better metric to track training stability). However, what's remarkable is how well the loss curve decays.

However, as mentioned in the introduction of this article, training methodologies are a topic for another time.

Figure 24: Annotated figures from the Kimi K2 announcement blog article (https://moonshotai.github.io/Kimi-K2/) and the OLMo 2 paper (https://arxiv.org/abs/2305.19466).

The model itself is 1 trillion parameters large, which is truly impressive.

It may be the biggest LLM of this generation as of this writing (given the constraints that Llama 4 Behemoth is not released, proprietary LLMs don't count, and Google's 1.6 trillion Switch Transformer is an encoder-decoder architecture from a different generation).

It's also coming full circle as Kimi K2 uses the DeepSeek V3 architecture we covered at the beginning of this article except they made it larger, as shown in the figure below.

Figure 25.1: An architecture comparison between DeepSeek V3 and Kimi K2.

As shown in the figure above, Kimi K2 is basically the same as DeepSeek V3, except that it uses more experts in the MoE modules and fewer heads in the Multi-head Latent Attention (MLA) module.

中文译文 19

451 字

8. Kimi K2 与 Kimi K2 Thinking

Kimi K2 最近在 AI 社区引起了巨大反响:它是开放权重模型,却表现极佳。根据基准测试,它与 Google Gemini、Anthropic Claude 和 OpenAI ChatGPT 等最出色的专有模型不相上下。 [1]

一个值得注意的特点,是它使用相对较新的 Muon 优化器变体,而非 AdamW。据我所知,这是 Muon 首次取代 AdamW 用于如此规模的生产模型;此前只证明它能扩展到 160 亿参数。这带来了非常漂亮的训练损失曲线,可能帮助模型登上了上述基准测试的前列。 [1] [2]

有人认为它的损失曲线因没有尖峰而异常平滑,我却不认为它格外平滑——例如可看下图 OLMo 2 的损失曲线;另外,梯度的 L2 范数或许更适合跟踪训练稳定性。不过,损失曲线下降得如此良好,确实很出色。

但如引言所述,训练方法留待以后讨论。

图 24:Kimi K2 发布博客和 OLMo 2 论文中的插图,附有批注。https://moonshotai.github.io/Kimi-K2/;https://arxiv.org/abs/2305.19466

模型本身达到 1 万亿参数,确实令人印象深刻。

截至写作时,它可能是这一代规模最大的大模型;前提是 Llama 4 Behemoth 尚未发布、专有模型不计入,而 Google 的 1.6 万亿参数 Switch Transformer 属于另一代编码器—解码器架构。 [1]

这也让话题回到起点:Kimi K2 使用了本文开头介绍的 DeepSeek V3 架构,只是将其放大,如下图所示。

图 25.1:DeepSeek V3 与 Kimi K2 的架构对比。

如上图所示,Kimi K2 基本与 DeepSeek V3 相同,区别是 MoE 模块的专家更多,多头潜在注意力(MLA)模块的头更少。

英文原文 20

380 词 · 4 张图

Kimi K2 is not coming out of nowhere. The earlier Kimi 1.5 model discussed in the Kimi k1.5: Scaling Reinforcement Learning with LLMs paper, was impressive as well. However, it had the bad luck that the DeepSeek R1 model paper was published on exactly the same date on January 22nd. Moreover, as far as I know, the Kimi 1.5 weights were never publicly shared.

So, most likely the Kimi K2 team took these lessons to heart and shared Kimi K2 as an open-weight model, before DeepSeek R2 was released. As of this writing, Kimi K2 is the most impressive open-weight model.

Update: On Nov 6, 2025 the Kimi K2 team also released their new “Thinking” model variant. The architecture is unchanged from Kimi K2 above, except that they extended the context size from 128k to 256k.

According to the benchmarks shared by the Kimi team, the model exceeds the performance of the leading proprietary LLMs. (Unfortunately, there is no direct comparison to DeepSeek R1.

Figure 25.2: DeepSeek R1 versus Kimi K2 Thinking architecture (top) and Kimi K2 Thinking benchmarks (bottom).

9. GPT-OSS

OpenAI’s released gpt-oss-120b and gpt-oss-20b, their first open-weight models since GPT-2 in 2019, about one week after I wrote this article. Since OpenAI’s open-weight models have been so widely anticipated, I updated this article to include them. I will keep this section brief, but I have written another, much more detailed article dedicated to the gpt-oss models here:

Before summarizing the interesting tidbits, let's start with an overview of the two models, gpt-oss-20b and gpt-oss-120b, as shown in Figure 26 below.

Figure 26: Architecture overview of the two gpt-oss models.

Looking at Figure 26, the architecture contains all the familiar components we have seen in other architectures discussed previously. For instance, Figure 27 puts the smaller gpt-oss architecture next to Qwen3 30B-A3B, which is also an MoE model with a similar number of active parameters (gpt-oss has 3.6B active parameters, and Qwen3 30B-A3B has 3.3B).

Figure 27: Architecture comparison between gpt-oss and Qwen3

One aspect not shown in Figure 27 is that gpt-oss uses sliding window attention (similar to Gemma 3, but in every other layer instead of using a 5:1 ratio).

中文译文 20

477 字

Kimi K2 并非凭空出现。此前《Kimi k1.5: Scaling Reinforcement Learning with LLMs》讨论的 Kimi 1.5 同样出色,只是运气不佳,DeepSeek R1 的论文恰好也在 1 月 22 日发布。而且据我所知,Kimi 1.5 的权重从未公开。 [1]

因此,Kimi K2 团队很可能吸取了这些经验,在 DeepSeek R2 发布前,就将 Kimi K2 以开放权重模型的形式发布。截至写作时,Kimi K2 是最令人印象深刻的开放权重模型。

更新:2025 年 11 月 6 日,Kimi K2 团队还发布了新的 Thinking 版本。除将上下文长度从 128k 扩展到 256k 外,架构与上述 Kimi K2 相同。

根据 Kimi 团队公布的基准测试,该模型超过了领先的专有大模型。(遗憾的是,没有与 DeepSeek R1 直接比较。 [1]

图 25.2:DeepSeek R1 与 Kimi K2 Thinking 架构对比(上),以及 Kimi K2 Thinking 基准测试结果(下)。

9. GPT-OSS

我写完本文约一周后,OpenAI 发布了 gpt-oss-120b 和 gpt-oss-20b,这是其自 2019 年 GPT-2 以来首批开放权重模型。由于大家期待已久,我更新本文加入了它们。本节从简;我另写了一篇详尽得多的 gpt-oss 专文,见这里: [1]

在总结有趣细节之前,先看下方图 26 对 gpt-oss-20b、gpt-oss-120b 两款模型的概览。

图 26:两款 gpt-oss 模型的架构概览。

图 26 中的架构包含我们在前述模型中见过的所有熟悉组件。例如,图 27 将较小的 gpt-oss 与 Qwen3 30B-A3B 并排比较;后者同样是 MoE,活跃参数规模也接近:gpt-oss 为 36 亿,Qwen3 30B-A3B 为 33 亿。

图 27:gpt-oss 与 Qwen3 的架构对比。

图 27 未显示的一点是,gpt-oss 使用滑动窗口注意力,与 Gemma 3 类似,但为隔层使用,而非 5∶1 的比例。

英文原文 21

364 词 · 1 张图

9.1 Width Versus Depth

Figure 27 shows that gpt-oss and Qwen3 use similar components. But if we look at the two models closely, we see that Qwen3 is a much deeper architecture with its 48 transformer blocks instead of 24.

On the other hand, gpt-oss is a much wider architecture:

  • An embedding dimension of 2880 instead of 2048

  • An intermediate expert (feed forward) projection dimension of also 2880 instead of 768

It's also worth noting that gpt-oss uses twice as many attention heads, but this doesn't directly increase the model's width. The width is determined by the embedding dimension.

Does one approach offer advantages over the other given a fixed number of parameters? As a rule of thumb, deeper models have more flexibility but can be harder to train due to instability issues, due to exploding and vanishing gradients (which RMSNorm and shortcut connections aim to mitigate).

Wider architectures have the advantage of being faster during inference (with a higher tokens/second throughput) due to better parallelization at a higher memory cost.

When it comes to modeling performance, there's unfortunately no good apples-to-apples comparison I am aware of (where parameter size and datasets are kept constant) except for an ablation study in the Gemma 2 paper (Table 9), which found that for a 9B parameter architecture, a wider setup is slightly better than a deeper setup. Across 4 benchmarks, the wider model achieved a 52.0 average score, and the deeper model achieved a 50.8 average score.

9.2 Few Large Versus Many Small Experts

As shown in Figure 27 above, it's also noteworthy that gpt-oss has a surprisingly small number of experts (32 instead of 128), and only uses 4 instead of 8 active experts per token. However, each expert is much larger than the experts in Qwen3.

This is interesting because the recent trends and developments point towards more, smaller models as being beneficial. This change, at a constant total parameter size, is nicely illustrated in Figure 28 below from the DeepSeekMoE paper.

Figure 28: An annotated figure from "DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models", https://arxiv.org/abs/2401.06066

Notably, unlike DeepSeek's models, neither gpt-oss nor Qwen3 uses shared experts, though.

中文译文 21

459 字

9.1 宽度与深度

图 27 显示,gpt-oss 与 Qwen3 的组件相似。但仔细看,Qwen3 的架构要深得多:有 48 个 Transformer 块,而不是 24 个。

另一方面,gpt-oss 的架构宽得多:

  • 嵌入维度为 2880,而非 2048。

  • 专家前馈层的中间投影维度同样为 2880,而非 768。

还应注意,gpt-oss 的注意力头数是两倍,但这并不直接增加模型宽度。宽度由嵌入维度决定。

参数量固定时,两种方式哪一种更有优势?一般而言,更深的模型更灵活,但也可能因梯度爆炸和梯度消失带来的不稳定而更难训练;RMSNorm 和跳跃连接正是为了缓解这些问题。

更宽的架构更利于并行化,因此推理更快、每秒 token 吞吐量更高,但内存成本更高。

至于建模表现,据我所知,除 Gemma 2 论文表 9 的消融研究外,缺少保持参数量和数据集不变的公平比较。该研究发现,在 90 亿参数架构上,更宽的配置略胜于更深的配置:4 项基准的平均分分别为 52.0 与 50.8。 [1]

9.2 少量大专家与大量小专家

上方图 27 还显示,gpt-oss 的专家数少得出奇:32 个,而非 128 个;每个 token 也只激活 4 个,而非 8 个。不过,每个专家远大于 Qwen3 的专家。

这很有意思,因为近期趋势和进展表明,数量更多、规模更小的模型更有利。下方图 28 来自 DeepSeekMoE 论文,清晰展示了总参数量不变时的这种调整。

图 28:《DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models》中的插图,附有批注。https://arxiv.org/abs/2401.06066

不过值得注意,与 DeepSeek 模型不同,gpt-oss 和 Qwen3 都不使用共享专家。

英文原文 22

347 词 · 4 张图

9.3 Attention Bias and Attention Sinks

Both gpt-oss and Qwen3 use grouped query attention. The main difference is that gpt-oss restricts the context size via sliding window attention in each second layer, as mentioned earlier.

However, there's one interesting detail that caught my eye. It seems that gpt-oss uses bias units for the attention weights, as shown in Figure 29 below.

Figure 29: gpt-oss models use bias units in the attention layers. See code example here.

I haven't seen these bias units being used since the GPT-2 days, and they are commonly regarded as redundant. Indeed, I found a recent paper that shows mathematically that this is at least true for the key transformation (k_proj). Furthermore, the empirical results show that there is little difference between with and without bias units (see Figure 30 below).

Figure 30: Table from https://arxiv.org/pdf/2302.08626 showing the average test loss when the models were trained from scratch with and without bias units.

Another detail you may have noticed is the definition of sinks in the code screenshot in Figure 30. In general models, attention sinks are special "always-attended" tokens placed at the start of the sequence to stabilize attention, which is especially useful in long-context scenarios. I.e., if the context gets very long, this special attended token at the beginning is still attended to, and it can learn to store some generally useful information about the entire sequence. (I think it was originally proposed in the Efficient Streaming Language Models with Attention Sinks paper.)

In the gpt-oss implementation, attention sinks are not actual tokens in the input sequence. Instead, they are learned per-head bias logits that are appended to the attention scores (Figure 31). The goal is the same as with the above-mentioned attention sinks, but without modifying the tokenized inputs.

Figure 31: The use of attention sinks in gpt-oss; based on the Hugging Face code here.

For more information about gpt-oss, and how it compares to GPT-2, please see my other gpt-oss article:

中文译文 22

482 字

9.3 注意力偏置与注意力汇聚点

gpt-oss 和 Qwen3 都使用 GQA。主要区别是,前者如前所述,每隔一层使用滑动窗口注意力限制上下文范围。

但有个有趣细节引起了我的注意:gpt-oss 似乎在注意力权重中使用偏置项,如下方图 29 所示。

图 29:gpt-oss 模型在注意力层中使用偏置项。代码示例见这里。

自 GPT-2 以来,我就没再见到这些偏置项被使用;通常认为它们是冗余的。实际上,我找到一篇近期论文,从数学上证明至少对键变换 k_proj 确实如此。实证结果也表明,有无偏置项区别很小(见下方图 30)。

图 30:论文 https://arxiv.org/pdf/2302.08626 中的表格,展示有无偏置项的模型从零训练后的平均测试损失。

你可能还注意到了图 30 代码截图中 sinks 的定义。一般模型中的注意力汇聚点,是放在序列开头、始终被关注的特殊 token,用于稳定注意力,尤其适用于长上下文。也就是说,即便上下文很长,开头这一特殊 token 仍会被关注,并能学会存储一些对整个序列普遍有用的信息。(我认为它最初由《Efficient Streaming Language Models with Attention Sinks》提出。) [1]

在 gpt-oss 实现中,注意力汇聚点并非输入序列中的实际 token,而是每个头独立学习的偏置 logit,追加到注意力分数中(图 31)。其目标与上述注意力汇聚点相同,但无需修改分词后的输入。

图 31:gpt-oss 中注意力汇聚点的用法;基于这里的 Hugging Face 代码。 [1]

更多 gpt-oss 细节,以及它与 GPT-2 的比较,见我的另一篇文章:

英文原文 23

244 词 · 1 张图

10. Grok 2.5

A few weeks after this article first went online, xAI released the weights of their 270B-parameter Grok 2.5 model.

I thought it would be worth including here, since Grok 2.5 was xAI's flagship production model last year. Up to this point, all models we discussed were released as open-weight models from the start. For example, gpt-oss is likely not an open-weight clone of GPT-4 but rather a custom model trained specifically for the open-source community.

With Grok 2.5, we get a rare look at a real production system, even if it is last year's.

Architecturally, Grok 2.5 looks fairly standard overall (Figure 32), but there are a few noteworthy details.

Figure 32: Grok 2.5 next to a Qwen3 model of comparable size

For instance, Grok 2.5 uses a small number of large experts (eight), which reflects an older trend. As discussed earlier, more recent designs such as those in the DeepSeekMoE paper favor a larger number of smaller experts (this is also present in Qwen3).

Another interesting choice is the use of what amounts to a shared expert. The additional SwiGLU module shown on the left in Figure 32 functions as an always-on, shared expert. It is not identical to the classic shared-expert design since its intermediate dimension is doubled, but the idea is the same. (I still find it interesting that Qwen3 omitted shared experts, and it will be interesting to see if that changes with Qwen4 and later models.)

中文译文 23

322 字

10. Grok 2.5

本文首次上线数周后,xAI 发布了 2700 亿参数 Grok 2.5 的权重。

我认为值得将其纳入,因为它是 xAI 去年的旗舰生产模型。此前讨论的所有模型,一开始就以开放权重形式发布。例如,gpt-oss 很可能不是 GPT-4 的开放权重复刻,而是专门为开源社区训练的定制模型。

Grok 2.5 让我们难得地窥见了真正的生产系统,尽管是去年的版本。

从架构看,Grok 2.5 整体相当标准(图 32),但有几个细节值得注意。

图 32:Grok 2.5 与参数规模相当的 Qwen3 模型对比。

例如,Grok 2.5 使用少量大专家,共 8 个,体现了较早的趋势。如前所述,DeepSeekMoE 论文等近期设计更倾向于大量小专家;Qwen3 也如此。

另一个有趣选择,是采用了实质上相当于共享专家的组件。图 32 左侧额外的 SwiGLU 模块始终开启,起共享专家的作用。它的中间维度加倍,因此不完全等同于经典共享专家设计,但思想相同。(我仍觉得 Qwen3 省略共享专家很有意思,也很想看看 Qwen4 及后续模型是否会改变。)

英文原文 24

224 词 · 2 张图

11. GLM-4.5

GLM-4.5 is another major release this year.

It is an instruction/reasoning hybrid similar to Qwen3, but even better optimized for function calling and agent-style contexts.

Figure 33: GLM-4.5 benchmark from the official GitHub repository at https://github.com/zai-org/GLM-4.5

As shown in Figure 34, GLM-4.5 comes in two variants. The flagship 355-billion-parameter model outperforms Claude 4 Opus on average across 12 benchmarks and trails only slightly behind OpenAI’s o3 and xAI’s Grok 4. There is also GLM-4.5-Air, a more compact 106-billion-parameter version that delivers performance only marginally below the 355-billion model.

Figure 35 compares the 355-billion architecture to Qwen3.

Figure 34: GLM-4.5 next to a similarly-sized Qwen3 model.

The designs are largely similar, but GLM-4.5 adopts a structural choice first introduced by DeepSeek V3: 3 dense layers precede the Mixture-of-Experts (MoE) blocks. Why? Starting with several dense layers improves convergence stability and overall performance in large MoE systems. If MoE routing is introduced immediately, the instability of sparse expert selection can interfere with early syntactic and semantic feature extraction. So, one might say that by keeping the initial layers dense ensures the model forms stable low-level representations before routing decisions begin to shape higher-level processing.

Also, GLM-4.5 uses a shared expert similar to DeepSeek V3 (and unlike Qwen3).

(Interestingly, GLM-4.5 also retains the attention bias mechanism used in GPT-2 and gpt-oss.)

中文译文 24

351 字

11. GLM-4.5

GLM-4.5 是今年另一项重要发布。 [1]

它与 Qwen3 类似,混合了指令与推理能力,但对函数调用及智能体场景作了更充分的优化。

图 33:GLM-4.5 官方 GitHub 仓库中的基准测试。https://github.com/zai-org/GLM-4.5

如图 34 所示,GLM-4.5 有两种版本。旗舰版为 3550 亿参数,在 12 项基准测试中的平均表现超过 Claude 4 Opus,仅略逊于 OpenAI o3 和 xAI Grok 4。另有更紧凑的 1060 亿参数 GLM-4.5-Air,其表现只比 3550 亿参数版本略低。

图 35 将 3550 亿参数架构与 Qwen3 对比。

图 34:GLM-4.5 与规模相近的 Qwen3 模型对比。

两者设计大体相似,但 GLM-4.5 采用了 DeepSeek V3 首次引入的一项结构选择:在 MoE 块之前先放 3 层稠密层。原因是什么?大规模 MoE 系统起始采用数层稠密层,有助于收敛稳定性与整体表现。如果一开始就引入 MoE 路由,稀疏专家选择的不稳定可能干扰早期句法和语义特征的提取。可以说,保持起始层稠密,能让模型在路由决策开始塑造高层处理之前,先形成稳定的低层表示。

此外,GLM-4.5 像 DeepSeek V3 一样使用共享专家,与 Qwen3 不同。

(有趣的是,它还保留了 GPT-2 和 gpt-oss 使用的注意力偏置机制。)

英文原文 25

329 词 · 2 张图

12. Qwen3-Next

On 11 September 2025, the Qwen3 team released Qwen3 Next 80B-A3B (Figure 35), available in both Instruct and Thinking variants. While its design builds on the previously discussed Qwen3 architecture, I included it here as a separate entry to keep the figure numbering consistent and to draw attention to some of its design changes.

12.1 Expert Size and Number

The new Qwen3 Next architecture stands out because, despite being 3× smaller than the previous 235B-A22B model (Figure 35), it introduces four times as many experts and even adds a shared expert. Both of these design choices (a high expert count and the inclusion of a shared expert) were future directions I had highlighted prior to this release, particularly in the video version of the article that I linked at the top.

Figure 35: The original Qwen3 model released in May (left) next to the Qwen3 Next model released in September (right).

12.2 Gated DeltaNet + Gated Attention Hybrid

The other highlight is that they replace the regular attention mechanism by a Gated DeltaNet + Gated Attention hybrid, which helps enable the native 262k token context length in terms of memory usage (the previous 235B-A22B model model supported 32k natively, and 131k with YaRN scaling.)

So how does this new attention hybrid work? Compared to grouped‑query attention (GQA), which is still standard scaled dot‑product attention (sharing K/V across query‑head groups to cut KV‑cache size and memory bandwidth as discussed earlier but whose decode cost and cache still grow with sequence length), their hybrid mechanism mixes Gated DeltaNet blocks with Gated Attention blocks with in a 3:1 ratio as shown in Figure 36.

Figure 36: The Gated DeltaNet + Gated Attention hybrid mechanism. Note that these are arranges in a 3:1 ratio, meaning that 3 transformer blocks with Gated DeltaNet are followed by 1 transformer block with Gated Attention. The right subfigure is from the official Qwen3 blog: https://qwen.ai/blog?id=4074cca80393150c248e508aa62983f9cb7d27cd&from=research.latest-advancements-list

中文译文 25

407 字

12. Qwen3-Next

2025 年 9 月 11 日,Qwen3 团队发布了 Qwen3 Next 80B-A3B(图 35),提供 Instruct 与 Thinking 两个版本。虽然它基于前面讨论的 Qwen3 架构,我仍将其单列,以保持图号一致,并突出一些设计变化。

12.1 专家的规模与数量

新的 Qwen3 Next 很突出:虽然模型规模约为先前 235B-A22B 的三分之一(图 35),专家数却是其四倍,甚至增加了共享专家。高专家数与共享专家这两项设计,正是我在它发布前强调过的未来方向,尤其在本文开头链接的视频版中有所提及。

图 35:5 月发布的原始 Qwen3(左)与 9 月发布的 Qwen3 Next(右)。

12.2 Gated DeltaNet 与门控注意力混合机制

另一个亮点,是用 Gated DeltaNet 与门控注意力的混合机制替代常规注意力,从内存使用角度支持原生 262k token 上下文;先前 235B-A22B 原生支持 32k,借助 YaRN 扩展支持 131k。 [1] [2] [3]

这种新混合注意力如何工作?GQA 仍是标准缩放点积注意力:如前所述,在查询头组间共享 K/V,以降低 KV 缓存和内存带宽,但解码成本与缓存仍随序列长度增长。相比之下,新机制以 3∶1 比例混合 Gated DeltaNet 块与门控注意力块,如图 36 所示。

图 36:Gated DeltaNet 与门控注意力混合机制,按 3∶1 排列,即 3 个带 Gated DeltaNet 的 Transformer 块之后,接 1 个带门控注意力的块。右侧子图来自 Qwen3 官方博客:https://qwen.ai/blog?id=4074cca80393150c248e508aa62983f9cb7d27cd&from=research.latest-advancements-list [1]

英文原文 26

222 词

We can think of the gated attention block as standard scaled-dot-product attention that can be used in GQA, but it has a few tweaks on top. The main differences between gated attention and plain GQA block are:

  1. an output gate (sigmoid-controlled, usually per-channel) that scales the attention result before it is added back to the residual;

  2. zero-centered RMSNorm for QKNorm, rather than a standard RMSNorm;

  3. partial RoPE (on a subset of dimensions).

Note that these are essentially just stability changes to GQA.

The Gated DeltaNet is a more significant change. In the DeltaNet block, q, k, v and two gates (α, β) are produced by linear and lightweight convolutional layers with normalization, and the layer replaces attention with a fast‑weight delta rule update.

However, the tradeoff is that DeltaNet offers less precise content‑based retrieval than full attention, which is why one gated attention layer remains.

Given that attention grows quadratically, the DeltaNet component was added to help with memory efficiency. In the "linear-time, cache-free" family, the DeltaNet block is a essentially an alternative to Mamba. Mamba keeps a state with a learned state-space filter (essentially a dynamic convolution over time). DeltaNet keeps a tiny fast-weight memory updated with α and β and reads it with q, with small convolutions only used only to help form q, k, v, α, β.

中文译文 26

323 字

门控注意力块可理解为用于 GQA 的标准缩放点积注意力,再加上几项调整。与普通 GQA 块的主要区别是:

  1. 输出门:由 sigmoid 控制,通常逐通道,在注意力结果加回残差之前对其缩放。

  2. QK-Norm 采用以零为中心的 RMSNorm,而非标准 RMSNorm。

  3. 局部 RoPE:只作用于部分维度。

注意,这些本质上只是对 GQA 的稳定性调整。

Gated DeltaNet 的变化更大。DeltaNet 块通过带归一化的线性层和轻量卷积层生成 q、k、v 及两个门 α、β,并以快速权重的 delta 规则更新替代注意力。 [1]

但代价在于,DeltaNet 基于内容的精确检索能力不如完整注意力,因此仍保留一层门控注意力。

考虑到注意力的成本按平方增长,引入 DeltaNet 是为了提高内存效率。在“线性时间、无缓存”这一类方法中,DeltaNet 块实质上是 Mamba 的一种替代。Mamba 使用可学习的状态空间滤波器维持状态,本质上相当于沿时间的动态卷积;DeltaNet 则保留一小块由 α、β 更新、由 q 读取的快速权重记忆,小卷积只用于辅助形成 q、k、v、α、β。

英文原文 27

344 词

12.3 Multi-Token Prediction

The two subsections above describe two design decisions geared towards efficiency. Since all good things come in threes, the Qwen3 also adds another efficiency-technique on top: Multi-Token Prediction (MTP).

(Note that DeepSeek V3 & V3.2, and later GLM-4.5 and MiniMax-M2 all use MTP during training; however, since it’s a training technique, I haven’t explicitly discussed it in the architecture comparisons.)

Multi-token prediction trains the LLM to predict several future tokens, instead of a single one, at each step. Here, at each position t, small extra heads (linear layers) output logits for t+1...t+k, and we sum cross-entropy losses for these offsets (in the MTP paper the researchers recommended k=4). This additional signal speeds up training, and inference may remain at generating one token at a time. However, the extra heads can be used in speculative multi-token decoding, which is what Qwen3-Next seems to do, however, the details are still a bit sparse:

Qwen3-Next introduces a native Multi-Token Prediction (MTP) mechanism, which not only yields an MTP module with a high acceptance rate for Speculative Decoding but also enhances the overall performance.Additionally, Qwen3-Next specifically optimizes the multi-step inference performance of MTP, further improving the acceptance rate of Speculative Decoding in real scenarios through multi-step training that maintains consistency between training and inference. Souce: Qwen3-Next blog post

12.4 Qwen3-Coder-Next

In early February 2026, the Qwen3 team shared the 80B Qwen3-Coder-Next model (3B parameters active), which made big headlines for outperforming much larger models like DeepSeek V3.2 (37B active) and Kimi K2.5 and GLM-7.5 (both 32B active) on coding tasks.

Moreover, the Qwen3-Coder-Next SWE-Bench Pro Performance is roughly on par with Claude-Sonnet-4.5 (and only slightly below Claude-Opus-4.5), which is impressive for an open-weight model!

Note that the architecture behind Qwen3-Coder-Next is exactly the same as Qwen3-Next 80B, which we discussed above (in fact, they used Qwen3-Next as a base model to train Qwen3-Coder-Next. Since this is an article about LLM architectures, the training details are outside the scope. However, interested readers can find more information in their detailed technical report on GitHub.

中文译文 27

476 字

12.3 多 token 预测

前两小节介绍了面向效率的两项设计。好事成三,Qwen3 又增加了一项效率技术:多 token 预测(MTP)。 [1]

(DeepSeek V3、V3.2 及后来的 GLM-4.5、MiniMax-M2 在训练时均使用 MTP。不过,它属于训练技术,因此前面的架构对比中未明确讨论。)

多 token 预测让大模型每步预测多个未来 token,而不是一个。在每个位置 t,额外的小预测头,即线性层,输出 t+1 至 t+k 的 logits,并将这些偏移位置的交叉熵损失相加;MTP 论文建议 k=4。额外训练信号能加快训练,推理仍可一次生成一个 token。不过,额外预测头也能用于推测式多 token 解码,Qwen3-Next 似乎正是这样做的,只是细节仍不充分: [1]

Qwen3-Next 引入原生多 token 预测(MTP)机制,不仅得到一个在推测解码中接受率较高的 MTP 模块,还提高了整体表现。此外,Qwen3-Next 特别优化 MTP 的多步推理性能,采用保持训练与推理一致的多步训练,进一步提升真实场景中的推测解码接受率。来源:Qwen3-Next 博客。 [1]

12.4 Qwen3-Coder-Next

2026 年 2 月初,Qwen3 团队发布了 800 亿参数、30 亿活跃参数的 Qwen3-Coder-Next。它在代码任务上超过了大得多的 DeepSeek V3.2(370 亿活跃参数)、Kimi K2.5 和 GLM-7.5(两者均为 320 亿活跃参数),因此引发广泛关注。 [1]

此外,Qwen3-Coder-Next 的 SWE-Bench Pro 表现与 Claude-Sonnet-4.5 大致相当,只略低于 Claude-Opus-4.5。对开放权重模型而言,这很出色!

注意,Qwen3-Coder-Next 的架构与前述 Qwen3-Next 80B 完全相同;实际上,团队就是以 Qwen3-Next 为基础模型训练它的。本文讨论架构,训练细节不在范围内;感兴趣的读者可在 GitHub 上的详细技术报告中了解更多。 [1]

英文原文 28

264 词 · 2 张图

13. MiniMax-M2

Recently, open-weight LLM developers shared flavors of their core architectures optimized for efficiency. One example is Qwen3-Next (see previous section), which replaces some of the full attention blocks with a fast gated DeltaNet module. Another example is DeepSeek V3.2, which uses sparse attention, a linear attention variant that trades off some modeling performance for improved computational performance (I plan to cover this mechanism in more detail in an upcoming article).

Now, MiniMax-M1 falls into a similar category to the models above, in that it uses a linear attention variant (lightning attention) that offers improved efficiency over regular (full) attention. I originally didn’t cover MiniMax M1 as it wasn’t quite as popular as some of the other models discussed here. However, their new MiniMax-M2 release is currently considered the best open-weight model (according to benchmark performance), which makes it too big to ignore.

Figure 37: MiniMax-M2 benchmark performance compared to other popular open-weight and proprietary LLMs. Image from the official model hub release readme file.

As shown in the overview figure below, I grouped MiniMax-M2 with the other decoder-style transformer LLMs as it does not use the efficient lightning attention variant proposed in MiniMax-M1. Instead, the developers went back to using full attention, likely to improve modeling (and benchmark) performance.

Figure 38: A timeline of the main LLMs covered in this article, next to some of the attention-hybrid models that constitute more efficient alternatives, trading off some modeling performance with improved efficiency.

Overall, MiniMax-M2 is surprisingly similar to Qwen3. Besides changing the number of layers, sizes, etc., it uses the same components overall.

中文译文 28

392 字

13. MiniMax-M2

最近,开放权重大模型开发者推出了一些面向效率优化的核心架构变体。例如上一节的 Qwen3-Next,用快速门控 DeltaNet 替换部分完整注意力块;另一个例子是 DeepSeek V3.2,它使用稀疏注意力——一种以部分建模表现换取更高计算性能的线性注意力变体;我计划在后续文章详细讨论该机制。

MiniMax-M1 也属于类似类别:它采用称为闪电注意力的线性注意力变体,比常规完整注意力更高效。我起初未介绍 M1,因为它没有本文其他一些模型那么热门。但新发布的 MiniMax-M2 按基准表现被认为是当前最好的开放权重模型,因此已无法忽视。 [1] [2]

图 37:MiniMax-M2 与其他热门开放权重、专有大模型的基准表现对比。图片来自官方 Model Hub 发布说明。 [1]

如下方总览图所示,我将 MiniMax-M2 归入其他解码器式 Transformer 大模型一类,因为它没有使用 M1 提出的高效闪电注意力。开发者转而重新使用完整注意力,可能是为了改善建模及基准测试表现。

图 38:本文主要大模型的时间线,以及部分混合注意力模型;后者是效率更高的替代方案,以部分建模表现换取更高效率。

总体而言,MiniMax-M2 与 Qwen3 相似得令人意外。除了层数、尺寸等变化,整体组件相同。

英文原文 29

272 词 · 1 张图

13.1 Per-Layer QK-Norm

Perhaps the one noteworthy highlight here is that MiniMax-M2 uses a so-called “per_layer” QK-Norm instead of the regular QK-Norm. A closer look at the code reveals that it is implemented like this inside the attention mechanism:

self.q_norm = MiniMaxText01RMSNormTP(self.head_dim * self.total_num_heads, eps=...)

self.k_norm = MiniMaxText01RMSNormTP(self.head_dim * self.total_num_kv_heads, eps=...)

Here, the hidden_size equals the concatenated heads (num_heads * head_dim), so the RMSNorm has a scale vector with distinct parameters for every head (and each head dim).

So, the “per_layer” means that the RMSNorm (used for QK-Norm as explained earlier) is defined in each transformer block (as in regular QK-Norm), but, in addition, instead of reusing it across attention heads, it’s a unique QK-Norm for each attention head.

The model configuration file also includes a sliding-window attention setting (similar to Gemma 3 in section 3), but, as in Mistral 3.1 (discussed in section 4), it is disabled by default.

Otherwise, besides the per-layer QK-Norm, the architecture is very similar to Qwen3, as shown in the figure below.

Figure 39: Comparison between Qwen3 and MiniMax-M2.

13.2 MoE Sparsity

Other interesting tidbits, as shown in the figure below, include the fact that they don’t use a shared expert (similar to Qwen3 but unlike Qwen3-Next). As mentioned earlier, in my opinion, shared experts are useful because they reduce redundancy among the other experts.

Also, as apparent from the figure above, MiniMax-M2 is twice as “sparse” as Qwen3. I.e., at roughly the same size as Qwen3 235B-A22B, MiniMax-M2 has only 10B instead of 22B active experts per token (that is, 4.37% of the parameters are used in each inference step in MiniMax-M2, whereas Qwen3 uses 9.36% active tokens).

中文译文 29

354 字

13.1 逐层 QK 归一化

这里或许唯一值得强调的,是 MiniMax-M2 采用所谓“per_layer”QK-Norm,而非常规 QK-Norm。仔细看代码,注意力内部的实现如下: [1]

self.q_norm = MiniMaxText01RMSNormTP(self.head_dim * self.total_num_heads, eps=...)

self.k_norm = MiniMaxText01RMSNormTP(self.head_dim * self.total_num_kv_heads, eps=...)

这里的 hidden_size 等于拼接后的所有注意力头,即 num_heads × head_dim。因此,RMSNorm 的缩放向量为每个头、每个头内维度都设置了独立参数。

因此,“per_layer”表示与普通 QK-Norm 一样,每个 Transformer 块中都定义了用于 QK-Norm 的 RMSNorm;此外,它不在各注意力头之间复用,而是为每个头使用独立的 QK-Norm。

模型配置中还包含滑动窗口注意力设置,类似第 3 节的 Gemma 3;但与第 4 节讨论的 Mistral 3.1 一样,默认禁用。 [1]

除逐层 QK-Norm 外,其架构与 Qwen3 非常相似,如下图所示。

图 39:Qwen3 与 MiniMax-M2 的对比。

13.2 MoE 稀疏性

下图还展示了一些有趣细节,例如它不使用共享专家:这一点类似 Qwen3,却不同于 Qwen3-Next。如前所述,我认为共享专家很有用,因为能减少其他专家间的冗余。

另外,从上图可见,MiniMax-M2 的“稀疏程度”约为 Qwen3 的两倍。它与 Qwen3 235B-A22B 规模大致相同,但每个 token 的活跃专家参数只有 100 亿,而非 220 亿;即 MiniMax-M2 每次推理使用 4.37% 的参数,而 Qwen3 使用 9.36% 的活跃 token。

英文原文 30

279 词

13.3 Partial RoPE

Lastly, similar to MiniMax-M1, MiniMax-M2 uses a “partial” instead of regular RoPE inside the attention modules to encode positional information. Similar to regular RoPE, the rotations are applied to the queries and keys after applying QK-Norm.

Partial RoPE here means only the first rotary_dim channels of each head get rotary position encodings, and the remaining head_dim - rotary_dim channels remain unchanged.

In the official M1 README file, the developers mention

Rotary Position Embedding (RoPE) applied to half of the attention head dimension with a base frequency of 10,000,000

We can picture it as follows:

Full RoPE:     [r r r r r r r r]
Partial RoPE:  [r r r r — — — —]

where in the conceptual illustration above, the “r”s show rotated (position-encoded) dimensions, and the dashes are the untouched dimensions.

What’s the point of this? In the M1 paper, the developers stated that

…implementing RoPE on half of the softmax attention dimensions enables length extrapolation without performance degradation.

My speculation is that this prevents “too much” rotation for long sequences, and particularly those that are longer than the longest documents in the training dataset. I.e., the rationale here could be that no rotation is better than a “bad” or “too extreme” rotation that the model hasn’t seen before in training.

14. Kimi Linear

There’s recently been a revival in linear attention mechanisms to improve the efficiency of LLMs.

The attention mechanism introduced in the Attention Is All You Need paper (2017), aka scaled-dot-product attention, remains the most popular attention variant in today’s LLMs. Besides traditional multi-head attention, it’s also used in the more efficient flavors like grouped-query attention, sliding window attention, and multi-head latent attention.

中文译文 30

386 字

13.3 局部 RoPE

最后,与 MiniMax-M1 类似,MiniMax-M2 在注意力模块中使用局部而非常规 RoPE 编码位置信息。与常规 RoPE 一样,旋转在 QK-Norm 之后作用于查询和键。

这里“局部 RoPE”表示,每个头只有前 rotary_dim 个通道应用旋转位置编码,剩下 head_dim − rotary_dim 个通道不变。

在 M1 官方 README 中,开发者写道: [1]

旋转位置嵌入(RoPE)作用于注意力头维度的一半,基频为 10,000,000。

可以这样直观表示:

Full RoPE:     [r r r r r r r r]
Partial RoPE:  [r r r r — — — —]

上述示意中的 r 表示经过旋转、即位置编码的维度,横线表示未改动的维度。

这样做有什么意义?M1 论文中,开发者指出: [1]

……在 softmax 注意力的一半维度上实施 RoPE,可以在不损失性能的情况下进行长度外推。

我猜测,这能避免长序列出现“过多”旋转,特别是比训练集中最长文档还长的序列。其可能的理由是:与模型训练时从未见过的“不好”或“过于极端”的旋转相比,不旋转更好。

14. Kimi Linear

最近,线性注意力机制重新受到关注,目的是提高大模型效率。

2017 年《Attention Is All You Need》提出的注意力,也就是缩放点积注意力,仍是当今大模型最流行的变体。除传统多头注意力,它也用于 GQA、滑动窗口注意力、MLA 等更高效的形式。

英文原文 31

275 词 · 2 张图

14.1 Traditional Attention and Quadratic Costs

The original attention mechanism scales quadratically with the sequence length:

Attention(Q,K,V)=softmax ((QK^(⊤))/(√(d)))V

This is because the query (Q), key (K), and value (V) are n-by-d matrices, where d is the embedding dimension (a hyperparameter) and n is the sequence length (i.e., the number of tokens).

You can find more details on attention in my other article:

Figure 40: Illustration of the quadratic cost in attention due to sequence length n.

14.2 Linear attention

Linear attention variants have been around for a long time, and I remember seeing tons of papers in the 2020s. For example, one of the earliest I recall is the 2020 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention paper, where the researchers approximated the attention mechanism:

Attention(Q,K,V)=softmax ((QK^(⊤))/(√(d)))V≈ϕ(Q)(ϕ(K)^(⊤)V)

Here, φ(·) is a kernel feature function, set to φ(x) = elu(x) + 1 .

This approximation is efficient because it avoids explicitly computing the n \times n attention matrix QK^T . Instead of performing all pairwise token interactions (which cost O(n^2d) time and memory).

I don’t want to dwell too long on these older attempts. But the bottom line was that they reduced both time and memory complexity from O(n^2) to O(n) to making attention much more efficient for long sequences.

However, they never really gained traction as they degraded the model accuracy, and I have never really seen one of these variants applied in an open-weight state-of-the-art LLM.

中文译文 31

389 字

14.1 传统注意力与平方成本

原始注意力机制的成本随序列长度按平方增长:

Attention(Q,K,V)=softmax ((QK^(⊤))/(√(d)))V

原因是查询 Q、键 K、值 V 都是 n×d 矩阵,其中 d 是嵌入维度,为超参数;n 是序列长度,即 token 数。

注意力的更多细节见我的另一篇文章:

图 40:注意力中由序列长度 n 引起的平方成本示意。

14.2 线性注意力

线性注意力变体已存在很久,我记得 2020 年代见过大量相关论文。例如,我记得最早的一批包括 2020 年的《Transformers Are RNNs: Fast Autoregressive Transformers with Linear Attention》,研究者在其中对注意力作了如下近似: [1]

Attention(Q,K,V)=softmax ((QK^(⊤))/(√(d)))V≈ϕ(Q)(ϕ(K)^(⊤)V)

这里 φ(·) 是核特征函数,设为 φ(x) = elu(x) + 1。

这一近似很高效,因为它避免显式计算 n×n 注意力矩阵 QK^T,不必进行所有 token 两两交互;后者消耗 O(n²d) 的时间与内存。

这里不再过多介绍这些早期尝试。关键是,它们将时间和内存复杂度从 O(n²) 降到 O(n),让长序列注意力高效得多。

但这些变体因会降低模型准确性,始终没有真正普及;我也从未见它们用于先进的开放权重大模型。

英文原文 32

294 词 · 1 张图

14.3 Linear Attention Revival

In the second half of this year, there was a bit of a revival of linear attention variants. The first notable model was MiniMax-M1 with lightning attention, a 456B parameter mixture-of-experts (MoE) model with 46B active parameters, which came out back in June.

Then, in August, the Qwen3 team followed up with Qwen3-Next, which I discussed in more detail above. Then, in September, the DeepSeek Team announced DeepSeek V3.2. All three models (MiniMax-M1, Qwen3-Next, DeepSeek V3.2) replace the traditional quadratic attention variants in most or all of their layers with efficient linear variants.

Interestingly, there was a recent plot twist, where the MiniMax team released their new 230B parameter M2 model (discussed in section 13) without linear attention, going back to regular attention. The team stated that linear attention is tricky in production LLMs. It seemed to work fine with regular prompts, but it had poor accuracy in reasoning and multi-turn tasks, which are not only important for regular chat sessions but also agentic applications.

This could have been a turning point where linear attention may not be worth pursuing after all. However, it gets more interesting. In October, the Kimi team released their new Kimi Linear model with linear attention.

Figure 41: An overview of the linear attention hybrid architectures.

Side note: I could have grouped Qwen3-Next and Kimi Linear with the other transformer-state space model (SSM) hybrids in the overview figure. Personally, I see these other transformer-SSM hybrids as SSMs with transformer components, whereas I see the models discussed here (Qwen3-Next and Kimi Linear) as transformers with SSM components. However, since I have listed IBM Granite 4.0 and NVIDIA Nemotron Nano 2 in the transformer-SSM box, an argument could be made for putting them into a single category.

中文译文 32

402 字

14.3 线性注意力复兴

今年下半年,线性注意力变体有所复兴。首个值得关注的是 6 月发布、采用闪电注意力的 MiniMax-M1:它是 4560 亿总参数、460 亿活跃参数的 MoE 模型。 [1]

随后,Qwen3 团队于 8 月推出了上面详述的 Qwen3-Next,DeepSeek 团队于 9 月公布了 DeepSeek V3.2。这三个模型——MiniMax-M1、Qwen3-Next、DeepSeek V3.2——都在大多数或全部层中,以高效线性变体替换传统平方成本注意力。

有趣的是,最近出现了转折:MiniMax 团队发布的 2300 亿参数 M2(见第 13 节)没有使用线性注意力,而是回到常规注意力。团队表示,线性注意力在生产大模型中很棘手:普通提示下表现尚可,但推理和多轮任务准确性较差;后两者不仅对聊天重要,对智能体应用也很重要。

这原本可能成为转折,让人觉得线性注意力终究不值得继续追求。但事情更有意思了:10 月,Kimi 团队发布了使用线性注意力的新模型 Kimi Linear。 [1]

图 41:混合线性注意力架构概览。

补充说明:在总览图中,也可以将 Qwen3-Next 和 Kimi Linear 归到其他 Transformer—状态空间模型(SSM)混合架构中。我个人认为,其他混合架构是“带 Transformer 组件的 SSM”,而这里讨论的 Qwen3-Next、Kimi Linear 是“带 SSM 组件的 Transformer”。不过,既然已将 IBM Granite 4.0 与 NVIDIA Nemotron Nano 2 放在 Transformer—SSM 一栏,主张将它们归为一类也有道理。

英文原文 33

239 词 · 1 张图

14.4 Kimi Linear vs. Qwen3-Next

Kimi Linear shares several structural similarities with Qwen3-Next. Both models rely on a hybrid attention strategy. Concretely, they combine lightweight linear attention with heavier full attention layers. Specifically, both use a 3:1 ratio, meaning for every three transformer blocks employing the linear Gated DeltaNet variant, there’s one block that uses full attention as shown in the figure below.

Figure 42: Qwen3-Next and Kimi Linear side by side.

Gated DeltaNet is a linear attention variant with inspiration from recurrent neural networks, including a gating mechanism from the Gated Delta Networks: Improving Mamba2 with Delta Rule paper. In a sense, Gated DeltaNet is a DeltaNet with Mamba-style gating, and DeltaNet is a linear attention mechanism. Due to the overview-nature of this article, DeltaNet would be good topic for a separate article in the future.

Note that the omission of the RoPE box in the Kimi Linear part of the figure above is intentional. Kimi applies NoPE (No Positional Embedding) in multi-head latent attention MLA) layers (global attention). As the authors state, this lets MLA run as pure multi-query attention at inference and avoids RoPE retuning for long‑context scaling (the positional bias is supposedly handled by the Kimi Delta Attention blocks). For more information on MLA, and multi-query attention, which is a special case of grouped-query attention, please see my The Big LLM Architecture Comparison article.

In addition, I’ve written more about Gated DeltaNet here.

中文译文 33

305 字

14.4 Kimi Linear 与 Qwen3-Next

Kimi Linear 与 Qwen3-Next 有多个结构相似点。两者都采用混合注意力,结合轻量线性注意力与较重的完整注意力层,且都采用 3∶1:每 3 个使用线性 Gated DeltaNet 变体的 Transformer 块,对应 1 个完整注意力块,如下图所示。

图 42:Qwen3-Next 与 Kimi Linear 的并排对比。

Gated DeltaNet 是受循环神经网络启发的线性注意力变体,包含《Gated Delta Networks: Improving Mamba2 with Delta Rule》中的门控机制。某种意义上,它是加入 Mamba 式门控的 DeltaNet,而 DeltaNet 是一种线性注意力机制。本文偏重总览,DeltaNet 适合未来另写专文介绍。 [1]

注意,上图 Kimi Linear 部分刻意省略了 RoPE 方框:Kimi 在多头潜在注意力 MLA,也就是全局注意力层中使用 NoPE。作者表示,这让 MLA 在推理时作为纯多查询注意力运行,并避免为长上下文扩展重新调节 RoPE;位置偏置据称由 Kimi Delta Attention 块处理。关于 MLA 及多查询注意力——GQA 的特例——的更多信息,可参考我的《The Big LLM Architecture Comparison》。 [1]

此外,我还在这里进一步介绍了 Gated DeltaNet。 [1]

英文原文 34

297 词 · 1 张图

14.5 Kimi Delta Attention

Kimi Linear modifies the linear attention mechanism of Qwen3-Next by the Kimi Delta Attention (KDA) mechanism, which is essentially a refinement of Gated DeltaNet. Whereas Qwen3-Next applies a scalar gate (one value per attention head) to control the memory decay rate, Kimi Linear replaces it with a channel-wise gating for each feature dimension. According to the authors, this gives more control over the memory, and this, in turn, improves long-context reasoning.

In addition, for the full attention layers, Kimi Linear replaces Qwen3-Next’s gated attention layers (which are essentially standard multi-head attention layers with output gating) with Multi-Head Latent Attention (MLA). This is the same MLA mechanism we discussed earlier in the DeepSeek V3/R1 section but with an additional gate. (To recap, MLA compresses the key/value space to reduce the KV cache size.)

There’s no direct comparison to Qwen3-Next, but compared to the Gated DeltaNet-H1 model from the Gated DeltaNet paper (which is essentially Gated DeltaNet with sliding-window attention), Kimi Linear achieves higher modeling accuracy while maintaining the same token-generation speed.

Figure 43: Annotated figure from the Kimi Linear paper showing that Kimi Linear is as fast as GatedDeltaNet, and much faster than an architecture with multi-head latent attention (like DeepSeek V3/R1), while having a higher benchmark performance.

Furthermore, according to the ablation studies in the DeepSeek-V2 paper, MLA is on par with regular full attention when the hyperparameters are carefully chosen.

And the fact that Kimi Linear compares favorably to MLA on long-context and reasoning benchmarks makes linear attention variant once again promising for larger state-of-the-art models. That being said, Kimi Linear is 48B-parameter large, but it’s 20x smaller than Kimi K2. It will be interesting to see if the Kimi team adopts this approach for their upcoming K3 model.

中文译文 34

384 字

14.5 Kimi Delta Attention

Kimi Linear 用 Kimi Delta Attention(KDA)修改 Qwen3-Next 的线性注意力,本质上是 Gated DeltaNet 的改进。Qwen3-Next 用标量门,即每个头一个值,控制记忆衰减率;Kimi Linear 改为对每个特征维度逐通道门控。作者表示,这能更精细地控制记忆,进而改善长上下文推理。

此外,在完整注意力层中,Kimi Linear 用 MLA 替换了 Qwen3-Next 的门控注意力层;后者本质上是带输出门控的标准多头注意力层。这与前述 DeepSeek V3/R1 的 MLA 相同,但多了一个门。回顾一下:MLA 通过压缩键值空间缩小 KV 缓存。

虽然没有与 Qwen3-Next 的直接比较,但与 Gated DeltaNet 论文中的 Gated DeltaNet-H1——本质上是 Gated DeltaNet 加滑动窗口注意力——相比,Kimi Linear 在保持相同 token 生成速度时,建模准确性更高。

图 43:Kimi Linear 论文中的插图,附有批注,显示它与 GatedDeltaNet 同样快、远快于使用 MLA 的架构(如 DeepSeek V3/R1),同时基准表现更好。

另外,DeepSeek-V2 论文的消融研究显示,只要仔细选择超参数,MLA 的表现与常规完整注意力相当。 [1]

Kimi Linear 在长上下文与推理基准上优于 MLA,这让线性注意力变体再次成为更大型先进模型的有希望选择。不过,它只有 480 亿参数,比 Kimi K2 小 20 倍。Kimi 团队是否会在即将推出的 K3 中采用这一方法,值得关注。

英文原文 35

326 词 · 2 张图

15. Olmo 3 Thinking

Allen AI released their new Olmo 3 7B and 32B models on November 20. (The official spelling was changed from OLMo to Olmo, so I will be adopting that in this section.)

As mentioned earlier, Olmo models are always interesting because they are fully open-source. Here, that means that the team also shares detailed training reports, multiple checkpoints, information about the training data, and so forth. In other words, Olmo models are fully transparent.

This time, the Olmo suite also comes in an additional reasoning model flavor (next to base and instruct models), and there are lots of interesting details about the training in Olmo 3’s technical report. However, since this is an article about architectural comparisons, this section focuses only on Olmo 3’s architecture.

The closest model to compare Olmo 3 to would be Qwen3, as the Qwen3 series has two models of similar size, and the Qwen3 models have a similar performance.

First, let’s take a look at the smaller of the two, Olmo 3 7B.

Figure 44: Olmo 3 7B and Qwen3 8B side by side.

As we can see, the Olmo 3 architecture is relatively similar to Qwen3. However, it’s worth noting that this is essentially likely inspired by the Olmo 2 predecessor, not Qwen3.

Similar to Olmo 2, Olmo 3 still uses post-norm instead of pre-norm, as they found in the Olmo 2 paper that it stabilizes the training.

Interestingly, the 7B model still uses multi-head attention similar to Olmo 2. However, to make things more efficient and shrink the KV cache size, they now use sliding window attention (e.g., similar to Gemma 3).

Next, let’s look at the 32B model.

Figure 45: Olmo 3 32B and Qwen3 32B side by side.

Overall, it’s the same architecture but just scaled up. Also, the proportions (e.g., going from the input to the intermediate size in the feed forward layer, and so on) roughly match the ones in Qwen3.

中文译文 35

375 字

15. Olmo 3 Thinking

Allen AI 于 11 月 20 日发布了新的 Olmo 3 7B 和 32B。(官方拼写从 OLMo 改为 Olmo,本节将沿用新拼写。) [1]

如前所述,Olmo 模型一直有趣,因为它们完全开源:团队还会提供详细训练报告、多个检查点、训练数据信息等。换言之,Olmo 完全透明。 [1]

这次,除了基础与指令模型,Olmo 系列还新增推理模型;Olmo 3 技术报告中有许多有趣的训练细节。但本文比较架构,因此这里只关注其架构。 [1]

最适合与 Olmo 3 比较的模型是 Qwen3,因为后者有两款规模相近、表现也接近的模型。

先来看两者中较小的 Olmo 3 7B。

图 44:Olmo 3 7B 与 Qwen3 8B 的并排对比。

可以看到,Olmo 3 与 Qwen3 的架构相对相似。不过值得注意,它很可能主要受前代 Olmo 2 启发,而非 Qwen3。

与 Olmo 2 一样,Olmo 3 仍采用 Post-Norm 而非 Pre-Norm,因为 Olmo 2 论文发现,这能稳定训练。

有趣的是,7B 模型仍像 Olmo 2 一样使用 MHA。但为提高效率、缩小 KV 缓存,现在也使用滑动窗口注意力,例如 Gemma 3 的做法。

接下来看看 32B 模型。

图 45:Olmo 3 32B 与 Qwen3 32B 的并排对比。

总体上,架构相同,只是放大了规模。各部分比例,例如前馈层从输入到中间维度的扩展,也与 Qwen3 大致一致。

英文原文 36

309 词 · 4 张图

My guess is the architecture was initially somewhat smaller than Qwen3 due to the smaller vocabulary, and they then scaled up the intermediate size expansion from 5x in Qwen 3 to 5.4 in Olmo 3 to have a 32B model for a direct comparison.

Also, note that the 32B model uses grouped query attention.

Perhaps a last small detail is that Olmo 3 uses YaRN for context extension for the supported context length of 64k, but only for the global (non-sliding-window-attention) layers. (YaRN is essentially a careful RoPE rescaling technique, which helps preserve model quality better at long context sizes.)

In Qwen3, YaRN is optional to extend the native context from 32k tokens to 131k tokens.

If you are interested in additional architecture details, I implemented Olmo 3 from scratch in a standalone notebook here.

16. DeepSeek V3.2

This article started with DeepSeek V3, which was released back in December 2024. There have been multiple DeepSeek releases back then, but I largely skipped them as they were not big flagship-model releases like DeepSeek V3 and DeepSeek R1.

Figure 47: A timeline of the DeepSeek model releases since DeepSeek V3. The main models are shown in red.

However, DeepSeek V3.2 was a really big release as it is on par with the current GPT-5.1 and Gemini 3.0 Pro models on certain benchmarks.

The architecture is overall similar to DeepSeek V3 but they added a sparse attention mechanism to improve efficiency.

Figure 48: The DeepSeek model architecture with multi-head latent and sparse attention.

I originally planned to write a short section about DeepSeek V3.2 for this article, but it turned into a >5000 word write-up, so I moved it to a separate article, which I linked below:

中文译文 36

412 字

我猜,由于词表更小,它起初的架构规模略小于 Qwen3;为了得到可直接对比的 32B 模型,团队随后将中间维度扩展倍数从 Qwen3 的 5 倍提高到 Olmo 3 的 5.4 倍。

另外,32B 模型使用分组查询注意力。

最后一个小细节是,Olmo 3 用 YaRN 扩展到支持的 64k 上下文,但只用于全局、非滑动窗口注意力层。YaRN 本质上是精细调整 RoPE 缩放的技术,有助于更好地保持长上下文下的模型质量。 [1]

Qwen3 则可选用 YaRN,将原生 32k token 上下文扩展到 131k。

如果你想了解更多架构细节,我在这里的独立 notebook 中从零实现了 Olmo 3。 [1]

图 46:从零实现 Olmo 3。 [1]

16. DeepSeek V3.2

本文从 2024 年 12 月发布的 DeepSeek V3 开始。此后有过多次 DeepSeek 发布,但我大多略过了,因为它们不像 DeepSeek V3、R1 那样属于大型旗舰发布。

图 47:DeepSeek V3 以来的模型发布时间线,主要模型以红色标出。

但 DeepSeek V3.2 是一次重要发布:在某些基准上,它与当时的 GPT-5.1、Gemini 3.0 Pro 不相上下。

整体架构与 DeepSeek V3 相似,但增加了稀疏注意力机制以提高效率。

图 48:带有多头潜在注意力与稀疏注意力的 DeepSeek 架构。

我原计划在这里简短介绍 V3.2,结果写成了超过 5000 个英文词的长文,因此移到另一篇文章,链接如下:

英文原文 37

379 词 · 1 张图

17. Mistral 3

On December 2, 2025, one day after the DeepSeek V3.2 release, the Mistral team released their new Mistral 3 model suite. This includes three smaller dense models (3B, 8B, and 14B) under the Ministral 3 name, as well as their new Mistral 3 Large flagship model, which is a 675B parameter MoE (with 41B parameters active). More specifically, the Mistral 3 Large model consists of

  • An MoE Language Model with 673B params and 39B active

  • A 2.5B Vision Encoder

(Since this article focuses on the LLM aspects, we will ignore the vision encoder in this section. I should perhaps update my multimodal LLMs article sometime, though.)

First, it’s interesting to note that it’s Mistral’s first MoE since Mixtral in 2023 (earlier in this article, I wrote that Mistral abandoned MoEs, and DeepSeek V3 last year ushered in an MoE revival).

The release blog article says that all model sizes come in base, instruct, and reasoning variants, which is nice. However, their reasoning version of their 675B model is not available yet.

Another interesting tidbit is that Mistral partnered with NVIDIA here to optimize tokens/sec throughput on Blackwell chips, according to their announcement. This is nice because it means the Ministral models will run a bit faster than comparable models on my little DGX Spark (I still have to test this).

Besides the token/sec speed advantage of Mistral 3, based on quality benchmarks, though their smaller models, Ministral, look on par with Qwen3. The larger flagship model is on par with DeepSeek V3.1.

Since the release of Mistral 3 was just one day after DeepSeek V3.2’s release, they didn’t include any V3.2 comparisons in their article (except for the LMArena Elo score, where DeepSeek V3.2 is slightly ahead with 1423 vs 1418).

Unfortunately, it’s not possible to do an apples-to-apples comparison right now, because Mistral 3 Large currently doesn’t have a reasoning model, and DeepSeek V3.2 didn’t share the benchmark results for their non-thinking mode, but in case you are curious, I overlaid the DeepSeek V3.2-Thinking numbers (from the DeepSeek V3.2 report) with the Mistral 3 Large benchmark chart.

Figure 49: Mistral 3 Large benchmarks from the Mistral 3 announcement, with the DeepSeek V3.2 results (from the DeepSeek V3.2 paper) overlayed on top of it.

中文译文 37

465 字

17. Mistral 3

2025 年 12 月 2 日,即 DeepSeek V3.2 发布次日,Mistral 团队推出了新 Mistral 3 系列:包括名为 Ministral 3 的三款小型稠密模型,规模为 3B、8B、14B;以及旗舰 Mistral 3 Large,为 6750 亿总参数、410 亿活跃参数的 MoE。具体而言,Mistral 3 Large 包含: [1]

  • 一个总参数 6730 亿、活跃参数 390 亿的 MoE 语言模型。

  • 一个 25 亿参数的视觉编码器。

(本文关注大模型的语言部分,因此本节忽略视觉编码器。不过,我或许该找时间更新多模态大模型的那篇文章。) [1]

首先值得注意,这是 Mistral 自 2023 年 Mixtral 以来首款 MoE。前文曾提到它放弃了 MoE,而去年的 DeepSeek V3 引领了 MoE 复兴。

发布博客说,所有规模都提供基础、指令和推理版本,这很好。但其 6750 亿参数模型的推理版尚未开放。

另一个有趣细节是,据公告,Mistral 与 NVIDIA 合作优化了 Blackwell 芯片上的每秒 token 吞吐量。这很好,意味着 Ministral 在我的小型 DGX Spark 上会比同类模型快一些;我还需要实际测试。 [1]

除 Mistral 3 每秒 token 的速度优势外,从质量基准看,其小型 Ministral 模型似乎与 Qwen3 相当,大型旗舰则与 DeepSeek V3.1 相当。

Mistral 3 仅比 DeepSeek V3.2 晚一天发布,因此发布文章未比较 V3.2;唯一例外是 LMArena Elo,DeepSeek V3.2 以 1423 分略高于 1418 分。

遗憾的是,目前无法公平比较:Mistral 3 Large 尚无推理模型,DeepSeek V3.2 也未公布非思考模式的基准结果。不过,如果你好奇,我把 DeepSeek V3.2 报告中的 Thinking 成绩叠加到了 Mistral 3 Large 基准图上。 [1]

图 49:Mistral 3 发布公告中的 Large 基准图,叠加了 DeepSeek V3.2 论文中的结果。 [1] [2]

英文原文 38

387 词 · 1 张图

Looking at the Mistral Large 3 Instruct model with the DeepSeek V3.2-Thinking model next to it (numbers are from the DeepSeek V3.2 paper), the V3.2-Thinking model is obviously much better. So, I am staying tuned for the Mistral 3 Large Thinking release and look forward to seeing the updated plot!

So, right now, I would say that, thanks to the optimizations, Mistral 3 Large is a great candidate for cost-effective, low-latency deployments. DeepSeek V3.2-Thinking is great if you want to maximize answer quality. Another selling point of Mistral 3 Large is that it offers multimodal support as well (DeepSeek V3.2 is text-only).

By the way, my focus on DeepSeek V3.2 here in this section comes from the fact that the models were released so close to each other, within a day of each other. Plus, they have an almost identical size, 671B and 673B, which makes for an interesting comparison!

Unfortunately, there is no technical report. that contains more information about the model development. However, since it’s an open-weight model, we do have the model weights on Hugging Face hub to analyze, though. So, let’s take a closer look at Mistral 3 Large.

As it turns out, Mistral 3 Large is exactly the same architecture as DeepSeek V3 and V3.1! The only difference is that they increased the size of the experts by a factor of 2 while decreasing the number of experts by the same factor.

Figure 50: DeepSeek V3 and Mistral 3 Large side by side.

However, while it’s effectively the same architecture, it is likely the Mistral team trained Mistral 3 from scratch rather than initializing it from DeepSeek V3 and further training it, because Mistral uses its own tokenizer.

Next to Kimi K2, Mistral 3 is now the second model series to use the DeepSeek V3 architecture. However, where the Kimi K2 team scaled up the model size from 671B to 1 trillion, the Mistral 3 team only changed the expert size ratio and added a vision encoder for multimodal support. But yes, why not? I think DeepSeek V3 is a pretty solid architecture design, plus it has these nice MoE and MLA efficiency aspects to it. So, why change what ain’t broke? A lot of the secret sauce these days is in the training pipeline as well as the inference scaling strategies.

中文译文 38

431 字

将 Mistral Large 3 Instruct 与 DeepSeek V3.2-Thinking 并排看,后者明显更好,数据来自 DeepSeek V3.2 论文。因此,我会继续关注 Mistral 3 Large Thinking 发布,期待看到更新后的图表!

目前我会认为,受益于这些优化,Mistral 3 Large 很适合高性价比、低延迟部署;若想最大化回答质量,DeepSeek V3.2-Thinking 很出色。Mistral 3 Large 的另一卖点是多模态支持,而 DeepSeek V3.2 仅支持文本。

顺便说明,本节着重比较 DeepSeek V3.2,是因为两者发布只相差一天,而且规模几乎相同,分别为 671B 和 673B,因此很值得比较!

遗憾的是,没有技术报告进一步说明模型开发过程。不过,它是开放权重模型,我们仍可分析 Hugging Face Hub 上的权重。下面仔细看看 Mistral 3 Large。 [1]

结果发现,Mistral 3 Large 与 DeepSeek V3、V3.1 的架构完全相同!唯一区别是,专家尺寸加倍,同时专家数量减半。

图 50:DeepSeek V3 与 Mistral 3 Large 的并排对比。

虽然架构实质相同,Mistral 团队很可能从零训练了 Mistral 3,而非从 DeepSeek V3 初始化后继续训练,因为它使用自己的分词器。

继 Kimi K2 后,Mistral 3 成为第二个采用 DeepSeek V3 架构的模型系列。不过,Kimi K2 将规模从 6710 亿扩大到 1 万亿;Mistral 3 只改变专家尺寸比例,并增加视觉编码器支持多模态。何乐而不为?我认为 DeepSeek V3 的架构相当扎实,MoE 与 MLA 又有很好的效率优势,何必改变运行良好的设计?如今许多关键诀窍也在于训练流水线和推理扩展策略。

英文原文 39

365 词 · 2 张图

18. Nemotron 3 Nano and Super

This article is not an exhaustive list of all LLMs out there. To keep it manageable, I am focusing on the main highlights. Here, “highlights” means that they are either very popular, perform very well, or have an interesting architecture component.

That being said, it’s time to finally add one of NVIDIA’s models to this list. NVIDIA just released their newest entry in the Nemotron series, Nemotron 3, on December 15th, 2025. What’s nice about Nemotron is, is that it doesn’t come with just the open weights and a technical report, but NVIDIA also shares the dataset and training code similar to Olmo 3.

According to the announcement article, Nemotron 3 comes in three sizes:

1. Nano (30B-A3B),

2. Super (100B), (later, this was updated to 120B, see section 18.1)

3. and Ultra (500B).

18.1 Nemotron 3 Nano

Architecture-wise, the models are a Mixture-of-Experts (MoE) Mamba-Transformer hybrid architecture. As of this writing (Dec 17), only the Nano model has been released as open-weight model, so the discussion below will focus on it, as illustrated in the figure below.

Figure 51.1: Outline of the Nemotron 3 Nano model, which is a Transformer-Mamba hybrid.

As illustrated above, Nemotron 3 Nano (30B-A3B) is a 52-layer hybrid Mamba-Transformer model that interleaves Mamba-2 sequence-modeling blocks with sparse Mixture-of-Experts (MoE) feed-forward layers, and uses self-attention only in a small subset of layers.

There’s a lot going on in the figure above, but in short, the architecture is organized into 13 macro blocks with repeated Mamba-2 → MoE sub-blocks, plus a few Grouped-Query Attention layers. In total, if we multiply the macro- and sub-blocks, there are 52 layers in this architecture

Regarding the MoE modules, each MoE layer contains 128 experts but activates only 1 shared and 6 routed experts per token.

The Mamba-2 layers would take a whole article itself to explain (perhaps a topic for another time). But for now, conceptually, you can think of them as similar to the Gated DeltaNet approach that Qwen3-Next and Kimi-Linear use, which I introduced above. You can also read more about it in my other Beyond Standard LLMs article:

中文译文 39

434 字

18. Nemotron 3 Nano 与 Super

本文并非穷举所有大模型。为控制篇幅,我只关注主要亮点;“亮点”是指非常热门、表现很好,或者包含有趣架构组件的模型。

现在终于该把 NVIDIA 的模型纳入了。NVIDIA 于 2025 年 12 月 15 日发布了 Nemotron 系列最新成员 Nemotron 3。它的好处是,除了开放权重和技术报告,还像 Olmo 3 一样公开数据集与训练代码。 [1] [2] [3] [4]

根据发布公告,Nemotron 3 有三种规模: [1]

1. Nano(30B-A3B);

2. Super(100B);后来更新为 120B,见第 18.1 节。

3. Ultra(500B)。

18.1 Nemotron 3 Nano

从架构看,这些模型是混合专家(MoE)与 Mamba—Transformer 的混合架构。截至本段写作时,即 12 月 17 日,只有 Nano 已开放权重,因此下面重点讨论它,如下图所示。

图 51.1:Nemotron 3 Nano 的架构概览,它是 Transformer—Mamba 混合模型。

如图所示,Nemotron 3 Nano(30B-A3B)是一个 52 层的 Mamba—Transformer 混合模型:Mamba-2 序列建模块与稀疏 MoE 前馈层交错,仅少数层使用自注意力。图中细节很多,简而言之,它组织为 13 个宏块,重复 Mamba-2 → MoE 子块,并穿插少量 GQA 层。将宏块与子块数量相乘,架构共 52 层。 [1]

每个 MoE 层有 128 个专家,但对每个 token 只激活 1 个共享专家和 6 个路由专家。

Mamba-2 本身值得整篇文章解释,或许留待以后。目前可先在概念上将其理解为类似前面介绍的 Qwen3-Next、Kimi Linear 所用 Gated DeltaNet 的方法。更多内容也可参考我的《Beyond Standard LLMs》:

英文原文 40

325 词 · 1 张图

The similarity between Gated DeltaNet and Mamba-2 layers is that both replace standard attention with a gated-state-space update. The idea behind this state-space-style module is that it maintains a running hidden state and mixes new inputs via learned gates. In contrast to attention, it scales linearly instead of quadratically with the input sequence length.

What’s actually quite exciting about this architecture is its really good performance compared to pure transformer architectures of similar size, while achieving much higher tokens-per-second throughput.

Overall, this is an interesting direction, even more extreme than Qwen3-Next and Kimi-Linear in its use of only a few attention layers. However, one of the strengths of the transformer architecture is its performance at a (really) large scale. I am curious to see how Nemotron 3 Super and especially Ultra will compare to the likes of DeepSeek V3.2.

18.2 Nemotron 3 Super

On March 11, 2026, NVIDIA now also released the 120B Super version as open-weight models on the Hugging Face Hub alongside a nice new “Super”-focused technical report.

Compared to the Nano model, besides scaling the architecture, there are two main modifications to the architecture.

First Nemotron 3 Super uses Multi-Token Prediction (MTP), which is a technique that trains the LLM to predict multiple future tokens at each step, rather than a single one.

Instead of training the model only with the standard next-token objective, MTP also trains it to predict multiple future token offsets from the same position. This provides a richer training signal and, according to the Super report, improves both modeling quality and inference efficiency.

Figure 51.2: Multi-Token Prediction versus regular next token prediction. (Left subfigure inspired by the MTP paper.) Originally, MTP was only used during training, not inference; hence, the inference time steps (bottom) show a single next-token prediction.

A key difference from the standard uses of MTP (which I've drawn in figure 51.2 above) is that Nemotron 3 Super does not use it only during training.

中文译文 40

444 字

Gated DeltaNet 与 Mamba-2 的相似点在于,两者均用门控状态空间更新替代标准注意力。这类状态空间式模块维护一个持续更新的隐藏状态,通过学得的门混入新输入。与注意力相比,其成本随输入序列长度线性增长,而非平方增长。

这一架构真正令人兴奋的,是相较同规模纯 Transformer,它既有很好的表现,每秒 token 吞吐量又高得多。

总体而言,这是有趣的方向。它只使用极少量注意力层,比 Qwen3-Next 和 Kimi Linear 更为极端。但 Transformer 的优势之一,是在极大规模下的表现。我很好奇 Nemotron 3 Super,尤其是 Ultra,将如何与 DeepSeek V3.2 等模型竞争。

18.2 Nemotron 3 Super

2026 年 3 月 11 日,NVIDIA 也在 Hugging Face Hub 开放了 120B Super 版的权重,并发布了一份专门介绍 Super 的新技术报告。 [1] [2]

相比 Nano,除扩大规模外,架构主要有两处修改。

首先,Nemotron 3 Super 使用多 token 预测(MTP):训练模型在每个步骤预测多个未来 token,而非一个。 [1]

MTP 不只用标准下一 token 目标训练,而是让模型从同一位置预测多个未来偏移位置。这提供了更丰富的训练信号;据 Super 报告,能同时提高建模质量和推理效率。

图 51.2:多 token 预测与常规下一 token 预测的对比,左图受 MTP 论文启发。最初 MTP 仅用于训练、不用于推理,因此下方推理时间步展示的是单个下一 token 预测。 [1]

与我在上方图 51.2 绘制的标准 MTP 用法相比,一个关键区别是:Nemotron 3 Super 不只在训练中使用 MTP。

英文原文 41

356 词 · 3 张图

The Nemotron 3 Super explicitly uses MTP at inference time as well, where the shared-weight MTP head acts as an internal draft model for native speculative decoding. During generation, the model can then propose candidate continuations and then verify them with the main model. This reduces inference latency without needing a separate external draft model.

Since this is not quite standard MTP, it is perhaps more accurate to describe Nemotron 3 Super as using shared-weight MTP for speculative decoding than to call it something like “MTP-3” like in other architectures (like Step 3.5 Flash, which I covered here).

The second main difference compared to Nano is that the Super architecture uses latent experts, meaning that the experts operate in latent space (the inputs to the MoE layer are down-projected from 4096 to 1024 dimensions, the experts are applied, and then the outputs are up-projected back from 1024 to 4096 dimensions.

Figure 51.3: Nemotron 3 Super 120B-A12B with latent MoE layers, multi-token prediction, and the Mamba-2 hybrid attention approach.

Benchmark-wise Nemotron 3 Super is on par with Qwen3.5 122B-A10B and GPT-OSS 120B, but the throughput, thanks to the aforementioned “tricks” (MTP, latent MoE, and hybrid attention) is great: 2x faster than Qwen3.5 122B-A10B and (regarding the NVFP4 version) 2.2x faster than GPT-OSS 120B.

Figure 51.4: Nemotron 3 Super benchmark comparison from the Hugging Face Hub page.

19. Xiaomi MiMo-V2-Flash

There’s been another impressive entry in December 2025. Xiaomi released their newest Xiaomi MiMo-V2-Flash with impressive benchmark performance matching DeepSeek V3.2, while only having half the parameters and being faster in inference. It’s a 309B Mixture-of-Experts (MoE) model with 15 active parameters per token.

Interestingly, it uses sliding window attention (SWA) in a 5:1 ratio with global (regular) attention, similar to Gemma 3 (see section 3). However, it uses a much more aggressive sliding window size (128) that is 8 times smaller than Gemma 3 (1024).

Figure 52: Xiaomi MiMo-V2-Flash compared to DeepSeek V3.2, which has similar benchmark performance.

Based on my knowledge, this is the largest sliding window attention model to date.

Additionally, the Xiaomi model uses multi-token prediction (MTP), as described earlier in section 12.3.

中文译文 41

461 字

它也明确在推理中使用 MTP,共享权重的 MTP 预测头充当内部草稿模型,实现原生推测解码。生成时,模型先提出候选续写,再由主模型验证,从而无需单独的外部草稿模型,也能降低推理延迟。

由于这不完全是标准 MTP,将它描述为“使用共享权重 MTP 的推测解码”,可能比沿用其他架构的“MTP-3”等叫法更准确;例如,我在这里介绍过的 Step 3.5 Flash。 [1]

第二个主要区别是,Super 使用潜在专家:专家在潜在空间工作。MoE 输入先从 4096 维降投影到 1024 维,再应用专家,最后将输出从 1024 维升投影回 4096 维。

图 51.3:Nemotron 3 Super 120B-A12B,包含潜在 MoE 层、多 token 预测与 Mamba-2 混合注意力。

基准测试上,Nemotron 3 Super 与 Qwen3.5 122B-A10B、GPT-OSS 120B 相当,但得益于前述 MTP、潜在 MoE 和混合注意力这些“技巧”,吞吐量很好:达到 Qwen3.5 122B-A10B 的 2 倍;NVFP4 版达到 GPT-OSS 120B 的 2.2 倍。

图 51.4:来自 Hugging Face Hub 页面的 Nemotron 3 Super 基准对比。 [1]

19. Xiaomi MiMo-V2-Flash

2025 年 12 月还有一款出色模型:小米发布了最新的 Xiaomi MiMo-V2-Flash,基准表现可媲美 DeepSeek V3.2,参数却只有约一半,推理也更快。它是一个 3090 亿参数的 MoE 模型,每个 token 有 15 个活跃参数。

有趣的是,它与 Gemma 3 类似(见第 3 节),以 5∶1 混合滑动窗口注意力和全局常规注意力。但窗口更激进,仅为 128,比 Gemma 3 的 1024 小 8 倍。

图 52:Xiaomi MiMo-V2-Flash 与基准表现相近的 DeepSeek V3.2 对比。

据我所知,这是截至当时规模最大的滑动窗口注意力模型。

此外,小米模型也使用第 12.3 节介绍的 MTP。

英文原文 42

286 词 · 2 张图

20. Arcee AI Trinity Large

It’s been a while since the last LLM architecture addition. On January 27, Arcee AI (a company I hadn’t had on my radar up to then) began releasing versions of their open-weight 400B Trinity Large LLMs on the model hub, along with two smaller variants.

Their flagship large model is a 400B param MoE (13B active params). The two smaller variants are Trinity Mini (26B with 3B active parameters) and Trinity Nano (6B with 1B active parameters).

Figure 53: Overview of the Trinity Large architecture (based on the model hub config file).

Along with the model weights, Arcee AI also released a nice technical report with lots of details.

So, let’s take a closer look at the 400B flagship model. The figure below compares it to the previously discussed GLM 4.5 (section 11), which is perhaps the most similar and is also relatively small. Also, the Trinity technical report showed that the modeling performance of the Trinity Large and GLM-4.5 base models are practically identical (I assume they didn’t compare it to more recent base models because many companies only share their fine-tuned models these days.)

Figure 54: Arcee AI Trinity Large next to GLM 4.5 of a relatively similar size (400B vs 355B).

But as we can see, there are several interesting architectural components added to the Trinity model.

First, there are the alternating local:global (sliding window) attention layers like in Gemma 3, Olmo 3, Xiaomi MiMo, etc., earlier. But instead of using the common 5:1 ratio that Gemma 3 and Xiaomi used, they opted for a 3:1 ratio similar to Olmo 3, and a relatively large sliding window size of 4096 (also similar to Olmo 3).

中文译文 42

372 字

20. Arcee AI Trinity Large

距离上次新增架构已过了一段时间。1 月 27 日,Arcee AI——此前我还未关注的一家公司——开始在 Model Hub 发布其开放权重的 400B Trinity Large 大模型版本,以及两款更小的模型。 [1]

旗舰 Large 是 4000 亿总参数、130 亿活跃参数的 MoE。较小的两款分别为 Trinity Mini,260 亿总参数、30 亿活跃参数;以及 Trinity Nano,60 亿总参数、10 亿活跃参数。

图 53:Trinity Large 架构概览,基于 Model Hub 配置文件。 [1]

除模型权重外,Arcee AI 还发布了一份包含大量细节的优秀技术报告。 [1]

下面细看 400B 旗舰模型。下图将其与第 11 节介绍的 GLM-4.5 比较,后者可能最相似,规模也相对较小。Trinity 技术报告还显示,两者基础模型的建模表现几乎相同。我猜之所以未与更新的基础模型比较,是因为如今许多公司只分享微调后的模型。

图 54:规模相近的 Arcee AI Trinity Large 与 GLM-4.5 并排对比,分别为 400B 和 355B。

不过可以看到,Trinity 增加了几个有趣的架构组件。

首先,与前面的 Gemma 3、Olmo 3、Xiaomi MiMo 等一样,它交替使用局部滑动窗口和全局注意力。但它未采用 Gemma 3、小米常用的 5∶1,而是像 Olmo 3 一样采用 3∶1,窗口也相对较大,为 4096,同样类似 Olmo 3。

英文原文 43

280 词 · 1 张图

In addition to QK-Norm (covered in section 2, Olmo 2), they use NoPE in the global layers (we discussed NoPE in section 7, SmolLM3).

They also have a form of gated attention. They don’t have the full-blown GatedDeltaNet (discussed in section 12) but use a similar gating as in the attention mechanism in Qwen3-Next.

But they modified the standard attention by adding elementwise gating to the scaled dot-product before the output linear projection (as shown in the figure below), which reduces attention sinks and improves long-sequence generalization. Additionally, it also helped with training stability.

Figure 55: Illustration of the gating mechanism that Trinity Large uses in the attention mechanism.

You may have noticed the use of four (instead of two) RMSNorm layers in the previous Trinity Large architecture figure. This is their so-called depth-scaled sandwich norm, which is based on previous work but something I haven’t seen before in major architectures. Overall, it looks like a Gemma 3-like RMSNorm placement, but the twist here is that the gain of the second RMSNorm (in each block) is depth-scaled, meaning it’s initialized to about 1 / sqrt(L) (with L the total number of layers). So, early in training, the residual update starts small and grows as the model learns the right scale.

The MoE is a DeepSeek-like MoE with lots of small experts, but made it coarser as that helps with inference throughput (something we have also seen in Mistral 3 Large when they adopted the DeepSeek V3 architecture).

Lastly, there are some interesting details on the training improvements (a new MoE load-balancing strategy and another using the MuOpt optimizer), but since this is an architecture post, these are out of scope.

中文译文 43

366 字

除第 2 节 OLMo 2 中介绍的 QK-Norm 外,它还在全局层使用 NoPE;第 7 节 SmolLM3 已讨论过 NoPE。

它还采用一种门控注意力。并非第 12 节介绍的完整 GatedDeltaNet,而是使用类似 Qwen3-Next 注意力机制的门控。

其修改是在输出线性投影前,对缩放点积的结果增加逐元素门控,如下图所示。这减少了注意力汇聚现象、改善长序列泛化,也有助于训练稳定。

图 55:Trinity Large 在注意力中使用的门控机制示意。

你可能注意到,前面的 Trinity Large 架构图用了 4 层 RMSNorm,而非 2 层。这叫作深度缩放的夹心归一化,基于既有研究,但我此前未在主要架构中见过。总体布局类似 Gemma 3,区别在于每个块中第二个 RMSNorm 的增益按深度缩放,初始化约为 1/√L,其中 L 是总层数。因此,训练初期残差更新较小,随后随着模型学得合适尺度而增长。

其 MoE 类似 DeepSeek,拥有大量小专家,但粒度更粗,因为有利于推理吞吐量;Mistral 3 Large 采用 DeepSeek V3 架构时,我们也见过类似变化。

最后,训练改进还有一些有趣细节:一种新的 MoE 负载均衡策略,以及使用 MuOpt 优化器的另一项改进。但本文讨论架构,这些不在范围内。

英文原文 44

288 词 · 1 张图

21. GLM-5

Chinese New Year has become a surprisingly reliable window for strong open-weight releases. For example, GLM-4 and Qwen 1.5 were released in January and February 2024, and DeepSeek R1 and Qwen 2.5 were released in 2025.

This year, z.AI (Zhipu AI) kicked things off (again relatively early) with GLM-5 on February 11, 2026, approximately a week before the Lunar New Year on February 17.

Compared to the GLM-4.5 model I covered earlier in this article (see section 11, released in summer 2025), its GLM-5 successor is twice the size: up from 355B parameters to 744B, pushing it into the territory between DeepSeek-V3.2 and Kimi K2.

Similar to GLM-4.5, GLM-5 is a Mixture-of-Experts (section 1.2) model, and the number of active parameters per token is only increased slightly: 40B in GLM-5 versus 32B in GLM-4.5.

Figure 56: Architecture of GLM-5 and GLM-4.5 side by side.

Interestingly, as shown in Figure 56 above, GLM-5 adopts DeepSeek’s multi-head latent attention (MLA, see section 1.1) as well as DeepSeek Sparse Attention (which I covered in more detail in my DeepSeek V3.2 article). The motivation for these modifications is to reduce the inference cost when working with long contexts.

Other than that, the architecture is relatively similar. The increased size is mainly due to having more experts (256 instead of 160) and slightly increasing the layer sizes. For instance, the embedding dimension and expert size are now 6,144 (up from 5,120), and the intermediate projection size is also slightly up from 1,536 to 2,048. Interestingly, the number of layers (transformer blocks) is reduced from 92x to 78x. I am assuming this is to reduce inference costs and make the model faster (because layer depth can’t be parallelized).

中文译文 44

320 字

21. GLM-5

春节前后竟成了高质量开放权重模型相当稳定的发布窗口。例如,GLM-4、Qwen 1.5 于 2024 年 1—2 月发布,DeepSeek R1、Qwen 2.5 则于 2025 年发布。

今年,z.AI,也就是智谱 AI,再次较早于 2026 年 2 月 11 日发布 GLM-5,距离 2 月 17 日农历新年约一周。

相比第 11 节介绍、2025 年夏发布的 GLM-4.5,后继 GLM-5 的规模约翻倍,从 355B 增至 744B,处于 DeepSeek-V3.2 与 Kimi K2 之间。

GLM-5 与 GLM-4.5 一样是 MoE(见第 1.2 节),但每个 token 的活跃参数只略增:从 320 亿增至 400 亿。

图 56:GLM-5 与 GLM-4.5 的并排架构对比。

有趣的是,上方图 56 显示,GLM-5 采用了 DeepSeek 的 MLA(见第 1.1 节)和 DeepSeek 稀疏注意力;后者我在 DeepSeek V3.2 专文中详述过。这些调整旨在降低长上下文推理成本。 [1]

其余架构相对相似。规模增长主要来自更多专家,从 160 增至 256,以及层尺寸略增。例如,嵌入维度与专家尺寸从 5120 增至 6144,中间投影维度也从 1536 略增至 2048。有趣的是,Transformer 块数从 92 降到 78。我猜这是为了降低推理成本、加快模型,因为层的深度无法并行化。

英文原文 45

306 词 · 2 张图

I usually don’t include benchmarks here since this article is focused on the architecture. If I were to include training details and evaluations, this article would grow way out of scope and length. That being said, I saw that I included the GLM-4.5 benchmark back in July 2025, so I will make another exception here, because the benchmarks look truly impressive and on par with all major flagship LLM offerings (GPT-5.2 extra-high, Gemini Pro 3, and Claude 4.6 Opus). But again, it’s worth highlighting that benchmark performance isn’t necessarily equal to real-world performance.

Figure 57: GLM architectures next to benchmarks. The GLM-4.7 architecture is similar to GLM-4.5. The benchmarks are taken from the GLM-5 release blog post: https://z.ai/blog/glm-5

22. More February 2026 Releases: from Kimi K2.5 to Tiny Aya

In total, there have been 10 interesting open-weight LLM releases between January and February 2026:

  1. Arcee AI’s Trinity Large (Jan 27, 2026)

  2. Moonshot AI’s Kimi K2.5 (Jan 27, 2026)

  3. StepFun Step 3.5 Flash (Feb 1, 2026)

  4. Qwen3-Coder-Next (Feb 3, 2026)

  5. z.AI’s GLM-5 (Feb 12, 2026)

  6. MiniMax M2.5 (Feb 12, 2026)

  7. Nanbeige 4.1 3B (Feb 13, 2026)

  8. Qwen 3.5 (Feb 15, 2026)

  9. Ant Group’s Ling 2.5 1T & Ring 2.5 1T (Feb 16, 2026)

  10. Cohere’s Tiny Aya (Feb 17, 2026)

  11. Sarvam 30B and 105B (Mar 6, 2026)

I covered Arcee AI’s Trinity Large and z.AI’s GLM-5 in sections 19 and 20 above. However, since there was a lot of content to cover for the January-February time period, I wrote a standalone article with more information about the 10 architectures listed above here:

A Dream of Spring for Open-Weight LLMs: 10 Architectures from Jan-Feb 2026

A Dream of Spring for Open-Weight LLMs: 10 Architectures from Jan-Feb 2026

If you have struggled a bit to keep up with open-weight model releases this month, this article should catch you up on the main themes.

中文译文 45

393 字

本文侧重架构,我通常不列基准。若加入训练与评估细节,范围和篇幅都会大幅膨胀。但既然 2025 年 7 月已列 GLM-4.5 的基准,这里再破例一次,因为成绩确实出色,媲美 GPT-5.2 extra-high、Gemini Pro 3、Claude 4.6 Opus 等主要旗舰。不过仍应强调,基准表现未必等于真实场景表现。

图 57:GLM 架构与基准测试并列展示。GLM-4.7 的架构类似 GLM-4.5。基准来自 GLM-5 发布博客:https://z.ai/blog/glm-5

22. 2026 年 2 月更多发布:从 Kimi K2.5 到 Tiny Aya

2026 年 1 月到 2 月,共有 10 项值得关注的开放权重大模型发布:

  1. Arcee AI Trinity Large(2026 年 1 月 27 日)

  2. Moonshot AI Kimi K2.5(2026 年 1 月 27 日)

  3. 阶跃星辰 Step 3.5 Flash(2026 年 2 月 1 日)

  4. Qwen3-Coder-Next(2026 年 2 月 3 日)

  5. z.AI GLM-5(2026 年 2 月 12 日)

  6. MiniMax M2.5(2026 年 2 月 12 日)

  7. Nanbeige 4.1 3B(2026 年 2 月 13 日)

  8. Qwen 3.5(2026 年 2 月 15 日)

  9. 蚂蚁集团 Ling 2.5 1T 与 Ring 2.5 1T(2026 年 2 月 16 日)

  10. Cohere Tiny Aya(2026 年 2 月 17 日)

  11. Sarvam 30B 与 105B(2026 年 3 月 6 日)

我在上面的第 19、20 节介绍了 Arcee AI Trinity Large 与 z.AI GLM-5。不过,1—2 月内容很多,因此另写了一篇专文,进一步介绍上述 10 种架构:

开放权重大模型的春之梦:2026 年 1—2 月的 10 种架构

A Dream of Spring for Open-Weight LLMs: 10 Architectures from Jan-Feb 2026

如果你本月有些跟不上开放权重模型的发布,这篇文章能帮你掌握主要脉络。

英文原文 46

310 词 · 2 张图

23. Gemma 4

After the Nemotron 3 Super release in March, the rest of the month was relatively quiet for flagship open-weight model releases. While I am still waiting for DeepSeek-V4, April at least brought us Google’s Gemma 4.

Architecture-wise, Gemma 4 (31B) looks pretty much unchanged compared to Gemma 3 (27B), as illustrated in the figure below.

Figure 58: Gemma 3 (27B) and Gemma 4 (31B) side by side.

(Note that Gemma 4 also has multimodal model support now, but I will leave the image encoder part for a separate article in the future; here, we only focus on the text portion.)

As we can see in the figure above, Gemma 4 maintains a relatively unique Pre- and Post-norm setup and remains relatively classic, with a 5:1 hybrid attention mechanism combining a sliding-window (local) layer and a full-attention (global) layer. The attention mechanism itself is also classic Grouped Query Attention (GQA).

However, a small change over Gemma 3, which is easy to overlook, is that for the global (full) attention layers they reuse the keys in the attention mechanism. I.e., they set values = keys, which should result in further KV cache size reduction.

Furthermore, Gemma 4 also uses p-RoPE, where only 25% of the frequency pairs get positional information. This helps with reducing positional noise in long-context situations.

But let’s not be fooled by the lack of big(ger) architectural changes. Looking at the benchmarks, Gemma 4 is a huge leap from Gemma 3! For instance, on the AI Arena Leaderboard, Gemma 4 (31B) ranks similarly to the much larger Qwen3.5-397B-A17B model. But as I discussed in my model evaluation article (linked below), arena scores are a bit problematic as they can be gamed and are biased towards human (style) preference.

中文译文 46

400 字

23. Gemma 4

3 月 Nemotron 3 Super 发布后,当月余下时间的旗舰开放权重模型发布相对平静。我还在等待 DeepSeek-V4,不过 4 月至少带来了 Google Gemma 4。

从架构看,Gemma 4(31B)相比 Gemma 3(27B)几乎没变,如下图所示。

图 58:Gemma 3(27B)与 Gemma 4(31B)的并排对比。

(Gemma 4 现在也支持多模态,但图像编码器留待以后另写文章,这里只讨论文本部分。)

可以看到,Gemma 4 保持了相对独特的前置与后置归一化布局,整体仍相当经典:采用 5∶1 的混合注意力,结合局部滑动窗口层与全局完整注意力层,注意力本身仍是经典 GQA。

但有一个相比 Gemma 3 容易忽视的小变化:全局完整注意力层复用了键,即设置 values = keys,这应能进一步缩小 KV 缓存。

此外,Gemma 4 也使用 p-RoPE,只有 25% 的频率对注入位置信息,这有助于减少长上下文中的位置噪声。

不过,不要因架构变化不大就低估它。基准显示,Gemma 4 相比 Gemma 3 有巨大进步!例如,在 AI Arena 排行榜上,31B 的 Gemma 4 与大得多的 Qwen3.5-397B-A17B 排名相近。但正如我在下方链接的模型评估文章中所说,竞技场分数存在问题:可能被针对性操纵,也偏向人类对风格的偏好。 [1]

英文原文 47

322 词 · 5 张图

However, if we look at some other common benchmarks, which I plotted below, we can see that it’s indeed a very clear leap over Gemma 3 and ranks on par with Qwen3.5 27B.

Figure 59: Gemma 3 versus Gemma 4 versus Qwen3.5 (the numbers are taken from the Gemma 4 and Qwen3.5 model hub pages).

Note that there is also a Mixture-of-Experts (MoE) Gemma 4 variant, which is illustrated below next to a Qwen3 model of similar size.

Figure 60: Qwen3 Coder Flash compared to Gemma 4 MoE.

As the figure above shows, the approaches are relatively similar except that Gemma 4 uses the unique Pre- and Post-norm placement discussed earlier.

Benchmark-wise, the Gemma 4 MoE variant, which has 4B parameters less in total than the Gemma 4 (31B) dense variant, the performances are relatively similar.

Figure 61: Gemma 4 MoE (26B-A4B) is only slightly worse than Gemma 4 (31) dense.

If you are interested in a visual overview of all the architectures covered here, I put together an LLM Architecture Gallery here.

After all these years, LLM releases remain exciting, and I am curious to see what’s next!


This magazine is a personal passion project, and your support helps keep it alive.

If you’d like to support my work, please consider my Build a Large Language Model (From Scratch) book or its follow-up, Build a Reasoning Model (From Scratch). (I’m confident you’ll get a lot out of these; they explain how LLMs work in depth you won’t find elsewhere.)

Thanks for reading, and for helping support independent research!

Build a Large Language Model (From Scratch)
Build a Large Language Model (From Scratch) is now available on Amazon. Build a Reasoning Model (From Scratch) is in Early Access at Manning.

If you read the book and have a few minutes to spare, I’d really appreciate a brief review. It helps us authors a lot!

Your support means a great deal! Thank you!

中文译文 47

409 字

不过,看下方绘制的其他常用基准,可以发现它确实明显超过 Gemma 3,与 Qwen3.5 27B 相当。

图 59:Gemma 3、Gemma 4 与 Qwen3.5 对比;数据来自 Gemma 4、Qwen3.5 的 Model Hub 页面。 [1] [2]

注意,Gemma 4 还有一个 MoE 版本,下图将它与规模相似的 Qwen3 模型比较。

图 60:Qwen3 Coder Flash 与 Gemma 4 MoE 的对比。

可以看到,两者方法相对相似,区别是 Gemma 4 使用前述独特的前置与后置归一化布局。

从基准看,Gemma 4 MoE 的总参数比稠密版 Gemma 4(31B)少 40 亿,但表现相对相似。

图 61:Gemma 4 MoE(26B-A4B)只略逊于 Gemma 4(31B)稠密版。

如果你想直观总览本文所有架构,我在这里整理了大模型架构画廊。 [1]

大模型架构画廊:https://sebastianraschka.com/llm-architecture-gallery/ [1]

这么多年过去,大模型发布仍令人兴奋,我很好奇接下来会有什么!


这份杂志是我出于个人热情创办的项目,你的支持让它得以持续。

如果愿意支持我的工作,可以考虑购买《Build a Large Language Model (From Scratch)》或续作《Build a Reasoning Model (From Scratch)》。我相信你会获益良多,它们深入解释大模型如何工作,深度是别处难以找到的。 [1] [2]

感谢阅读,也感谢你支持独立研究!

Build a Large Language Model (From Scratch)
《Build a Large Language Model (From Scratch)》现已在 Amazon 发售;《Build a Reasoning Model (From Scratch)》已在 Manning 开放抢先阅读。 [1] [2]

如果读过书且有几分钟空闲,希望你能写一段简短书评。这对作者帮助很大! [1]

你的支持意义重大!谢谢!

来源与阅读说明

来源为用户提供的完整网页保存件;原始文件和保存图片保留字节,正文完整性针对本地文件。译文由 AI 逐单元翻译,并在后续审校阶段对照原文与实际图片复核,未经过人工全文审校。原文发表日期与正文最后更新日期分别保留。

两处 MathML 公式以带明确括号的线性形式呈现,原始 MathML 同时归档。保存件有一处视频引用,未取得视频文件,也未观看视频;请从原文入口访问。代码按原样保留,未执行。缩略预览的小字不作推测。

作者的主张、建议与基准保留来源归属;本次未逐篇访问外部论文或复现实验。内部不一致写在补充判断中,原文与译文不作静默纠正。章节说明是本文解释,未冒充知识专题入库;公共阅读器采用现行共享组件。