Meet the chatbots: LLMs

How ChatGPT, Claude and friends work: one word at a time, with surprising results.

โฑ 6 min read

A large language model (LLM) is a neural network trained on a huge amount of text. Its core skill sounds almost too simple: given some text, predict what comes next.

Thecatsatonthe?model scores every tokenmat62%floor18%sofa11%roof6%moon3%
The model scores every possible next token, picks one, appends it, and repeats.

๐Ÿงฉ Tokens, not words

Text is chopped into tokens: whole words, word pieces, or punctuation. "unbelievable" might become "un" + "believ" + "able".

Roughly, 1 token โ‰ˆ ยพ of an English word.

๐ŸŽฒ One token at a time

The model outputs a probability for every token in its vocabulary, picks one, adds it to the text, and runs again.

A setting called temperature controls randomness: low = safe and predictable, high = more creative and more chaotic.

๐Ÿงฉ Quick quiz

At its core, what is an LLM trained to do?

๐ŸŽ“ From autocomplete to assistant

Step 1, pre-training: read a huge slice of the internet and books, predicting next tokens. Result: a brilliant but unruly autocomplete.

Step 2, fine-tuning: train on example conversations and human feedback so it follows instructions and is helpful and safe.

๐ŸŒซ๏ธ Hallucinations

LLMs generate what sounds likely, not what is verified. Sometimes that's confidently wrong: a fake citation, an invented date.

Always double-check facts that matter, especially names, numbers, quotes and sources.

โœ๏ธ Prompting tips that actually work

Be specific: say who it's for, how long, what format.

Give context and examples of what good looks like.

Ask it to think step by step for reasoning tasks.

Iterate: treat the first answer as a draft and refine.

๐Ÿงฉ Quick quiz

An LLM gives you a book citation that sounds perfect. What should you do?

โœจ Before you drift off

  • LLMs predict the next token, one at a time.
  • Pre-training makes them knowledgeable; fine-tuning makes them helpful.
  • They can hallucinate, so verify facts that matter.
  • Clear, specific prompts with context get better answers.

๐Ÿ“š Go deeper (free & open)