Routed expert

Clamp the gate

×

Limit each gate feature to at most 7.

gˉ=min⁡(g, 7){\htmlData{light=clamp-gate}{\bar g}}=\min({\htmlData{light=take-gate}{g}},\,7)
in
gg [B batch, T positions, 2880 expert d_ff]
out
gˉ\bar g [B batch, T positions, 2880 expert d_ff]

swiglu_limit in original/config.json (model.py 268, 323).

Sources

In codex_glu.clamp(min=None, max=limit) · 252

Open pinned code ↗

Direct evidence

The experts’ activation: the gate features are the even features of the projection, counted from zero, the linear features the odd ones; the gate is capped at the limit from above, the linear bounded to ±limit; the gate times the sigmoid of 1.702 times itself, multiplied by the linear plus one.

model.py 249–256 ↗ · openai/gpt-oss @ 5681a6b65526

Excerpt
def swiglu(x, alpha: float = 1.702, limit: float = 7.0):
    x_glu, x_linear = x[..., ::2], x[..., 1::2]
    # Clamp the input values
    x_glu = x_glu.clamp(min=None, max=limit)
    x_linear = x_linear.clamp(min=-limit, max=limit)
    out_glu = x_glu * torch.sigmoid(alpha * x_glu)
    # Note we add an extra bias of 1 to the linear layer
    return out_glu * (x_linear + 1)

The configuration the reference implementation reads: 36 layers of width 2,880; 128 experts, 4 per token, each of 2,880 inner features; swiglu_limit 7.0; 64 query and 8 key–value heads of 64; a sliding window of 128; RoPE base 150,000 over an initial context of 4,096, scaled by 32 with NTK α 1 and β 32; a vocabulary of 201,088.

config.json 1 ↗ · openai/gpt-oss-120b @ b5c939de8f75

Excerpt
{"num_hidden_layers": 36, "num_experts": 128, "experts_per_token": 4, "vocab_size": 201088, "hidden_size": 2880, "intermediate_size": 2880, "swiglu_limit": 7.0, "head_dim": 64, "num_attention_heads": 64, "num_key_value_heads": 8, "sliding_window": 128, "initial_context_length": 4096, "rope_theta": 150000, "rope_scaling_factor": 32.0, "rope_ntk_alpha": 1, "rope_ntk_beta": 32}