What are LLMs?
Read a little, play a little. No scary maths, and no rush.
Big autocomplete, carefully trained
An LLM predicts the next token (word piece) given all previous tokens — then appends it and repeats. Sentences, code, plans: all emergent from that one loop plus sampling settings (temperature, top-p) controlling how adventurous each pick is.
Training in one line: pretrain on lots of text → teach instructions → align with human feedback. Each stage is its own chapter later; for now, know the shape.
Why they sound confident when wrong
Models are trained to continue fluently, not to say "I don't know." Faced with a gap, they produce the most plausible continuation — a hallucination delivered with total confidence. This isn't a rare bug; it's the default behavior of the objective function.
The fixes you'll learn across this track: RAG grounding (evidence in, cited answers out), abstain rules ("say NOT FOUND"), citations (every claim traceable), and evals (measuring honesty, not assuming it).
Tokens and cutoffs run your budget
"ChatGPT is great" costs about 4–5 tokens — and costs, context limits, and chunking are all denominated in tokens, not words. Meanwhile the knowledge cutoff (when training data ended) means everything newer is unknown: fresh facts must arrive via retrieval or tools, never memory.
One step of the loop, up close
Give a model the text "The capital of France is". It does not look up an answer. It produces a probability for every token in its vocabulary, something like "Paris" 92%, "a" 3%, "located" 2%, and thousands of others sharing the rest.
Then one token is picked. At temperature 0 the top choice wins every time, so you get "Paris" reliably. At higher temperatures, less likely tokens get a real chance, which is useful for brainstorming and harmful for facts. The chosen token is appended, and the whole process runs again for the next one. A 300-word answer is a few hundred of these steps in a row.
This is why the same prompt can produce different answers, and why lowering the temperature is the first move when you need consistency.
Good at, bad at
Good at: drafting and rewriting text, summarizing, translating, classifying messages by topic or tone, pulling fields out of messy documents, explaining code, and writing first drafts of code.
Bad at, unless you help: exact arithmetic (give it a calculator tool), counting letters (it sees tokens, not letters), facts newer than its cutoff (use retrieval), and remembering earlier conversations.
That last one surprises people. The model itself is stateless: each API call starts from nothing. A chat app feels like it remembers because it sends the previous messages along with every new request. When the conversation outgrows the context window, something has to be dropped or summarized, which is a design decision you will face in later chapters.
Next
Tokenization → Transformer simplified → your first API call. The loop starts now.
Remember this
- Next-token loop + sampling = all generation. Fluency ≠ truth; grounding is engineered.
- Budget in tokens; distrust memory past the cutoff.
Check your understanding
5 questions · first-try answers earn the most XP
My notes
Saved in this browser. Highlight a line above and save it, or write it in your own words.
Nothing saved yet. Your highlights will live here.
References
Finished reading?
Ticking it here also ticks the chapter in the sidebar, the section count and your streak — it is all one number.
Related chapters
Spotted a mistake or want a topic covered? Report an issue