你的专家也有搭档。HOPE 有望让它们保持协作
原题Your Experts Have Partners. There's HOPE for Keeping Them Together
读前速览
HOPE 为混合专家语言模型提出了一种二阶剪枝方法,能够考虑专家之间的成对交互;通过保留协作的专家组而非独立剪除专家,该方法在 50% 剪枝率下实现了更优性能。
一阶剪枝方法无法考虑专家之间的协作
传统专家剪枝方法会使用标量重要性指标独立评估每个专家,但专家会形成稳定的协作组并共同激活。如果移除某个单独看来很重要、但属于协作组的专家,就可能破坏整个协作组的功能,而一阶方法无法识别这一点。
HOPE 使用 F 矩阵捕捉专家之间的成对交互
F 矩阵的对角线元素衡量每个专家的重要性,非对角线元素则反映专家之间的成对协作贡献。每个元素 F_{i,j} 表示在专家 i 和 j 共同激活的 token 上,两者经门控权重加权后的输出乘积均值,使该方法能够在剪枝时保留协作簇。
通过二次规划优化剪枝集合的选择
HOPE 将剪枝建模为在校准集上最小化预期剪枝误差的问题,并将其转化为带有二元约束的二次规划。该问题通过连续松弛和取整求解,每层只需数秒,同时能在保持模型性能的前提下实现最优专家移除。
HOPE 在激进剪枝率下优于基线方法
在 50% 剪枝率下,HOPE 的平均排名为 1.58,而次优方法 REAP 为 2.42;它在智能体编程任务上的提升最高达 +6.1%。在 Qwen3.5-35B-A3B 上,HOPE 在 SWE-Bench Pro 上取得 41.8 分,与未剪枝模型持平,而 REAP 降至 36.2 分。这表明,在多样化的多轮任务中,保留协作结构至关重要。
完整摘要
本文介绍了 HOPE(专家高阶剪枝),这是一种针对混合专家(MoE)语言模型的新型剪枝方法,旨在解决一阶剪枝方法的局限。传统方法会独立评估每个专家,而 HOPE 注意到,专家会形成协作组并共同激活。该方法构建一个 F 矩阵来捕捉专家之间的成对交互,并通过求解二次规划,找出能将剪枝误差降至最低的最优剪枝集合。在使用 Evol-CodeAlpaca 和 SWE-Bench Verified 校准数据集对 Qwen3.5-122B、Qwen3.5-35B 和 GLM-4.5-Air 模型进行评估后,HOPE 在 5 种方法中取得了最佳平均排名(2.07),并在激进的 50% 剪枝率下占据优势;与次优方法相比,它在智能体编程任务上的提升最高达 +6.1%。该方法只需对校准数据进行一次前向传播,每层的二次规划求解也只需数秒,因此具备实际部署可行性。
目录 · 8 节
混合专家语言模型中的专家高阶剪枝 Higher-Order Pruning of Experts in Mixture-of-Experts Language Models
简介 Introduction
混合专家(MoE)模型使最先进的大语言模型(LLM)得以扩展到数千亿参数,但它们存在一个根本且代价高昂的问题:推理时,每个专家 MLP 都必须占用内存,尽管对于任意给定的 token 来说,绝大多数专家都处于闲置状态。例如,Qwen3.5-122B 的 48 个 MoE 层中,每层都有 256 个专家,而其约 250 GB 的参数内存占用中,95% 完全由这些专家 MLP 构成。然而,对于任意给定的 token,每层实际上只会用到 8 个专家。Mixture-of-Experts (MoE) models have enabled state-of-the-art LLMs to be scaled to hundreds of billions of parameters, but they come with a fundamental and costly caveat: every expert MLP must occupy memory at inference time, even though the vast majority are idle for any given token. For example, Qwen3.5-122B has 256 experts in each of its 48 MoE layers, and 95% of its ~250 GB parameter memory footprint is taken up entirely by these expert MLPs alone. However, for any given token, only 8 experts in each layer are actually used.
专家剪枝是解决这一内存瓶颈最直接的方法之一。也就是说,永久删除作用最小的专家。剪枝可以避免动态加载和卸载专家所带来的延迟问题(这些问题会让动态加载和卸载在实际应用中难以实现);它不需要任何训练,而且还能与量化结合。鉴于这些优势以及这一思路本身的简单性,专家剪枝为何会成为缩小混合专家模型(MoE)的常用方法,也就不难理解了。难点在于判断哪些专家可以最安全地移除。Expert pruning is one of the most direct fixes to this memory bottleneck. That is, permanently delete the least useful experts. Pruning avoids the latency issues which make dynamic loading/off-loading of experts impractical; it does not require any training; and it composes with quantization. Given these attractive benefits and the simplicity of the idea, it's easy to see why expert pruning has become a go-to approach for shrinking MoEs. The difficulty lies in deciding which experts are safest to remove.
现有的剪枝方法会独立评估每个专家,根据校准数据集为每个专家分配一个标量重要性分数,并在每一层内分别剪掉重要性最低的专家。这些属于一阶方法,因为它们假设每个专家的贡献与其他专家彼此独立。实际上,专家会形成协作群组。我们在自己的实验中观察到,协同激活的专家会形成稳定的簇;独立研究也表明,专家协作是 MoE 的稳定特性,并且对模型性能十分重要。忽略这些交互会导致剪枝效果欠佳,尤其是在剪枝率较高时。Existing pruning methods score each expert independently, assigning every expert a scalar importance score (based on a calibration dataset), and cutting out the least important experts (in each layer independently). These are first-order methods, because they assume each expert's contribution is independent of all others. In reality, experts form cooperative groups. We observe consistent clusters of co-activated experts in our own experiments, and independent work has shown that expert cooperation is a stable property of MoEs and is important for model performance. Ignoring these interactions leads to suboptimal pruning, especially at aggressive rates.
我们的最新论文提出了 HOPE(专家高阶剪枝),这是一种考虑专家两两交互的二阶方法。在剪枝率为 50% 时,HOPE 的平均排名优于所有其他方法;在智能体编程任务上,相较于次优剪枝方法,提升最高达 6.1%。Our newest paper derives HOPE (Higher-Order Pruning of Experts), a second-order method that accounts for pairwise expert interactions. At 50% pruning, HOPE achieves the best average rank of any method, with gains of up to +6.1% on agentic coding tasks over the next-best pruning method.
在这篇文章中,我们将介绍 HOPE 的工作原理,展示它在哪些方面优于现有方法,并讲解如何将它用于你自己的模型。如果你还不熟悉 MoE 架构,请参阅《Transformer 中的专家混合(MoE)》。In this post, we explain how HOPE works, show where it outperforms existing methods, and walk through how to use it for your own models. For readers unfamiliar with MoE architectures, see Mixture of Experts (MoEs) in Transformers.
专家不会单打独斗 Experts don't work alone
在标准 MoE 中,每一层有 E 个专家,每个输入 token x 都会被独立路由到 K 个专家(K=8 是常见选择)。路由由一个单独的层完成,该层为每个专家 k 生成经过 softmax 归一化的门控权重 gₖ(x)。随后,选取得分最高的 K 个专家,组成活跃专家集合 T(x)⊂{1,...,E}。该层的输出为 ∑ₖ∈T(x) gₖ(x)fₖ(x),其中 fₖ(x) 是专家 k 对 token x 的输出。In a standard MoE, each layer has EE experts, and each input token xx is routed independently to KK such experts ( K=8 K = 8 is a typical choice). Routing is performed by a single layer which produces softmax-normalized gate weights gk(x) g_{k}(x) for each expert kk , wherein the KK experts with the highest gate weights are selected to form the active set of experts, T(x)⊂{1,..,E}T(x) \subset\{1,..,E\} . The output of the layer is then ∑k∈T(x) gk(x)fk(x) \sum\limits_{k\in T(x)}g_{k}(x)f_{k}(x) , where fk(x) f_{k}(x) is the output of expert kk for token xx .

