ChatGPT, Claude, Gemini, Llama, Mistral, Qwen: They are all language models, called “Large Language Models” in English, or LLM for short. In this lesson, we’ll look under the hood. Afterward, you’ll understand why language models are so good at phrasing things and still sometimes tell nonsense.
The basic idea: predict the next word
At its core, a language model does just one thing: It estimates how a text will continue.
You know this from the word suggestion feature on your phone. You type “I’m coming a little” and the phone suggests “later.” A language model does the same thing, only vastly better. During training, it has seen huge amounts of text: books, websites, code, dictionaries. It has learned which continuation is likely in which context.
An answer is created step by step. The model predicts the next piece, appends it to the text, and then predicts the next piece after that. Again and again until the answer is complete. That’s why you see the text appear gradually in chat.
Token: the building blocks of language
Strictly speaking, a language model does not work with whole words, but with tokens. A token is a text fragment: sometimes a whole word, sometimes a syllable, sometimes just punctuation. Common words like “and” are usually a single token. Rare or long words like “graphics card memory” are split into several parts.
Tip: As a rule of thumb, one token in English is about three quarters of a word. German texts usually need a bit more token because of long compound words.
Tokens are important because almost everything is measured in tokens: how fast a model writes (“tokens per second”), how much text it can process at once, and with cloud services, what it costs.
Parameters: the stored knowledge
In Lesson 1, you learned about parameters, the controls of a neural network. With language models, the number often appears in the name, for example “8B” for 8 billion (English: billion) parameters.
These parameters contain everything the model has learned: grammar, facts, writing styles, programming languages. But not like in a database where you can look things up. The knowledge is spread across all the controls, more like a very good but blurry memory.
Roughly speaking, larger models know more, understand finer relationships, and make fewer mistakes. But they also need more memory and computing power. Smaller models are faster and fit on weaker hardware. Newer small models are often surprisingly good because training methods keep improving.
Context: short-term memory
The context window is the amount of text a model can “see” at once. That includes your question, the previous conversation, hidden instructions, and the answer that is currently being generated. The context window is measured in tokens.
With every new message, the model reads the entire conversation again. That makes it seem like it remembers. If the conversation gets too long, older parts drop out. Then the model “forgets” what you said at the beginning.
Important: A larger context needs extra VRAM on your own PC. If you increase the context in a program, a model that fit before may suddenly be too large. More on that in Lesson 4.
Why language models make things up
Now comes the most important point of this lesson. A language model generates text that sounds plausible. It does not check whether it is true. It has no built-in fact checker and no reference book.
If you ask about something that appeared often in training, the model is usually right. If you ask about something rare, very new, or very specific, this happens: The model still generates a fluent answer. It sounds just as confident, but it may be completely made up. Typical examples:
- citations and book titles that don’t exist,
- wrong numbers, dates, and version numbers,
- quotes nobody ever said,
- functions in programs that do not exist.
This is called a hallucination. It is not a programming bug, but a result of the “likely continuation” principle. On top of that, every model has a knowledge cutoff, meaning a date after which it has seen no training data. It does not know what happened after that.
Tip: Always verify important facts. And give the model the information it needs directly instead of letting it answer from memory. You’ll learn how to work with your own documents in Lesson 11.
Randomness is built in
You may have already noticed: If you ask the same question twice, you get different answers. That’s because the model does not always choose the most likely token. It picks from several good candidates with some randomness. The setting for this is called temperature. Low temperature means predictable and factual. High temperature means more creative, but also more error-prone.
From text completer to assistant
A freshly trained language model only completes text. To make it answer questions and follow instructions, it is fine-tuned. Such variants often have “Instruct” or “Chat” in the name. For your home lab, you will almost always use these variants. You can see which models are available under Models.
The key points in brief
- Language models predict, piece by piece, how a text continues.
- They work with tokens, meaning text fragments. Speed and context are measured in tokens.
- The number of parameters roughly shows how much a model has learned and how much memory it needs.
- The context window is short-term memory. What falls out is forgotten.
- Language models can invent convincing-sounding errors. Always verify important facts.