5 ms·
> An LLM is a function that takes an array of integers and returns a new array of integers. To refine this a bit more, a LLM is a function that takes an array
by smaddox 4y ago
> An LLM is a function that takes an array of integers and returns a new array of integers.
To refine this a bit more, a LLM is a function that takes an array of integers (or really, a batch of arrays of integers), and returns a probability distribution for each possible integer, with the array shifted left by one place to enable prediction.
- sorokod 4y agoTo refine further: takes an array of integers and draws the rest of the f**king owl.
- turzmo 4y agoI would argue that my hard drive too can take an array of integers and produce an owl.
- wilg 4y agoOh let's see! I'll start: 1
- x-complexity 4y ago1
- VHRanger 4y agoMoreover: The integers are really indeces into the embedding space. So you'd want to think more that the model maintains a giant matrix (one row = one token; one column is an embedding feature). The array of indices gets the relevant embeddings to shove through the rest of the model's forward pass.
- flir 4y agoA probability distribution for each token in the array, not just the last one? I don't understand that, because wouldn't the probabilities later in the sentence be impacted by the tokens chosen earlier in the sentence?
- ruuda 4y agoYou unfold it one token at a time by sampling from the returned distribution. To control the amount of variation, you can make the probability distribution more extreme, in the most extreme case you only select the most likely token, and the sequence becomes deterministic. Yes, what happens later in the sentence depends on the particular choice you made earlier in the sentence.
- smaddox 4y agoYes, one distribution per position. This was a key innovation that allowed training over the entire sequence in parallel, rather than on one token prediction at a time, thereby massively speeding up training. More recently, there are models like RWKV that can run in both parallel (GPT-like) mode for training and serial (RNN-like) mode for inference. But transformers always output a probability distribution at each position in the context.
- nonfamous 4y agoI've always wondered how stop tokens fit in here. Does the LLM generate a probability for "stop" in addition to every other token in the space? Or is stopping handled heuristically by the outer loop that generates the output tokens sequentially? The API docs talk about letting you specify your own stop token (like "<!-->") but I don't think "token" is meant in the same sense here.
- amilios 4y agoYes, the model has something like an EOF token which it emits for the output to end. It is part of the probability distribution that the model predicts.
- lukasb 4y agoCould the properties of the distribution (the spread? not stats literate enough) be used to calculate a confidence metric for the answer?
- fnbr 4y agoYes! This is something that is done. The problem is that a) it’s tough to find a sane denominator as the likelihood of the entire sequence can be quite small, even though it’s the best answer and b) the answer isn’t grounded in anything, so the confidence score isn’t super helpful. A score like this can be useful for active learning though, where you find areas of low confidence in your dataset and get more data to train on.