左:典型的 MoE 层,每个 token 都会被路由到 top-K 个专家。右:一阶方法根据标量重要性分数对专家排序并剔除,但最佳剪枝决策还会考虑专家之间交互的强度。Left: typical MoE layer, where each token is routed to the top-K experts. Right: first-order methods rank and delete experts based on a scalar importance score, but the best pruning decisions will also consider the strength of interactions between experts.
重要的是,所选集合 T(x)T(x) 中的专家并非彼此独立。专家会形成稳定的协作群体,并持续共同激活。已有文献也观察到了这一现象:专家共同选择模式在训练早期便会出现,并在整个训练过程中趋于稳定。Importantly, experts in the selected set T(x)T(x) are not independent. Experts form stable cooperative groups that get consistently co-activated together. This has been observed before in the literature, as well: expert co-selection patterns emerge early in training and stabilize throughout.
这意味着,当我们对 MoE 层中的专家进行剪枝时,剪枝决策需要考虑这些专家之间的高阶影响。单独来看,移除专家 A 似乎无伤大雅;但如果专家 B 与 A 经常协作并依赖 A,且 B 非常重要,那么移除 A 就会仅凭一次删除瓦解一个协作群体。一阶方法完全无法捕捉这一点,因为它们会分别对 A 和 B 进行评分。This means that when we prune experts from an MoE layer, pruning decisions need to consider the higher-order effects between these experts. Removing expert A might seem fine on its own, but if expert B—which frequently cooperates with and relies on A—is highly important, then removing A would dismantle a cooperative group just through a single deletion. First-order methods miss this entirely, because they score A and B separately.
这种效应在高剪枝率下会不断累积。当我们移除多达 50% 的专家时,可能会破坏许多协作连接。这正是二阶剪枝最具优势的地方。This effect compounds at high pruning rates. When we remove up to 50% of experts, we risk breaking many cooperative links. This is where second-order pruning is most advantageous.
HOPE 如何识别剪枝集 How HOPE identifies a prune-set
(HOPE 目标函数的完整推导见我们对应论文的附录 A)(See Appendix A in our corresponding paper for the full derivation of the HOPE objective)
当我们从某个 MoE 层中删除一组 PP 专家时,选定的专家集合 T(x)(对于任意 token x)可能会发生变化。原本会被选中的已剪枝专家,将由门控权重次高的专家替代。由此产生的层输出变化就是剪枝误差。我们的目标是找到剪枝集合 P(其剪枝预算预先设定为 |P|),使得产生的剪枝误差最小(针对校准集中的 token x)。When we delete a set of PP experts from some MoE layer, the selected set of experts T(x)T(x) (for any token xx ) can change. The pruned experts that would have been selected are replaced by the experts with the next-highest gate weights. The resulting change in layer output is the pruning error. Our goal is to find the prune-set PP (of some predefined pruning budget ∣P∣\vert P\vert ) that minimizes the resulting pruning error (over tokens xx from our calibration set).
遗憾的是,直接在 PP 上最小化剪枝误差是难以处理的。剪枝误差取决于替代专家的身份,而替代专家又取决于剪枝集 PP 本身。HOPE 通过定义一个易于处理的代理量 ZZ 来绕开这一问题,该代理量严格上界了剪枝误差中的主要部分:Unfortunately, minimizing the pruning error over PP directly is intractable. The pruning error depends on the identities of the replacement experts, which in turn depend on the prune-set PP itself. HOPE sidesteps this by defining a tractable surrogate ZZ , which strictly upper-bounds the dominant component of the pruning error:
Z=[ ∑j∈P∩T(x) gj(x)∥fj(x)∥2]2≥真实误差 Z = \bigl[\sum\limits_{j \in P\cap T(x)} g_{j}(x)\Vert f_j(x)\Vert_{2}\bigr]^{2} \geq \text{真实误差} Z=[ ∑j∈P∩T(x) gj(x)∥fj(x)∥2]2≥true error Z = \bigl[\sum\limits_{j \in P\cap T(x)} g_{j}(x)\Vert f_j(x)\Vert_{2}\bigr]^{2} \geq \text{true error}
由于 ZZ 是平方和,展开后自然会产生专家对之间的交叉项 gi(x)gj(x)∥fi(x)∥2∥fj(x)∥2 g_{i}(x)g_{j}(x)\Vert f_{i}(x)\Vert_{2}\Vert f_{j}(x)\Vert_{2}。这些正是被一阶方法舍弃的交互项。Because ZZ is a squared sum, expanding it naturally produces cross-terms gi(x)gj(x)∥fi(x)∥2∥fj(x)∥2 g_{i}(x)g_{j}(x)\Vert f_{i}(x)\Vert_{2}\Vert f_{j}(x)\Vert_{2} between pairs of experts. These are the interaction terms that first-order methods discard.
为找到最优剪枝集合,HOPE 在校准集上最小化 E[Z]\mathbb{E}[Z],这可以重新表述为以下二次规划问题:To find the optimal prune-set, HOPE minimizes E[Z]\mathbb{E}[Z] over the calibration set, which can be reformulated as the following quadratic program:
P∗= arg minp p⊤Fp 满足 p∈{0,1}E, ∑k=1E pk=∣P∣ P^{*} = \argmin_{p}\; p^{\top}Fp \quad \text{满足} \quad p \in \{0,1\}^{E}, \sum\limits_{k=1}^{E}p_{k} = \vert P\vert P∗= arg minp p⊤Fps.t.p∈{0,1}E, ∑k=1E pk=∣P∣ P^{*} = \argmin_{p}\; p^{\top}Fp \quad \text{s.t.} \quad p \in \{0,1\}^{E}, \sum\limits_{k=1}^{E}p_{k} = \vert P\vert
其中,F∈RE×EF\in\mathbb{R}^{E\times E} 定义为:where F∈RE×EF\in\mathbb{R}^{E\times E} is defined as:
\(F_{i,j} = \frac{1}{\vert \mathcal{X}_{i,j}\vert} \sum\limits_{x\in\mathcal{X}_{i,j}} g_{i}(x)g_{j}(x)\Vert f_{i}(x)\Vert_{2}\Vert f_{j}(x)\Vert_{2}\),其中 \(\mathcal{X}_{i,j} = \{x: i,j \in T(x)\}\) Fi,j = 1 ∣ Xi,j ∣ ∑ x∈ Xi,j gi(x)gj(x)∥fi(x)∥2∥fj(x)∥2where Xi,j ={x:i,j∈T(x)} F_{i,j} = \frac{1}{\vert \mathcal{X}_{i,j}\vert} \sum\limits_{x\in\mathcal{X}_{i,j}} g_{i}(x)g_{j}(x)\Vert f_{i}(x)\Vert_{2}\Vert f_{j}(x)\Vert_{2}\quad\text{where}\quad \mathcal{X}_{i,j} = \{x: i,j \in T(x)\}
该 F 矩阵是在校准数据集上收集的;通过求解由此得到的二次规划(QP),并采用连续松弛(随后将解舍入为二元解),即可获得最优剪枝集合。每个元素 \(F_{i,j}\) 表示专家 \(i\) 和专家 \(j\) 在共同激活的 token 上,经过门控权重加权的输出乘积的平均值。对角元素 \(F_{k,k}\) 衡量单个专家的重要性,而非对角元素(\(F_{i,j}\),其中 \(i\neq j\))衡量专家之间的成对协同贡献。This F-matrix is collected on the calibration dataset, and the optimal prune-set is obtained by solving the resulting quadratic program (QP) with a continuous relaxation (then rounding to binary solutions). Each entry Fi,j F_{i,j} captures the average gate-weighted output product of experts ii and jj , across tokens where both are co-activated. Whereas the diagonal Fk,k F_{k,k} measures individual expert importance, the off-diagonal entries ( Fi,j F_{i,j} for i≠ji\neq j ) measure pairwise cooperative contribution.
FF 在实践中是什么样的?它展示了专家协作的结构,而这种结构取决于层级:What does FF look like in practice? It shows the structure of expert cooperation, which depends on layer:

