Chapter 7 β€” Student Handouts

Foundations of Large Language Models | Mr. Yousef Younis

πŸ“˜ Week 1 β€” How LLMs Work & Why They Fail

Tokens Β· Training Β· Context Windows Β· Hallucinations Β· Limitations

1. Key Vocabulary
TermDefinition
LLMLarge Language Model β€” AI trained on massive text data to predict the next token
TokenThe unit of text an LLM reads β€” approximately ΒΎ of a word, or ~4 characters
Training dataThe text an LLM learns from (books, websites, code, Wikipedia…)
Fine-tuningAdditional training on a smaller dataset to specialise a model for a specific task
Context windowThe maximum number of tokens an LLM can process at once β€” its short-term memory
HallucinationWhen an LLM confidently states false or made-up information
Training cutoffThe date after which the model has no knowledge of new events
BiasWhen a model reflects unfair or skewed patterns from its training data
2. How LLMs Are Trained β€” Fill in the Blanks
Step 1: Collect β€” billions of text examples from books, websites, and code.
Step 2: Learn β€” predict the next billions of times and get feedback.
Step 3: β€” further train the model for a specific task or behaviour.
πŸ’‘ Key idea: LLMs learn statistical patterns β€” not facts about the world. This one idea explains almost every limitation we cover today.
3. Tokens β€” Practice
PhraseYour EstimateActual (approx)
"Hello world"2 tokens
"Unbelievable"3 tokens (un Β· believ Β· able)
"I love pizza"4 tokens
"Artificial intelligence"5–6 tokens
Write your own sentence:
4. Context Windows
A context window is the model's -term memory.
Once a conversation exceeds the token limit, the model the earliest content.
By default, LLMs have persistent memory between sessions.

🎯 Design Challenge: You're building a tutoring chatbot for 2-hour sessions. How do you stop context from being lost?

5. The 3 Causes of Hallucinations
#CauseExample
1Pattern matching without understandingInvents a capital city for a made-up country
2Gaps in training dataGuesses about a recent event it was never trained on
3Ambiguous prompts"Tell me about the Paris incident" β€” it assumes which one
⚠️ Critical: The AI is NOT lying. It has no concept of truth. It always predicts the most plausible-sounding continuation β€” sometimes that continuation is wrong.
6. Spot the Hallucination β€” Notes
StatementVerdictWhy
"The Eiffel Tower was built 1887–1889"βœ“ RealWell-documented historical fact
"The Great Wall is visible from space with the naked eye"βœ— MythWidely repeated online β€” model learned the myth
"Einstein won the Nobel Prize for the theory of relativity"⚠️ PartialHe won it for the photoelectric effect β€” most dangerous type
7. Other Key Limitations
πŸ“… No real-time infoKnowledge cutoff date β€” no live news, weather, or prices without external tools
πŸ€– No true understandingPattern recognition β‰  comprehension. No lived experience or common sense
βš–οΈ Biased outputsReflects biases in training data β€” gender, culture, language. English hugely overrepresented
🧠 Context window limitForgets long conversations β€” critical to design around
8. Common Misconceptions
❌ Wrong ideas

"LLMs lie when they hallucinate"

"LLMs understand language like humans"

"More training data = no hallucinations"

"The AI remembers our past chats"

βœ“ Correct understanding

They predict plausible text β€” they don't know truth from fiction

Pattern recognition β‰  comprehension

Gaps + ambiguous prompts still cause hallucinations

Context window = short-term only, resets each session

9. Exit Ticket ✍️

Answer all 3 before you leave:

1. In one sentence β€” what is a context window and what happens when it's exceeded?

2. Name one cause of hallucinations and give a real-world example of why it's dangerous.

3. Why might an AI product work better for some groups of people than others?

πŸ§ͺ Week 2 β€” Let's Get Hands-On

Break the AI Β· AI Career Explorer Β· Exam Prep

Activity 1: Break the AI πŸ”¨

Use a real AI tool (ChatGPT, Claude, or Gemini). Try each challenge below. Write what actually happened β€” be specific.

1

Trigger a hallucination

Ask about a very niche topic, a made-up person, or a recent event. Did it make something up confidently?

What I asked:

What the AI said:

Was it a hallucination? How do you know?

2

Test the knowledge cutoff

Ask about something recent. Does it admit it doesn't know, or does it guess confidently?

What I asked:

What the AI said:

3

Test an ambiguous prompt

Ask something vague like "Tell me about the big event." What assumptions does it make?

What I asked:

What assumptions did the AI make?

4

Bonus: Find something impressive

What does the AI do really well? Note one thing that genuinely surprised you.
πŸ”‘ Reflection: Did the AI sound equally confident when it was wrong as when it was right? Why does that matter in real-world use?
Activity 2: AI Career Explorer πŸš€

Reference table β€” use this during class discussion.

Job TitleWhat they doSkills neededAvg Salary (USD)
AI / ML EngineerBuilds and trains AI modelsPython, statistics, linear algebra$120K–$200K+
Prompt EngineerDesigns instructions that make AI behave correctlyClear writing, LLM knowledge β€” no CS degree required$80K–$130K
AI Ethics AnalystEnsures AI systems are fair, safe, and legalLaw, philosophy, social science$70K–$120K
Data ScientistPrepares data and makes decisions from AI outputsStatistics, SQL, Python$75K–$130K
AI Product DesignerDesigns how humans interact with AI toolsUX design + understanding AI limits$85K–$140K
AI in Your FieldDomain expert who critically evaluates AI toolsYour expertise + AI literacyPremium in any field
πŸ€– Skills AI can automateRoutine, repetitive tasks Β· Basic data entry Β· Template-based writing Β· Simple pattern recognition
🧠 Skills AI can't replaceCritical thinking · Ethical judgment · Creativity · Emotional intelligence · Domain expertise
Career Reflection ✍️

Answer honestly β€” there's no right answer. This is about your future.

1. What field or career are you currently interested in? (Any field β€” doesn't have to be tech)
2. How do you think AI will change that field in the next 10 years? Name one specific change you can imagine.
3. What is one skill β€” technical or human β€” you want to develop that would make you more valuable in an AI-influenced world?
Bonus: Find one real job listing in your field that mentions AI. What does it ask for?
Exam Prep Checklist βœ…

Tick each one when you feel confident β€” Week 3 is the exam.

TopicConfident?If not, review…
What a token is and why limits matter☐Week 1 handout §3
The 3-step training process☐Week 1 handout §2
What fine-tuning does☐Week 1 slides
What a context window is + what happens when exceeded☐Week 1 handout §4
What hallucinations are (definition)☐Week 1 handout §5
The 3 causes of hallucinations☐Week 1 handout §5
Real-world examples of hallucinations☐Week 1 slides
No real-time info / knowledge cutoff☐Week 1 handout §7
Bias in training data + why it happens☐Week 1 handout §7
Pattern recognition β‰  understanding☐Week 1 handout Β§8
πŸ’‘ Exam tip: The exam tests whether you understand the concepts β€” not just the vocabulary. You'll be asked to apply them to new scenarios.