Skip to content
Pixel
العربية

1-2Unit 1 · Information Technology and Society

How AI Works

10 min readStart exercises
In this lesson
  1. The Big Idea
  2. What Is AI?
  3. Machine Learning: From Writing Rules to Learning from Data
  4. Deep Learning and Artificial Neural Networks
  5. Generative AI and Hallucination
  6. How the Four Ideas Fit Together
  7. Try It Yourself
  8. Common Mistakes
  9. Key Points
  10. FAQ

The Big Idea

Artificial Intelligence (AI) is not one single technology. It is a wide field of computer systems that can learn, predict, recognise, create content and support decisions. Inside that field is machine learning (ML), where the computer learns patterns from data instead of being handed every rule. One approach within machine learning is deep learning (DL), which uses multi-layer neural networks. And most modern generative AI (GenAI) tools, such as ChatGPT, rely on deep learning.

What Is AI?

Artificial Intelligence (AI) is a field of computer systems that can do tasks we used to think needed "intelligence", such as:

  • Learning from data: getting better as the system sees more examples.
  • Predicting: estimating how busy a road will be before you leave home.
  • Recognising: understanding you when you tell your phone "Call Mum", or unlocking the phone by recognising your face.
  • Generating content: writing a paragraph or creating an image from a description.
  • Making or supporting decisions: suggesting the best route in a maps app.

Classic everyday examples are speech recognition, image recognition and translation. A lot of the time AI works in the background without you noticing: it sorts your spam, suggests the next video and translates a comment on a page.

Machine Learning: From Writing Rules to Learning from Data

There are two ways to make a computer tell spam from normal email:

  1. Write the rules ourselves: "If the message contains the word prize, it is spam." The computer follows exactly what we wrote, and every new trick the spammers invent needs a new rule written by a person.
  2. Give it lots of examples and let it learn: thousands of emails, each one known to be spam or not. During training the system finds the shared patterns by itself, then uses what it learned to predict whether a new, unseen email is spam.

The second way is machine learning (ML): a branch of AI in which models learn patterns from data to make predictions or classifications or to support decisions, instead of having every rule programmed explicitly.

Hand-written rules vs learning from data Two panels about one example, spotting spam emails. In the first, a programmer writes a fixed rule such as: if the email contains the word prize, it is spam; the computer follows it exactly, and every new trick needs a new rule. In the second, thousands of emails marked spam or not go into training, where patterns are found; the result is a model. A new email goes into the model, which predicts spam, and nobody wrote that rule by hand. 1) Rules written by hand Programmer writes every rule Fixed rule if “prize” → spam Computer follows it exactly A new spam trick? A human must write a new rule. 2) Machine learning: patterns learned from data Data many emails, tagged spam/OK Training finds patterns in the examples Model what it learned from the data Prediction this email: “spam” New email Nobody hand-wrote the rule
In machine learning nobody writes the rule; the model works out the patterns from examples.

The book's two machine-learning examples:

  • Spam filtering: it learns from past emails what spam tends to look like.
  • Product recommendations: an online shop learns from your purchase history (and that of similar shoppers) and suggests things you are likely to want.

Deep Learning and Artificial Neural Networks

Deep learning (DL) is one approach within machine learning. It relies on multi-layer neural networks and can learn complex patterns and representations from data. Examples include image analysis and speech recognition. So all deep learning is machine learning, but not all machine learning is deep learning.

What is an artificial neural network?

An artificial neural network (ANN) is a computational model loosely inspired by the idea of connected neurons in the brain. It is not a brain and not a copy of one. Instead it is:

  • Many simple units connected together and arranged in layers: an input layer that receives the data, hidden layers in the middle, and an output layer that gives the result.
  • Each connection between two units has a weight, which sets how much one unit influences the next.
  • During training these weights are adjusted little by little until the network has learned the patterns in the data.

"Deep" refers to the many layers: each layer picks up something slightly more complex than the layer before it.

Why does deep learning need so much data?

Deep learning often relies on relatively large amounts of data to learn reliable patterns. The important consequence: if something is rare in the training data, the system will not learn its pattern well and may get it wrong when it meets it.

Example: a farmer wants a system that tells photos of healthy tomato leaves from diseased ones. It needs many photos of both, each with its condition known. If every photo was taken in daylight, or one disease appears in only a handful of photos, the system may fail on a picture taken in different lighting or on that rare disease.

Generative AI and Hallucination

Generative AI (GenAI) refers to systems that create new content, such as text, images, audio and software, based on patterns learned from their training data. You type a prompt, and it produces text, an image or an audio clip. Most modern generative systems rely on deep learning models. Examples include ChatGPT and image-generation tools.

Compare it with a spam filter: the filter classifies something that already exists (spam or not), while a generative system creates something that did not exist before.

Hallucination: convincing but wrong

Generative AI can produce text that sounds plausible and confident but is factually incorrect. This is called a hallucination: a book title that does not exist, a wrong date, or an invented number inside a very well-written sentence.

That is why copying a generative tool's answer straight into a school report is risky: you could hand your teacher false information while believing it is true. The right move is to check the output and its sources before you use it.

