Large Language Model (LLM)
An LLM is like an extremely sophisticated autocomplete system. Trained on massive amounts of text, it learns to predict what comes next, but at such a scale that the output is surprisingly coherent, nuanced, and useful. When you interact with an AI code assistant or chatbot, you're communicating with an LLM.
How It Works
As the diagram shows, an LLM goes through two distinct phases: training and inference.
During training, the model processes billions of text documents: books, source code, websites, research papers, and more. Through this exposure, it adjusts billions of internal parameters (called weights) to learn statistical patterns in language. It learns that "import" is frequently followed by a module name, that functions have return statements, and that questions generally expect answers. This training process can take weeks on specialized hardware and costs millions of dollars for large models.
At inference time, when you actually use the model, it takes your input text and predicts the next most likely token (a word or word fragment). It then feeds that prediction back and predicts the next token, and the next, building a complete response piece by piece. This autoregressive process is the reason you sometimes see AI responses appear word by word.
A critical distinction: the model doesn't "understand" what it reads or writes. It has no beliefs, memories, or intentions. It does pattern matching at enormous scale, producing text that is statistically likely given the input. This is why it can write convincing code but also produce incorrect answers with confidence: it's optimizing for plausibility, not truth.
Why It Matters
LLMs are the engine behind AI code assistants, chatbots, translation tools, and content generators. Understanding that they predict rather than know helps you set the right expectations. When an LLM writes a function, it's generating code that resembles the patterns it learned, which is frequently correct — but not guaranteed.
This mental model changes how you work with AI tools. You learn to verify outputs, provide clear context, and treat the model as a powerful but fallible collaborator rather than an infallible oracle. The better you understand the mechanism, the more effectively you can leverage it.