Embedding and LM Head
PremiumUnderstand how token ids enter a continuous vector space, and how hidden states are projected back to vocabulary logits
Get code accessUnderstand how token ids enter a continuous vector space, and how hidden states are projected back to vocabulary logits
Get code accessThe heaviest computation in a Decoder-only Transformer happens in the blocks in the middle, but the input/output relationship of a language model is actually determined by the two ends:
This is premium content. Please log in to access the full article.
If these two ends are not understood clearly, many later questions get tangled together: why the input is integers, why the output is not a token id, why the loss needs shifted targets, why the vocabulary size significantly affects the parameter count, and even why some models share the weights of the input embedding and the output LM Head.
The main thread of this chapter only covers the two ends, input and output: Embedding and LM Head.