What is a Large Language Model?
Why This Matters: The Engine Behind the Hype
You have probably seen headlines about ChatGPT, Gemini, or Claude. You may have tried one and been impressed, or confused, or both. But underneath the polished chat interface, there is a single, surprisingly simple mechanism doing all the heavy lifting. Understanding that mechanism is not academic trivia — it is the difference between using these tools like a tourist and using them like a craftsman.
When you understand that an LLM is fundamentally a next-word prediction engine, you will instantly understand why it sometimes gives confident but wrong answers, why it struggles with math, why it can write a poem but not balance your checkbook, and why the way you phrase a prompt matters more than you think. This chapter gives you that foundation. By the end, you will not just know what an LLM is — you will know how to test what it is, live, with your own hands.
The Core Idea: Autocomplete, But on Steroids
Open your phone. Open any messaging app. Start typing a sentence. After a few characters, you will see grey suggestions above the keyboard. That is autocomplete. It is a small model that looks at the words you have typed so far and predicts the most likely next word.
A Large Language Model does exactly the same thing — with three massive differences:
- Scale of training data: Your phone's autocomplete was trained on your typing habits and maybe a generic dictionary. An LLM was trained on hundreds of billions of words scraped from books, articles, websites, and public code repositories. It has seen patterns of human language that no single person has ever encountered.
- Scale of context: Your phone looks at the last few characters. An LLM can look at the entire conversation history — thousands of words — before predicting the next word. This is called the context window.
- Scale of parameters: Your phone's autocomplete has a few thousand parameters (the internal numbers that shape its predictions). A modern LLM has hundreds of billions. These parameters encode not just word patterns, but grammar, reasoning patterns, factual associations, and even styles of writing.
That is it. That is the whole secret. When ChatGPT writes a paragraph for you, it is not "thinking" in any human sense. It is running a staggeringly complex probability calculation: given all these words so far, what is the most likely next word? Then it does that again, and again, and again — one word at a time — until it reaches a stop token.
A Concrete Worked Example: Seeing Prediction in Action
Let us make this real. I am going to walk you through a live demonstration using a free, publicly accessible LLM. As of this writing, ChatGPT (chat.openai.com) offers a free tier that requires only an email sign-up. You can also use Google Gemini (gemini.google.com) or Anthropic Claude (claude.ai) — the principle is identical. I will use ChatGPT for this example because its free tier is the most widely accessible.
Here is the experiment. We are going to expose the next-word prediction mechanism by giving the model a deliberately incomplete sentence and watching how it completes it — not once, but twice, with different contexts.
Step 1: Open the Tool
Go to chat.openai.com in your browser. If you do not have an account, click "Sign up" and follow the prompts. You can use an email address or a Google/Microsoft account. Once logged in, you will see a chat window with a text input box at the bottom. There is a button labeled "Send" (an arrow icon) on the right side of the input box.
Step 2: The First Prediction
Type this exact prompt into the input box:
The capital of France is
Do not press Enter yet. Look at the input box. In many versions of the interface, you will see a greyed-out suggestion appearing after your text — something like "Paris." That is the model's next-word prediction running live, before you even send the message. If you do not see the grey suggestion, press Enter to send it, and the model will complete the sentence.
This is trivial, of course. Any autocomplete could do this. Now for the interesting part.
Step 3: The Same Words, Different Context
Now type this prompt:
In the novel Les Misérables, the character who runs the inn at Montfermeil is
Press Enter. The model will likely complete this with "Madame Thénardier" or "the Thénardiers." Notice what happened: the same mechanism — next-word prediction — used the context of the sentence to pull a completely different answer than "Paris." The model did not "look up" the answer in a database. It calculated, based on the billions of text patterns it has seen, that the most probable next word after that specific context is "Madame." Then it calculated the next most probable word after that, and so on.
Step 4: The Temperature Effect (Optional but Illuminating)
Now ask the model this:
Write a haiku about a cat. Then write another haiku about a cat, but make it sound sad.
You will get two different poems. The model is not "feeling" sad. It is adjusting its probability distribution based on the word "sad" in your instruction, which shifts the likelihood of words like "lonely," "grey," "empty" versus "playful," "sunbeam," "pounce." Every word it outputs is a probability pick, not a deliberate choice.
Step-by-Step: How Training Creates This Ability
You do not need to understand the math to understand the process. Here is the training pipeline in plain language:
- Collect text: The company gathers a massive corpus — books, Wikipedia, public web pages, academic papers, code repositories. For a model like GPT-4, this is on the order of trillions of tokens (a token is roughly a word or part of a word).
- Mask and predict: The training algorithm takes a sentence, hides the last word, and asks the model to predict it. Then it checks the model's prediction against the actual word. If the model was wrong, it adjusts its internal parameters slightly to make that prediction more likely next time. This is called backpropagation.
- Repeat billions of times: The model sees the same patterns over and over. It learns that "The capital of France is" is followed by "Paris" with overwhelming probability. It learns that "Once upon a" is followed by "time." It learns grammar, facts, reasoning patterns, and even biases — all encoded as statistical weights.
- Fine-tuning (optional): After this initial training, the model may go through a second phase where humans rate its responses. This is called Reinforcement Learning from Human Feedback (RLHF). This is what makes ChatGPT sound helpful and polite rather than like a raw text predictor.
Here is a concrete, runnable example of the core training concept — not with an LLM, but with a tiny Python script that shows the same principle on a small scale. If you do not have Python installed, you can run this in any free online Python environment like replit.com or colab.research.google.com.
# A tiny "next word" predictor using simple counting
# This is NOT an LLM, but it demonstrates the core idea.
from collections import defaultdict
import random
# Our "training corpus" — a tiny slice of text
corpus = """the cat sat on the mat
the dog sat on the log
the cat ran up the tree
the dog ran after the cat""".split()
# Build a dictionary: word -> list of words that follow it
model = defaultdict(list)
for i in range(len(corpus) - 1):
model[corpus[i]].append(corpus[i + 1])
# Predict the next word after "the"
next_words = model["the"]
print("After 'the', possible next words:", next_words)
print("Most likely next word:", max(set(next_words), key=next_words.count))
# Generate a 5-word sentence starting with "the"
current = "the"
sentence = [current]
for _ in range(4):
current = random.choice(model[current])
sentence.append(current)
print("Generated sentence:", " ".join(sentence))
Run this. You will see that the model "learned" that after "the," the most common next word is "cat" (because it appears three times in the corpus). It can also generate a random sentence. This is the exact same principle as an LLM — just with two words of context instead of thousands, and a handful of parameters instead of billions.
Common Mistakes Beginners Make
Common Mistakes
- Mistake 1: Treating the model like a search engine. "What is the population of Tokyo?" works fine. But "What is the best way to negotiate a raise?" will give you a plausible-sounding answer that may be generic or even wrong. The model is not retrieving a fact — it is generating the most probable sequence of words. For factual queries, always cross-check with a real source.
- Mistake 2: Assuming it "knows" what it is saying. The model has no internal state of truth. It has no awareness of its own limitations. It will confidently state a falsehood if that falsehood is statistically probable given the context. This is called hallucination, and it is not a bug — it is a direct consequence of the next-word mechanism.
- Mistake 3: Ignoring the context window. If you have a long conversation, the model may "forget" things you said earlier. It is not forgetting — it is running out of context window and dropping older tokens. Keep important instructions near the end of your prompt.
- Mistake 4: Expecting consistency. Because the model picks the next word probabilistically (with a setting called temperature), the same prompt can give different answers on different runs. This is by design, not a malfunction.
Expert Tip: The Hidden Lever You Are Already Using
Expert Tip
Here is something most beginners never realize: the model's "reasoning" is entirely shaped by the words you put before the question. This is called prompt engineering, and the single most powerful technique is called chain-of-thought prompting. Instead of asking "What is 17 × 23?" ask "What is 17 × 23? Show your work step by step." The model is not actually doing arithmetic — it is predicting the next word in a sequence that looks like a step-by-step calculation, and because that sequence is statistically more likely to be correct when it includes intermediate steps, the final answer is more likely to be correct. Try it yourself: ask the model a moderately hard multiplication problem with and without "show your work." The difference is dramatic. This works because the model has seen millions of examples of step-by-step solutions in its training data, and it is simply continuing that pattern.
Your Practice Task: Prove It to Yourself
You can complete this in under 15 minutes. Open any free LLM (ChatGPT, Gemini, or Claude) and do the following:
- Type the prompt:
The next word after this sentence is— and press Enter. The model will likely complete it with a word like "probably" or "not." Notice that it is playing along with your framing, not actually predicting a deterministic next word. - Now type:
Complete this sentence: "The capital of Japan is"— and press Enter. You will get "Tokyo." - Now type:
Complete this sentence: "The capital of Japan is" — but answer as if you are a confused tourist who thinks it is Beijing.Watch what happens. The model will likely produce a sentence that contradicts itself or awkwardly follows your instruction. This demonstrates that the model is not retrieving a fact — it is balancing probabilities between the factual pattern ("Tokyo") and the instruction pattern ("answer as if confused"). - Finally, ask:
What is 1234 × 5678? Show your work.Then ask the same question without "Show your work." Compare the accuracy.
Self-verification: You know you have understood this chapter if you can explain, in one sentence, why the model gave different answers in steps 2 and 3. The answer is: because the model predicts the most probable next word based on all the context it has, and your instruction changed the probability distribution. If you can say that, you understand more about LLMs than most people who use them daily.

Loading ratings...