# What is an LLM? How large language models like ChatGPT and Gemini work, explained

> Every chatbot you use runs on one trick: predicting the next word, one token at a time. Here is how large language models are built and trained, with real examples and their limits.

- Publisher: NextDiff (https://nextdiff.com/)
- Section: AI
- Author: NextDiff Editorial
- Published: 2026-10-24T05:09:48.643Z
- Updated: 2026-10-26T05:27:09.249Z
- Canonical URL: https://nextdiff.com/posts/what-is-an-llm/
- Topics: llms, chatgpt, gemini, openai, google

## In short

An LLM (large language model) is an AI system trained on huge amounts of text to predict the next token in a sequence. Repeating that prediction lets it answer questions, write and code. It runs on a transformer neural network with billions of parameters, and powers ChatGPT, Gemini, Claude and Meta's Llama.

## Key takeaways

- An LLM is a neural network trained to predict the next token (a word or piece of a word); writing one token at a time produces whole answers.
- Almost all LLMs use the transformer architecture from Google's 2017 paper, with billions of parameters learned from trillions of tokens of text.
- Fine-tuning on human feedback turns a raw model into a helpful assistant: a 1.3B-parameter InstructGPT beat the 175B GPT-3 in people's ratings.
- LLMs don't look things up on their own and can hallucinate, so chatbots pair them with search and you should check key facts.

**What is an LLM?** An LLM, or large language model, is an AI system trained on huge amounts of text to predict the next word (more exactly, the next token) in a sequence. Repeating that prediction one token at a time lets it answer questions, write, translate, summarise and code. ChatGPT, Gemini and Claude all run on LLMs.

Our 28-second version:

https://www.youtube.com/shorts/ldJDwQa5b6A

That one sentence hides a lot. [IBM](https://www.ibm.com/think/topics/large-language-models) describes LLMs as deep learning models "trained on immense amounts of data", and the "large" refers to two things: the training text (trillions of words) and the model itself (billions of adjustable numbers called parameters). This explainer shows how the prediction trick works, which models you already use, and where LLMs still go wrong.

![Artwork of glass rails moving coloured blocks, illustrating the prediction method used in large language models](/media/f96ace2ffea14e5b85a1.jpg)
*Image: Wes Cockx for Google DeepMind, Visualising AI project (Unsplash License)*

## What is an LLM and how does it work?

Think of the autocomplete on your phone keyboard. It suggests the next word from the last few you typed. An LLM is the same idea scaled up enormously: it reads your whole prompt, and everything said so far in the chat, and works out which token is most likely to come next. Then it adds that token to the text and does it again, thousands of times, until the answer is finished.

Under the hood there are four steps:

1. **Tokens.** Your text is split into tokens: whole words, pieces of words or punctuation. [Google's Gemini docs](https://ai.google.dev/gemini-api/docs/tokens) put it at about 4 characters per token, so 100 tokens is roughly 60 to 80 English words.
2. **Numbers.** Each token becomes a long list of numbers (an embedding) that captures something of its meaning, so "king" and "queen" sit closer together than "king" and "carrot".
3. **The transformer.** These numbers pass through dozens of layers of a neural network called a transformer. Its key part, attention, lets every token "look at" every other token, so the model can tell that "it" in "the trophy didn't fit in the bag because it was too big" means the trophy.
4. **Next-token odds.** The last layer gives a probability for every token in its vocabulary. The model picks one (usually a likely one, with a little randomness so answers don't sound robotic), appends it and repeats.

![How an LLM writes: prompt tokens go into a transformer, which outputs probabilities for the next token, and the chosen token is appended](/media/6f7331e115be4609aa0c.jpg)
*Chart: NextDiff (probabilities are illustrative)*

The transformer was introduced by Google researchers in the 2017 paper [Attention Is All You Need](https://arxiv.org/abs/1706.03762). Almost every modern LLM is built on it. The "GPT" in ChatGPT stands for generative pre-trained transformer.

![The Transformer model architecture diagram from the 2017 paper, with stacked multi-head attention and feed-forward layers](/media/94e0ceec0a34439a8b44.png)
*Image: Vaswani et al., Google, "Attention Is All You Need", Figure 1 (reproduced with attribution under the paper's permission for journalistic use)*

### How is an LLM trained?

Training happens in two broad stages:

- **Pre-training.** The model reads a vast collection of text (web pages, books, code) and is scored on guessing the next token, billions of times. Each wrong guess nudges its parameters slightly. Nobody programs grammar or facts into it; they emerge from the patterns.
- **Fine-tuning.** A raw pre-trained model just continues text. To turn it into a helpful assistant, companies train it further on example conversations and on human ratings of its answers (reinforcement learning from human feedback, or RLHF). OpenAI's [InstructGPT paper](https://arxiv.org/abs/2203.02155) showed how much this matters: people preferred answers from a 1.3-billion-parameter fine-tuned model over the 175-billion-parameter GPT-3, a model more than 100 times bigger.

## Examples of LLMs, with real numbers

- **GPT-3 (OpenAI, 2020).** [175 billion parameters](https://arxiv.org/abs/2005.14165). Its successors power [ChatGPT](https://openai.com/index/chatgpt/), which OpenAI launched on 30 November 2022 and which made LLMs a household term.
- **Llama 3.1 405B (Meta, July 2024).** [405 billion parameters, trained on over 15 trillion tokens using more than 16,000 Nvidia H100 GPUs](https://ai.meta.com/blog/meta-llama-3-1/), with a 128,000-token context window. Meta released the weights, so anyone can download and run it.
- **Gemini (Google), GPT (OpenAI), Claude (Anthropic).** Today's frontier families. Their makers no longer publish parameter counts, but they compete on benchmarks, as in our look at [Gemini 4 Argon vs GPT-6 Astra and Claude](/posts/gemini-4-argon-benchmarks-vs-gpt-6-astra-claude-opus/).
- **Open specialist models.** Google's [MedGemma](/posts/medgemma-nature-medicine-open-medical-ai-models/) is an open LLM tuned for medical text and images, published in Nature Medicine.

![Artwork of glass capsules refracting lines of model code, illustrating language models that generate text](/media/72a13e824d314a5ba617.jpg)
*Image: Wes Cockx for Google DeepMind, Visualising AI project (Unsplash License)*

## LLM vs chatbot vs AI agent vs small language model

| | LLM | Chatbot | AI agent | Small language model |
|---|---|---|---|---|
| What it is | The model: predicts the next token | An app you chat with | An LLM in a loop with tools | A compact LLM |
| Typical size | Billions to hundreds of billions of parameters | Uses an LLM inside | Uses an LLM inside | Roughly 1 to 10 billion parameters |
| Can act on its own | No | No | Yes: browses, clicks, runs code | No |
| Runs on | Data-centre GPUs | Cloud | Cloud or your computer | Laptops and phones |
| Example | GPT, Gemini, Claude, Llama | ChatGPT, Gemini app | Gemini Agent, ChatGPT agent | Gemma, Llama 3.2 1B |

In everyday speech people call ChatGPT an LLM, but strictly ChatGPT is the product and the GPT model inside it is the LLM. Wrap that model in a loop with tools and memory and you get an agent, which our explainer [What are AI agents?](/posts/what-are-ai-agents/) covers.

## Why LLMs matter, and who they are for

LLMs turned AI from narrow tools (one model for translation, another for spam filtering) into general-purpose software that takes instructions in plain language. One model can draft an email, explain a contract, write code and summarise a research paper.

For **everyday users**, that means search-style answers, writing help and tutoring in many languages, including Hindi, Tamil and Telugu. For **developers**, LLMs are a building block reached through an API and priced per million tokens, which is why prices like [GPT-6.1 Sol's](/posts/gpt-6-1-sol-near-frontier-fifth-of-the-price/) make news. For **companies**, running these models at scale ("inference") is now a major cost, behind deals for chips and cloud capacity.

## Common misconceptions about LLMs

- **"An LLM looks things up."** On its own it doesn't. It answers from patterns learned in training, which have a cut-off date. Chatbots that cite fresh sources are pairing the LLM with a live web search.
- **"It thinks like a person."** An LLM is a statistical next-token predictor. It can show impressive reasoning, but it has no senses and no memory between chats unless an app adds one.
- **"Bigger is always better."** Size helps, but training data and fine-tuning matter as much, as the InstructGPT result shows. Small models now handle many everyday tasks on a phone.
- **"Hallucinations are a rare glitch."** LLMs can state false things fluently. OpenAI researchers argued in a [September 2025 paper](https://arxiv.org/abs/2509.04664) that this happens partly because training and evaluation "reward guessing over acknowledging uncertainty". Check important facts.

## Latest news on LLMs

- [Kimi K3.1 Pro vs Opus 5.5: price, benchmarks and how to try it free](/posts/kimi-k3-1-pro-vs-opus-5-5-price-benchmarks-free/): an open-weight LLM lands within a point of Claude Opus 5.5 on Moonshot's coding test (26 Oct 2026).
- [Gemini 4 Argon benchmarks: where it beats GPT-6 Astra and Claude](/posts/gemini-4-argon-benchmarks-vs-gpt-6-astra-claude-opus/): how today's frontier LLMs compare.
- [GPT-6.1 Sol brings near-flagship performance at a fifth of the price](/posts/gpt-6-1-sol-near-frontier-fifth-of-the-price/): LLM prices keep falling.
- [Google's open MedGemma clears peer review](/posts/medgemma-nature-medicine-open-medical-ai-models/): an open LLM for medicine.
- [ChatGPT's Intelligent UI turns answers into diagrams and tools](/posts/chatgpt-intelligent-ui-gpt-6-interactive-answers/): LLM output that goes beyond text.
- [Etched draws $40B–$50B bids as inference chips heat up](/posts/etched-40-billion-valuation-offers-inference-chips/): the hardware race to run LLMs faster.
- [What are AI agents?](/posts/what-are-ai-agents/): what happens when an LLM gets tools.

## Questions readers ask

### What is an LLM in simple words?

An LLM is AI that has read a huge amount of text and learned to guess the next word. By guessing one word at a time, very well, it can answer questions, write, translate and code.

### How does an LLM work?

It splits your text into tokens, turns them into numbers, runs them through a transformer neural network that weighs how the tokens relate, and outputs a probability for every possible next token. It picks one, adds it to the text and repeats until the answer is done.

### Is ChatGPT an LLM?

ChatGPT is a chatbot app built on OpenAI's GPT large language models. People often call ChatGPT an LLM, but strictly the GPT model inside it is the LLM and ChatGPT is the product around it.

### What is the difference between AI and an LLM?

AI is the whole field of making machines do tasks that need intelligence. An LLM is one type of AI model, specialised in language, that predicts text; image recognisers or chess engines are AI but not LLMs.

### What is an LLM agent?

An LLM agent is a large language model running in a loop with tools such as a browser, email or code. It plans steps, acts, checks the results and keeps going until a task is done, instead of only replying.

## Sources

- [Vaswani et al., Google — Attention Is All You Need (2017)](https://arxiv.org/abs/1706.03762)
- [IBM — What are large language models (LLMs)?](https://www.ibm.com/think/topics/large-language-models)
- [Google AI for Developers — Understand and count tokens (Gemini API)](https://ai.google.dev/gemini-api/docs/tokens)
- [Brown et al., OpenAI — Language Models are Few-Shot Learners (GPT-3, 2020)](https://arxiv.org/abs/2005.14165)
- [Ouyang et al., OpenAI — Training language models to follow instructions with human feedback (2022)](https://arxiv.org/abs/2203.02155)
- [Meta — Introducing Llama 3.1: our most capable models to date](https://ai.meta.com/blog/meta-llama-3-1/)
- [OpenAI — Introducing ChatGPT (30 Nov 2022)](https://openai.com/index/chatgpt/)
- [Kalai et al. — Why Language Models Hallucinate (Sept 2025)](https://arxiv.org/abs/2509.04664)
- [Unsplash — Google DeepMind Visualising AI (Wes Cockx, large language models)](https://unsplash.com/photos/a-close-up-of-a-metal-structure-made-of-wood-and-metal-pyET8SQTc0A)
