How large language models work
Large language models are functions that map text to text. Given an input string of text, a large language model predicts the text that should come next.

The magic of large language models is that by being trained to minimize this prediction error over vast quantities of text, the models end up learning concepts useful for these predictions. For example, they learn:

how to spell
how grammar works
how to paraphrase
how to answer questions
how to hold a conversation
how to write in many languages
how to code
etc.
None of these capabilities are explicitly programmed in—they all emerge as a result of training.