What is a program?

A program is a series of steps a computer can follow — written in a language it understands, like Python.

# hello.py
print("Hello, World!")
Output

Hello, World!

A computer is not as smart as you — it cannot work out what the next word should be. So we make language easy for it to follow: we do language modeling.

What is AI?

Artificial Intelligence
Any computer doing something that seems smart.

Machine Learning
AI that learns from examples instead of following written rules.

Deep Learning
Machine learning that uses neural networks with many layers.

Generative AI
Deep learning that creates new things: text, images, music.

Large Language Models
Generative AI that works with words.

ChatGPT
One LLM that you have probably used.

ArtificialIntelligence (AI) Machine Learning Deep Learning Generative AI Large LanguageModels (LLMs) ChatGPT
  1. AI
  2. Machine Learning
  3. Deep Learning
  4. Generative AI
  5. LLMs

AI, at its simplest, is just if-statements

# chatbot.py
if "hello" in message:
    print("Hi there!")
elif "sad" in message:
    print("Why do you feel sad?")
else:
    print("Tell me more...")
Chat

> hello

Hi there!

> i feel sad today

Why do you feel sad?

> what is 2 + 2?

Tell me more...

A human wrote every single rule. The computer isn't learning anything.

What happens when someone types something we never wrote a rule for?

  1. AI
  2. Machine Learning
  3. Deep Learning
  4. Generative AI
  5. LLMs

Machine Learning: the best-fit line

The line

score = ? × study + ?

Total error
0

It learned just 2 numbers.

Remember plotting results in physics and drawing a best-fit line? Press Next →

The computer starts with a random guess, then measures how far off it is.

It nudges its two numbers a little, so the error gets smaller…

…again and again until the line fits best. That nudging is called training.

Now it can predict a score nobody measured. No rules written: it learned from data.

  1. AI
  2. Machine Learning
  3. Deep Learning
  4. Generative AI
  5. LLMs

Add an input: the line becomes a plane

Try your own hours
Predicted test score

0

Same chart as before. The line is OK, but lots of points are far from it. Why?

Because score depends on more than study! Add a second input: hours slept.

The best fit is no longer a line: it's a flat plane. Change the hours and watch your score move.

With 100 inputs we can't draw it any more, but the maths is exactly the same.

  1. AI
  2. Machine Learning
  3. Deep Learning
  4. Generative AI
  5. LLMs

Neurons: from your brain to the computer

Drawing of a human neuron: branching dendrites on the left, a cell body, and a long axon leading to branches on the right 1 2 3
① Dendrites: in ② Cell body: add up ③ Axon: out

Picture: Dhp1080 and Actam, CC BY-SA 3.0, via Wikimedia Commons

a neural network: lots of neurons wired together ① inputs how importantis it to you? ② add up ③ output sunny?1 homework (hrs)2 friends free?2 2 0.5 1.5 squash ?98% go out to play? parent says: noloss: 98% = 4

This is a neuron: one of about 86 billion cells in your brain.

Signals come in, get added up, and if there's enough, it fires a signal out.

An artificial neuron copies the idea with maths: inputs in, add up, one output.

How important each input is to you is its weight. Drag the sliders and watch the answer.

Your parent checks: they say no. The loss is how far off you were. Can you fix it?

Backpropagation: send the loss backwards to work out how much each weight is to blame.

The computer moves the sliders itself: a bigger input gets a bigger nudge.

After many more examples the weights settle: it has learned that homework matters most.

One neuron can't do much. Wire lots of them together and you have a neural network.

What are Large Language Models?

LLMs are basically your ChatGPT. The thing you talk to every day. ChatGPT is a large language model.

These models require training to understand how to connect words and sentences and say the right thing!

How do we model Language?

“The two men appeared out of nowhere. The narrow path stretched ahead. The same stars twinkled above. Two men walked silently. The two guards stood watch. Men appeared from shadows. Out of the darkness they came. Nowhere seemed safe anymore.”

How would we model this piece of text such that a computer can understand it consistently and generate similar language?

One way is…..

“The two men appeared out of nowhere. The narrow path stretched ahead. The same stars twinkled above. Two men walked silently. The two guards stood watch. Men appeared from shadows. Out of the darkness they came. Nowhere seemed safe anymore.”

Generated text…..

Our generator wrote:

first-order Markov language model – Bigram

What we just did is called Markov chaining. Because each next word depends only on the one word before it, it's a Bigram model.

By the end of this course you would have built your own text generation engine using Python.

Introduction to Transformers

The first language models used Markov chaining. LLMs today do not — they use a newer, much more advanced model called transformers.

Transformers can understand how words relate to each other by looking at the context of the entire sentence.

“Car” is closely related to “vehicle”

“Bank” can mean different things depending on whether we are talking about money or a river

At its core, an LLM learns patterns and relationships between words from enormous amounts of text.

When these patterns are scaled with massive datasets + computing power, they can produce remarkably sophisticated language understanding and generation.

Inside a transformer

× dozens of layers Attention Think The two men appeared out of ? NEXT WORD? nowhere64% the19% sight9% banana0% nowhere numbers in"Think" = a small neural networknew numbers out Attention + think, again and again Layer 1nearby words→ Layer 2grammar→ Layer 3 …meaning→ Last layerready to guess
  1. 1Words → numbers
  2. 2Attention: look at every word
  3. 3Think: a small neural network
  4. 4Repeat for many layers
  5. 5Score every possible word
  6. 6Add the word, go again

Start with the words so far. The transformer's job: work out the next word.

Each word is turned into a list of numbers, so the computer can do maths on it.

Attention: every word looks at all the others. Our bigram model only saw "of".

Think: each word's numbers pass through a small neural network and come out updated.

That was one layer. The numbers pass through dozens, each one refining them a bit more.

Out comes a score for every word it knows. "nowhere" is the favourite.

The chosen word joins the sentence, then it all runs again for the next word.

Modern AI models and their companies

Anthropic OpenAI DeepSeek
  • USAOpenAIGPT-6 Astra, GPT-6.1 Sol, GPT-6 Luna
  • USAAnthropicClaude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5
  • USAGoogleGemini 4 Argon, Gemini 3.8 Flash, Gemini 3.1 Pro
  • USAMetaMuse Spark 1.3, Muse Glimmer
  • USAxAI (X)Grok 4.7, Grok 4.6
  • USAMicrosoftCopilot, MAI-Thinking-1, MAI-Code-1-Flash
  • FranceMistralMistral Large 4, Mistral Small 4
  • ChinaDeepSeekDeepSeek V4.1 Flash
  • ChinaMoonshot AIKimi K3, Kimi K2.8 Preview
  • ChinaAlibabaQwen3.8-Max, Qwen3.8-Flash
  • ChinaBaiduERNIE 5.1, ERNIE 5.0

As of October 2026. New models come out every few weeks!

Hallucinations

Leif Erikson was a real Viking explorer. He sailed to North America around the year 1000 AD.
Gemini confidently explaining “Leif Erikson Syndrome”, a condition that does not exist, and listing strategies for managing it