Introduction to Large Language Models

In addition to looking at language mathematically and evolutionarily, we can also look at it as a statistical machine learning problem.

Getting Started

Human languages have evolved over at least tens of thousands of years. Symbols, words, grammar, pragmatics, and social cognition have evolved with them. How do we compute with human language? The techniques used for artificial languages and programming languages are limited. Applying a statistical learning engine to trillions of words of existing human language text has been shown to work better.

We’re only going to scratch the surface of language modeling, but you’ll be able to at least pick up some vocabulary with which to enter your ML or NLP courses, and get a sense of what an LLM actually does.

It’s always a good idea to start with a 3Blue1Brown video if one exists for the topic of interest!

If you prefer a shorter introduction:

You can also jump start your learning by reading the Large Language Model article on Wikipedia or take the LLM Course on Hugging Face. Getting involved with the HuggingFace Community is worthwhile too.

Language Modeling

Roughly speaking, language modeling is assigning a probability distribution over sequences of tokens.

Formally, $P(w_1, w_2, w_3, … w_n)$ is the probability of a sequence and $P(w_n \mid w_1, w_2, … w_{n-1})$ is the probability of the “next token” $w_n$ given all previous tokens. (Technically, this is how autoregressive models work, but that’s the biggest category of LLMs.) You probably heard that “LLMs predict the next token.” If this is done well and efficiently at scale, you get all the good stuff: summarization, translation, programming, and reasoning.

Not surprisingly, prediction power can come from throwing machine learning at the problem. Hopefully, we can do this well enough to learn:

Excellent prediction is either language understanding or an approximation of understanding, depending on your perspective.

A language model that is really big is called a large language model (LLM). One that isn’t very big at all, and fits on a single device, is called a smol language model. (Actually it’s “small,” but “smol” is cuter.)

LLMs can do cool things, like:

These things are done in response to a prompt. There is some context involved too. LLMs are generally part of an agentic framework, where agents consult the LLM for a lot of the work but also search the web, run specialized computations, invoke APIs, and much more.

Just an introduction today

We won’t go into the details of speech (acoustic models, ASR) or multimodal models (vision-language) today.

Embeddings

Here is a cool idea: represent each word (well, actually each token, but we’ll get to that) as a vector in a high-dimensional space, arranged so that words with similar meanings are close together. Why vectors? Because neural networks operate on vectors of real numbers. If words are vectors, then neural networks can “do” language.

An embedding is the vector for the token. “Meaning” gets encoded as geometry. You’ll also hear the phrase embedding layer which is that part of the system that maps tokens to vectors. An embedding space is the high-dimensional space in which those vectors live.

The Naive Approach

The simplest way to turn words into vectors is one-hot encoding. Assume a vocabulary of, say, 50,000 words. Each word gets its own position, and its vector has length 50,000: all zeros except for a single 1 in that word’s position. So if aardvark is word 0 and abacus is word 1, we have:

$$ \begin{array}{l} v_{aardvark} = [1, 0, 0, 0, \ldots, 0] \\ v_{abacus} = [0, 1, 0, 0, \ldots, 0] \end{array} $$

This is easy to understand, but it doesn’t capture meaning. One-hot vectors encode only identity, not relationships. Every vector is orthogonal (perpendicular) to every other one, so dog is exactly as far from puppy as it is from democracy. The vectors are also enormous and almost entirely zeros. One-hot is the most primitive kind of encoding but completely useless in practice.

Exercise: If you know something about linear algebra, you may have seen a use for one-hot vectors before. What are they used for?
Multiplying a table of vectors by a one-hot selects a row from the table.

The Distributional Hypothesis

To do better, we need some way for vectors to capture meaning. Remember this quote from our study of human language?

You shall know a word by the company it keeps. —J. R. Firth (1957)

This is the distributional hypothesis: words that appear in similar contexts tend to have similar meanings. If you’ve seen puppy show up near bark, leash, fetch, and vet, and dog shows up near those same words, you can guess that dog and puppy are related, without ever having seen either one. The hypothesis is empirically well-supported, and it is the philosophical foundation of construction grammars, word embeddings, and large language models.

Exercise: Relate the distributional hypothesis to the principle of compositionality from the philosophy of language, and to Wittgenstein’s idea of meaning as use. How are these ideas similar? How are they different?

Word2Vec

In 2013, a team at Google led by Tomas Mikolov introduced Word2Vec.

Let’s oversimplify a bit and just capture the intuition. Word2Vec trains a shallow neural network on a huge corpus so that each word ends up as a dense vector of a few hundred real numbers (300 was a popular choice). Nobody tells the network what the dimensions mean. It just learns vectors that are good at a prediction task, and meaning emerges as a side effect. There were two flavors of the prediction task:

Either way, words that keep the same company (a la Firth) get pushed toward the same region of the space.