GLM-4.5-Air 的交互矩阵可视化(每层 128 个专家,总参数量为 106B),展示了三个具有代表性的层(早期、中期和后期)。专家经过聚类,以显现块状结构。对角线上的亮色块表示成对交互分数较高的专家组。Visualization of the interaction matrix F for GLM-4.5-Air (128 experts per layer, 106B parameters total) at three representative layers (early, middle, late). Experts have been clustered to reveal block structure. Bright blocks along the diagonal indicate groups of experts with strong pairwise interaction scores.
从实际成本来看,HOPE 与其他专家剪枝方法一样,需要进行一次校准遍历(对校准数据执行一次前向传播)。唯一额外的步骤是求解二次规划问题。该问题虽为非凸问题,但可通过标准 QP 求解器高效求解(每层耗时 1–2 秒)。与一阶方法相比,总额外开销可以忽略不计,因为校准耗时占主导。In terms of practical cost, HOPE requires the same calibration pass as any other expert-pruning method (one forward pass over calibration data). The only addition is solving the quadratic program, which is non-convex, but can be solved efficiently via a standard QP solver (1–2 seconds each layer). The total additional overhead is negligible compared to first-order methods, as the time for calibration dominates.
与 REAP 的连接 Connection to REAP
值得注意的是,HOPE 与 Router 加权专家激活剪枝(REAP)有着密切联系。REAP 是一种先进的一阶专家剪枝方法。HOPE 的 F 矩阵在对角线上编码了各个专家的重要性分数,而该对角线实际上能够还原 REAP 用于独立评估专家并决定剪枝顺序的分数(两者仅在专家贡献的方差上有所不同)。FF 的对角线几乎完美地还原了 REAP 的专家排序(Spearman ρ=0.988)。因此,HOPE 相比 REAP 所取得的任何改进,都归因于 FF 矩阵非对角线元素中的二阶交互项。Notably, HOPE has a strong connection to Router-weighted Expert Activation Pruning (REAP), a state-of-the-art first-order expert-pruning method. HOPE's F-matrix encodes individual expert importance scores on the diagonal, and this diagonal effectively recovers the scores used by REAP to independently rank experts for pruning (differing only by the variance of expert contributions). The diagonal of FF recovers REAP's expert rankings almost perfectly (Spearman ρ=0.988\rho = 0.988 ). Thus, any improvement HOPE achieves over REAP is attributable to the second-order interaction terms in the off-diagonal entries of the FF -matrix.
结果 Results
我们将 HOPE 作为一种专家剪枝方法进行评估,使用了 3 个模型(Qwen3.5-122B、Qwen3.5-35B 和 GLM-4.5-Air)以及 2 个校准数据集(Evol-CodeAlpaca 和 SWE-Bench Verified 轨迹)。我们使用 Tulu3 套件和 SWE-Bench Pro(智能体编程)测试剪枝后的模型,并在 10% 至 50% 的剪枝率范围内,将 HOPE 与 4 种一阶基线方法(REAP、MAN、EAN 和 Frequency)进行比较。We evaluated HOPE as an expert pruning method using 3 models (Qwen3.5-122B, Qwen3.5-35B, and GLM-4.5-Air), with 2 calibration datasets (Evol-CodeAlpaca and SWE-Bench Verified trajectories). We used the Tulu3 suite and SWE-Bench Pro (agentic coding) to test the resulting pruned models, comparing HOPE to 4 first-order baselines (REAP, MAN, EAN, and Frequency) across pruning rates spanning from 10% to 50%.

