This router uses the same mechanism as in Mixture-of-Experts with Expert
Choice (https://arxiv.org/abs/2202.09368): each expert selects its top
expert_capacity tokens. An individual token may be processed by multiple
experts or none at all.
Uses Keras add_loss() and add_metric() APIs.
Args
num_experts
Number of experts.
jitter_noise
Amplitude of jitter noise applied to router logits.
use_bias
Whether or not to use the bias term in computing the router
weights.
kernel_initializer
Kernel initializer for router weights.
bias_initializer
Bias initializer for router weights.
router_z_loss_weight
Weight for router_z_loss. Use non-zero values if
running into training instability (esp. with dtype 'bfloat16' or lower).
export_metrics
Whether to export metrics using Keras add_metric API.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-11-06 UTC."],[],[]]