puwaer/DeepSeek-V4-Flash-0731-reap-150b

Model

puwaer/DeepSeek-V4-Flash-0731-reap-150b

1

4 commits

2 linked in READMEs

updated Aug 26, 2026

See the code

README

puwaer/DeepSeek-V4-Flash-0731-reap-150b

DeepSeek-V4-Flash-0731 with its routed experts reduced from 256 to 132 per layer by router-weighted expert activation pruning (REAP), taking the checkpoint from 156 GiB to 79 GiB. All 43 layers are kept; only the expert population inside each MoE block changes. No fine-tuning, no distillation, and no gradient step of any kind β€” the experts are pruned from calibration statistics in a single pass.

Produced with moe-compress.

Benchmarks

ModelExpertsSizeGSM8KMATH-500HumanEval+MBPP+mean
base 284b256156 GiB0.94840.70600.87200.74070.8168
REAP 200b178104 GiB0.94010.68800.87200.74070.8102
REAM 200b178104 GiB0.86200.60800.88410.76980.7810
REAP 150b13279 GiB0.92950.71400.89630.75930.8248
REAM 150b13279 GiB0.69220.50200.85370.73280.6952

Difference from the base model, in points:

GSM8KMATH-500HumanEval+MBPP+mean
-1.90+0.80+2.44+1.85+0.80

Metrics: GSM8K exact_match,strict-match, MATH-500 math_verify,none, HumanEval+/MBPP+ pass@1_plus. All greedy (n=1), 4096-token context, enable_thinking=false, served with SGLang.

What changed relative to the base model

basethis model
Routed experts per layer256132
Decoder layers4343
Experts per token66
Checkpoint size156 GiB79 GiB
MTP modules (mtp.0/1/2)present (4705 tensors)absent
chat_templatenot shippedshipped (chat_template.jinja)
encoding/encoding_dsv4.pypresentpresent (copied verbatim)

One difference deserves to be read before you deploy this:

  • The multi-token-prediction modules are gone. The base checkpoint carries mtp.0, mtp.1 and mtp.2; this one carries none of them. MTP-based speculative decoding is therefore unavailable. Engines that look for those weights will fall back to ordinary decoding. Nothing else references them, so standard generation is unaffected.

Everything else about the prompt and generation defaults is the base model's.

Thinking

Thinking is on by default, just like the base model.

# Python
tok.apply_chat_template(msgs, add_generation_prompt=True, enable_thinking=False)

# SGLang or llama-server API
{"messages": [...], "chat_template_kwargs": {"enable_thinking": false}}

  • Reasoning effort: Set reasoning_effort to "low" (default), "high", or "max" (applies only in thinking mode).

Practical Notes

  1. Token Budget: Thinking consumes tokens before the actual answer starts. Ensure your max_tokens is high enough to prevent mid-reasoning truncation.
  2. Default Sampling: Per generation_config.json, the model samples by default (do_sample, temperature, top_p) rather than using greedy decoding.
  3. Output Format: Reasoning appears inline in message.content, ending with </think>. (In llama.cpp, use --reasoning-format deepseek to isolate it into message.reasoning_content).

Where the prompt format comes from

DeepSeek does not ship a chat_template: the base model builds prompts with a Python encoder, encoding/encoding_dsv4.py, which does not survive a checkpoint conversion. Two things here address that.

encoding/ is copied verbatim from the base repository (MIT, Copyright (c) 2023 DeepSeek) and is the authority. Use it directly if you need tool calling, the internal task tokens, developer or latest_reminder messages, or multi-turn context β€” none of which the template implements.

chat_template.jinja is a transcription of encode_messages() for the subset that does fit a template: system, user and assistant turns, both thinking modes, and reasoning_effort. It is verified to reproduce the encoder string for string over several hundred conversations, including multi-turn exchanges with reasoning_content, consecutive user messages, and all three effort levels.

Compression recipe

moe-compress compress \
    --model deepseek-ai/DeepSeek-V4-Flash-0731 \
    --method reap --num-kept-experts 132 \
    --datasets c4,math,code --mix-ratio 0.0,0.3,0.7 \
    --num-samples 3072 --seq-len 512 \
    --streaming --stream-experts \
    --save-path DeepSeek-V4-Flash-0731-reap-150b

Calibration is the REAM paper's mixture, weighted 30% math / 70% code with no C4 (mix_ratio positions match datasets). --streaming is what lets a 156 GiB checkpoint be compressed on a single 96 GB GPU: layers are read and written one at a time, so peak memory is the skeleton plus one layer.

Reconstruction quality

Measured during compression on a 4096-token probe, comparing each rebuilt MoE block's output against the original, averaged over all 43 layers:

cosine (mean)cosine (min)rel. L2 (mean)
this model0.94450.84170.2068

This is a compression-time diagnostic, not a quality metric β€” read the benchmarks for that.

Serving

Verified with SGLang. On Hopper the MXFP4 expert layout needs an explicit MoE runner; auto lands on a Triton path that asserts on the packed weights:

