AI technologies and generative AI
Why This Matters
“AI” covers a decision tree that fits on a page and a language model with hundreds of billions of parameters. They fail in different ways and are tested in different ways. This lesson gives you the map: which technologies there are, how they relate, and why generative AI is the hardest of them to test.
What you will learn
- The main AI technologies: machine learning and its three forms, deep learning, generative AI, and the others
- How generative AI works, in enough detail to understand why its output varies
- The benefits and concerns of generative AI that testers have to keep in mind
Syllabus: AI-1.1.3, AI-1.1.4.
The map
Think of the technologies as nested circles, with a few others beside them:
Artificial intelligence
├── Machine learning (ML): learns from data
│ ├── supervised, unsupervised, reinforcement learning
│ ├── e.g. decision trees, random forests, support vector machines, Bayesian models
│ └── Deep learning (DL): ML with deep neural networks
│ ├── CNN: images
│ ├── RNN: sequences, time series
│ ├── Transformers: long-range relations in text and images
│ └── Generative AI (GenAI): creates new text, images, audio
│ └── Large language models (LLMs)
├── Natural language processing, computer vision (application areas)
├── Fuzzy logic, search algorithms, rule-based expert systems
└── Agentic AI: agents that plan, reason and act toward goals
Machine learning
Machine learning builds a model from data instead of from programmed rules. Some systems keep learning while they are used; most are retrained explicitly from time to time. There are three forms, covered in depth in module 3:
- Supervised learning learns from labelled data: examples with the right answer. It predicts a value or a class. Algorithms include linear regression and decision trees.
- Unsupervised learning finds structure in unlabelled data, for example by grouping similar customers (clustering).
- Reinforcement learning learns by trial and error: an agent tries actions and receives rewards and penalties.
Other ML technologies the syllabus names: neural networks, Bayesian models, support vector machines (SVM) and random forests.
Deep learning
Deep learning is ML with deep neural networks: networks with many layers (module 4 opens one up). Three architectures matter:
- Convolutional neural networks (CNN) for images: recognising objects, detecting them in a photo.
- Recurrent neural networks (RNN) for sequences: text, time series.
- Transformers for long-range relations: which word in a long sentence a pronoun refers to. They power modern language models, and vision transformers for images.
Other AI technologies
Not all AI learns from data:
- Natural language processing (NLP): sentiment analysis, machine translation.
- Computer vision: facial recognition, robotics.
- Fuzzy logic: reasoning with “somewhat warm” instead of true/false.
- Search algorithms: optimisation, navigation, strategy (the chess engine).
- Rule-based expert systems: decision support with rules from experts.
And one that is rapidly growing: agentic AI, autonomous agents that plan, reason and take actions (calling tools, browsing, editing files) to reach a goal in a changing environment. An agent that acts is riskier than a model that only answers, which makes testing it more important.
Generative AI
Generative AI builds on deep learning to create content: text, images, audio, video, code. It is driven by large language models, which combine deep neural networks with natural language processing. Three core technologies:
- Generative adversarial networks (GANs): two networks compete. One generates fake data, the other tries to tell fake from real; both get better until the fakes are realistic.
- Diffusion models: learn to add noise to data and then remove it step by step. Generating an image means starting from noise and “denoising” it into a picture.
- Transformers: use self-attention to weigh how much every part of the input matters for every other part. They are the basis of LLMs, and are adapted for multimodal tasks.
Why the same prompt gives different answers
An LLM writes one token (a word or a part of a word) at a time. For every next token it calculates a probability for every possible token, and then samples one. Suppose the prompt is “The test failed because the” and the model calculates:
| Next token | Probability |
|---|---|
| server | 0.32 |
| data | 0.24 |
| assertion | 0.18 |
| network | 0.11 |
| model | 0.08 |
| (everything else) | 0.07 |
With sampling, “server” comes out about one time in three, “data” one time in four, and so on. Every next token is sampled again, so after a few tokens two runs can be completely different sentences. A setting called temperature controls how adventurous the sampling is: at a low temperature the model almost always picks the most likely token; at a high temperature unlikely tokens get more chances.
For testers, this has three consequences that run through this course:
- There is no single expected output. “The test failed because the server timed out” and “…because the data was invalid” can both be correct. You check properties of the answer, not the exact text (module 5).
- One run is not a test. A failure that appears one time in five is a real failure that one run will usually miss.
- Settings are inputs. Temperature, the system prompt, the maximum length and the context are part of the input. A test that does not record them cannot be repeated.
In practice
Most GenAI applications are not trained from scratch. They use a foundation model (a large pretrained model) and adapt it, by fine-tuning or by giving it documents to work with (module 3). Models are increasingly multimodal: one model handles text, images and audio.
Benefits and concerns
GenAI brings productivity, creativity and new possibilities in entertainment, marketing, education and research. It also brings concerns the syllabus lists explicitly:
- deepfakes, misinformation and fraud
- privacy and security: models that leak data, or are manipulated with prompt injection
- manipulation of people
- job displacement, especially in white-collar work
- energy use and carbon footprint of training and running large models
Regulation is catching up: the EU AI Act is the main example (lesson 4).
Exercise
- For each system, name the AI technology that fits best: (a) a camera that counts cars at a crossroads, (b) a model that groups customers by buying behaviour without predefined groups, (c) a tool that writes a product description from a few keywords, (d) a robot vacuum that learns which routes cover a room fastest by trying, (e) a system that assigns 1 to 5 stars to a review text.
- You ask a chatbot the same question five times and get three different answers. Name two reasons from this lesson why that can happen, and what it means for how you test it.
Show suggested answer
(a) Computer vision, typically a CNN. (b) Unsupervised learning: clustering. (c) Generative AI, an LLM. (d) Reinforcement learning. (e) NLP: sentiment analysis, a supervised classification model.
The model samples the next token from a probability distribution, so different runs take different paths; and the settings (temperature, system prompt, context of earlier messages) may differ between runs. It means: record all settings with every test, run each test several times, and judge the answers on properties (is it correct, complete, safe?) instead of comparing the exact text.
Exam-style questions
1. Which statement about deep learning is correct?
- A. Deep learning is a form of rule-based expert system
- B. Deep learning is a subset of machine learning that uses deep neural networks
- C. Deep learning cannot be used for images
- D. Deep learning and generative AI are the same thing
Show answer
2. Which technology works by adding noise to data and learning to remove it, to generate high-quality images?
- A. Generative adversarial network
- B. Diffusion model
- C. Recurrent neural network
- D. Fuzzy logic
Show answer
3. Which is a concern of generative AI named in the syllabus?
- A. It can only process text
- B. It is fully deterministic, which makes it predictable for attackers
- C. High energy use and the resulting carbon footprint
- D. It cannot be combined with other AI technologies