This post shall give a very basic view on LLMs and therefore can be a little bit off the actual behavior.
Creation
- Data crawling: The crawler searches the internet and extracts the actual text from the web pages.
- Tokenization: The tokenizer translates the text into tokens, represented by unique token IDs. 1
- Network pre-training: The training happens in a loop over the tokenized training data. 2, 3
- The first/next token (sequence) from the training data gets fed into the network.
- The network returns a probability distribution over the vocabulary, indicating how likely each possible next token is.
- The network’s weights are adjusted based on the difference between its prediction and the actual next token.
- Network post-training: Trains the model with specific user-defined datasets to improve its behavior.
1 You want to try it out? Here is a tool showing you tokenizers: https://tiktokenizer.com/.
2 The ANN in an LLM is a Transformer, which contains of more than just FFNNs/MLPs.
3 The LLM will actually be trained, processing multiple token sequences in parallel.
Usage
- Prompting: You are entering text for the LLM in the provided input field via the GUI. 4
- Tokenization: The tokenizer processes the prompt in the same way as the training data.
- Inference: It’s like the network training process, but without the actual training.
- The model receives the prompt and the tokens already generated for the response.
- The model calculates the probability distribution and returns the next token based on it.
4 The actual input for the LLM is called context, which contains more than the prompt from the user.
Summary
An LLM is a huge ANN
… which has been trained on a lot of tokenized text data
… that responses by repeatedly predicting the next token.