混合专家语言模型中专家的高阶剪枝
引言
混合专家(MoE)模型使得最先进的LLM能够扩展到数千亿参数,但它们存在一个根本且昂贵的限制:在推理时,每个专家MLP都必须占用内存,尽管对于任何给定的token,绝大多数专家都处于空闲状态。例如,Qwen3.5-122B在其48个MoE层中的每一层都有256个专家,其约250 GB的参数内存占用完全由这些专家MLP占据。然而,对于任何给定的token,每层实际上只使用8个专家。
专家剪枝是解决这一内存瓶颈最直接的方法之一。也就是说,永久删除最不重要的专家。剪枝避免了使动态加载/卸载专家变得不切实际的延迟问题;它不需要任何训练;并且可以与量化结合。鉴于这些诱人的好处和概念的简单性,很容易理解为什么专家剪枝已成为缩小MoE的首选方法。困难在于决定哪些专家可以安全地移除。
现有的剪枝方法独立地对每个专家进行评分,为每个专家分配一个标量重要性分数(基于校准数据集),并剪除最不重要的专家(在每一层中独立进行)。这些是一阶方法,因为它们假设每个专家的贡献与其他所有专家无关。在现实中,专家形成合作群体。我们在自己的实验中观察到一致的共激活专家集群,独立的研究也表明,专家合作是MoE的稳定属性,对模型性能至关重要。忽视这些相互作用会导致次优的剪枝,尤其是在激进的剪枝率下。
我们最新的论文推导出了HOPE(Higher-Order Pruning of Experts,专家的高阶剪枝),这是一种考虑成对专家相互作用的二阶方法。在50%剪枝率下,HOPE实现了任何方法的最佳平均排名,与次优的剪枝方法相比,在代理编码任务上获得了高达+6.1%的提升。
在这篇文章中,我们将解释HOPE的工作原理,展示它在哪些方面优于现有方法,并逐步介绍如何将其用于您自己的模型。对于不熟悉MoE架构的读者,请参阅《Transformer中的混合专家(MoEs)》。
专家并非孤立工作
在标准的MoE中,每层有E个专家,每个输入token x被独立路由到K个这样的专家(K=8是典型选择)。路由由单层执行,该层为每个专家k产生softmax归一化的门控权重g_k(x),其中具有最高门控权重的K个专家被选中以形成活跃专家集T(x) ⊂ {1, ..., E}。然后,该层的输出为∑_{k∈T(x)} g_k(x)f_k(x),其中f_k(x)是token x的专家k的输出。
左图:典型的MoE层,每个token被路由到前K个专家。右图:一阶方法基于标量重要性分数对专家进行排名和删除,但最佳的剪枝决策还将考虑专家之间相互作用的强度。
重要的是,选定集T(x)中的专家并非相互独立。专家形成稳定的合作群体,并始终一起被共激活。文献中也已经观察到这一点:专家共选择模式在训练早期出现,并在整个过程中保持稳定。
这意味着,当我们从混合专家(MoE)层中剪枝掉部分专家时,剪枝决策需要考虑这些专家之间的高阶效应。单独来看,移除专家 A 似乎并无不妥,但如果与 A 频繁合作且依赖 A 的专家 B 至关重要,那么仅仅通过一次删除操作就会瓦解一个协作群体。一阶方法完全忽略了这一点,因为它们分别对 A 和 B 进行评分。
这种效应在高剪枝率下会进一步加剧。当我们移除多达 50% 的专家时,我们面临着破坏大量协作链接的风险。这正是二阶剪枝最具优势的地方。
HOPE 如何识别剪枝集
(请参阅我们相应论文的附录 A,以获取 HOPE 目标的完整推导)
当我们从某个 MoE 层中删除一组 P 个专家时,所选的专家集合 T(x)(对于任意 token x)可能会发生变化。原本会被选中的被剪枝专家将由具有次高门控权重的专家所取代。由此产生的层输出变化即为剪枝误差。我们的目标是找到能够最小化由此产生的剪枝误差(针对来自校准集的 token x)的剪枝集 P(具有某个预定义的剪枝预算 |P|)。
不幸的是,直接针对 P 最小化剪枝误差是难以处理的。剪枝误差取决于替换专家的身份,而这些身份又反过来依赖于剪枝集 P 本身。HOPE 通过定义一个可处理的替代目标 Z 来规避这一问题,该目标严格地给出了剪枝误差主导成分的上界:
Z = [ ∑_{j ∈ P ∩ T(x)} g_j(x) ||f_j(x)||_2 ]^2 ≥ true error
由于 Z 是一个平方和,展开它自然会生成专家对之间的交叉项 g_i(x)g_j(x)||f_i(x)||_2||f_j(x)||_2。这些正是被一阶方法丢弃的交互项。
为了找到最优剪枝集,HOPE 在校准集上最小化 E[Z],这可以重新表述为以下二次规划问题:
P* = arg min_p p^⊤Fp s.t. p ∈ {0,1}^E, ∑_{k=1}^E p_k = |P|
其中 F ∈ R^{E×E} 定义为:
F_{i,j} = (1/|X_{i,j}|) ∑{x ∈ X{i,j}} g_i(x)g_j(x)||f_i(x)||2||f_j(x)||_2,其中 X{i,j} = {x: i,j ∈ T(x)}
该 F 矩阵是在校准数据集上收集的,最优剪枝集是通过求解由此产生的二次规划(QP)问题获得的(使用连续松弛,然后舍入为二元解)。每个条目 F_{i,j} 捕捉了专家 i 和 j 在两者共同激活的 token 上的平均门控加权输出乘积。虽然对角线元素 F_{k,k} 衡量单个专家的重要性,但非对角线元素(对于 i ≠ j 的 F_{i,j})衡量成对的协作贡献。
在实践中,F 看起来是什么样的?它展示了专家协作的结构,这取决于层:
GLM-4.5-Air(每层128个专家,总计106B参数)在三个代表性层(早期、中期、晚期)的交互矩阵F的可视化。专家已被聚类以揭示块状结构。对角线上的明亮区块表示具有强两两交互得分的专家组。
就实际成本而言,HOPE与其他任何专家剪枝方法一样,只需要一次校准传递(对校准数据进行一次前向传播)。唯一的额外部分是求解二次规划问题,该问题是非凸的,但可以通过标准的QP求解器高效解决(每层1-2秒)。与一阶方法相比,总附加开销可以忽略不计,因为校准时间占主导地位。
与REAP的联系
值得注意的是,HOPE与路由加权专家激活剪枝(Router-weighted Expert Activation Pruning, REAP)有着密切联系,这是一种最先进的基于一阶的专家剪枝方法。HOPE的F矩阵在对角线上编码了单个专家的重要性得分,而对角线有效地恢复了REAP用于独立排序专家以进行剪枝的得分(仅在专家贡献的方差上有所不同)。F的对角线几乎完美地恢复了REAP的专家排名(Spearman ρ = 0.988)。因此,HOPE相对于REAP取得的任何改进都归因于F矩阵非对角线条目中的二阶交互项。
结果
我们使用3个模型(Qwen3.5-122B、Qwen3.5-35B和GLM-4.5-Air)以及2个校准数据集(Evol-CodeAlpaca和SWE-Bench Verified轨迹)评估了HOPE作为专家剪枝方法的效果。我们使用Tulu3套件和SWE-Bench Pro(代理编码)来测试剪枝后的模型,将HOPE与4个一阶基线(REAP、MAN、EAN和Frequency)进行比较,剪枝率范围从10%到50%。
HOPE在所有条件下均取得最佳总体排名,并在激进剪枝率下占据主导地位。左图:所有模型、校准集和基准测试的平均排名(越低越好)。右图:Qwen3.5-35B在SWE-Bench Pro上的性能。
在所有条件下,HOPE取得了最佳平均排名(5种方法中的2.07),拥有最高的第一名完成率(39%的条件)和第二名完成率(67%)。在直接比较中,HOPE在大多数条件下击败了所有其他基线。
正如预期的那样,HOPE的优势随着剪枝率的提高而增长。随着更多专家被移除,更多的合作链接被切断,F的非对角线项变得更为重要。在50%剪枝率下,HOPE的平均排名提升至1.58(而次优方法REAP为2.42)。这也是最具部署相关性的设置,其中内存节省足以容纳更长的上下文、更深层次的推理和更多的工具调用。
HOPE的优势在SWE-Bench Pro上最为显著,这是一个代理编码基准测试,模型必须自主解决真实的GitHub问题。这些问题涉及跨多个回合的组合多样化任务(例如编码、工具调用、推理等),并可能利用多样化的专家组合——这正是保留合作结构最重要的领域。在50%剪枝率下,Qwen3.5-35B-A3B上的HOPE在SWE-Bench Pro上取得了42.3分,与未剪枝模型的41.8分持平(而REAP降至36.2分,出现13%的性能倒退)。
值得注意的是,剪枝后的模型偶尔可以匹配或超过未剪枝的基线,这可能是因为移除了低相关性专家减少了目标任务上的噪声。这种现象并非HOPE独有,已在各种剪枝方法中观察到。此外,我们的实验表明,使用任何剪枝方法(包括HOPE)进行代码focused校准并未严重损害非编码基准测试,且无论校准集如何,HOPE在Tulu3套件中均表现良好。
HOPE保留了更多合作专家
与保留专家的协作强度平均值(由F矩阵值衡量),按HOPE和REAP存在分歧的专家进行分类。
HOPE 的优势源于对整个交互矩阵 $F$ 进行优化。为了理解这如何影响实际的剪枝决策,我们考察了 HOPE 和 REAP 意见不一致的那些专家。对于每个有争议的专家,我们计算其合作得分(即其与其他保留专家的平均 F 值)。仅由 HOPE 保留的专家始终具有比仅由 REAP 保留的专家更高的合作得分。换句话说,作为二次规划(QP)优化的一部分,HOPE 牺牲了一些 individually 高分的专家,以保留合作集群。基准性能的提升(如上所示)证实了这一权衡是有利的。
如何运行 HOPE
我们创建了一个基本包来运行 HOPE。它包含三个步骤:1) 校准;2) 求解;3) 剪枝。我们的包已在 Qwen3、Qwen3-Next、Qwen3.5 和 GLM-4.5 上进行了测试。
步骤 1:校准
hope calibrate \
--model-path Qwen/Qwen3.5-35B-A3B \
--prompts calibration_prompts.txt \
--out-path observations.h5
校准步骤在校准数据(无论是智能体 rollout 还是单轮轨迹)上运行单次前向传播。这利用 HuggingFace transformers 钩入每个独立 MoE 层的前向传播。对于每个 token,它记录所选专家、其门控权重、输出范数以及成对共激活统计信息。此步骤的输出是 F 矩阵,存储在 HDF5 文件中。
步骤 2:求解 QP
hope solve \
--obs-path observations.h5 \
--prune-frac 0.50 \
--out-path pruneset.json
该命令将 F 矩阵具体化,并通过连续松弛求解二次规划(QP)。这需要每层几秒钟的时间,输出是一个包含剪枝集的 JSON 文件。从技术上讲,这是 HOPE 算法的最终输出。
步骤 3:剪枝
hope prune \
--model-path Qwen/Qwen3.5-35B-A3B \
--pruneset-path pruneset.json \
--out-path ./Qwen3.5-35B-A3B-pruned-50
为了完成流水线,我们运行此命令以根据剪枝集实际创建较小的模型检查点。剪枝后的模型是一个标准的 HuggingFace 检查点,在磁盘和内存中更小(无需更改 vLLM 或 SGLang 的模型定义)。
我们还发布了一个更紧凑的 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 的局限性
HOPE 的优势在较高的剪枝率(40–50%)下最为明显。在较低的剪枝率(10–20%)下,像 REAP 和 MAN 这样的一阶方法有时具有竞争力,且 HOPE 的优势缩小。此外,与大多数专家剪枝算法一样,HOPE 独立地剪枝每一层,并未考虑跨层交互。在我们的论文中,我们提出了一个跨层 HOPE 的理论框架,但结果仍处于初步阶段。最后,HOPE 捕捉了成对交互,但更高阶的交互(三元组及更高)可能会提供额外的信号,尽管它们在组合上难以估计。
更多信息
欲了解更多信息,请参阅我们的相应论文和代码库。
论文:https://arxiv.org/abs/2609.18916
代码:https://github.com/awslabs/HOPE
要了解如何将 HOPE 应用于下一代混合架构,请参阅我们的相应仓库。
引用:
@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},
}
Higher-Order Pruning of Experts in Mixture-of-Experts Language Models
Introduction
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.
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.
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.
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.
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
In a standard MoE, each layer has E E E experts, and each input token x x x is routed independently to K K K such experts ( K = 8 K = 8 K = 8 is a typical choice). Routing is performed by a single layer which produces softmax-normalized gate weights g k ( x ) g_{k}(x) g k ( x ) for each expert k k k , wherein the K K K experts with the highest gate weights are selected to form the active set of experts, T ( x ) ⊂ { 1 , . . , E } T(x) \subset{1,..,E} T ( x ) ⊂ { 1 , .. , E } . The output of the layer is then ∑ k ∈ T ( x ) g k ( x ) f k ( x ) \sum\limits_{k\in T(x)}g_{k}(x)f_{k}(x) k ∈ T ( x ) ∑ g k ( x ) f k ( x ) , where f k ( x ) f_{k}(x) f k ( x ) is the output of expert k k k for token x x x .
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.
Importantly, experts in the selected set T ( x ) 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.
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.
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.
How HOPE identifies a prune-set
(See Appendix A in our corresponding paper for the full derivation of the HOPE objective)
When we delete a set of P P P experts from some MoE layer, the selected set of experts T ( x ) T(x) T ( x ) (for any token x x x ) 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 P P P (of some predefined pruning budget ∣ P ∣ \vert P\vert ∣ P ∣ ) that minimizes the resulting pruning error (over tokens x x x from our calibration set).
Unfortunately, minimizing the pruning error over P P P directly is intractable. The pruning error depends on the identities of the replacement experts, which in turn depend on the prune-set P P P itself. HOPE sidesteps this by defining a tractable surrogate Z Z Z , which strictly upper-bounds the dominant component of the pruning error:
Z = [ ∑ j ∈ P ∩ T ( x ) g j ( x ) ∥ f j ( 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} Z = [ j ∈ P ∩ T ( x ) ∑ g j ( x ) ∥ f j ( x ) ∥ 2 ] 2 ≥ true error
Because Z Z Z is a squared sum, expanding it naturally produces cross-terms g i ( x ) g j ( x ) ∥ f i ( x ) ∥ 2 ∥ f j ( x ) ∥ 2 g_{i}(x)g_{j}(x)\Vert f_{i}(x)\Vert_{2}\Vert f_{j}(x)\Vert_{2} g i ( x ) g j ( x ) ∥ f i ( x ) ∥ 2 ∥ f j ( x ) ∥ 2 between pairs of experts. These are the interaction terms that first-order methods discard.
To find the optimal prune-set, HOPE minimizes E [ Z ] \mathbb{E}[Z] E [ Z ] over the calibration set, which can be reformulated as the following quadratic program:
P ∗ = arg min p p ⊤ F p s.t. p ∈ { 0 , 1 } E , ∑ k = 1 E p k = ∣ 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 P ∗ = p arg min p ⊤ F p s.t. p ∈ { 0 , 1 } E , k = 1 ∑ E p k = ∣ P ∣
where F ∈ R E × E F\in\mathbb{R}^{E\times E} F ∈ R E × E is defined as:
F i , j = 1 ∣ X i , j ∣ ∑ x ∈ X i , j g i ( x ) g j ( x ) ∥ f i ( x ) ∥ 2 ∥ f j ( x ) ∥ 2 where X i , 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 i , j = ∣ X i , j ∣ 1 x ∈ X i , j ∑ g i ( x ) g j ( x ) ∥ f i ( x ) ∥ 2 ∥ f j ( x ) ∥ 2 where X i , j = { x : i , j ∈ T ( x )}
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 F i , j F_{i,j} F i , j captures the average gate-weighted output product of experts i i i and j j j , across tokens where both are co-activated. Whereas the diagonal F k , k F_{k,k} F k , k measures individual expert importance, the off-diagonal entries ( F i , j F_{i,j} F i , j for i ≠ j i\neq j i = j ) measure pairwise cooperative contribution.
What does F F F look like in practice? It shows the structure of expert cooperation, which depends on layer:
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.
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.
Connection to REAP
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 F F F recovers REAP's expert rankings almost perfectly (Spearman ρ = 0.988 \rho = 0.988 ρ = 0.988 ). Thus, any improvement HOPE achieves over REAP is attributable to the second-order interaction terms in the off-diagonal entries of the F F F -matrix.
Results
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 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.
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.
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 F F F 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'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).
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 retains more cooperating experts
Average strength of cooperation (measured by F-matrix value) with retained experts, split by experts on which HOPE and REAP disagree.
HOPE's advantage stems from optimizing over the entire interaction matrix F F F . 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.
How to run HOPE
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.
Step 1: Calibrate
hope calibrate \
--model-path Qwen/Qwen3.5-35B-A3B \
--prompts calibration_prompts.txt \
--out-path observations.h5
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.
Step 2: Solve QP
hope solve \
--obs-path observations.h5 \
--prune-frac 0.50 \
--out-path pruneset.json
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.
Step 3: Prune
hope prune \
--model-path Qwen/Qwen3.5-35B-A3B \
--pruneset-path pruneset.json \
--out-path ./Qwen3.5-35B-A3B-pruned-50
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).
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" )
Limitations of 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.
Paper: https://arxiv.org/abs/2609.18916
Code : https://github.com/awslabs/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},
}
首次收录 · 2026-11-10 · 10.48 分