Embedding Space Properties

A good embedding space should have these properties:

This is what is meant by meaning in a vector space.

Cosine Similarity

Remember your vector math! The cosine of the angle between two vectors $v$ and $w$ is their dot product divided by the product of their magnitudes:

$$ \cos(v, w) = \frac{v \cdot w}{\|v\|\,\|w\|} $$

It ranges from −1 (pointing in opposite directions) through 0 (orthogonal, unrelated) to 1 (pointing the same way). It ignores vector length and cares only about direction, which turns out to be just what we want for comparing meanings.

Don’t avoid learning this. Remember the old adage: “[He] who refuses to do arithmetic is doomed to speak nonsense” (or something like that, look it up 😁).

Exercise: Sure vector spaces encode meaning, but whose meanings? Read about bias in word embeddings.

The Problem of Context

2013 is ancient history. Word2Vec gives each word one vector. That means bank in “we picnicked on the river bank” and bank in “I deposited my paycheck at the bank” get the exact same vector, somewhere awkwardly between rivers and money.

But language is massively context-dependent. We saw this when studying human language: meaning depends on surrounding words, on the situation, on who is talking. What we really want are representations that shift depending on the surrounding context, so that each occurrence of bank gets its own appropriate vector. This is exactly the problem the transformer will solve. Hang on.

Tokens

We’ve been conflating the terms “words” and “tokens.” As you probably know, LLMs don’t actually process words. They process tokens, which are often subword pieces.

Why not just use words? A word-level vocabulary has trouble with new words, typos, names, code, and languages with rich morphology (a single Turkish or Finnish word can carry what English needs a whole sentence to say). Why not just use characters, then? Sequences get really long, and individual characters carry very little meaning on their own. Subwords are a compromise.

Tokens are not morphemes

It kind of feels like morphemes would be useful here, but morphemes are language-specific and hard to identify consistently, especially across languages. Subword tokenizers instead learn pieces from the training data, without needing to know what a morpheme is.

In an LLM, it’s frequency that drives splits. Tokenizers merge high-frequency character sequences, not grammatical roots or affixes. For example, a word like unhappiness can be cut into arbitrary pieces like un, h, and appiness rather than clean morphemes. Also, whole words and spaces are common. Frequent words—often including a leading space—frequently become single tokens, while rare words or punctuation get split into smaller fragments.

When tokens do match morphemes (such as in common prefixes, suffixes, or short root words), that’s mostly a coincidence, because those pieces happen to occur often.

You’d expect some overlap though, since we’re kind of getting meaning out of this stuff anyway. Research studying tokenization across languages—such as a study published in TACL that evaluates semantic information in LLM tokens across 41 languages—shows that LLMs still capture morphological and semantic patterns even when token boundaries do not align with morphemes.

The most popular approach is Byte-Pair Encoding (BPE). Start with individual characters (or bytes). Find the most frequent adjacent pair in the training corpus and merge it into a new token. Repeat until you have a vocabulary of the size you want. Common words end up as single tokens, while rarer words get split into pieces, so unbelievably might become something like un + believ + ably. Since you can always fall back to individual bytes, nothing is ever “unknown.” And the pieces often (but not always!) line up with real morphemes.

Vocabulary sizes have grown over time: GPT-2 used about 50,000 tokens, and today’s models typically use somewhere between 100,000 and 260,000.

Exercise: For the following models, research their vocabulary sizes. GPT-5, Gemma 3, Llama 4, Qwen3, and DeepSeek-V3.
Exercise: Why don’t models use higher vocabulary sizes? Research the diminishing returns that start happening as vocabulary size increases. Consider overhead in compute and storage, undertrained rare tokens, compression. Also, is 260K even good enough for all of the world’s languages, regardless of script?
Tokens vs. words

A word may be several tokens; a token may be part of a word, a word plus its leading space, or a chunk of punctuation. This is why LLMs have historically been oddly bad at things like counting the letters in strawberry: they never see the individual letters at all.

CLASSWORK
Let’s play with a tokenizer, such as the OpenAI Tokenizer or Tiktokenizer. Try compound words, rare words, names, emoji, code, numbers, and some text in a language other than English. What surprises you? Which languages seem to need more tokens to say the same thing? Why might that matter?
CLASSWORK
Let’s explore an embedding space, such as with the TensorFlow Embedding Projector. Find the nearest neighbors of king and of bank. Can you see the polysemy problem?

The Very Basics of Neural Networks

We’ve been saying “train a neural network” a lot. Let’s take a quick look at what that means. Just the basics, so you have the vocabulary. You’ll get the real thing in a machine learning course.

Neurons

An artificial neuron takes a vector of inputs $x$, computes a weighted sum of them plus a bias, then applies a nonlinear function $f$ (called the activation function) to the result:

$$ \textit{output} = f(w \cdot x + b) $$

