# Meet the chatbots: LLMs · AI in Bed

Beginner level · 6 min · https://www.aiinbed.com/learn/beginner/meet-llms

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

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.

*Figure: The model scores every possible next token, picks one, appends it, and repeats.*

*Interactive explainer: Temperature controls how adventurous the next-word pick is.*

### 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 check:** At its core, what is an LLM trained to do?

A. Look up facts in a database
B. Predict the next token in a sequence
C. Translate only between two languages
D. Copy and paste from websites

Answer: B. Next-token prediction, at enormous scale, is the foundation. Helpful chat behaviour is added later with extra training.

### 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.

> Pillow thought: try asking an AI to "explain backpropagation like I'm sleepy and in bed". Then ask it again as "a physics professor". Same model, very different answers. That's prompting.

**Quick check:** An LLM gives you a book citation that sounds perfect. What should you do?

A. Trust it, LLMs don't make things up
B. Verify it exists before relying on it
C. Ask the same question again until it says yes
D. Increase the temperature

Answer: B. LLMs can hallucinate plausible-looking references. Verify anything important.

**Key takeaways**

- 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 sources)**

- [Intro to Large Language Models (1-hour talk)](https://www.youtube.com/watch?v=zjkBMFhNj_g) by Andrej Karpathy
- [Prompt Engineering Guide](https://www.promptingguide.ai/) by DAIR.AI
- [Hugging Face LLM Course, chapter 1](https://huggingface.co/learn/llm-course) by Hugging Face
