“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.”
Introduction
To AI
By: Mr Farhan
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!")
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.
- AI
- Machine Learning
- Deep Learning
- Generative AI
- 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...")
> 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?
- AI
- Machine Learning
- Deep Learning
- Generative AI
- LLMs
Machine Learning: the best-fit line
score = ? × study + ?
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.
- AI
- Machine Learning
- Deep Learning
- Generative AI
- LLMs
Add an input: the line becomes a plane
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.
- AI
- Machine Learning
- Deep Learning
- Generative AI
- LLMs
Neurons: from your brain to the computer
1
2
3
Picture: Dhp1080 and Actam, CC BY-SA 3.0, via Wikimedia Commons
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…..
Generated text…..
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
- 1Words → numbers
- 2Attention: look at every word
- 3Think: a small neural network
- 4Repeat for many layers
- 5Score every possible word
- 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
OpenAIGPT-6 Astra, GPT-6.1 Sol, GPT-6 Luna
AnthropicClaude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5
GoogleGemini 4 Argon, Gemini 3.8 Flash, Gemini 3.1 Pro
MetaMuse Spark 1.3, Muse Glimmer
xAI (X)Grok 4.7, Grok 4.6
MicrosoftCopilot, MAI-Thinking-1, MAI-Code-1-Flash
MistralMistral Large 4, Mistral Small 4
DeepSeekDeepSeek V4.1 Flash
Moonshot AIKimi K3, Kimi K2.8 Preview
AlibabaQwen3.8-Max, Qwen3.8-Flash
BaiduERNIE 5.1, ERNIE 5.0
As of October 2026. New models come out every few weeks!
Hallucinations