python3 -m sglang.launch_server \
    --model-path puwaer/DeepSeek-V4-Flash-0731-reap-150b \
    --tp-size 2 \
    --nnodes 2 --node-rank $RANK --dist-init-addr <head>:5000 \
    --moe-runner-backend flashinfer_mxfp4 \
    --chat-template chat_template.jinja \
    --context-length 4096

GGUF builds for llama.cpp are available; the routed experts are already MXFP4 in the source weights, so an MXFP4_MOE GGUF is numerically identical to this checkpoint.

Choosing between REAP and REAM

On this model REAP wins outright, and by a margin that widens as more is removed. Points against the base model, given as 178 experts / 132 experts:

GSM8KMATH-500HumanEval+MBPP+mean
REAP β€” prune low-saliency expertsβˆ’0.83 / βˆ’1.90βˆ’1.80 / +0.80Β±0.00 / +2.44Β±0.00 / +1.85βˆ’0.66 / +0.80
REAM β€” merge them into survivorsβˆ’8.64 / βˆ’25.63βˆ’9.80 / βˆ’20.40+1.22 / βˆ’1.83+2.91 / βˆ’0.79βˆ’3.58 / βˆ’12.16

REAP at 178 experts returns the base model's pass@1 exactly on both code benchmarks β€” 542 problems, not one of them different β€” for a third off the checkpoint.

An earlier build of these checkpoints looked like a trade-off instead β€” REAP holding arithmetic and losing code, REAM the reverse. That was an artifact of a bug in the hash-routed layers' expert table, not a property of either method. With it fixed the trade-off disappears: REAP is at least as good as REAM on code and far better on arithmetic.

Note also how differently the two scale. Going from 178 experts to 132 costs REAP 1.1 more points of GSM8K; it costs REAM 17.0.

Citation

The methods:

  • REAP β€” Router-weighted Expert Activation Pruning. Lasby et al., 2025. arXiv:2510.13999
  • REAM β€” Router-weighted Expert Activation Merging. Jha et al., 2026. arXiv:2604.04356

The implementation: https://github.com/puwaer/moe-expert-compress

The base model: deepseek-ai/DeepSeek-V4-Flash-0731

License

MIT, following the base model. The compression code is MIT; its numerical core is ported from the official REAM reference implementation (Copyright (c) 2026 Samsung Electronics Co., Ltd.) with attribution headers retained. encoding/encoding_dsv4.py is DeepSeek's, redistributed under the same MIT terms as the base model.

8-bit
compressed
conversational
deepseek_v4
endpoints_compatible
expert-pruning
reap
safetensors
text-generation
transformers

Contributors

puwaer

4 commits

puwaer/DeepSeek-V4-Flash-0731-reap-150b

Model

puwaer/DeepSeek-V4-Flash-0731-reap-150b

1

4 commits

2 linked in READMEs

updated Aug 26, 2026

See the code

README

puwaer/DeepSeek-V4-Flash-0731-reap-150b

DeepSeek-V4-Flash-0731 with its routed experts reduced from 256 to 132 per layer by router-weighted expert activation pruning (REAP), taking the checkpoint from 156 GiB to 79 GiB. All 43 layers are kept; only the expert population inside each MoE block changes. No fine-tuning, no distillation, and no gradient step of any kind β€” the experts are pruned from calibration statistics in a single pass.

Produced with moe-compress.

Benchmarks

ModelExpertsSizeGSM8KMATH-500HumanEval+MBPP+mean
base 284b256156 GiB0.94840.70600.87200.74070.8168
REAP 200b178104 GiB0.94010.68800.87200.74070.8102
REAM 200b178104 GiB0.86200.60800.88410.76980.7810
REAP 150b13279 GiB0.92950.71400.89630.75930.8248
REAM 150b13279 GiB0.69220.50200.85370.73280.6952

Difference from the base model, in points:

GSM8KMATH-500HumanEval+MBPP+mean
-1.90+0.80+2.44+1.85+0.80

Metrics: GSM8K exact_match,strict-match, MATH-500 math_verify,none, HumanEval+/MBPP+ pass@1_plus. All greedy (n=1), 4096-token context, enable_thinking=false, served with SGLang.

What changed relative to the base model

basethis model
Routed experts per layer256132
Decoder layers4343
Experts per token66
Checkpoint size156 GiB79 GiB
MTP modules (mtp.0/1/2)present (4705 tensors)absent
chat_templatenot shippedshipped (chat_template.jinja)
encoding/encoding_dsv4.pypresentpresent (copied verbatim)

One difference deserves to be read before you deploy this:

  • The multi-token-prediction modules are gone. The base checkpoint carries mtp.0, mtp.1 and mtp.2; this one carries none of them. MTP-based speculative decoding is therefore unavailable. Engines that look for those weights will fall back to ordinary decoding. Nothing else references them, so standard generation is unaffected.

Everything else about the prompt and generation defaults is the base model's.

Thinking

Thinking is on by default, just like the base model.

# Python
tok.apply_chat_template(msgs, add_generation_prompt=True, enable_thinking=False)

# SGLang or llama-server API
{"messages": [...], "chat_template_kwargs": {"enable_thinking": false}}

  • Reasoning effort: Set reasoning_effort to "low" (default), "high", or "max" (applies only in thinking mode).

