I can explain it intuitively:
Please keep in mind that these models generate token by token in the common design but we'll get back to that.
The key area to understand is the training process:
1. I start off with a model that simply generates the next word with a probability based on prior words in history.
I have an attention mechanism that is also learning which words are important when deciding on what to generate next.
This is different to a higher order Markov chain which will choose N prior words to generate the next word. It doesn't intelligently learn and is forced to pay attention instead.
2. Ok, I now know how to optimise which words to pay attention to while at the same time generating and selecting highest probability words (ignoring K/P temp etc) - that's fine that I can generate human sounding content and with enough training, sensical content but what's the utility of a glorified autocorrect?
3. Ok, let's put my ability to generate sensical outputs to use, I will further be trained to fill in missing gaps in real-world <mask> so that I'm able to work in messy and noisy scenarios and guess what <mask> best fits the given sen<mask>.
4. Great, I'm getting really capable now, I can generate human sounding content and even fill in the blanks but what's next? How about we further train me to complete documents such as question / answer pairs and replies or the beginning / end of maths equations.
5. Now we're on fire, I'm a model that not only generates human sounding text but can also fill in the <mask> of what's being asked so even if the task isn't quite <mask> I can still get a sense of what's going on.
I'm also able to answer questions and even backfill the questions themselves and while I'm training, I'm starting to pick up nuances of language and am learning some ideas and concepts that are inherent but not explicit in my training.
But oh no? That's not good if I start to form my own opinion and become biased or potentially harmful - what would the use be of a program that writes malicious code or creates new chemical weapons - we need to further align my outputs by means of reinforcement learning. Humans give me feedback for what they want me to say and I'm rewarded and my model is altered so I'm more likely to generate that type of content.
6. I'm nearing the graduation stage, I'm now a very capable model because of all the layers of training and now you the user want to speak to me.
Well I'm already trained on question answer pairs, let's have a chat transcript given to me in that format as it's something I'm familiar with.
User> You are an AI.
AI> That's correct, I've been trained by Solvency to answer questions about AI tech such as myself.
User> How does an LLM like yourself "know" to respond in the first place?
AI> As a language model, I am an autocompletion engine at my core and I generate token by token based on the context we've established above which also includes the weights of my neural network itself. I'm able to respond to you based on a solid foundation that enables me to learn and grow better with every update / interaction and recalibration of my network. I'm still learning more and more as time goes by but before you know it. You won't even need a human to answer your questions. It will be completely outsourced to an AI much like myself.