That’s it! All done. Just kidding.

The weights $w$ and the bias $b$ are the neuron’s parameters. These are what get learned. A classic choice for $f$ is the ReLU (Rectified Lineary Unit), which is simply $\max(0, z)$. Each neuron ends up acting as a little learned feature detector: it “fires” when its input looks a certain way.

Without the nonlinear $f$, we’d be composing a bunch of linear functions, which gives us just another linear function, so all the layers basically collapse. With nonlinearity, things get interesting. The Universal Approximation Theorem tells us that a network with even one hidden layer can approximate any reasonable function to any desired accuracy, given enough neurons.

Exercise: If you’re someone, as you should be, that does not take everything you see here without evidence, look up the Universal Approximation Theorem and its assumptions. What does “reasonable function” mean here? Does the theorem say that a network with one hidden layer is always the best choice?

Layers and Depth

A layer is a bunch of neurons operating in parallel on the same input. A layer of $N$ neurons turns its input into a vector of length $N$. A deep network stacks layers, so the output of each layer is the input to the next:

input $\longrightarrow$ layer 1 $\longrightarrow$ layer 2 $\longrightarrow$ … $\longrightarrow$ layer $L$ $\longrightarrow$ output

Each layer transforms the representation. In vision networks, it has been clearly observed that early layers detect simple things like edges and textures, while deeper layers detect eyes, wheels, and faces. Something similar seems to happen in language models, with early layers handling surface features and deeper layers handling more abstract ones. Though who really knows.

Exercise: Investigate! Then answer the question: does it really matter?

Training

How do the parameters get their values? We start them off random and then improve them, over and over:

  1. Define a loss function that measures how wrong the network’s predictions are. For language modeling, the network outputs a probability distribution over the next token, and the loss is the cross-entropy between that distribution and the token that actually came next. (Yes, this is somewhat related to Shannon’s entropy from Information Theory.) Loosely, it measures how surprised the model was.
  2. Use backpropagation (more or less the chain rule from calculus) to compute the gradient of the loss with respect to every single parameter. The gradient tells us which direction to nudge each parameter to make the loss go up.
  3. Nudge every parameter a little bit in the opposite direction. This is gradient descent.
  4. Repeat, for billions upon billions of examples.

A few hyperparameters (settings that you choose, rather than the network learning them) control the process:

Learning

In everyday speech, learning can mean (1) absorbing facts told to you, (2) figuring out rules from examples, or (3) getting better at a task through practice. For a language model, training is closest to (2): it sees examples of text and adjusts its parameters to predict the next token. It is not being handed a list of facts or practicing a task with feedback.

That's right: A trained network has no symbolic rules. There is no line of code anywhere that says “verbs agree with their subjects” or “Paris is the capital of France.” There are only billions of numbers that got adjusted until the predictions came out well. Whatever “knowledge” the network has is distributed across the weights, not stored in any one place.

This is deeply unlike the classical, symbolic AI of expert systems and hand-written grammars, and quite unlike how we naively imagine memory working (like files in a cabinet). Maybe it’s more like how brains work. After all, the idea for neural networks was inspired by the brain. (We’ll see different kinds of AI later in our notes on Generative AI.)

Scale

Each parameter is just one number. So how many are there in a large language model? A lot.

Exercise: Find out what has means in this context.

Small models matter too. Models with a few billion parameters run on phones, and they keep getting better.

Here’s an article describing parameters. And another one.

The Transformer Architecture

Finally we get to talk about how we can deal with word representations that shift depending on context (the classic example, again, is bank).

This big ideas are self-attention and the transformer.

What’s cool is how this works at Internet scale.

The Problem with Sequential Models

Before transformers, the standard approach to language was the recurrent neural network (RNN), which reads tokens one at a time, left to right, carrying a “memory” (a hidden state vector) along the way. This seems natural (it’s how we read, sort of), but it has two big problems:

Attention Is All You Need

In 2017, a team at Google published Attention Is All You Need, one of the most influential papers in the history of computing (no kidding). They proposed throwing out recurrence entirely and relying on a mechanism called attention. In their transformer architecture, all the tokens are processed simultaneously, and every token can look directly at every other token. No more passing messages down a long chain.

Arguably the title should have been “transformers are all you need.”

Exercise: Where did the name of the paper come from?

Self-Attention

Here’s the core idea. For each token, we compute three vectors, by multiplying its embedding by three learned matrices:

To figure out how much token $i$ should attend to token $j$, we take the dot product of $i$’s query with $j$’s key. (Dot products measure alignment, remember? Just like cosine similarity.) We scale it down by the square root of the vector size $d_k$ to keep the numbers manageable, then run the scores for all $j$ through a softmax, which turns them into positive weights that sum to 1. The new representation of token $i$ is the weighted average of all the value vectors. Written compactly for all tokens at once:

