What are the main components of a Large Language Model?
A Large Language Model (LLM) is made of several core components that work together to convert text into predictions and generate new text.
The main components are:
- Tokenizer
The tokenizer converts raw text into tokens—the units the model processes. These may be whole words, parts of words, punctuation, or other text pieces.
- Token embeddings
Each token is converted into a numerical vector called an embedding. This gives the model a mathematical representation it can process.
- Positional information
Because token order matters, the model also needs information about where each token appears in the sequence. Different LLM architectures encode position in different ways.
- Transformer layers
Most modern LLMs are built from many stacked Transformer layers. Each layer typically contains:
- Self-attention, which allows tokens to use information from other relevant tokens in the context
- Feed-forward networks, which transform the representation of each token
- Residual connections and normalization, which help information flow through deep networks and make training more stable
- Output layer / language-model head
After the Transformer layers process the input, the model converts the final hidden representation into scores for tokens in its vocabulary.
These scores are turned into probabilities for possible next tokens.
- Learned parameters
The embeddings, attention layers, feed-forward networks, and output layers contain numerical parameters learned during training. These parameters encode the patterns the model has learned from data.
A simplified flow is:
Text
↓
Tokenizer
↓
Token IDs
↓
Embeddings + positional information
↓
Transformer layers
↓
Output scores
↓
Next-token probabilitiesFor deeper explanations, see “What is a token in an LLM?”, “What are parameters in an LLM?”, and “How does an LLM predict the next token?”
In short: the main components of an LLM are the tokenizer, embeddings, positional information, stacked Transformer layers, an output layer, and the learned parameters that connect everything together.
Learning Sequence
Large Language Models Curriculum
Explore Related Questions
Deepen your understanding across related Large Language Models topics.