androidengineers.Book a session

How a language model works

What a language model actually does

article5 min

A large language model (LLM) does one thing, very well: given some text, it predicts what text should come next. Everything else — answering questions, writing code, summarising documents — is built on top of that one ability.

Predicting the next piece

When you ask "What is the capital of France?", the model does not look up a database. It reads your text and calculates, for every possible next piece of text, how likely it is. "Paris" is very likely. "Banana" is not. It picks one, adds it to the text, and repeats — one small piece at a time — until the answer is complete.

What is the capital of France?  →  The
What is the capital of France? The  →  capital
What is the capital of France? The capital  →  is
...  →  Paris.

This is why responses appear word by word when you watch them stream: the model really is producing them one step at a time.

Where the knowledge comes from

Before you ever use it, a model is trained on a huge amount of text. Training adjusts billions of internal numbers so that its predictions match the patterns in that text. After training, those numbers are fixed. When you send a message, the model is using what it learned — it is not learning from your conversation.

Two important consequences:

  • The model has a knowledge cutoff. It does not know about events after its training data was collected, unless you give it that information.
  • The model knows patterns, not verified facts. Usually the most likely answer is also the correct one. Sometimes the most likely-sounding answer is wrong — and the model says it just as confidently. You will learn how to handle that later in this course.

A useful mental model

Think of an LLM as an extremely well-read assistant who answers from memory, never checks a source unless you hand one over, and is very good at sounding sure. Your job as an engineer is to give it the right information, ask clearly, and check what comes back.

Try it: ask any AI chat app about something that happened this week. Notice whether it knows, admits it doesn't, or makes something up.

Quick check: can you explain, in one sentence, why a model might not know about yesterday's news? (It only knows what was in its training data, unless you provide newer information.)

YOUR LEARNING JOURNEY

0 of 15 available lessons completed

Progress saved in this browser. No account needed.