Module 01 · Foundations

Understanding AI

⏱ 55 minutes
🟢 Beginner
📚 6 sections + quiz

Why we start with theory

For one simple reason: everything else (good prompts, common pitfalls, choosing the right tool) flows from the mathematical nature of these models. An hour of theory now will save you weeks of trial-and-error later.

By the end of this module, you'll be able to answer three questions without hesitation:

  • What is the difference between AI, Machine Learning and Deep Learning?
  • How does an AI "think" (or rather, why doesn't it actually think)?
  • Why are there so many different models (ChatGPT, Claude, Mistral, Gemini)?

Three simple questions that open the door to everything that follows.

The Russian dolls of AI

When people say "AI", they often mean very different things. The simplest mental image is Russian dolls: each concept contains a smaller, more precise one.

Artificial Intelligence any system that mimics intelligent behaviour Machine Learning learns patterns from data Deep Learning GPT · Claude · Gemini
Each concept contains a more precise one. Deep Learning ⊂ Machine Learning ⊂ AI.

🪆 Artificial Intelligence (AI)

This is the umbrella concept. Anything that lets a machine mimic intelligent human behaviour: reasoning, learning, understanding language, making decisions. A simple chess programme with hand-coded rules already qualifies as AI.

🪆 Machine Learning (ML)

A subcategory of AI. The big difference: the rules are no longer written by humans. Instead, you feed the machine millions of examples, and it learns the patterns on its own.

Concrete example: to recognise a cat on a photo, you don't describe a cat ("4 legs, pointy ears, whiskers"). You hand over 10 million cat photos, and the machine works out its own rules. That's automated learning in action.

🪆 Deep Learning (DL)

Deep Learning is Machine Learning "on steroids". Where classical ML learns from the data as a whole, Deep Learning stacks several successive layers, each detecting a different level of detail.

Concrete example: face recognition on your phone. When you open the Photos app, your phone automatically identifies the faces of your loved ones. Here is what happens under the hood:

  • The first layer detects edges and contrast zones (a light eye on a darker skin, for instance).
  • The second layer combines those edges to recognise shapes (a nose, a mouth, ears).
  • The third layer assembles those shapes into faces.
  • The fourth layer compares the face to a library to identify the person.

No one wrote these rules by hand. The system learnt them on its own, from millions of annotated examples. That stacking of layers, each refining the result a bit more, is what gives "Deep" Learning its name (deep means many layers).

The same machinery powers voice recognition (Siri, Alexa), automatic translation (DeepL, Google Translate), Tesla's autonomous driving, and of course generative AI.

💡
Key takeaway

Every generative AI (ChatGPT, Claude...) is Deep Learning, which is Machine Learning, which is AI. The reverse isn't true: a smart thermostat is AI, but it isn't Deep Learning.

The Transformer revolution (2017)

Generative AI as we know it today was born in 2017 with a research paper: "Attention is All You Need". It introduced the Transformer architecture (the "T" in GPT, which stands for Generative Pre-trained Transformer). Nearly all today's AIs are descendants of that paper.

The attention mechanism

Before Transformers, models read sentences word by word, in order. A bit like us when we read, but without the ability to "look back".

The attention mechanism changes everything. The model analyses the sentence as a whole and assigns an "importance weight" to each word depending on the context. In "the bank of the river", it instantly figures out it's a riverbank, not a financial institution, because the word "river" carries more weight than the default meaning of "bank". That's the mechanism that makes modern models so good.

"the" "bank" "of" "the" "river" attention weights on "bank" 0.05 0.08 0.05 0.82
To interpret "bank", the model weighs every word in the context. "river" gets 82 % of the attention. So "bank" = riverbank, not a financial institution.
📜
Side note

The "Attention is All You Need" paper was authored by 8 Google researchers. Most have since left Google to start their own labs: Anthropic, Cohere, Character AI. The Transformer technology itself remains under an open licence.

Generative AI is all about probabilities

This is the single most important point in the entire programme, and the least well understood.

When you write to ChatGPT, it doesn't "think". It doesn't "understand" your question the way a human would. Here is what it actually does, step by step:

  1. It splits your prompt into "tokens" (chunks of words).
  2. It computes the probability of the next most likely word based on its training.
  3. It picks that word.
  4. It starts again with your prompt + the word it just produced.
  5. And so on, word by word, until the response is complete.

In short, it's a very sophisticated autocomplete machine. Impressive in its outputs, but purely statistical in how it works.

Prompt sent
"The
capital
of
France
is
Paris 94 %
Other candidates: Lyon 0.4 % · located 2.1 % · a 1.7 %
At each token, the AI computes the probability of the next word. It picks the most likely, then loops. Infinite loop until the answer ends.
⚠️
Direct consequence: hallucinations

If the statistical probability of a next word looks plausible, the model outputs it, even when it's wrong. That's why an AI can invent a book that doesn't exist, a fake legal precedent, or a bogus number with the confidence of an expert. It isn't lying. It's filling in the probable space. That's a different thing.

Why you must remember this

Every prompt engineering best practice (Module 2) follows from this principle. The more context you give, the more you frame the probabilities, the better the answer. That's also why people say "Shit in, shit out. Value in, value out": the quality of the answer is directly proportional to the quality of the input.

Tokens and context window: the hidden grammar of AI

If you only remember one technical concept from this entire programme, make it this one. The token is the unit of currency AI works with. Understanding tokens means understanding why AI costs what it costs, why it sometimes "forgets", and why it hallucinates after a long conversation.

What is a token, concretely?

A token is neither a letter nor a word. It's a chunk of word, decided by the model's training algorithm. The word "anticonstitutional" is split into several tokens (anti / constitu / tional). On the other hand, "the", "and", "of" are tokens on their own.

For English text, keep these orders of magnitude in mind:

  • 1 token ≈ 4 characters
  • 1 token ≈ 0.75 word
  • 1,000 tokens ≈ 750 words ≈ a dense A4 page
🧪 Interactive demo: tokenise your own text
0 tokens
0 words
0 characters
tokens / word
ℹ️
Accuracy of this demo

This demo is a teaching approximation. The real tokenisers (tiktoken for OpenAI, Claude's tokeniser) are proprietary and use more sophisticated algorithms (BPE, SentencePiece). The order of magnitude is accurate to within ±15 %.

How do you pay for AI?

Before going further, let's clarify this. There are two very different billing models coexisting on the market.

💳
Model 1: the personal subscription

This is what most people know. You pay a fixed monthly fee (typically $20 to $25), and use the tool as much as you want, with some rate limits. Examples: ChatGPT Plus, Claude Pro, Gemini Advanced, Mistral's Le Chat Pro.

Handy for personal use or a single user. Pricing is predictable.

🏢
Model 2: pay-per-use (API)

This kicks in as soon as you integrate AI into a business tool: a customer chatbot, a Make workflow, an internal assistant. You no longer pay a fixed fee but a price per token consumed, in input and output. Output is typically 3 to 5 times more expensive than input.

Upside: cost scales with actual usage. Downside: without governance, the bill can climb fast at high volume.

The calculator below is about Model 2 (API, enterprise usage). That's the one that becomes strategic at scale. If you're using ChatGPT from the web app with your personal subscription, you don't need to count tokens. You already pay the flat fee.

Pick a model, tune the volume, and watch the monthly and yearly cost for a 200-user deployment.

💰 AI cost calculator (2026 pricing)
$0.000
per request
$0
per month
$0
per year
💡
Three levers to cut the bill

1. Pick the right model. A Sonnet or a Mini handles 80 % of use cases for 10 to 30 times less than an Opus or a full GPT-5.1. Save the top-tier models for tasks that actually need them.

2. Limit the context you inject. If you paste a 50-page PDF when 3 paragraphs would do, you pay for the 50 pages. That's one of the reasons RAG exists (see Module 2).

3. Constrain the output. Explicitly ask for a 200-word answer rather than letting the model "breathe". Output is 3 to 5 times more expensive than input.

The context window: AI's working memory

The context window is the maximum amount of tokens a model can "see" at once. It includes your prompt, the conversation history, the attached documents, and the answer being generated. All of that, combined.

In 2026, the orders of magnitude have exploded compared to 2023:

GPT-3.5 (2022)
16k
GPT-4 (2023)
128k
Claude Opus 4.7
200k
GPT-5.1
400k
Claude Sonnet 4.6
1M
Gemini 3 Pro
2M
For scale: 200k tokens is roughly 500 pages of dense text, an entire novel or a complete pitch deck dossier. 2 million tokens is 5,000 pages, basically the entire knowledge base of a department.
Exponential growth of context windows since 2022. Source: vendors (Anthropic, OpenAI, Google), public values for 2026.

The "lost in the middle" trap

Having a big context window doesn't mean the model uses it well. Recent studies have shown that past a certain volume, models tend to focus on the beginning and the end of the context, and neglect the middle. That's the "lost in the middle" effect.

Concretely: if you paste a 200-page PDF and the key info is on page 100, the model may miss it. For very long contexts, it's better to either summarise upfront, or use a RAG system that only surfaces the relevant passages.

Why AI "forgets" and hallucinates when the context overflows

Here's the concrete experience. You start a conversation, you give context, you exchange 20 messages, you add a document, and then 30 messages later the AI "forgets" your name or contradicts what it said at the start. That's context window overflow.

🪟 Demo: what happens when the context overflows
Model memory (24 tokens)
0 token · empty memory

Click "Send 8 tokens" several times. You'll see the older tokens turn grey and crossed out: the model "loses" them. When you later ask something that depends on those lost tokens, two things can happen.

  • Case 1: the AI says it doesn't know. Ideal scenario. You start a fresh session with a clean summary of the key context.
  • Case 2: the AI makes something up. As you saw in the probabilities section, the model must produce a next word. If it no longer has the real info in memory, it fills the probable space with something that looks like the truth. That's a hallucination caused by context overflow.
⚠️
Symptoms of a saturated context window
  • The model contradicts what it said 15 messages earlier
  • It "forgets" an instruction you gave at the start
  • It makes up a detail it had at hand earlier in the conversation
  • Its answers become more generic, less anchored in your context

Habit to build: for long tasks, start a new session with a clean summary of the context. You restart on fresh memory.

Three habits to adopt starting tomorrow

  1. Estimate your tokens before sending a big prompt. A 30-page PDF is about 15,000 tokens. An average email is 200 tokens. Having this reflex saves you from billing surprises.
  2. Start a new session when the topic changes. Rather than piling 50 messages into the same chat, open one session per task. Your results will be more precise and less costly.
  3. Give just what's needed, no more. If one page is enough, don't paste the entire document. The model doesn't "read better" because it has more context: past a certain threshold, the opposite happens.

LLM vs SLM: why so many different models?

LLM, the "Large Language Models"

The "giant" models. Hundreds of billions of parameters, trained on terabytes of text. Versatile, powerful, capable of complex tasks. That's what you use when you go to Claude or ChatGPT.

Claude Opus 4.7
Anthropic · reasoning & code
GPT-5.1 / o4
OpenAI · ChatGPT
Gemini 3 Pro
Google · native multimodal
Grok 4
xAI · real-time access
Llama 4
Meta · Open source
Mistral Large 2
Mistral AI · France
DeepSeek V3 / R1
DeepSeek · Open source 🇨🇳
Qwen 3
Alibaba · Open source 🇨🇳

SLM, the "Small Language Models"

The "light" models. Much smaller, faster, cheaper. Ideal for specific tasks, or to run directly on a phone or an enterprise server without sending data to a public vendor.

Concrete examples: Apple Intelligence on iPhone runs partly locally thanks to an SLM. Mistral also offers SLMs for targeted business use cases.

🎯
For your everyday work

As a user, you'll almost always interact with LLMs. But in the enterprise context (Module 6), SLMs become strategic. They let you keep data under control, on your own infrastructure.

Key takeaways before the quiz

  • AI ⊃ Machine Learning ⊃ Deep Learning. Each concept contains a more precise one.
  • Transformers (2017) revolutionised AI by analysing the global context of a sentence via the attention mechanism.
  • A generative AI does not think. It mathematically computes the most probable next word.
  • As a result, hallucinations are structural. Not a bug, it's how the system works.
  • A token is a chunk of word. LLMs charge by token, and their memory (the context window) is bounded. When it overflows, the model hallucinates.
  • LLM = large, versatile models (cloud). SLM = light models, perfect for targeted or sovereign use cases.
🎯

Module 1 quiz

7 questions · 60 % to validate the module

1. Which hierarchy is correct?
AI is the umbrella concept that contains Machine Learning, which itself includes Deep Learning. ChatGPT is Deep Learning, therefore also ML, therefore also AI. The reverse isn't true.
2. When a generative AI produces an answer, what does it really do?
A generative AI is a statistical autocomplete machine. It computes the probability of each next token from its training. That's why better context gives better output, and why hallucinations are structural.
3. What does the Transformer attention mechanism do?
The attention mechanism lets the model analyse a sentence as a whole and weigh which words matter in context. It's what distinguishes "the bank of the river" from "the bank around the corner".
4. Why can an AI "hallucinate" (invent a false answer)?
Hallucinations are structural. The model will always generate a next word, even when it doesn't actually know. It will pick the statistically most plausible word. Hence the importance of guardrails (RAG, human verification, etc.).
5. What is the main advantage of an SLM (Small Language Model) over an LLM?
An SLM runs on modest resources, even on a phone. It's less versatile than an LLM but very well suited to targeted tasks and data control (deploy on your own server, without sending data to a public vendor).
6. For English text, what does 1,000 tokens roughly correspond to?
In English, roughly 1 token per 0.75 word, so 1,000 tokens ≈ 750 words ≈ a dense A4 page. Keeping this order of magnitude in mind protects you from billing surprises and from context window overflow.
7. Why can a long conversation eventually produce hallucinations, even if the model was accurate at the start?
The context window is a bounded working memory. When it overflows, the first tokens fall out of the model's field of view. Because it must always produce a next word (the probability principle), it makes things up rather than admit the gap. Reflex: for long tasks, start a fresh session with a clean summary of the context.