How a Language Model Works

It Predicts the Next Word, Billions of Times

A language model does one simple thing: it predicts the next piece of text. Knowing how it was trained explains both what it does well and where it fails.

Ranjit Nethi

·

How a Language Model Works

The short version

  • A language model predicts the next small piece of text, called a token, again and again until the answer is complete.
  • It learned from a huge amount of text in three stages: general reading, task training and human feedback.
  • It does not look facts up. It writes what is likely, which is why it needs your data and your checks.

The idea

A large language model (LLM) is a neural network: a very large mathematical function with billions of adjustable numbers called parameters. Text is cut into tokens, which are words or parts of words. Given the tokens so far, the model calculates a probability for every possible next token, picks one, adds it to the text and repeats.

The design that made this work at scale is the transformer, introduced in 2017. Its key part, called attention, lets the model weigh every word in the input against every other word, so it can follow meaning across long passages.

The model is a very well-read autocomplete. It has read more than any person could, and it finishes your sentence with what usually comes next. It has no list of facts to check against.

Training happens in three stages:

  1. Pre-training: read a huge amount of text
  2. Fine-tuning: learn to follow instructions
  3. Human feedback: learn which answers people prefer
  1. Pre-training. The model reads a very large body of text and learns to predict missing words. This gives it grammar, facts and reasoning patterns.
  2. Supervised fine-tuning. It is trained on examples of instructions and good answers, so it behaves like an assistant.
  3. Learning from human feedback. People rate answers, and the model is adjusted toward the answers people prefer and away from harmful ones.

An example

Ask a model, “What is the lead time for part 4471?” It has never seen your system, so it cannot know. But it has seen thousands of sentences about lead times, so it may write “The lead time is typically 4 to 6 weeks.” The sentence sounds right and is invented. The fix is to give the model the real record before it answers. Parts 3 and 4 of this guide cover how.

Common mistakes

  • Treating the model as a database of facts.
  • Assuming it knows your company, your products or last month’s events.
  • Believing a fluent answer is a correct answer.
  • Thinking a bigger model removes the need for your own data.

What to do this week

  1. Ask a model three questions about your own business that it cannot know. Note how sure the wrong answers sound.
  2. Share those examples with your leadership team. It is the fastest way to explain why data and checks matter.

The terms, in plain language

TermWhat it means
TokenA word or part of a word. Models read and write in tokens
ParametersThe adjustable numbers inside the model, set during training
TransformerThe model design used by nearly all modern language models
Pre-trainingThe first, largest stage of training on general text
Fine-tuningExtra training to shape behavior for a task

Further reading

Section 1.2 of the AI Engineering Guide · Last reviewed November 2026

All parts of the guideChecklists and templates

About the author

Ranjit Nethi leads AI and data for commercial operations at a global industrial manufacturer. He writes about the operating model that turns AI pilots into results finance will sign. Kellogg Executive MBA; MS in Computer Science. This site is his own perspective and view, with no affiliation with any organization.