HOPE 在各种条件下的综合排名最佳,并且在高剪枝率下占据优势。左:所有模型、校准集和基准测试的平均排名(越低越好)。右:Qwen3.5-35B 在 SWE-Bench Pro 上的表现。HOPE achieves the best overall rank across conditions and dominates at aggressive pruning rates. Left: average rank (lower = better) across all models, calibration sets, and benchmarks. Right: SWE-Bench Pro performance on Qwen3.5-35B.
在所有条件下,HOPE 的平均排名最佳(5 种方法中排名 2.07),获得第一名的比例最高(占 39% 的条件),进入前两名的比例也最高(占 67%)。在一对一比较中,HOPE 在大多数条件下都优于其他所有基线方法。Across all conditions, HOPE achieved the best average rank (2.07 out of 5 methods), with the highest rate of top-1 finishes (39% of conditions) and top-2 finishes (67%). In a head-to-head comparison, HOPE beats every other baseline in the majority of conditions.
正如预期,剪枝率越高,HOPE 的优势就越明显。随着更多专家被移除,更多协作链接遭到破坏,FF 的非对角项也变得更加重要。在 50% 的剪枝率下,HOPE 的平均排名提升至 1.58(次优方法 REAP 为 2.42)。这也是与实际部署最相关的设置,因为此时节省的内存足以支持更长的上下文、更深入的推理以及更多的工具调用。As expected, HOPE's advantage grows at higher pruning rates. As more experts are removed, more cooperative links are broken, and the off-diagonal terms of FF become more important. At 50% pruning, HOPE's average rank improves to 1.58 (vs. 2.42 for the next-best method, REAP). This is also the most deployment-relevant setting, where memory savings are large enough to accommodate longer contexts, deeper reasoning, and more tool calls.
HOPE 的优势在 SWE-Bench Pro 上最为显著。这是一个智能体式编程基准,要求模型自主解决真实的 GitHub 问题。这些问题涉及多轮交互中的各类组合式任务(例如编程、调用工具、推理等),很可能需要多种专家组合协同——这正是保留协作结构最为重要的场景。在 Qwen3.5-35B-A3B 上进行 50% 剪枝时,HOPE 在 SWE-Bench Pro 上取得了 42.3 分,与未剪枝模型的 41.8 分持平(而 REAP 降至 36.2 分,性能下降了 13%)。HOPE's advantage is most pronounced on SWE-Bench Pro, an agentic coding benchmark where models must solve real GitHub issues autonomously. These problems involve compositionally diverse tasks (e.g. coding, tool calls, reasoning, etc.) over many turns and likely exercise diverse expert combinations—exactly the regime where preserving cooperative structure matters most. On Qwen3.5-35B-A3B at 50% pruning, HOPE achieved 42.3 on SWE-Bench Pro, matching the unpruned model's 41.8 (while REAP dropped to 36.2, a 13% regression).
值得注意的是,剪枝后的模型有时能达到甚至超过未剪枝基线的表现,这可能是因为移除相关性较低的专家减少了目标任务上的噪声。这种现象并非 HOPE 独有,在多种剪枝方法中都能观察到。此外,我们的实验表明,使用任何剪枝方法(包括 HOPE)进行面向代码的校准,都不会严重损害模型在非编码基准测试上的表现;无论使用哪种校准集,HOPE 在整个 Tulu3 测试套件上都表现良好。Notably, pruned models can occasionally match or exceed the unpruned baseline, likely because the removal of low-relevance experts reduces noise on the target tasks. This effect is not unique to HOPE and has been observed across pruning methods. Furthermore, our experiments showed that code-focused calibration with any pruning method (including HOPE) did not severely degrade non-coding benchmarks, and HOPE performed well across the Tulu3 suite regardless of calibration set.
HOPE 留住了更多协作专家 HOPE retains more cooperating experts

