# LM head

> LM head: The final layer that turns the last position's vector into one logit per vocabulary token.

Canonical: https://llmdojo.dev/glossary/lm-head

The final layer that turns the last position's vector into one logit per vocabulary token.

Learn it in the lesson: [One score per token](https://llmdojo.dev/learn/model-foundations/sampling/one-score-per-token) (Model Foundations · Next-Token Prediction and Sampling).

## Interview questions about LM head

- [Your LM head is too big for one device. How do you shard it by vocabulary or by hidden width, combine the logits, and compute an exact top-k across shards?](https://llmdojo.dev/interview/q/your-lm-head-is-too-big-for-one-device-how-do-you)
- [What are logits, and how does a model go from them to a whole sentence of output?](https://llmdojo.dev/interview/q/what-are-logits-and-how-does-a-model-go-from-them-to)

## Related
- [Logit](https://llmdojo.dev/glossary/logit)
- [Autoregressive generation](https://llmdojo.dev/glossary/autoregressive)
- [Greedy decoding](https://llmdojo.dev/glossary/greedy-decoding)
- [Temperature](https://llmdojo.dev/glossary/temperature)
- [Top-k](https://llmdojo.dev/glossary/top-k)
- [Top-p (nucleus sampling)](https://llmdojo.dev/glossary/top-p)
- [Seed](https://llmdojo.dev/glossary/seed)
- [Logprob](https://llmdojo.dev/glossary/logprob)
- [Glossary of every term](https://llmdojo.dev/glossary)