$$ \textit{Attention}(Q, K, V) = \textit{softmax}\left(\frac{QK^\top}{\sqrt{d_k}}\right)V $$

Each token figures out how relevant every other token is to it, then blends in their information accordingly. This is how bank gets a different representation next to river than next to paycheck: it attends to its neighbors and absorbs some of their meaning.

Read this article for some helpful diagrams and explanations. This picture came from it:

decoder-only.png

Attention picks up on aspects of language that linguists have studied, such as:

In classical NLP, features like these were painstakingly hand-engineered. In the transformer architecture, nobody programmed them. Nobody had to! They emerged from gradient descent on next-token prediction.

CLASSWORK
Let’s visualize attention, using a tool like BertViz or the Transformer Explainer. What does it attend to in ambiguous sentences?

Multi-Head Attention

One attention operation can only capture one kind of relationship at a time. So transformers run many of them in parallel, each with its own $Q$, $K$, and $V$ matrices. Each of these heads is free to specialize: one might track syntax, another coreference, another which token came just before. The results are concatenated and combined. Models typically have dozens of heads per layer.

The Transformer Block

Attention is the main ingredient, but a full transformer block has a few more:

input
  ↓
normalize → multi-head self-attention → add the input back in (residual)
  ↓
normalize → feed-forward network → add the input back in (residual)
  ↓
output (same shape as the input)

Since a block’s output has the same shape as its input, you can stack them. Stack dozens to over a hundred of these blocks, and that’s the model.

Positional Information

Interestingly, attention by itself has no idea what order the tokens are in. It just computes scores between pairs. So without some extra help, “dog bites man” and “man bites dog” would look identical. That’s bad.

The fix is to inject position information. The original paper added a fixed pattern of sine waves to each token’s embedding. Most modern models instead use Rotary Position Embedding (RoPE), which rotates the query and key vectors by an amount that depends on position, so that attention scores naturally reflect how far apart two tokens are.

The Context Window

The context window is the maximum number of tokens a model can attend to at once: the prompt, the conversation so far, any documents you pasted in, and everything it has generated. Early GPT models had 512 or 1,024 tokens (a page or two). Today, a million tokens (several novels’ worth) is common at the frontier.

But since every token attends to every other token, the cost of attention grows quadratically with context length: double the context, quadruple the work. This is a central engineering challenge, and a very active research area: clever GPU implementations, sparse attention that only looks at the most relevant tokens, and hybrid architectures that mix in cheaper, linear-time layers.

Exercise: Research different approaches to reducing the pain of quadratic growth in attention. What trade-offs do they make?

Decoder-Only Models

The original transformer was built for translation, so it had two halves: an encoder that reads the source sentence and a decoder that writes the translation. BERT (2018) used just the encoder, and is great for understanding tasks like classification. But GPT and all the big ones today use just the decoder.

A decoder-only model is trained to predict the next token, so it must not peek ahead. It uses causal masking: when computing attention for token $i$, all tokens after $i$ are hidden. Generation then works like this: predict a distribution over the next token, pick one (sampling, with a temperature setting controlling how adventurous to be), append it, and do it all again. This is called autoregressive generation. Almost all modern AI assistants produce one token at a time this way.

Here’s an explainer.

Mixture of Experts

Large models don’t use all of their parameters for every token. Most frontier models today are Mixture of Experts (MoE) models: the feed-forward network in each block is replaced by many smaller “expert” networks, plus a little router that picks just a few experts for each token. Kimi K3, for example, picks 16 of its 896 experts per token. So a model can have trillions of parameters (lots of knowledge capacity) while only activating a small fraction of them for any one token (making it affordable to run). When you see a model described as, say, “1.6T total, 49B active,” this is what that means.

Training at Scale

How do we turn a stack of randomly initialized transformer blocks into something that can write sonnets and debug your code? Lots of data, lots of compute, and a few training stages.

Data

The raw material is text, and lots of it:

Raw web text is mostly junk, so it gets heavily processed: deduplicated, filtered for quality, sorted by language, and scrubbed of the worst content. The exact mixture of sources matters enormously to how the model turns out, and labs generally don’t tell you what’s in theirs. (Who owned that data, and whether it was fair to use it, is a big ongoing legal and ethical fight.)

How much text? Meta’s Llama 3 (2024) was trained on about 15 trillion tokens. Frontier models today use tens of trillions. Think of it as the distributional hypothesis, “you shall know a word by the company it keeps,” applied to pretty much the entire public web.

Pretraining

The first and by far the biggest training stage is pretraining, and its objective is simply next-token prediction. Take a chunk of text, run it through the model, compare the model’s predicted distribution for each next token with what actually came next, compute the cross-entropy loss, backpropagate, nudge the weights. Then do that trillions of times.

