Absolute mean over root mean square IMportance for Expert Ranking
AIMER, short for Absolute mean over root mean square IMportance for Expert Ranking, is a simple, weight-only criterion for post-training pruning of mixture-of-experts (MoE) language models. Instead of collecting router statistics or activation traces on a calibration set, AIMER ranks experts directly from pretrained weights, prunes them uniformly layer by layer, saves a standard Hugging Face checkpoint, and supports downstream evaluation with the same benchmark stack used in the paper.
This repository gives you a minimal end-to-end pipeline:
pretrained MoE checkpoint
|
v
AIMER expert scoring
|
v
uniform layer-wise pruning
|
v
pruned HF checkpoint
|
v
evaluation with lm-eval / EvalPlus / LiveCodeBench / EvalScope / WildBench
save_pretrained(...) and can be evaluated directly.| Path | Purpose |
|---|---|
src/reap/calib_free_prune.py | AIMER pruning CLI |
src/reap/eval.py | Evaluation runner |
src/reap/args.py | Dataclass-based eval arguments |
src/reap/model_util.py | MoE model helpers and model-name patching |
experiments/calib-free-cli.sh | End-to-end prune + evaluate wrapper |
experiments/eval.sh | Evaluation wrapper |
scripts/build.sh | Environment + submodule bootstrap |
scripts/command_calibfree.sh | Minimal example invocation |
config/ | WildBench config templates |
third-party/ | Pinned evaluation dependencies |
model_type | Example checkpoint |
|---|---|
olmoe | allenai/OLMoE-1B-7B-0125-Instruct |
ernie4_5_moe | baidu/ERNIE-4.5-21B-A3B-PT |
qwen3_moe | Qwen/Qwen3-30B-A3B-Instruct-2507 |
bash scripts/build.sh
Use the pruning CLI directly when you only want the pruned checkpoint and score tables:
python src/reap/calib_free_prune.py \
--model-name Qwen/Qwen3-30B-A3B-Instruct-2507 \
--metric aimer \
--sparsity-ratio 0.25 \
--output-dir artifacts/calib-free/Qwen3-30B-A3B-Instruct-2507/aimer_0.250_uniform \
--device-map auto \
--torch-dtype bfloat16 \
--metric-device auto \
--local-files-only false \
--trust-remote-code true
Behavior worth knowing:
--local-files-only defaults to true, so set it to false if the model is not already cached locally.--metric-device cpu is useful if you want scoring to run from CPU copies after model load.For the paper-style workflow, use the wrapper:
bash experiments/calib-free-cli.sh \
0,1 \
Qwen/Qwen3-30B-A3B-Instruct-2507 \
aimer \
0.25 \
42
This wrapper:
CUDA_VISIBLE_DEVICESartifacts/calib-free/...The first positional argument is the CUDA device mask. The wrapper also derives the serving port from the first visible GPU as 8300 + first_device.
Minimal example:
bash scripts/command_calibfree.sh
Important default:
experiments/calib-free-cli.sh enables all benchmark groups by default, including WildBench.You can evaluate either an original checkpoint or a pruned checkpoint directly:
python src/reap/eval.py \
--model-name artifacts/calib-free/Qwen3-30B-A3B-Instruct-2507/aimer_0.250_uniform \
--seed 42 \
--use-server true \
--vllm_port 8300 \
--run-lm-eval true \
--run-evalplus true \
--run-livecodebench true \
--run-math true \
--run-wildbench false \
--results_dir artifacts/calib-free/Qwen3-30B-A3B-Instruct-2507/aimer_0.250_uniform/eval_vllm
Pruned checkpoints are saved under:
artifacts/calib-free/<model-name>/<metric>_<ratio>_uniform/
Typical contents:
| File | Description |
|---|---|
config.json, model weights, tokenizer files | standard saved Hugging Face checkpoint |
pruned_experts.json | pruned expert ids per layer |
pruning_plan.json | per-layer kept/pruned counts |
calib_free_metadata.json | pruning metadata |
calib_free_scores.csv | raw per-expert AIMER scores |
calib_free_score_table.csv | scores, within-layer rank, and prune decision |
eval_vllm/ or eval_hf/ | evaluation outputs |
*.log | wrapper logs when using the shell scripts |
AIMER/
|-- config/
|-- experiments/
|-- scripts/
|-- src/reap/
| |-- args.py
| |-- calib_free_prune.py
| |-- eval.py
| `-- model_util.py
`-- third-party/
This release builds on infrastructure adapted from CerebrasResearch/reap, the official codebase for REAP: Router-weighted Expert Activation Pruning for SMoE compression. We thank the REAP authors for open-sourcing their codebase and evaluation pipeline, which helped make this release possible.
This repository is released under the Apache 2.0 License. See LICENSE.
2 commits
Python
91.0%
Shell
9.0%
Absolute mean over root mean square IMportance for Expert Ranking
AIMER, short for Absolute mean over root mean square IMportance for Expert Ranking, is a simple, weight-only criterion for post-training pruning of mixture-of-experts (MoE) language models. Instead of collecting router statistics or activation traces on a calibration set, AIMER ranks experts directly from pretrained weights, prunes them uniformly layer by layer, saves a standard Hugging Face checkpoint, and supports downstream evaluation with the same benchmark stack used in the paper.
This repository gives you a minimal end-to-end pipeline:
pretrained MoE checkpoint
|
v
AIMER expert scoring
|
v
uniform layer-wise pruning
|
v
pruned HF checkpoint
|
v
evaluation with lm-eval / EvalPlus / LiveCodeBench / EvalScope / WildBench
save_pretrained(...) and can be evaluated directly.| Path | Purpose |
|---|---|
src/reap/calib_free_prune.py | AIMER pruning CLI |
src/reap/eval.py | Evaluation runner |
src/reap/args.py | Dataclass-based eval arguments |
src/reap/model_util.py | MoE model helpers and model-name patching |
experiments/calib-free-cli.sh | End-to-end prune + evaluate wrapper |
experiments/eval.sh | Evaluation wrapper |
scripts/build.sh | Environment + submodule bootstrap |
scripts/command_calibfree.sh | Minimal example invocation |
config/ | WildBench config templates |
third-party/ | Pinned evaluation dependencies |
model_type | Example checkpoint |
|---|---|
olmoe | allenai/OLMoE-1B-7B-0125-Instruct |
ernie4_5_moe | baidu/ERNIE-4.5-21B-A3B-PT |
qwen3_moe | Qwen/Qwen3-30B-A3B-Instruct-2507 |
bash scripts/build.sh
Use the pruning CLI directly when you only want the pruned checkpoint and score tables:
python src/reap/calib_free_prune.py \
--model-name Qwen/Qwen3-30B-A3B-Instruct-2507 \
--metric aimer \
--sparsity-ratio 0.25 \
--output-dir artifacts/calib-free/Qwen3-30B-A3B-Instruct-2507/aimer_0.250_uniform \
--device-map auto \
--torch-dtype bfloat16 \
--metric-device auto \
--local-files-only false \
--trust-remote-code true
Behavior worth knowing:
--local-files-only defaults to true, so set it to false if the model is not already cached locally.--metric-device cpu is useful if you want scoring to run from CPU copies after model load.For the paper-style workflow, use the wrapper:
bash experiments/calib-free-cli.sh \
0,1 \
Qwen/Qwen3-30B-A3B-Instruct-2507 \
aimer \
0.25 \
42
This wrapper:
CUDA_VISIBLE_DEVICESartifacts/calib-free/...The first positional argument is the CUDA device mask. The wrapper also derives the serving port from the first visible GPU as 8300 + first_device.
Minimal example:
bash scripts/command_calibfree.sh
Important default:
experiments/calib-free-cli.sh enables all benchmark groups by default, including WildBench.You can evaluate either an original checkpoint or a pruned checkpoint directly:
python src/reap/eval.py \
--model-name artifacts/calib-free/Qwen3-30B-A3B-Instruct-2507/aimer_0.250_uniform \
--seed 42 \
--use-server true \
--vllm_port 8300 \
--run-lm-eval true \
--run-evalplus true \
--run-livecodebench true \
--run-math true \
--run-wildbench false \
--results_dir artifacts/calib-free/Qwen3-30B-A3B-Instruct-2507/aimer_0.250_uniform/eval_vllm
Pruned checkpoints are saved under:
artifacts/calib-free/<model-name>/<metric>_<ratio>_uniform/
Typical contents:
| File | Description |
|---|---|
config.json, model weights, tokenizer files | standard saved Hugging Face checkpoint |
pruned_experts.json | pruned expert ids per layer |
pruning_plan.json | per-layer kept/pruned counts |
calib_free_metadata.json | pruning metadata |
calib_free_scores.csv | raw per-expert AIMER scores |
calib_free_score_table.csv | scores, within-layer rank, and prune decision |
eval_vllm/ or eval_hf/ | evaluation outputs |
*.log | wrapper logs when using the shell scripts |
AIMER/
|-- config/
|-- experiments/
|-- scripts/
|-- src/reap/
| |-- args.py
| |-- calib_free_prune.py
| |-- eval.py
| `-- model_util.py
`-- third-party/
This release builds on infrastructure adapted from CerebrasResearch/reap, the official codebase for REAP: Router-weighted Expert Activation Pruning for SMoE compression. We thank the REAP authors for open-sourcing their codebase and evaluation pipeline, which helped make this release possible.
This repository is released under the Apache 2.0 License. See LICENSE.
2 commits
Python
91.0%
Shell
9.0%