Router-weighted Expert Activation Pruning (REAP)
applied to
LiquidAI/LFM2-24B-A2B
, reducing experts from 64 → 32 per MoE layer (50% expert reduction).
What is REAP?
REAP (Router-weighted Expert Activation Pruning) analyzes the router gate weights in Mixture-of-Experts models to identify which experts contribute least to model outputs. Experts with the lowest router weight magnitudes — indicating they are rarely or weakly selected during inference — are pruned. The remaining experts retain their original weights, preserving model quality while significantly reducing size.
Model Details
Property
Original
REAP'd
Total Parameters
24B
~14B
Active Parameters
2.3B
2.3B
Experts per MoE layer
64
32
Experts per token
4
4
MoE layers
38 (layers 2-39)
38 (layers 2-39)
Dense layers
2 (layers 0-1)
2 (layers 0-1)
Total layers
40
40
Hidden size
2048
2048
MoE intermediate size
1536
1536
Context length
128K
128K
Vocabulary
65,536
65,536
Architecture
LFM2-24B-A2B is a hybrid architecture combining:
30 convolutional layers
(short convolution with gated projections)
10 full attention layers
(GQA with 32 heads, 8 KV heads)
38 MoE FFN layers
(layers 2-39, with top-4 routing from 64 experts)
2 dense FFN layers
(layers 0-1, dense feed-forward with intermediate_size=11776)
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"DJLougen/LFM2-24B-A2B-REAP",
torch_dtype="bfloat16",
device_map="auto",
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained("DJLougen/LFM2-24B-A2B-REAP")
REAP Methodology
Expert Importance Scoring
For each MoE layer, expert importance is computed from the
router gate weight matrix
W_gate ∈ R^{num_experts × hidden_size}
:
importance(expert_i) = ||W_gate[i, :]||_2
Experts with the lowest L2 norm of their router weight vectors are pruned. This metric captures how strongly the router can direct tokens to each expert — experts with small weight norms are rarely or weakly selected.
Pruning Process
Extract router weights
from all 38 MoE layers
Compute L2 importance
for each of 64 experts per layer
Select bottom 32
experts (per layer, independently) for removal
Slice expert tensors
to remove pruned experts' parameters
Update router gate
to match reduced expert count
Update expert bias
vector to match reduced expert count
LFM2-24B-A2B-REAP huggingface.co is an AI model on huggingface.co that provides LFM2-24B-A2B-REAP's model effect (), which can be used instantly with this DJLougen LFM2-24B-A2B-REAP model. huggingface.co supports a free trial of the LFM2-24B-A2B-REAP model, and also provides paid use of the LFM2-24B-A2B-REAP. Support call LFM2-24B-A2B-REAP model through api, including Node.js, Python, http.
LFM2-24B-A2B-REAP huggingface.co is an online trial and call api platform, which integrates LFM2-24B-A2B-REAP's modeling effects, including api services, and provides a free online trial of LFM2-24B-A2B-REAP, you can try LFM2-24B-A2B-REAP online for free by clicking the link below.
DJLougen LFM2-24B-A2B-REAP online free url in huggingface.co:
LFM2-24B-A2B-REAP is an open source model from GitHub that offers a free installation service, and any user can find LFM2-24B-A2B-REAP on GitHub to install. At the same time, huggingface.co provides the effect of LFM2-24B-A2B-REAP install, users can directly use LFM2-24B-A2B-REAP installed effect in huggingface.co for debugging and trial. It also supports api for free installation.