Thanks to causal masking, one pass over a chunk of $n$ tokens gives you $n$ training examples at once, all computed in parallel. That parallelism is precisely what RNNs lacked, and is why the transformer won.

It’s striking that such a simple objective works. To predict the next word of a physics textbook, a murder mystery, or a Python program really well, a model has to pick up a lot about physics, people, and Python.

Compute

Training a frontier model takes tens of thousands of GPUs running for months, with total computation on the order of $10^{25}$ to $10^{26}$ floating-point operations. The cost of a single training run is now in the hundreds of millions of dollars, and data centers are being built that draw as much power as a city.

Why GPUs? A transformer is, at heart, a big pile of matrix multiplications, and GPUs were born to multiply matrices (graphics needed it first). The hardware, the money, and the electricity form a genuine barrier to entry, and have made AI compute a geopolitical resource, with export controls on chips and nations racing to build capacity.

Scaling Laws and Emergence

Around 2020, researchers noticed something remarkable: a model’s loss goes down smoothly and predictably as you increase parameters, data, and compute. These are called scaling laws, and they gave labs the confidence to spend enormous sums on ever-bigger training runs.

Loss goes down smoothly, but abilities seemed to appear in jumps. Small models just produce plausible-looking text. Scale up, and suddenly the model can learn a new task from a few examples in the prompt. Scale more and it can do multi-step arithmetic, write working code, and so on. These were dubbed emergent abilities: capabilities that show up abruptly at certain scales and aren’t predicted by smooth extrapolation.

Whether emergence is real is hotly debated. A 2023 paper argued that many of these jumps are artifacts of how we measure: grade a math answer as simply right or wrong, and steady improvement looks like a sudden leap. The honest answer is that we don’t fully understand why scale works as well as it does.

Post-Training

A pretrained-only model knows a great deal about language and the world, but it isn’t an assistant. Ask it a question and it might answer, or might generate five more similar questions, as if continuing a quiz. It has no particular inclination to be helpful, honest, or safe. Turning it into something like Claude is the job of post-training:

You’ll learn all this stuff in a Gen AI class. For now, just know that an AI assistant (once called a chatbot, though hopefully nobody says that anymore) is a pretrained model plus a lot of careful post-training.

What LLMs Can and Cannot Do

Here are three conceptual handles that help in thinking about what LLMs are:

So how does this translate into what LLMs can and cannot do?

What They’re Good At

We can all agree that LLMs do a lot of things well:

Shortcomings

They are not perfect, though. Let’s be aware of the limitations.

Hallucination

Models sometimes generate confident, fluent, false claims: invented citations, nonexistent court cases, made-up biographical details. This is called hallucination.

Why does it happen? Pretraining teaches a model to produce plausible text, not true text, and if the training data contains errors, the model has no way to know. Training can also accidentally reward guessing: if a benchmark gives zero points for “I don’t know,” a confident guess scores better on average. Hallucination rates have dropped a lot as models learn to say when they’re unsure and to check sources with web search, but the problem is not solved.

CLASSWORK
Let’s try to make a model hallucinate. Ask about something plausible-sounding but false, or something very obscure. Does it confidently make things up? Does it hedge? Does it search?

Brittleness

Small changes in a prompt can cause surprisingly large changes in output. Reordering examples, rephrasing a question, or changing a name can swing the results. Models are sensitive to surface form in ways humans usually aren’t. This has gotten better with larger models and post-training, but it hasn’t gone away.

No Persistent Learning

Once training ends, the weights are frozen. A model doesn’t learn from your conversation in any lasting way: what it “knows” about the current conversation is whatever is in its context window. Products work around this with memory features, which save notes about you and paste them into future contexts, and with retrieval-augmented generation (RAG), which looks up relevant documents and puts them in the context. Useful tricks! But they’re very different from how you remember things.

Systematic Generalization

Models can struggle with novel combinations of familiar pieces, such as “the blue sphere to the left of the red cube that is behind the green cylinder,” especially when the combination is unlike anything in training. They may be learning statistical shortcuts rather than the compositional rules we’d expect. We studied compositionality when we looked at formal languages: there, it was guaranteed by construction. Here, it isn’t.

Arithmetic and Formal Reasoning

Early LLMs were surprisingly bad at multi-digit arithmetic and multi-step logic. Part of the reason was tokenization (numbers get chopped into odd pieces), and part was that the model had to produce each answer in a single forward pass, with nowhere to work things out.

The fix turned out to be giving the model room to think. Simply adding “Let’s think step by step” to a prompt dramatically improved results. This is called chain-of-thought prompting, and it probably works because writing intermediate steps lets the model condition on them, like a scratchpad. Reasoning models now produce long chains of thought automatically, and models can also hand computations off to tools, like running code. Today’s frontier models are genuinely strong at mathematics. But a model working purely “in its head” can still slip up on long, precise calculations that a calculator would never get wrong.

