Vocabulary projection

×

Project each normalized feature vector into vocabulary logits.

L=zWout{\htmlData{light=logits projection}{L}}={\htmlData{light=final-norm}{z}}W_{\mathrm{out}}
in
zz [B batch, T positions, 2880 d]
out
LL [B batch, T positions, 201088 vocabulary]
Parameters579,133,440

579,133,440 parameters per instance.

ComponentCalculationParameters
Weight matrix2,880 × 201,088579,133,440

The reference module holds the weight output by input, [out, in].

Explanation

Each entry scores one vocabulary token as the next token for its position. The softmax and the choice of token happen outside the model.

Sources

In codeself.unembedding(x) · 387

Open pinned code ↗

Direct evidence

The model: a token embedding of the vocabulary by the width; 36 layers; a final RMSNorm; an unembedding without bias, separate from the embedding; the forward embeds, applies the layers in order, normalises and projects to the vocabulary.

model.py 357–388 ↗ · openai/gpt-oss @ 5681a6b65526

Excerpt
class Transformer(torch.nn.Module):
    def __init__(
        self,
        config: ModelConfig,
        device: torch.device | None = None,
    ):
        super().__init__()
        self.embedding = torch.nn.Embedding(
            config.vocab_size, config.hidden_size, device=device, dtype=torch.bfloat16
        )
        self.block = torch.nn.ModuleList(
            [
                TransformerBlock(config, layer_idx, device)
                for layer_idx in range(config.num_hidden_layers)
            ]
        )
        self.norm = RMSNorm(config.hidden_size, device=device)
        self.unembedding = torch.nn.Linear(
            config.hidden_size,
            config.vocab_size,
            bias=False,
            device=device,
            dtype=torch.bfloat16,
        )

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        x = self.embedding(x)
        for block in self.block:
            x = block(x)
        x = self.norm(x)
        x = self.unembedding(x)
        return x

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}