Practical Notes

  1. Token Budget: Thinking consumes tokens before the actual answer starts. Ensure your max_tokens is high enough to prevent mid-reasoning truncation.
  2. Default Sampling: Per generation_config.json, the model samples by default (do_sample, temperature, top_p) rather than using greedy decoding.
  3. Output Format: Reasoning appears inline in message.content, ending with </think>. (In llama.cpp, use --reasoning-format deepseek to isolate it into message.reasoning_content).

Where the prompt format comes from

DeepSeek does not ship a chat_template: the base model builds prompts with a Python encoder, encoding/encoding_dsv4.py, which does not survive a checkpoint conversion. Two things here address that.

encoding/ is copied verbatim from the base repository (MIT, Copyright (c) 2023 DeepSeek) and is the authority. Use it directly if you need tool calling, the internal task tokens, developer or latest_reminder messages, or multi-turn context β€” none of which the template implements.

chat_template.jinja is a transcription of encode_messages() for the subset that does fit a template: system, user and assistant turns, both thinking modes, and reasoning_effort. It is verified to reproduce the encoder string for string over several hundred conversations, including multi-turn exchanges with reasoning_content, consecutive user messages, and all three effort levels.

Compression recipe

moe-compress compress \
    --model deepseek-ai/DeepSeek-V4-Flash-0731 \
    --method reap --num-kept-experts 132 \
    --datasets c4,math,code --mix-ratio 0.0,0.3,0.7 \
    --num-samples 3072 --seq-len 512 \
    --streaming --stream-experts \
    --save-path DeepSeek-V4-Flash-0731-reap-150b

Calibration is the REAM paper's mixture, weighted 30% math / 70% code with no C4 (mix_ratio positions match datasets). --streaming is what lets a 156 GiB checkpoint be compressed on a single 96 GB GPU: layers are read and written one at a time, so peak memory is the skeleton plus one layer.

Reconstruction quality

Measured during compression on a 4096-token probe, comparing each rebuilt MoE block's output against the original, averaged over all 43 layers:

cosine (mean)cosine (min)rel. L2 (mean)
this model0.94450.84170.2068

This is a compression-time diagnostic, not a quality metric β€” read the benchmarks for that.

Serving

Verified with SGLang. On Hopper the MXFP4 expert layout needs an explicit MoE runner; auto lands on a Triton path that asserts on the packed weights:

python3 -m sglang.launch_server \
    --model-path puwaer/DeepSeek-V4-Flash-0731-reap-150b \
    --tp-size 2 \
    --nnodes 2 --node-rank $RANK --dist-init-addr <head>:5000 \
    --moe-runner-backend flashinfer_mxfp4 \
    --chat-template chat_template.jinja \
    --context-length 4096

GGUF builds for llama.cpp are available; the routed experts are already MXFP4 in the source weights, so an MXFP4_MOE GGUF is numerically identical to this checkpoint.

Choosing between REAP and REAM

On this model REAP wins outright, and by a margin that widens as more is removed. Points against the base model, given as 178 experts / 132 experts:

GSM8KMATH-500HumanEval+MBPP+mean
REAP β€” prune low-saliency expertsβˆ’0.83 / βˆ’1.90βˆ’1.80 / +0.80Β±0.00 / +2.44Β±0.00 / +1.85βˆ’0.66 / +0.80
REAM β€” merge them into survivorsβˆ’8.64 / βˆ’25.63βˆ’9.80 / βˆ’20.40+1.22 / βˆ’1.83+2.91 / βˆ’0.79βˆ’3.58 / βˆ’12.16

REAP at 178 experts returns the base model's pass@1 exactly on both code benchmarks β€” 542 problems, not one of them different β€” for a third off the checkpoint.

An earlier build of these checkpoints looked like a trade-off instead β€” REAP holding arithmetic and losing code, REAM the reverse. That was an artifact of a bug in the hash-routed layers' expert table, not a property of either method. With it fixed the trade-off disappears: REAP is at least as good as REAM on code and far better on arithmetic.

Note also how differently the two scale. Going from 178 experts to 132 costs REAP 1.1 more points of GSM8K; it costs REAM 17.0.

Citation

The methods:

  • REAP β€” Router-weighted Expert Activation Pruning. Lasby et al., 2025. arXiv:2510.13999
  • REAM β€” Router-weighted Expert Activation Merging. Jha et al., 2026. arXiv:2604.04356

The implementation: https://github.com/puwaer/moe-expert-compress

The base model: deepseek-ai/DeepSeek-V4-Flash-0731

License

MIT, following the base model. The compression code is MIT; its numerical core is ported from the official REAM reference implementation (Copyright (c) 2026 Samsung Electronics Co., Ltd.) with attribution headers retained. encoding/encoding_dsv4.py is DeepSeek's, redistributed under the same MIT terms as the base model.

8-bit
compressed
conversational
deepseek_v4
endpoints_compatible
expert-pruning
reap
safetensors
text-generation
transformers

Contributors

puwaer

4 commits