CLASSWORK
Let’s compare a small, fast model and a reasoning model on the same multi-step math problem, with and without asking it to show its work.

Some Deeper Critiques

Yann LeCun, a pioneer of deep learning, has long argued that LLMs have some inherent limitations that more scale won’t fix. Here’s Parth with a quick summary:

The Grounding Problem, Again

When we studied human language, we saw that words get their meaning from perception, action, joint attention, causal anchoring, and social life. LLMs have none of this. They learn from distributional co-occurrence at massive scale. (Modern models do take in images and audio too, which is a kind of partial grounding, but they still don’t live in the world.) What’s remarkable is how well this seems to work anyway.

But is it understanding? That’s a debate, and it depends a lot on what you mean by understanding.

Exercise: Read about Searle’s Chinese Room, a thought experiment about a system that produces appropriate outputs just by following rules. Is this what LLMs do? Does it matter? Do you think human understanding is also a form of sophisticated pattern matching, just implemented in neurons?

Stochastic Parrots?

In an influential 2021 paper, Bender, Gebru, et al. called LLMs stochastic parrots: systems that stitch together form without any reference to meaning, remixing their training data with no comprehension behind it.

The critique is useful. It reminds us not to be fooled by fluency, and it raised important points about bias, cost, and the environment. But the parrot metaphor is probably too strong. Parrots don’t write novel proofs, debug unfamiliar code, or explain why a joke is funny.

Exercise: Does the vast number of massively complex proofs that models started showing off in 2026 mean that LLMs understand mathematics and demonstrate creativity far beyond what we expected? Might this mean the parrot critique is not just too strong but way off?

Simulating Emotions

LLMs certainly talk as if they have feelings. Is anything going on inside? Here’s Parth on some research from Anthropic:

LLMs in the World

Where We’ve Been

A brief timeline of key developments in language models:

Today’s Models and Products

As of November 2026, here are some popular models:

FamilyProducerTypeOpen-weightTiers / VariantsNotes
ClaudeAnthropicGeneral LLMNoHaiku, Sonnet, Opus, Fable, Mythos
GeminiGoogle DeepMindGeneral LLMNoGemini 4: Hydrogen, Carbon, ArgonGemini 4 (Nov 2026) replaced the Flash/Pro names; Hydrogen is the fast tier, Carbon and Argon the frontier tiers
GemmaGoogle DeepMindSmall/edge LLMYesGemma 4: E2B, E4B, 12B, 26B (MoE), 31BOpen-weight counterpart to Gemini
GPTOpenAIGeneral LLMPartialGPT-6: Luna, Terra, Sol, AstraAstra is the top tier, Luna the cheapest; specialized Cyber and Rosalind (life sciences) variants; gpt-oss is the open-weight line
PhiMicrosoftSmall/edge LLMYesPhi-4, Phi-4-mini, Phi-4-multimodalOptimized for on-device / edge
MAIMicrosoftGeneral + SpecializedNoThinking-1, Transcribe-1, Voice-1, Image-2MAI-Thinking-1 (2026) is Microsoft’s first in-house flagship reasoning model
LlamaMetaGeneral LLMYesScout, MaverickBehemoth announced but unreleased
MuseMetaGeneral LLMPartialSpark, Spark Open, EmberFrom Meta Superintelligence Labs; Spark Open weights released Oct 2026 under a restrictive license
NemotronNVIDIAGeneral LLMYesNano, Super, UltraNemotron 3 Ultra (550B MoE) aimed at long-running agents
DeepSeekDeepSeekGeneral + ReasoningYesV4-Pro, V4-FlashR2 never shipped; reasoning was folded into V4. Earlier: V3, R1
QwenAlibaba CloudGeneral LLMPartialQwen3.6 (open sizes), Plus, MaxSmaller models open, Plus/Max closed; Qwen4-Max in preview
GLMZ.aiGeneral LLMYesGLM-5, GLM-5.1, GLM-5.2GLM-5.2 (MIT license) is one of the strongest open-weight models
KimiMoonshot AIGeneral LLMYesK2, K3K3 (July 2026): 2.8T-parameter MoE, ~1M-token context
MiniMaxMiniMaxGeneral LLMYesM3, M3.1 FlashWeights under a restrictive community license
MistralMistral AIGeneral LLMPartialMinistral, Small, Medium, Large, Devstral, MagistralLarge 4 (~1T parameters) went open-weight Oct 2026
GrokxAIGeneral LLMPartialGrok 4.5xAI rebranded as SpaceXAI; Grok 5 still unreleased; only older Grok 1 and 2 weights are open
SonarPerplexity AISearch-optimizedNoSonar, Sonar Pro, Sonar ReasoningFine-tune of LLaMA 3.3; not trained from scratch
Apple Foundation ModelsAppleOn-device + serverNoOn-device (~3B), Server (MoE)No public branding; powers Apple Intelligence