From prompt to content you can trust Flow chart: a prompt such as “Report on the Nile” goes into generative AI, which uses patterns from its training data and produces new content: text, image or audio. The output sounds right but may be false, which is called a hallucination. So you check before using it: compare with reliable sources, check names, numbers and dates, and record your sources. If it is correct, use it and cite the source; if it is wrong, fix or remove it. Prompt “Report on the Nile” Generative AI uses patterns from its training data New content text · image · audio Sounds right… but may be false (hallucination) Check before you use it 1. Compare with reliable sources (book, official site) 2. Check names, numbers and dates 3. Record the sources you checked ✓ Correct: use & cite it ✗ Wrong: fix or remove it
A generative tool is a fast assistant, but you are responsible for whether the information is true.

How the Four Ideas Fit Together

Now put the whole picture together. The book presents these ideas as nested categories, from the broadest to the most specialised:

  • AI is the broad field.
  • Machine learning is a branch of AI.
  • Deep learning is an approach within machine learning.
  • Generative AI: most of its modern applications rely on deep learning models.
The AI family: nested categories Four nested boxes: Artificial Intelligence is the widest; inside it is Machine Learning; inside that is Deep Learning; inside that is a dashed box for Generative AI, because most modern generative systems rely on deep learning. Each box gives the idea and one example. A note at the bottom says this is a simplified teaching picture. Artificial Intelligence (AI) Systems that learn, predict, recognise, decide · e.g. translation Machine Learning (ML) Learns patterns from data · e.g. spam filter Deep Learning (DL) Multi-layer neural networks · e.g. speech recognition Generative AI (GenAI) Creates new content · e.g. ChatGPT Most modern systems rely on deep learning A simplified teaching picture, not a strict hierarchy in every case
From broadest to most specialised. The dashed line reminds you that the relationship is simplified.

Try It Yourself

Try
Create or recognise?
Sort each use: does the system create new content, or does it recognise, classify or predict something that already exists?
Items (9)
Tap an item to select it, then tap the category it belongs to.
Nothing here yet
Nothing here yet
Try
A machine-learning model's journey
Put the steps of a system that learns to spot spam in order, from start to finish.
1. End up with a trained model that holds what it learned
2. Collect thousands of emails, each known to be spam or not
3. Train the model on these examples so it finds the patterns
4. A new email arrives that the model has never seen
5. The model predicts: this email is spam or not spam
Use the up and down buttons to move each step, then press Check.
Try
Mariam's report on the High Dam
The situation
Mariam asked a generative AI tool for a paragraph about the Aswan High Dam for a school report. The paragraph is neat and confident, with years, figures and the name of a reference. What should she do before handing it in?
What would you do? You can try more than one choice.

Common Mistakes

"AI and machine learning are two names for the same thing"

AI is a broad field and machine learning is one branch inside it. All machine learning is AI, but not the other way round.

AI is the wider field; machine learning is the branch of it that learns patterns from data.

"Deep learning is a completely different technology from machine learning"

Deep learning is not a rival to machine learning or a replacement for it; it is one of its approaches.

Deep learning is a kind of machine learning, distinguished by its use of multi-layer neural networks.

"In machine learning the programmer writes all the rules"

That describes programming with explicit rules, which is the opposite of the machine-learning idea.

In machine learning the model learns patterns from data instead of having every rule programmed explicitly.

"If a generative AI answer is well written and confident, it must be correct"

A generative tool creates text from patterns it has learned, so its text can be completely convincing and still wrong. That is a hallucination.

Always check the output and its sources against an outside, reliable reference before using it.

"An artificial neural network is a copy of the human brain"

It is only loosely inspired by the idea of connected neurons.

A neural network is a computational model of connected units whose weights change during training so it can learn patterns from data.

Key Points

  • AI is a broad field of systems that learn from data, predict, recognise, generate content, and make or support decisions. Most current AI systems are specialised in a specific task.
  • Machine learning is a branch of AI that learns patterns from data instead of having every rule programmed. Examples: spam filtering, product recommendations.
  • Deep learning is an approach within machine learning based on multi-layer neural networks. Examples: image analysis, speech recognition.
  • An artificial neural network is made of connected units in layers (input, hidden, output) whose weights change during training.
  • Deep learning usually needs relatively large data and may struggle with things that are rare in its data.
  • Generative AI creates new content (text, images, audio, software); most modern systems rely on deep learning. Example: ChatGPT.
  • A hallucination is output that sounds plausible but is factually wrong, so always check outputs and their sources.
  • From broadest to most specialised: AI, then machine learning, then deep learning, then generative AI, as a simplified teaching relationship.

FAQ

Is ChatGPT AI, machine learning or deep learning?

All of them, at different levels of detail. ChatGPT is an example of generative AI because it creates new text; it is built on deep learning models; deep learning is an approach within machine learning; and machine learning is a branch of AI. In the exam, call it generative AI, because that is the most precise description.

What is the difference between machine learning and deep learning in one line?

Machine learning is the branch that learns patterns from data instead of being given every rule; deep learning is an approach inside it that uses multi-layer neural networks, can learn more complex patterns, and usually needs more data.

Why does AI make mistakes with rare cases?

Because it learns from the examples it has seen. If a case appears only a few times in the training data, the model never forms a reliable pattern for it, so it is more likely to get it wrong.

Can I use generative AI for my homework?

Follow your school's and your teacher's rules first. If it is allowed, use it as an assistant, not a replacement: check every fact in a reliable source because it can hallucinate, cite your sources, and write your final understanding yourself.

Done reading? Test yourself