oa::Moe
Moe class in the OA Ml public surface.
Inheritance
public Module
Public Methods
Constructor & Destructor Documentation
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
Parameters
inDModeloa::I32—
inDFFoa::I32—
inNumExpertsoa::I32—
inExpertsPerTokenoa::I32—
inRmsEpsoa::F32Default: 1e-5f
inNumSharedExpertsoa::I32Default: 0
Public Method Documentation
No public source comment is attached to this declaration.
Returns
const oa::Matrix &The declared return value.
No public source comment is attached to this declaration.
Returns
oa::F32The declared return value.
No public source comment is attached to this declaration.
Returns
oa::I32The declared return value.
No public source comment is attached to this declaration.
Returns
oa::I32The declared return value.
No public source comment is attached to this declaration.
Returns
oa::I32The declared return value.
forward: x[T,D] → moe_out[T,D]
Parameters
inXconst oa::Matrix &—
Returns
oa::MatrixThe declared return value.
No public source comment is attached to this declaration.
Parameters
inDModeloa::I32—
inDFFoa::I32—
inNumExpertsoa::I32—
inExpertsPerTokenoa::I32—
inRmsEpsoa::F32Default: 1e-5f
inNumSharedExpertsoa::I32Default: 0
Returns
voidThe declared return value.
No public source comment is attached to this declaration.
Returns
const oa::Matrix &The declared return value.
No public source comment is attached to this declaration.
Returns
oa::I32The declared return value.
No public source comment is attached to this declaration.
Returns
oa::I32The declared return value.
── route telemetry (read after execute+Sync) ──────────────────────────────
Returns
MoeRouteStatsThe declared return value.
No public source comment is attached to this declaration.
Parameters
inExpertoa::I32—
Returns
oa::F32The declared return value.
── Optional differentiable balancing losses (opt-in, default off) ───────── Switch/GShard aux loss α·E·Σ_e f_e·p_e (f = hard load fraction, constant; P = mean router prob, differentiable) plus router z-loss β·mean(LSE²). Add auxLoss() to the task loss before backward. Both coefficients 0 ⇒ auxLoss() is a 0 scalar recorded on the tape with no gradient effect.
Parameters
inAlphaoa::F32—
Returns
voidThe declared return value.
── Aux-loss-free load balancing (DeepSeek-V3) ───────────────────────────── A per-expert bias added to the routing logits for the top-k SELECTION decision only (never into the gate magnitude, so it does not distort the weighted combine and produces no gradient). After each optimizer step, call updateRoutingBias() to nudge under-loaded experts up and over-loaded ones down. The update and next forward remain in the deferred GPU graph.
Parameters
inGammaoa::F32—
Returns
voidThe declared return value.
No public source comment is attached to this declaration.
Parameters
inBetaoa::F32—
Returns
voidThe declared return value.
No public source comment is attached to this declaration.
Parameters
inEnabledbool—
Returns
voidThe declared return value.
No public source comment is attached to this declaration.
Returns
boolThe declared return value.
No public source comment is attached to this declaration.
Returns
voidThe declared return value.