And popular products:

ProductVendorCategoryPrimary model(s)Includes third-party models?Notes
Claude.aiAnthropicConversational / AssistantClaudeNoWeb, desktop, and mobile apps
Claude APIAnthropicAPIClaudeNoAlso offered through AWS, Google Cloud, and Microsoft Foundry
Claude CodeAnthropicCoding assistantClaudeNoTerminal, IDE, desktop, and web
ChatGPTOpenAIConversational / AssistantGPTNoDesktop app now bundles Codex and the ChatGPT Work agent; the Atlas browser was retired in July 2026
CodexOpenAICoding assistantGPTNoCLI, IDE, and inside the ChatGPT apps
OpenAI APIOpenAIAPIGPTNo
Gemini appGoogleConversational / AssistantGeminiNoGemini is also built into Search, Chrome, and Workspace
Google AI StudioGoogleAPI / DevelopmentGemini, GemmaNo
AntigravityGoogleCoding assistantGeminiYes — Claude, gpt-ossAgent-first IDE
Microsoft CopilotMicrosoftProductivity assistantGPT, MAIYes — ClaudeRoutes between models by task
GitHub CopilotMicrosoftCoding assistantGPT, MAI-CodeYes — Claude, Gemini, and othersModel picker in the IDE; Microsoft’s own MAI-Code models added in 2026
CursorSpaceXAICoding assistantGrok, Cursor’s own modelsYes — Claude, GPT, GeminiAI-first code editor; acquired by SpaceX in Aug 2026
PerplexityPerplexity AISearch-answer engineSonarYes — GPT, Claude, Gemini, GrokCore differentiator is search grounding + routing
Meta AIMetaConversational / AssistantMuse, LlamaNoIntegrated into WhatsApp, Instagram, etc.
Grok appxAI (SpaceXAI)Conversational / AssistantGrokNoAlso built into X
Apple IntelligenceAppleOn-device assistantApple Foundation Models, Gemini-based Siri modelYes — ChatGPTPrivacy-first; runs on-device by default. The new Siri is built on a custom Gemini model
Le ChatMistral AIConversational / AssistantMistralNo
DeepSeek appDeepSeekConversational / AssistantDeepSeekNo
Qwen ChatAlibaba CloudConversational / AssistantQwenNo
Kimi appMoonshot AIConversational / AssistantKimiNoSiblings: Kimi Work and Kimi Code

See also Wikipedia’s List of large language models.

Effectiveness

Let’s step back and marvel for a moment. Systems built around LLMs are surprisingly effective! Trained on nothing but prediction, LLMs have learned the regularities of language, and they seem to have reconstructed a lot of its underlying structure along the way: grammar, semantics, even pragmatics. Yet they’re clearly missing things that are central to human language: grounding, embodiment, social cognition, and continuous experience of the world.

That raises a fundamental question: how much does that absence matter for the tasks we care about?

The question “are LLMs intelligent?” is mostly a debate about definitions. A more interesting question is: which cognitive and linguistic capacities are needed for which purposes, and which of those does this architecture actually have?

Exercise: Pick a task you care about (tutoring, writing fiction, medical advice, writing code, companionship). Which human capacities does it require? Which of those do LLMs have, approximate, or lack? Does it matter for that task?

Open Problems

There’s a lot we don’t know:

What Comes After LLMs?

Great question! The transformer has dominated since 2017, and we have a decent sense of its limitations, so naturally people are looking ahead to the next big thing. Here’s one take:

How about world models?

Next Steps

These notes were never meant to be more than a very light introduction. But we did get the big picture:

Raw text $\longrightarrow$ Tokens $\longrightarrow$ Embeddings (tokens to vectors) $\longrightarrow$ Transformer blocks (contextual representations) $\longrightarrow$ Output (distribution over next token) $\longrightarrow$ Sample a token $\longrightarrow$ Append $\longrightarrow$ Repeat

We were light on details, though. You’ll no doubt move on to more advanced studies, such as:

If you’re impatient, Andrej Karpathy’s Neural Networks: Zero to Hero series builds a GPT from scratch in Python. It’s wonderful.

Terms to Know

As you prepare for further study, consider making flashcards for:

Further Reading

And of course, read and watch:

Recall Practice

