pub struct Glm5NextMlpConfig {Show 14 fields
pub hidden: usize,
pub local_dense_intermediate: usize,
pub moe_intermediate: usize,
pub local_shared_intermediate: usize,
pub num_experts: usize,
pub local_experts: usize,
pub ep_rank: usize,
pub top_k: usize,
pub routed_scale: f32,
pub renormalize: bool,
pub swiglu_limit: f32,
pub router_bf16_ladder: bool,
pub tp_world_size: usize,
pub ep_world_size: usize,
}Expand description
2026-09-25: GLM MLP geometry for one rank, built by Self::from_config.
Fields§
§local_dense_intermediate: usize2026-09-25: intermediate_size / tp_world_size: this rank’s share of the dense FFN width.
moe_intermediate: usize2026-09-25: moe_intermediate_size, one routed expert’s width. Not divided by TP: an
expert is owned whole by one EP rank.
2026-09-25: shared_expert_intermediate_size / tp_world_size: this rank’s share of the
shared expert.
num_experts: usize2026-09-25: The full routed-expert count, not this rank’s share.
local_experts: usize2026-09-25: num_experts / ep_world_size; this rank owns ids
[ep_rank * local_experts, (ep_rank + 1) * local_experts).
ep_rank: usize§top_k: usize§routed_scale: f322026-09-25: routed_scaling_factor. Applied to the top-k weights, not to the shared
expert.
renormalize: bool2026-09-25: norm_topk_prob: divide the top-k weights by their sum plus 1e-20.
swiglu_limit: f322026-09-25: The asymmetric SwiGLU clamp bound; see the module header.
router_bf16_ladder: bool2026-09-25: True for Glm5NextRouterMode::VllmBf16: the router kernel then rounds the
scores, the running sum and each weight to BF16, which can change which experts are
selected. The parser yields HfFp32 (false) when the checkpoint names no router dtype.
tp_world_size: usize2026-09-25: TP ranks the dense/shared FFN is split over. Above 1, the site output is a partial sum.
ep_world_size: usize2026-09-25: EP ranks the routed experts are split over. Above 1, the routed sum is a partial sum.
Implementations§
Source§impl Glm5NextMlpConfig
impl Glm5NextMlpConfig
Sourcepub fn from_config(config: &ModelConfig) -> Result<Self>
pub fn from_config(config: &ModelConfig) -> Result<Self>
2026-09-25: Divides the global widths by TP and the expert set by EP (a world size of 0
counts as 1), then runs Self::validate. Errors when a width or the expert count does
not divide evenly.
Sourcepub fn local_expert_range(&self) -> Range<usize>
pub fn local_expert_range(&self) -> Range<usize>
2026-09-25: The half-open global expert-id range this rank owns.
Sourcepub fn local_slot(&self, global_id: usize) -> Option<usize>
pub fn local_slot(&self, global_id: usize) -> Option<usize>
2026-09-25: Global expert id to local slot, or None when another rank owns it. A
remote id contributes zero; experts is indexed by this slot, never by the global id.
Sourcepub fn needs_all_reduce(&self) -> bool
pub fn needs_all_reduce(&self) -> bool
2026-09-25: Whether the site output leaves this rank as a partial sum needing
all_reduce(SUM).
pub fn validate(&self) -> Result<()>
Trait Implementations§
Source§impl Clone for Glm5NextMlpConfig
impl Clone for Glm5NextMlpConfig
Source§fn clone(&self) -> Glm5NextMlpConfig
fn clone(&self) -> Glm5NextMlpConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more