与保留专家的平均协作强度(以 F 矩阵值衡量),按 HOPE 和 REAP 意见不一致的专家划分。Average strength of cooperation (measured by F-matrix value) with retained experts, split by experts on which HOPE and REAP disagree.
HOPE 的优势源于对整个交互矩阵 FF 进行优化。为了了解这在实践中如何影响剪枝决策,我们考察 HOPE 和 REAP 意见不一致的专家。对于每个存在争议的专家,我们计算其协作分数(即它与其他保留专家之间 F 值的平均值)。仅由 HOPE 保留的专家,其协作分数始终高于仅由 REAP 保留的专家。换言之,作为 QP 优化的一部分,HOPE 会牺牲一些个体得分较高的专家,以保留协作集群。基准测试性能的提升(如上所示)证实了这种权衡是有利的。HOPE's advantage stems from optimizing over the entire interaction matrix FF . To understand how this affects pruning decisions in practice, we examine the experts where HOPE and REAP disagree. For each disputed expert, we compute its cooperative score (i.e. its average F-value with other retained experts). Experts retained only by HOPE consistently have higher cooperative scores than experts retained only by REAP. In other words, as part of the QP optimization, HOPE sacrifices some individually high-scoring experts in favor of preserving cooperative clusters. The gains in benchmark performance (shown above) validate that this trade-off is advantageous.
如何运行 HOPE How to run HOPE

我们创建了一个用于运行 HOPE 的基础软件包,分为三个步骤:1)校准;2)求解;3)剪枝。我们的软件包已在 Qwen3、Qwen3-Next、Qwen3.5 和 GLM-4.5 上进行测试。We created a basic package to run HOPE. It has three steps: 1) calibrate; 2) solve; 3) prune. Our package has been tested on Qwen3, Qwen3-Next, Qwen3.5, and GLM-4.5.
第 1 步:校准 Step 1: Calibrate
hope calibrate \
--model-path Qwen/Qwen3.5-35B-A3B \
--prompts calibration_prompts.txt \
--out-path observations.h5
校准步骤会对校准数据执行一次前向传播,无论数据是智能体式 rollout 还是单轮轨迹。此步骤使用 HuggingFace transformers 钩入每个 MoE 层各自的前向传播。对于每个 token,它都会记录选中的专家、它们的门控权重、输出范数以及成对的协激活统计数据。此步骤的输出是 F 矩阵,存储在 HDF5 文件中。The calibration step runs a single forward pass over calibration data, whether it be agentic rollouts or single-turn traces. This uses HuggingFace transformers to hook into the forward pass of each individual MoE layer. For each token, this records which experts are selected, their gate weights, output norms, and pairwise co-activation statistics. The output of this step is the F-matrix, stored in an HDF5 file.
步骤 2:求解 QP Step 2: Solve QP
hope solve \
--obs-path observations.h5 \
--prune-frac 0.50 \
--out-path pruneset.json
此命令会将 F 矩阵实例化,并通过连续松弛求解二元二次规划。每层需要几秒钟,输出为包含剪枝集合的 JSON 文件。从技术上讲,这就是 HOPE 算法的最终输出。This command materializes the F-matrix and solves the binary quadratic program via a continuous relaxation. This takes a few seconds per layer, and the output is a JSON file which contains the prune-set. This is technically the final output of the HOPE algorithm.
步骤 3:剪枝 Step 3: Prune
hope prune \
--model-path Qwen/Qwen3.5-35B-A3B \
--pruneset-path pruneset.json \
--out-path ./Qwen3.5-35B-A3B-pruned-50
为了完成整个流程,我们运行此命令,实际从剪枝集创建较小的模型检查点。剪枝后的模型是标准的 HuggingFace 检查点,占用的磁盘空间和内存都更小(无需更改 vLLM 或 SGLang 的模型定义)。To complete the pipeline, we run this command to actually create the smaller model checkpoint from the prune-set. The pruned model is a standard HuggingFace checkpoint which is smaller on disk and in memory (no changes to vLLM or SGLang model definitions needed).
我们还发布了一个更精简的 Python API:We also released a more compact Python API:
from hope.calibrate import calibrate
from hope.solve import solve
from hope.prune import prune_model
calibrate("Qwen/Qwen3.5-35B-A3B", calibration_prompts, "observations.h5")
solve("observations.h5", prune_frac=0.50, out_path="pruneset.json")
prune_model("Qwen/Qwen3.5-35B-A3B", "pruneset.json", "./Qwen3.5-35B-A3B-pruned-50")
HOPE 的局限性 Limitations of HOPE
HOPE 的优势在较高剪枝率(40–50%)时最为显著。在较低剪枝率(10–20%)时,REAP 和 MAN 等一阶方法有时也具有竞争力,因此 HOPE 的优势会缩小。此外,与大多数专家剪枝算法一样,HOPE 会独立剪枝各层,不考虑层间交互。在我们的论文中,我们提出了一个针对跨层 HOPE 的理论框架,但相关结果仍处于初步阶段。最后,HOPE 能够捕捉成对交互,但更高阶的交互(三元组及以上)也可能提供额外信号,尽管这类交互在估算上存在组合爆炸难题。HOPE's advantage is most pronounced at higher pruning rates (40–50%). At lower pruning rates (10–20%), first-order methods like REAP and MAN are sometimes competitive, and HOPE's advantage shrinks. Additionally, as with most expert-pruning algorithms, HOPE prunes each layer independently and does not account for cross-layer interactions. In our paper, we presented a theoretical framework for cross-layer HOPE, but the results remain preliminary. Finally, HOPE captures pairwise interactions, but even higher-order interactions (triplets and beyond) could provide additional signal, although they are combinatorially difficult to estimate.
更多信息 More information
更多信息请参阅我们对应的论文和代码库。For more information, see our corresponding paper and codebase.
论文:https://arxiv.org/abs/2609.18916Paper: https://arxiv.org/abs/2609.18916
代码:https://github.com/awslabs/HOPECode: https://github.com/awslabs/HOPE
若要了解 HOPE 如何应用于下一代混合架构,请参阅我们对应的代码仓库。To see how HOPE can be applied to next-generation hybrid architectures, see our corresponding repository.
引用:Citation:
@article{tseng2026hope,
title={Higher-Order Pruning of Experts in Mixture-of-Experts Language Models},
author={Tseng, Alex M. and Kaul, Prannay and Zancato, Luca and Xia, Wei and Soatto, Stefano},
journal={arXiv preprint arXiv:2609.18916},
year={2026},
}