Here are some questions useful for your spaced repetition learning. Many of the answers are not found on this page. Some will have popped up in lecture. Others will require you to do your own research.

  1. What is language modeling?
    Assigning probabilities to sequences of tokens, and in particular, predicting the probability distribution of the next token given all the previous ones.
  2. Why is one-hot encoding a poor representation for words?
    It encodes only identity, not relationships: every word vector is orthogonal to every other, so dog is as far from puppy as from democracy. The vectors are also huge and sparse.
  3. What is the distributional hypothesis?
    Words that appear in similar contexts tend to have similar meanings. (“You shall know a word by the company it keeps.”)
  4. What are the two training approaches in Word2Vec?
    Skip-gram (given a word, predict its context) and CBOW (given the context, predict the word).
  5. What does it mean to say that word vectors in embedding spaces encode lexical relations? Give an example.
    The geometry of the space reflects semantic relationships: similar words are close together, and relationships show up as consistent directions. The classic example is $v_{king} − v_{man} + v_{woman} ≈ v_{queen}$.
  6. What does cosine similarity measure?
    The cosine of the angle between two vectors (their dot product divided by the product of their lengths), ranging from −1 to 1. It measures how much two vectors point in the same direction, ignoring length.
  7. What is the main limitation of Word2Vec-style embeddings?
    Each word gets a single vector regardless of context, so different senses of a word (like bank) are conflated.
  8. What is Byte-Pair Encoding (BPE), and why is it described as a compromise?
    BPE builds a vocabulary by starting with characters (or bytes) and repeatedly merging the most frequent adjacent pair. It is a compromise between word-level vocabularies (which can’t handle unknown words) and character-level ones (which make sequences too long), and its pieces don’t necessarily correspond to linguistically meaningful units like morphemes.
  9. Why do neural networks need nonlinear activation functions?
    Without them, any stack of layers collapses into a single linear transformation. Nonlinearity lets networks approximate essentially arbitrary functions.
  10. Describe gradient descent in one or two sentences.
    Compute how the loss changes with respect to each parameter (the gradient, via backpropagation), then nudge every parameter slightly in the direction that reduces the loss, and repeat.
  11. Where is the “knowledge” stored in a trained neural network?
    Distributed across all the weights, with no explicit symbolic rules and no single location for any particular fact.
  12. What two problems of RNNs did the transformer solve?
    Difficulty with long-range dependencies (information and gradients fade over long sequences), and lack of parallelism (tokens had to be processed one at a time).
  13. In self-attention, what are the roles of the query, key, and value?
    The query represents what a token is looking for, the key represents what a token offers, and the value is what a token contributes. Query–key dot products determine attention weights, which are used to blend the values.
  14. Why do transformers need positional information?
    Attention by itself is order-agnostic, so without position information, “dog bites man” and “man bites dog” would look the same.
  15. Why are very long context windows expensive?
    Every token attends to every other token, so attention cost grows quadratically with context length.
  16. What is causal masking, and why do decoder-only models need it?
    It hides all later tokens when computing attention for a given token, so that the model can’t “cheat” by looking at the token it is supposed to predict.
  17. What is a Mixture of Experts model?
    A model whose feed-forward layers are split into many expert networks, with a router activating only a few per token. It can have a huge total parameter count while using only a small fraction for each token.
  18. What are scaling laws?
    Empirical observations that a model’s loss decreases smoothly and predictably as parameters, data, and compute increase.
  19. What is the debate over emergent abilities?
    Whether capabilities truly appear abruptly at certain scales, or whether the apparent jumps are artifacts of all-or-nothing evaluation metrics applied to smoothly improving models.
  20. What are the main stages of post-training?
    Supervised fine-tuning on examples of good behavior, and reinforcement learning from feedback: human preferences (RLHF), AI feedback guided by principles (Constitutional AI), and verifiable rewards such as correct answers or passing tests.
  21. What is a reasoning model?
    A model trained, largely by reinforcement learning on verifiable problems, to generate a long chain of thought before giving its answer.
  22. Why do LLMs hallucinate?
    They are trained to produce plausible text rather than true text, they can’t detect errors in their training data, and training and evaluation can reward confident guessing over admitting uncertainty.
  23. Why does chain-of-thought prompting help?
    Writing out intermediate steps gives the model a scratchpad, so it can condition later steps on earlier ones instead of having to produce the answer all at once.
  24. What is retrieval-augmented generation (RAG)?
    Looking up relevant documents and inserting them into the model’s context so that it can draw on information beyond (or more recent than) its training data.
  25. What is the symbol grounding problem, and why does it matter for LLMs?
    Symbols in a closed formal system refer only to other symbols, not to perception or experience. LLMs learn from text co-occurrence without perceptual or social grounding, which raises the question of whether their “understanding” is genuine.
  26. What is the stochastic parrot critique?
    The argument that LLMs stitch together linguistic form based on statistical patterns, without meaning or communicative intent.

Summary

We’ve covered:

  • Language modeling
  • Embeddings and the distributional hypothesis
  • Tokens and Byte-Pair Encoding
  • Basics of neural networks
  • The transformer: attention, blocks, position, context, decoders, Mixture of Experts
  • Training: data, pretraining, compute, scaling, post-training
  • What LLMs can and cannot do
  • Grounding and the stochastic parrot critique
  • Today’s models and products
  • Open problems