Skip to content

Conversation

@avtc
Copy link
Contributor

@avtc avtc commented Jan 10, 2026

@Qubitium Hi, this feature adds ability to process moe weights in chunks in MoeRoutingBypass mode. Allowing to quantize large MoE models with less VRAM and devices.

Currently for each expert weight in GPTQ the hessian accumulator created during forward pass, which for example for GLM-4.5-Air is around 17Gb for up/gate moe modules for one layer. Processing expert weights in chunks require less hessian accumulator matrices and thus VRAM.

Example option usage:

moe={'routing': {'class': 'ExpertsRoutingBypass', 'batch_size': 50}}

@avtc avtc marked this pull request as ready for review January 10, 2026 18:53
@Qubitium
Copy link
Collaborator

Qubitium commented Jan 12, 2026

@avtc Do you have some rough numbers for vram saving in your setup with and without the PR?

@avtc
Copy link
Contributor Author

avtc commented Jan 12, 2026

@Qubitium Hi,
Here are screens from quantizing a GLM-4.5-Air - layer 0 - non moe, layer 1+ - moe:
Calibration data: 2320 samples - 769K tokens.
5x3090 with first one excluded from compute: compute_device_filter=lambda devices: [d for d in devices if d.index != 0]
VramStrategy=Exclusive (i.e. data parallel).

Without batching experts, forward of moe up/gate modules on the layer 1:
image
Results in CUDA OOM in a while after screenshot.

With batch_size = 128, same stage:
image
It works, we batch 128 modules from 256 (128 x up/gate) in one forward/quantize.

With batch_size = 32, same stage for comparison:
image

@Qubitium
Copy link
Collaborator

Qubitium commented Jan 13, 2026

@Qubitium Hi, Here are screens from quantizing a GLM-4.5-Air - layer 0 - non moe, layer 1+ - moe: Calibration data: 2320 samples - 769K tokens. 5x3090 with first one excluded from compute: compute_device_filter=lambda devices: [d for d in devices if d.index != 0] VramStrategy=Exclusive (i.e. data parallel).

Without batching experts, forward of moe up/gate modules on the layer 1: image Results in CUDA OOM in a while after screenshot.

With batch_size = 128, same stage: image It works, we batch 128 modules from 256 (128 x up/gate) in one forward/quantize.

With batch_size = 32, same stage for comparison: image

Looks good! We will work on this PR after a newly awq discovered regression is fixed.

Signed-off-by: ZX-ModelCloud <zx@modelcloud.ai>
Copy link
Collaborator

@Qubitium Qubitium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanup

…ng object

Signed-off-by: ZX-ModelCloud <zx@modelcloud.ai>
Signed-off-by: ZX-ModelCloud <zx@modelcloud.ai>
Signed-off-by: ZX-ModelCloud <zx@modelcloud.ai>
Signed-off-by: ZX-ModelCloud <zx@modelcloud.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants