CH 02 / 86Chapter 1: What Is Claude (AI Basics)

How Large Language Models Work

On this page8 items

In 10 seconds

Under the hood, Claude is simply predicting the next word. It chooses not the correct word, but the likely word.
That’s why its text reads naturally, and that’s why it sometimes writes things that don’t exist.

Under the hood, Claude is what’s called a large language model, often abbreviated as LLM.

The mechanism itself can be described in a surprisingly simple sentence: it predicts the next word. That’s all. It doesn’t understand the text, think about the meaning and assemble an answer. It picks “the most likely word to follow the text so far,” and repeats that over and over.

Once you grasp this one sentence, you can explain most of the phenomena that come up later. Why it makes mistakes. Why the way you write instructions changes the result. Why the conversation drifts in long chats. It all comes from here.

What predicting the next word means#

If you see “The capital of Japan is,” the next word is almost certainly “Tokyo.” After “The weather today is really,” “nice” is likely to follow. Humans can make these predictions too.

What the model does is this on a vastly larger scale. It is fed huge amounts of text and learns the tendencies of which words tend to follow which words. Once it outputs one word, it includes that and predicts the next one again. Repeat this, and you get text.

The key point here is that what it chooses is not “the correct word” but “the likely word.” In most cases, the likely word matches the correct one. That’s why it is usable in normal situations. But there are cases where they don’t match, and that is where the trap lies.

Why plausible falsehoods creep in#

Suppose it is asked, “What does Article X of the Civil Code say?” The model isn’t looking up the statute. It strings together words that are likely as statute text.

Statute-like style, statute-like phrasing, statute-like numbers. Everything looks convincing. But it doesn’t necessarily exist. This phenomenon is called hallucination.

The tricky part is that it looks most confident precisely when it’s wrong. That’s because the naturalness of the text and the correctness of its content are determined separately. Because it is good at producing natural text, the text stays natural even when the content is wrong.

The danger zones are predictable: statutes, court cases, statistics, people’s names, book titles and URLs. These six are easy to fake convincingly and the mistakes are hard to notice. For these, always check the primary source.

Training and the current conversation are separate#

There is one more point that is easy to confuse. “Training,” where the model is fed text to learn tendencies, is already finished. The text you hand over in a conversation isn’t remaking the model.

As an analogy, training is the education a person received at school, and the current conversation is a handout you’ve given them. If you give them the handout, they’ll look at it and answer, but the handout doesn’t change their education.

So it doesn’t know about anything newer than when it was trained, on its own. If needed, you hand it materials or have it search the web. No.05 covers this in detail.

Try it: get a feel for “it’s just predicting” (2 minutes)

Prompt
Continue "Once upon a time, in a faraway land," with just 20 characters. Then write two more completely different continuations from the same opening.

Expected result: all three read naturally, and their content is all over the place. You can see that none of them is “the right answer.”

If it doesn’t work: if all three are similar, add “in genres as different as possible.” Getting only similar continuations is also evidence that the “likely continuations” of that opening are skewed.

Common pitfalls#

Assuming it will look things up automatically when you ask. When the web search feature is on, it actually searches; otherwise it answers from memory. You can tell which state it is in from the screen. No.18 covers this.

It corrects itself too readily when you point out a mistake. If you say “Isn’t that wrong?”, it may “correct” things that were right. That’s because it can’t distinguish a valid correction from being led. Verify facts with primary sources, not by asking Claude again.

Tips for going further#

Turn “it predicts the next word” around, and the trick to writing instructions becomes clear. Write in a form where the continuation is predictable, and you’re more likely to get what you want. For example, “Make a table in the following format. Columns: date, client, amount” pins down the continuation far more than “make it a table.” That’s what Chapter 2 is about.

Related pages#

Summary#

  • Under the hood, it repeats “predict the next word.” What it chooses is the likely word
  • That’s why plausible falsehoods creep into statutes, court cases, figures, people’s names, book titles and URLs
  • Training is already finished, and the current conversation isn’t remaking the model

Read next#

What is a token?