AI, machine learning and deep learning: the vocabulary everything else assumes
How AI, machine learning, deep learning and generative AI nest inside each other, what a model and an algorithm actually are, how a neural network learns, the three kinds of learning, fit and bias, computer vision and NLP, large language models, batch versus real-time inference, and the shapes data comes in.
On this page
Every other article in this series leans on about thirty words: model, algorithm, training, inference, label, feature, supervised, overfit, token, endpoint. The exam leans on them too, and most of its wrong answers are built by swapping one of these words for its neighbour. This article pins each one down once, with a picture where a picture helps, so that later articles can say "a supervised classifier on tabular data behind a real-time endpoint" and mean something exact. The previous article laid out the exam and the AWS stack; this one is the dictionary for both.
The map
Read this first when short on time. Every branch is a section below.
The nested circles: AI, machine learning, deep learning and generative AI
Artificial intelligence is the whole field of making machines do things that look intelligent; machine learning is the part of it that gets there by learning from data; deep learning is the part of machine learning that uses many-layered neural networks; and generative AI is the part of deep learning whose models produce new content rather than a label or a number. Each circle sits inside the one before it.
Artificial intelligence (AI) is the oldest and loosest term. A chess program that searches millions of positions, a thermostat with hand-written rules, a route planner, a spam filter and a chatbot are all AI. What they share is the goal, not the method: perceive, reason, decide or act in a way a person would call intelligent. Many AI systems have no learning in them at all; they are rules, search and logic written by people. That kind is often called rule-based or symbolic AI, and the next article spends a section on when it is the better choice.
Machine learning (ML) flips the programming model. Instead of writing the rules, you give the computer examples and an algorithm that finds the rules for itself. The output of that process is a model: a function, with learned parameters, that turns an input into a prediction. If the data changes, you retrain and the rules change with it. The price is that you need data, often a lot of it, and that you can no longer read the rules off the page.
Deep learning (DL) is machine learning done with neural networks that have many layers (that is what "deep" means). Older ML needs a person to decide what the useful inputs are: the number of exclamation marks in an email, the ratio of a house's floor area to its plot. Deep networks learn those features themselves from raw pixels, raw audio samples or raw text, which is why they took over vision, speech and language, and why they need far more data and compute than the shallow methods.
Generative AI is the newest inner circle: deep learning models trained on enormous datasets that generate text, images, code, audio or video. The models are called foundation models because one model is trained once and then adapted to many tasks; the text-only ones are large language models. This article gives them one section near the end; the fifth article takes them apart properly.
Same goal, different tools: when each applies
The circles are about method, so the practical question is which method fits the problem. Rules win when the logic is known, small and must be exact: tax brackets, a firewall policy, "block the card if the PIN is wrong three times". Classical ML wins when the pattern is in the data but a person cannot write it down, the data is tabular (rows and columns) and there are thousands to millions of examples: fraud scores, churn, price prediction. Deep learning wins when the input is unstructured (pixels, audio, text) or the pattern is too rich for hand-made features, and there are enough examples and enough compute to pay for it. Generative AI wins when the output itself is content: a summary, an answer, an image, a block of code.
| Artificial intelligence | Machine learning | Deep learning | |
|---|---|---|---|
| Where the rules come from | Written by people (or learned; ML is included) | Learned from examples | Learned from examples, including the features |
| Data needed | None for a rule system | Hundreds to millions of rows | Usually far more, or a pre-trained model to start from |
| Compute | CPU | CPU is fine for most | GPUs or purpose-built chips (Trainium, Inferentia) |
| Feature engineering | Not applicable | Done by a person | Done by the network |
| Explainability | Full: read the rules | Good for linear models and trees, weaker for ensembles | Hard; needs tools like SHAP |
| Typical problems | Scheduling, routing, games, validation | Tabular prediction: fraud, churn, price, demand | Images, speech, text, generative content |
- Amazon.com recommendations began as classical machine learning (item-to-item collaborative filtering over purchase histories) and moved to deep learning models as the catalogue and the behaviour data grew.
- Alexa is deep learning end to end: a wake-word detector on the device, speech recognition and language understanding in the cloud, all neural networks trained on labelled audio and text.
- Amazon Bedrock lives in the innermost circle: it serves foundation models from Amazon, Anthropic, Meta and others behind one API, and never trains a classical model.
- A rules engine such as the fraud rules a card issuer writes by hand is AI in the broad sense and involves no learning; Amazon Fraud Detector lets you combine such rules with a learned score.
Questions here test containment and direction. "Deep learning is a subset of machine learning, which is a subset of AI" is the fact; a distractor swaps the order or says ML is a subset of DL. When a scenario mentions raw images, audio or free text and "learning features automatically", the answer is deep learning; when it mentions rows in a spreadsheet and "the relationship between columns", classical ML is enough.
- Rule-based system
- Software whose behaviour is a set of if-then rules written by people. Deterministic, explainable, and brittle when the world changes.
- Feature
- One input variable the model looks at: a column in a table, or something derived from the raw data such as the number of words in a review.
- Foundation model
- A very large deep learning model trained once on broad data, then adapted to many tasks through prompts or fine-tuning rather than retrained from scratch.
Model, algorithm, training and inference: the four words in every sentence
An algorithm is the learning procedure, a model is what that procedure produces from data, training is running the procedure, and inference is using the finished model to make a prediction on something it has not seen. The exam swaps these words in distractors more than any others, so it is worth being pedantic.
The algorithm is the recipe. Linear regression, XGBoost, k-means and "a convolutional network with this architecture" are algorithms: they say how to turn a dataset into a model. The same algorithm run on two datasets gives two different models. On SageMaker an algorithm is a container image, either one of the built-in ones or your own.
The model is the output of training: an architecture plus its learned numbers, the parameters. For linear regression the parameters are the slope and intercept; for a neural network they are the millions or billions of weights. The model is a file (SageMaker writes it to S3 as model.tar.gz) and it is a function: give it an input, it returns a prediction. Settings you choose before training rather than learn from data, such as the depth of a tree or the learning rate, are hyperparameters.
Training is fitting the parameters to the data. The algorithm makes a prediction on each example, compares it with the truth through a loss function (a number that says how wrong it was), and adjusts the parameters to shrink that number. It is expensive, needs the whole dataset, often needs GPUs, and happens rarely: once, then again when the data drifts.
Inference (the exam uses "inferencing") is running the trained model on a new input to get a prediction: is this transaction fraud, what will demand be next Tuesday, what is the next word. It is cheap per call and happens constantly, so it is where most of the money and most of the engineering go in a production system. The ways to serve it, batch and real-time, get their own section below.
flowchart TD D["Training data<br/>examples with the right answers"] --> A["Algorithm<br/>XGBoost, a neural network, k-means"] H["Hyperparameters<br/>tree depth, learning rate, epochs"] --> A A -->|"training: minimise the loss"| M["Model<br/>architecture plus learned parameters<br/>saved as an artifact"] N["New, unseen input"] -->|"inference"| M M --> P["Prediction<br/>a number, a class, a sentence"]
Features, labels and the split
Each training example is a set of features (the inputs) and, in supervised learning, a label (the answer). A house is [floor area, bedrooms, postcode] with the label sold price. Before training, the data is split three ways: a training set the algorithm learns from, a validation set used to choose hyperparameters and detect overfitting while training, and a test set touched exactly once at the end to report an honest number. A common split is 80/10/10 or 70/15/15. Leaking test rows into training is the most common way to get a model that looks brilliant and fails in production.
- Amazon SageMaker makes the split visible: a training job takes a container (the algorithm) and S3 channels named
train,validationandtest, and writes the model artifact to S3. - Netflix retrains its recommendation models on a schedule (training, rare and heavy) and serves the ranked rows to hundreds of millions of devices (inference, constant and cheap).
- Amazon Bedrock exposes only inference: the training of the foundation models happened before you arrived, and the API you call is the inference half of Figure 3.
"Parameters" and "hyperparameters" are not the same word with a prefix. Parameters are learned by training (weights); hyperparameters are set by you before training (learning rate, number of trees, batch size) and tuned by trying several values. SageMaker Automatic Model Tuning searches hyperparameters; it never touches parameters directly.
The exam likes "which phase" questions. Anything that happens once with the whole dataset and produces an artifact is training; anything that happens per request with a saved model is inference. "The model is deployed to an endpoint" means inference is about to start. "The company wants to reduce the cost of predictions" is an inference question; "reduce the time to build the model" is a training question.
- Loss function
- A formula that scores how far a prediction is from the truth for one example or a batch. Training exists to make it small. Mean squared error for regression and cross-entropy for classification are the usual ones.
- Model artifact
- The saved model: the file or files that hold the learned parameters and enough description to load them. What a training job produces and what an endpoint loads.
- Hyperparameter
- A knob set before training rather than learned: learning rate, number of layers, tree depth, number of epochs, regularisation strength.
Neural networks: neurons, layers, weights and backpropagation in plain words
A neural network is a stack of simple arithmetic units, each of which multiplies its inputs by learned weights, adds them up and passes the total through a squashing function; stacked in layers, and with the weights tuned by backpropagation, the stack can approximate almost any function from input to output.
One neuron
A neuron (also called a unit or node) takes several numbers in, multiplies each by a weight, adds a bias term (a constant, nothing to do with the fairness kind of bias later in this article), and passes the sum through an activation function. The activation is what makes the network more than a big linear equation: without it, stacking layers would collapse to a single straight line. The common choices are ReLU (zero for negative inputs, the input itself for positive ones; cheap and the default in hidden layers), sigmoid (squashes to between 0 and 1, used for a yes-or-no output) and softmax (turns a set of scores into probabilities that sum to 1, used for a multi-class output).
Layers
Neurons are arranged in layers. The input layer is just the features (pixel values, word embeddings, columns). One or more hidden layers do the work; each layer's outputs are the next layer's inputs. The output layer gives the answer: one neuron for a regression number, one sigmoid for a binary class, a softmax over N neurons for N classes. "Deep" simply means many hidden layers. Early layers of an image network learn edges and blobs, later ones learn textures, parts and whole objects; nobody programs that, it falls out of training.
How the weights are learned
- Forward pass. Feed a batch of examples in. Each layer computes its weighted sums and activations; the output layer produces predictions.
- Loss. Compare predictions with the labels through the loss function and get one number: how wrong the batch was.
- Backpropagation. Work backwards from the output layer to the input, and for every weight compute how much a tiny nudge to it would change the loss. That quantity is the gradient. The chain rule from calculus lets each layer pass its share of the blame to the layer before it, which is where the name comes from.
- Gradient descent. Move every weight a small step in the direction that reduces the loss. The size of the step is the learning rate: too big and training bounces around or diverges, too small and it takes forever.
- Repeat. Take the next mini-batch and do it again. One pass over the whole training set is an epoch; training runs for as many epochs as it takes for the validation loss to stop falling.
That loop is all a GPU does for days when a big model trains. GPUs suit it because the forward and backward passes are enormous matrix multiplications that parallelise well. AWS also builds its own chips for the two halves: AWS Trainium for training and AWS Inferentia for inference, both offered as EC2 instance families (Trn and Inf) and as SageMaker instance types.
- Alexa's speech recogniser is a deep network trained on labelled audio: the forward pass turns a second of sound into a probability over words, and the loss during training was how wrong those probabilities were against the transcript.
- Amazon Go and the Just Walk Out shops run deep vision networks over ceiling cameras to track which item left which shelf; the "features" (what a hand holding a can looks like) were learned, not written.
- AWS Trainium and Inferentia exist because this loop is so regular that a chip built for matrix multiplication beats a general processor on cost per training hour and cost per inference.
Two unrelated things are both called bias in this exam. In a neuron, the bias is a constant added to the weighted sum, a learned parameter like any weight. In the responsible-AI sense, bias is a systematic unfairness in the data or the predictions. A question about "the bias term in a neural network" is arithmetic; a question about "bias in the training data" is fairness.
The exam does not ask for the calculus. It wants the vocabulary: neurons in layers, weights learned, activation functions make it non-linear, backpropagation plus gradient descent adjust the weights to reduce the loss, an epoch is one pass, the learning rate is a hyperparameter. "The model's loss oscillates and never settles" points at a learning rate that is too high.
- Activation function
- The non-linear function applied to a neuron's weighted sum: ReLU in hidden layers, sigmoid for a probability, softmax for a probability over several classes.
- Backpropagation
- The algorithm that computes, for every weight in the network, how much the loss would change if that weight changed, by passing the error backwards from the output layer.
- Gradient descent
- Adjusting every weight a small step against its gradient so the loss falls. Stochastic gradient descent does it per mini-batch rather than per full dataset.
- Epoch
- One complete pass through the training set. Models train for several epochs; too many and they start to overfit.
Supervised learning: learning from examples with the answer attached
Supervised learning trains a model on examples that each carry the correct answer, the label, so that it can produce that answer for new examples; it is the most common kind of machine learning in production, and it splits into regression when the answer is a number and classification when the answer is a category.
The word "supervised" means a teacher marked the homework. Someone, or some process, attached a label to every training row: this email is spam, this transaction was charged back, this house sold for 412,000, this photo contains a cat. Getting labels is usually the expensive, slow part of a supervised project, which is why AWS sells a labelling service (SageMaker Ground Truth, covered in the lifecycle article) and why so much recent progress has come from methods that need fewer labels.
Regression: the answer is a number
Regression predicts a continuous value: a price, a temperature, tomorrow's demand, how many minutes the delivery will take. The simplest algorithm is linear regression: fit a straight line (or a plane through many features) that minimises the squared distance to the points. It is fast, explainable (each coefficient says how much the output moves per unit of that feature) and surprisingly hard to beat on small clean tabular data. Gradient-boosted trees such as XGBoost take over when the relationship is not a straight line. Regression is judged by how far off the numbers are: mean absolute error, root mean squared error, and friends, all defined in the metrics section of the lifecycle article.
Classification: the answer is a category
Classification predicts which of a fixed set of classes an example belongs to. Binary classification has two classes (fraud or not, churn or stay, positive or negative review). Multi-class classification picks one of many (which digit, which product category, which language). Multi-label allows several at once (a photo tagged both "beach" and "dog"). The workhorse for binary problems is logistic regression: despite the name it is a classifier, a linear model whose output goes through a sigmoid to give a probability, and you choose a threshold (0.5 by default) to turn that probability into a decision. Classification is judged by how many it got right and, more usefully, by precision and recall, also in the lifecycle article.
The algorithm shelf
The exam names algorithms without asking you to run them. What it wants is that each name lands in the right box: supervised or not, regression or classification, tabular or unstructured, simple or ensemble.
| Algorithm | Learning type | Predicts | One-line idea | Typical use |
|---|---|---|---|---|
| Linear regression | Supervised | Number | Best straight line through the points | Price, demand, any numeric baseline |
| Logistic regression | Supervised | Class (probability) | Linear score pushed through a sigmoid | Fraud yes/no, churn, click prediction |
| Decision tree | Supervised | Number or class | A flowchart of if-then splits learned from data | Explainable rules on tabular data |
| Random forest | Supervised | Number or class | Many trees on random subsets, vote or average | Robust tabular prediction with little tuning |
| XGBoost (gradient boosting) | Supervised | Number or class | Trees built one after another, each fixing the last one's errors | The default winner on tabular data; a SageMaker built-in |
| k-nearest neighbours | Supervised | Number or class | Look at the k closest training points and copy their answer | Small datasets, similarity search; a SageMaker built-in |
| Support vector machine | Supervised | Class | The boundary with the widest margin between classes | Text and small high-dimensional data |
| Naive Bayes | Supervised | Class | Multiply per-feature probabilities as if independent | Spam filters, fast text classification |
| k-means | Unsupervised | Cluster id | Move k centres until each point sits with the nearest one | Customer segments; a SageMaker built-in |
| PCA | Unsupervised | Fewer features | Rotate the data so a few axes carry most of the variance | Compression, visualisation, denoising; a SageMaker built-in |
| Random Cut Forest | Unsupervised | Anomaly score | Points that are easy to isolate are unusual | Anomaly detection in streams; a SageMaker built-in |
| CNN | Supervised (deep) | Class, boxes, masks | Slide small filters over the image to learn edges, then parts | Images and video |
| RNN, LSTM | Supervised (deep) | Next step of a sequence | Carry a hidden state from one step to the next | Time series, older speech and text models |
| Transformer | Self-supervised (deep) | Next token, embeddings | Attention lets every token look at every other | LLMs, translation, vision; see the generative AI article |
- Banks' fraud detection is the textbook binary classifier: each card transaction gets a probability of fraud from gradient-boosted trees or a network trained on years of labelled charge-backs, and a threshold decides whether to block it. Amazon Fraud Detector packages exactly that.
- Zillow's Zestimate is regression at scale: predict a sale price from a home's features and neighbourhood, with the actual sales as labels.
- Gmail's spam filter started life as naive Bayes over word counts, the classic example of a fast, explainable text classifier.
- Amazon SageMaker ships XGBoost, linear learner, k-NN, k-means, PCA and Random Cut Forest as built-in algorithms, so the exam's algorithm names are also SageMaker menu items.
Logistic regression is classification, not regression, whatever the name says. And a "regression" problem where the target is really a small set of buckets (low, medium, high) is a classification problem in disguise; treating it as regression is a common wrong answer.
Spot the label. If the scenario has historical outcomes ("past transactions marked as fraudulent", "houses with their sale prices") it is supervised. Then spot the target type: a quantity means regression, a category means classification. "Predict how much" is regression, "predict whether" or "predict which" is classification. If the scenario says "no labelled data", the supervised options are all wrong.
- Label
- The correct answer attached to a training example. Also called the target. Its presence is what makes learning supervised.
- Ensemble
- Several models combined. Random forests average many trees trained in parallel (bagging); XGBoost trains trees one after another to correct the previous ones (boosting).
- Threshold
- The probability above which a classifier says yes. Raising it gives fewer false alarms and more misses; lowering it does the opposite.
Unsupervised learning: finding structure when nobody labelled anything
Unsupervised learning works on data with no labels, so instead of predicting an answer it finds structure that is already in the data: groups of similar items, a smaller set of features that explain most of the variation, or the points that do not fit anywhere.
Unlabelled data is cheap and plentiful (every log line, every purchase, every sensor reading), which is the appeal. The difficulty is that there is no right answer to check against, so evaluating an unsupervised model is a judgement call: do the clusters make business sense, does the compressed data still work, do the flagged anomalies turn out to be real problems? Three tasks cover almost everything the exam means by the term.
Clustering
Clustering groups similar examples together. k-means is the standard algorithm: pick k, place k centre points, assign each example to its nearest centre, move each centre to the middle of its members, repeat until nothing moves. You choose k; the algorithm does not know how many groups there should be, and picking it is part of the craft (the "elbow method" plots the fit against k and looks for the bend). Typical uses: customer segments for marketing, grouping documents by topic, compressing an image to k colours, finding the natural groups in sensor behaviour before anyone names them.
Dimensionality reduction
A dataset with hundreds of features is slow to train on, hard to visualise and full of redundancy (height in centimetres and height in inches are two columns with one piece of information). Dimensionality reduction squeezes the features down while keeping most of what matters. Principal component analysis (PCA) does it linearly: it finds new axes, ordered by how much of the data's variance each one carries, and you keep the first few. The result trains faster, overfits less and can be plotted in two dimensions. Embeddings, which the generative AI article covers, are the deep-learning cousin: a learned low-dimensional representation of text or images.
Anomaly detection
Anomaly detection flags the examples that look nothing like the rest: a server whose latency pattern is unlike the fleet's, a transaction unlike any of the customer's previous ones, a machine whose vibration signature has changed. It is often unsupervised because anomalies are rare and unlabelled by nature; you have millions of normal readings and a handful of known failures. SageMaker's built-in Random Cut Forest algorithm and the Amazon Lookout family of services (Metrics, Equipment, Vision, in the next article) are built around this task.
| Regression | Classification | Clustering | |
|---|---|---|---|
| Learning type | Supervised | Supervised | Unsupervised |
| Output | A continuous number | One of a fixed set of classes (or a probability per class) | A group id the algorithm invented |
| Needs labels | Yes, numeric | Yes, categorical | No |
| Example problems | Sale price of a house; energy demand tomorrow; delivery time in minutes; how many units will sell | Is this email spam; will this customer churn; which animal is in the photo; which language is this text | Which customers behave alike; which support tickets belong together; which colours summarise this image |
| Typical algorithms | Linear regression, XGBoost, neural networks | Logistic regression, random forest, XGBoost, SVM, naive Bayes, CNNs | k-means, hierarchical clustering, DBSCAN |
| Judged by | MAE, RMSE, R squared | Accuracy, precision, recall, F1, AUC | Cluster tightness and separation, and whether the groups are useful |
- Retail customer segmentation is k-means over purchase frequency, basket size and recency; the marketing team then names the clusters ("weekend bulk buyers") after the fact.
- Amazon Lookout for Metrics learns the normal pattern of a business metric (orders per hour, sign-ups per region) and raises an alarm when a value falls outside it, with no labels needed.
- Amazon Comprehend topic modelling groups a corpus of documents into topics by the words they share, which is clustering on text.
- Amazon GuardDuty spots unusual API call patterns in an AWS account by comparing them with the account's own baseline, anomaly detection applied to security.
k-means finds exactly k round-ish groups whether or not the data has them. It also depends on feature scale: a column measured in thousands will dominate one measured in single digits unless the features are standardised first. Both are common causes of clusters that look fine and mean nothing.
"No labelled data", "discover natural groupings", "segment customers", "reduce the number of features" and "detect unusual behaviour without examples of it" all point at unsupervised learning. Pair the verb with the algorithm: group means k-means, reduce means PCA, unusual means anomaly detection (Random Cut Forest or a Lookout service).
- Clustering
- Grouping examples so that members of a group resemble each other more than they resemble other groups. No labels involved.
- Dimensionality reduction
- Replacing many features with fewer that keep most of the information. PCA is the linear version; embeddings are the learned version.
- Anomaly detection
- Finding the examples that do not fit the pattern of the rest. Usually unsupervised because the unusual cases are rare and unlabelled.
Reinforcement learning: learning by trial, error and reward
Reinforcement learning trains an agent to act in an environment by letting it try actions and rewarding the ones that lead to good outcomes; there are no labelled examples, only a score, and the agent has to discover for itself which sequence of actions earns the most of it.
The pieces have fixed names. The agent is the learner (a robot's controller, a game player, a bidding strategy). The environment is everything the agent acts on and observes (the warehouse floor, the game, the auction). At each step the agent sees a state, picks an action, and the environment returns a new state and a reward: a number, possibly zero, possibly negative. The agent's policy is its rule for choosing an action given a state, and training means improving the policy so the total reward over time goes up. Because the reward for a good move may arrive many steps later (the race is won at the finish line, not at the first corner), the agent has to learn which early actions deserve credit, which is what makes the problem hard.
flowchart TD A["Agent<br/>policy: state to action"] -->|"action"| E["Environment<br/>the track, the warehouse, the game"] E -->|"new state and reward"| A R["Reward function<br/>designed by you: stay on track, finish fast"] --> E
Two tensions run through every RL project. Exploration versus exploitation: the agent must sometimes try actions it has not tried, or it never finds the better strategy, but every experiment costs reward now. And reward design: the agent optimises exactly what you reward, not what you meant, so a car rewarded for speed learns to cut corners, and a robot rewarded for "objects in the bin" learns to drop them from a height. Because real trials are slow and can break hardware, most RL is trained in a simulator first and transferred to the real thing afterwards.
The cousins the exam mentions in passing
Semi-supervised learning uses a small labelled set plus a large unlabelled one: train on the labels, use the model to guess labels for the rest, retrain. It is the practical answer when labelling is expensive but raw data is not. Self-supervised learning makes labels out of the data itself, for example hide a word and predict it, or predict the next token; this is how large language models are pre-trained, and it is why they need no human labels for the bulk of their training. Reinforcement learning from human feedback (RLHF) combines RL with human preference ratings to steer an LLM's behaviour after pre-training; the article on customising foundation models covers it.
| Supervised | Unsupervised | Reinforcement | |
|---|---|---|---|
| Training signal | Labels: the right answer for each example | None; the structure of the data itself | Rewards: a score after actions, often delayed |
| What is learned | A mapping from features to label | Groups, compressed features, what is normal | A policy: which action to take in each state |
| Data | A fixed labelled dataset | A fixed unlabelled dataset | Generated by interacting with an environment or simulator |
| Hard part | Getting enough good labels | Judging whether the result is useful | Designing the reward, credit over long delays, exploration |
| Typical problems | Fraud, price, image labels, sentiment | Segmentation, anomaly detection, compression | Robotics, games, autonomous driving, resource scheduling |
| AWS touchpoints | SageMaker built-ins, Ground Truth, Rekognition Custom Labels | k-means, PCA, Random Cut Forest, Lookout services | AWS DeepRacer, SageMaker RL containers |
flowchart TD
S([A prediction problem]) --> L{Labels available?}
L -- Yes --> T{Target type?}
T -- "quantity" --> RG["Regression<br/>linear regression,<br/>XGBoost"]
T -- "category" --> CL["Classification<br/>logistic regression,<br/>random forest, CNN"]
L -- No --> G{Reward signal?}
G -- "yes" --> RL["Reinforcement<br/>agent, environment,<br/>reward, policy"]
G -- "data only" --> UN["Unsupervised<br/>k-means, PCA,<br/>Random Cut Forest"]
- AWS DeepRacer is a 1/18th-scale car whose driving policy is trained by reinforcement learning in a simulated track with a reward function you write (stay near the centre line, keep speed up); the trained model is then loaded onto the physical car.
- Amazon's fulfilment robots use reinforcement learning for tasks such as picking and packing items of unpredictable shape, where writing the control rules by hand is impractical and a simulator makes millions of trials cheap.
- Game-playing systems that beat human champions at Go and at video games were trained by self-play reinforcement learning: the environment was the game, the reward was winning.
- Data-centre cooling controllers have been trained by RL to adjust set-points for lower energy use, with the reward being power saved while temperatures stay in range.
Reinforcement learning is not "learning from feedback" in general. If the feedback is a correct label per example, that is supervised learning. RL is specifically an agent taking a sequence of actions and receiving rewards, with no one telling it the right action. A model that is retrained on newly labelled data every week is supervised, however much the scenario talks about "learning from outcomes".
The words agent, environment, action, reward and policy all appear together only in reinforcement learning, and any scenario about robots, games, autonomous vehicles or a simulator is RL. AWS DeepRacer is the exam's canonical RL example. "A small set of labelled data and a large set of unlabelled data" is semi-supervised.
- Policy
- The agent's decision rule: given the current state, which action to take. Training RL means improving the policy.
- Reward function
- The formula that scores each step or outcome. Written by the designer; the agent maximises it literally, so it must express what is actually wanted.
- Self-supervised learning
- Training where the labels are manufactured from the data itself (predict the hidden word, predict the next token), so huge unlabelled corpora become training data.
Fit: underfitting, overfitting and the bias-variance trade-off
A model fits well when it captures the real pattern in the data and nothing else; it underfits when it is too simple to capture the pattern, and overfits when it has also memorised the noise, so it scores brilliantly on the data it trained on and badly on anything new.
Underfitting is the easy one to spot: the model is poor even on its own training data. A straight line through data that curves, a tree with two splits for a problem that needs twenty, a network trained for one epoch. The cure is more capacity: a more flexible algorithm, more features, more training.
Overfitting is the one that bites. The model has enough capacity to fit every wiggle, including the wiggles that are just noise in this particular sample, so training error goes to nearly zero while the validation error stops improving and then rises. A decision tree grown until every leaf has one row, a network with millions of weights trained on a thousand images, a model that has learned that houses sold on Tuesdays are cheaper because three of them were. It generalises badly: the whole point of a model is to work on data it has not seen, and an overfit model does not.
The same idea has a statistician's name, the bias-variance trade-off. Bias here means systematic error from a model too simple for the truth (it is "biased" toward its own shape); variance means sensitivity to the particular training sample (retrain on a different sample of the same data and an overfit model gives very different answers). Simple models have high bias and low variance; flexible models have low bias and high variance. Total error is the sum of both plus irreducible noise, and it is lowest somewhere in the middle. Finding that middle is what the validation set is for.
| Underfitting | Good fit | Overfitting | |
|---|---|---|---|
| Training error | High | Low | Very low, near zero |
| Validation error | High, close to training error | Low, close to training error | Much higher than training error |
| Bias / variance | High bias, low variance | Balanced | Low bias, high variance |
| What it looks like | A line through a curve | A smooth curve through the trend | A wiggle through every single point |
| Fix | More capacity: a richer model, more features, train longer, less regularisation | Ship it, then monitor for drift | More data, regularisation, early stopping, dropout, simpler model, fewer features, cross-validation to choose settings |
flowchart TD
S([Model trained]) --> A{Training poor?}
A -- Yes --> U["Underfitting<br/>high bias: add capacity, features, epochs"]
A -- No --> B{Validation gap?}
B -- "large" --> O["Overfitting<br/>high variance: more data, regularise, stop early, simplify"]
B -- "small" --> G["Good fit<br/>confirm once on the test set, then deploy"]
The toolbox against overfitting
- More training data. The only fix that attacks the cause; noise averages out when there is more signal.
- Regularisation. Add a penalty to the loss for large weights (L1 pushes some weights to exactly zero, L2 shrinks them all), so the model cannot fit every wiggle.
- Early stopping. Watch the validation loss each epoch and stop when it starts rising, even if training loss is still falling.
- Dropout. In neural networks, randomly switch off a fraction of neurons on each training step so no single path can memorise.
- Simplify. Shallower trees, fewer features, a smaller network.
- Cross-validation. Split the training data into k folds, train k times each holding out one fold, and average; it gives a more honest estimate for choosing hyperparameters when data is scarce.
- Data augmentation. For images and audio, make new training examples by flipping, cropping, rotating or adding noise to existing ones.
- SageMaker Automatic Model Tuning runs many training jobs with different hyperparameters and picks the one with the best validation metric, which is the bias-variance search automated.
- SageMaker Debugger ships built-in rules such as
overfitandovertrainingthat watch training and validation loss during a job and can stop it early. - Kaggle competitions keep a hidden test set precisely because models tuned against the public leaderboard overfit to it; the final ranking uses data nobody saw.
Very high accuracy on the training set is not good news on its own; it is a warning until the validation number is beside it. And tuning hyperparameters against the test set turns the test set into a second validation set, so the final reported number is no longer honest. The test set is opened once.
"Performs well on training data but poorly on new data" is overfitting, every time; the fixes offered will be more data, regularisation, early stopping, dropout or a simpler model. "Performs poorly on both" is underfitting; add capacity. Watch for "bias" and "variance" used in this sense: high variance is overfitting, high bias is underfitting.
- Generalisation
- How well a model performs on data it did not train on. The only performance that matters in production.
- Regularisation
- Any technique that penalises model complexity during training to reduce overfitting: L1 and L2 weight penalties, dropout, early stopping.
- Cross-validation
- Training and validating k times on different splits of the same data and averaging the results, to get a stable estimate of generalisation.
Bias and fairness: when the data, not the code, is the problem
In the responsible-AI sense, bias is a systematic slant in the data or the model that makes it treat some groups or cases worse than others, and fairness is the goal of predictions that do not depend on attributes that should not matter; both are properties of the data and of how the model is used, and neither is fixed by better code alone.
Bias gets into a model through the data at several doors. Sampling bias: the training data does not represent the population the model will meet (a face dataset mostly of one skin tone, a speech corpus mostly of one accent). Measurement bias: the feature or label measures the wrong thing (using arrests as a label for crime, or past loan approvals as a label for "creditworthy"). Historical bias: the data faithfully records a world that was itself unfair, and the model learns to reproduce it. Label bias: the people who labelled the data brought their own assumptions. Class imbalance: one outcome is rare, so the model barely learns it (fraud is a fraction of a percent of transactions; a model that always says "not fraud" is 99.9 percent accurate and useless).
Fairness asks whether the model's behaviour differs across groups defined by a sensitive attribute (age, gender, ethnicity, postcode as a proxy for either). There is no single definition: one version asks for equal approval rates across groups, another for equal error rates, another that the decision not change if only the sensitive attribute changed, and they can conflict with each other. What the exam expects is that you know the questions, know that they must be measured before and after training, and know the AWS tools. Amazon SageMaker Clarify computes bias metrics on the training data (pre-training, for example class imbalance and difference in proportions of labels) and on predictions (post-training), and produces feature-importance explanations of why a model decided what it did; Amazon A2I routes low-confidence or high-stakes predictions to human reviewers; SageMaker Model Monitor watches for bias drift after deployment. The responsible AI article is the full treatment.
- Face analysis systems from several vendors were shown to have far higher error rates on darker-skinned women than on lighter-skinned men, traced to unrepresentative training sets; the fix was data, not architecture.
- A CV-screening model at a large company was abandoned after it learned to penalise applications that mentioned women's colleges, because its labels were a decade of past decisions.
- Credit scoring models are legally required in many countries to avoid proxies for protected attributes and to give reasons for a refusal, which is the business case for SageMaker Clarify's explanations.
Removing the sensitive column from the features does not remove the bias. Postcode, name, purchase history and a hundred other features encode it. Fairness is measured on outcomes across groups, not on the presence or absence of a column.
"The model performs worse for one demographic group" is a bias problem, and the answer involves more representative data plus measuring with SageMaker Clarify, not a different algorithm. "Human review of low-confidence predictions" is Amazon A2I. "Ensure the training data is balanced" and "detect bias before training" both point at Clarify's pre-training metrics.
- Sampling bias
- Training data that does not represent the population the model will serve, so the model is accurate for some groups and not others.
- Class imbalance
- One label being far rarer than another, so accuracy is misleading and the rare class is under-learned. Countered by resampling, class weights and better metrics.
- Fairness
- The property that a model's predictions or errors do not differ across groups in ways that are unjustified. Several formal definitions exist and they can conflict.
Computer vision and natural language processing: where deep learning earns its keep
Computer vision is the field of getting machines to understand images and video, and natural language processing is the field of getting them to understand and produce human language; both were transformed by deep learning because their raw inputs, pixels and words, are exactly the kind of unstructured data where learned features beat hand-made ones.
Computer vision
The tasks stack up in difficulty. Image classification says what is in the picture (one label per image). Object detection says what and where, drawing a bounding box around each object. Semantic segmentation labels every pixel. Face detection and recognition find faces and match them to identities. Optical character recognition (OCR) reads text out of images. Video analysis does any of these frame by frame and tracks objects across frames. The algorithm behind almost all of it is the convolutional neural network (CNN): small learned filters slide over the image and respond to edges, then combinations of edges, then parts, then whole objects, with pooling layers shrinking the picture as it goes so the later layers see the whole scene. On AWS, Amazon Rekognition does the common tasks as an API, Amazon Textract does OCR plus document structure, and Amazon Lookout for Vision spots defects; the next article covers each.
Natural language processing
NLP covers understanding and generating text. The common tasks are sentiment analysis (is this review positive), named entity recognition (find the people, places, dates, products), key phrase extraction, language detection, topic modelling, text classification, translation, summarisation, question answering and text generation. The first step is always tokenisation, chopping the text into tokens (words or pieces of words), and the second is turning each token into a vector of numbers, an embedding, so that a network can compute on it. For a decade the sequence models were recurrent neural networks (RNNs) and their longer-memory variant LSTM (long short-term memory), which read text one token at a time carrying a hidden state forward. Since 2017 the transformer, which reads all the tokens at once and lets each attend to every other, has replaced them, and scaled-up transformers are the large language models of the next section. Amazon Comprehend does the classic NLP tasks as an API; Amazon Translate translates; Amazon Bedrock serves the generative side.
Speech
Speech sits between the two. Automatic speech recognition (ASR), speech to text, turns audio into a sequence of tokens; text to speech (TTS) does the reverse. Both are sequence-to-sequence deep learning problems and both are APIs on AWS: Amazon Transcribe and Amazon Polly.
flowchart TD I["Image<br/>pixels"] --> C["Convolutional layers<br/>edges, textures, parts"] --> O["Classifier or detector<br/>label, boxes, masks, text"] T["Text<br/>characters"] --> K["Tokenise<br/>words or word pieces"] --> E["Embed<br/>one vector per token"] --> M["Sequence model<br/>LSTM or transformer"] --> N["Output<br/>sentiment, entities, translation, next token"]
- Amazon Go shops are object detection and tracking over dozens of ceiling cameras, fused with shelf weight sensors, so a customer can pick up an item and walk out.
- Amazon Rekognition is CNN-based classification, detection, face matching, text-in-image and content moderation behind one API; Amazon Textract is OCR that also understands forms and tables.
- Amazon Comprehend returns entities, key phrases, sentiment, language and PII from text; Alexa chains speech recognition into natural language understanding to turn "set a timer for ten minutes" into an intent and a slot.
- Google Translate switched from phrase-based statistical translation to a neural sequence model in 2016 and quality jumped overnight, the moment deep learning took NLP.
Match the data to the field: images and video mean computer vision (Rekognition, Textract for documents, Lookout for Vision for defects); text means NLP (Comprehend, Translate, Bedrock); audio means speech (Transcribe in, Polly out). The exam names CNNs for images and RNNs or transformers for sequences; it does not ask you to design one.
- Convolutional neural network
- A network whose early layers slide small learned filters across the image, so the same feature detector works anywhere in the picture. The standard architecture for vision.
- Tokenisation
- Splitting text into the units a model reads: words, sub-words or characters. Model prices and limits are quoted in tokens.
- Recurrent neural network
- A network that processes a sequence one step at a time while carrying a hidden state forward. LSTM is the variant that remembers over longer spans. Largely replaced by transformers.
Large language models: the deep learning that now dominates the exam
A large language model is a transformer neural network with billions of parameters, trained by self-supervision on a huge body of text to predict the next token, which turns out to teach it grammar, facts, styles and reasoning patterns well enough to answer questions, write, summarise, translate and code from a plain-language prompt.
The word large is literal: parameter counts run from a few billion to well over a trillion, and training data is measured in trillions of tokens. The word language is becoming loose: many current models are multimodal, taking images, audio or video as input alongside text. The training is self-supervised in the sense of the reinforcement learning section: the label is simply the next token in real text, so no human labels the corpus. After that pre-training, a much smaller round of supervised fine-tuning on example conversations and RLHF on human preferences turns a text predictor into a helpful assistant.
An LLM is a foundation model: trained once at enormous cost, then reused for thousands of tasks by changing the prompt, adding context (retrieval-augmented generation) or fine-tuning, rather than training a new model per task. That reuse is the economic fact behind Amazon Bedrock. The limits are as important as the powers for the exam: an LLM can hallucinate (state a plausible falsehood with confidence), knows nothing after its training cut-off, is non-deterministic unless told otherwise, costs money per token in and out, and carries whatever bias its training text carried. Tokens, embeddings, attention, context windows and the rest are the subject of the fifth article in this series.
- Amazon Bedrock offers LLMs from several providers (Amazon Nova, Anthropic Claude, Meta Llama, Mistral and others) as a single API with no servers to run.
- Amazon Q is an LLM assistant in two flavours: Q Business answers questions over a company's own documents, Q Developer helps write and understand code in the IDE and the AWS console.
- Amazon SageMaker JumpStart lets you deploy open-weight LLMs on your own endpoints when you need control over the weights and the hardware.
An LLM does not look things up; it predicts text. If a scenario needs answers grounded in current or private documents, the fix is to give the model those documents at query time (retrieval-augmented generation, in the applications article), not to trust the model's memory and not, usually, to retrain it.
Know the definition (transformer, billions of parameters, trained on vast text, predicts the next token, a foundation model) and the failure modes (hallucination, cut-off, bias, cost per token). When a scenario needs generated text, a summary, a chatbot or code, the classical ML options are distractors and the answer lives in Bedrock or Amazon Q.
- Large language model
- A very large transformer trained to predict the next token on vast amounts of text, usable for many language tasks through prompting.
- Hallucination
- Fluent, confident output that is false. A property of predicting likely text rather than retrieving facts.
- Multimodal
- A model that accepts or produces more than one kind of data: text and images, or text and audio.
Types of inferencing: batch, real-time and the variants in between
Batch inference runs a trained model over a whole dataset at once, on a schedule, with no one waiting for any single answer; real-time inference keeps the model loaded behind an endpoint and answers each request in milliseconds; the choice is set by who is waiting, how big the payload is and how steady the traffic is.
Real-time inference is a model behind an API. A request arrives, the model runs, the answer goes back, typically in tens to hundreds of milliseconds. It is the only option when a person or a system is waiting: a fraud check while the card is at the till, a product recommendation while the page loads, a chatbot turn. The cost is that the compute is always on: you pay for the instances behind the endpoint whether traffic is heavy or zero, and you must size and scale them.
Batch inference collects the inputs, runs the model over all of them in one job, and writes the results somewhere. Nobody waits for an individual answer; the job takes minutes or hours. It fits nightly risk scores for every account, weekly demand forecasts for every store, tagging a backlog of ten million images. It is the cheapest per prediction because the hardware runs flat out and is released when the job ends, and it is the simplest to operate because there is no endpoint to keep alive.
Two SageMaker variants fill the gap. Asynchronous inference keeps an endpoint but queues each request and notifies you when the result lands in S3, for large payloads (up to about a gigabyte) and long processing times (up to about an hour) that a synchronous call cannot wait for; it also scales the instance count to zero when the queue is empty. Serverless inference gives a real-time endpoint with no instances to manage: it scales to zero between requests and you pay per millisecond of compute, at the price of a cold start when traffic resumes and limits on payload size and duration, so it suits spiky or infrequent traffic that still needs a synchronous answer. Amazon Bedrock offers the same split for foundation models: on-demand and provisioned throughput for real-time calls, and batch inference that processes a file of prompts asynchronously at a discount.
A fifth place to run inference is the edge: on the device itself, for latency, privacy or lack of connectivity. SageMaker Neo compiles a model for a specific target chip and AWS IoT Greengrass runs it there; the lifecycle article covers both.
| Real-time | Serverless | Asynchronous | Batch | |
|---|---|---|---|---|
| Who waits | A user or a synchronous caller | A synchronous caller who can tolerate a cold start | Nobody; a notification arrives when the result is in S3 | Nobody; results appear when the job ends |
| Latency | Milliseconds | Milliseconds once warm, seconds on a cold start | Seconds to about an hour | Minutes to hours for the whole set |
| Payload | Small, a few megabytes | Small | Large, up to about a gigabyte | Whole datasets in S3 |
| Traffic pattern | Steady, predictable | Spiky, intermittent, low volume | Bursty with big items | Periodic, scheduled |
| Cost shape | Instances running all the time | Pay per invocation and compute time, zero when idle | Instances scale to zero when the queue is empty | Pay only while the job runs; cheapest per prediction |
| SageMaker feature | Real-time endpoint | Serverless Inference | Asynchronous Inference | Batch Transform |
| Exam keywords | "immediately", "interactive", "low latency" | "intermittent traffic", "no infrastructure", "scales to zero" | "large payload", "long processing time", "queue" | "overnight", "entire dataset", "lowest cost", "no need for immediate results" |
flowchart TD U["User at the checkout"] -->|"one request"| EP["Real-time endpoint<br/>model loaded, instances always on"] EP -->|"answer in milliseconds"| U S3i["S3 bucket<br/>a million rows to score"] -->|"nightly job"| BT["Batch transform<br/>instances start, run, stop"] BT -->|"results file"| S3o["S3 bucket<br/>scores for every row"]
- Card fraud scoring is real-time by necessity: the decision must come back before the terminal times out, so the model sits behind an always-on endpoint.
- Netflix's recommendation rows are largely precomputed in batch and stored per member, then a lighter real-time layer re-ranks them when the app opens.
- Amazon Bedrock batch inference takes a file of prompts in S3 and returns a file of completions, for classifying or summarising a backlog of documents at a lower price than on-demand calls.
- SageMaker Asynchronous Inference is the fit for scoring a whole uploaded video or a large medical image, where one request carries hundreds of megabytes and takes minutes.
Real-time is not automatically better. If nobody is waiting for the answer, an always-on endpoint is money spent on idle instances. The exam rewards matching the cheapest option that still meets the latency need, and "results are needed the next morning" is a batch problem however important the results are.
Read for who is waiting and how often. Immediate answers to users mean real-time; a nightly run over everything means batch transform; intermittent traffic with no servers to manage means serverless; a large payload or a long-running request with a notification means asynchronous. "Lowest cost" with no latency requirement is batch.
- Endpoint
- A hosted, always-available URL with a model behind it. In SageMaker, a real-time endpoint runs on instances you choose; a serverless one runs on capacity AWS manages.
- Batch transform
- SageMaker's batch inference job: read inputs from S3, run the model on temporary instances, write outputs to S3, release the instances.
- Cold start
- The delay when a serverless endpoint receives a request after being idle and must load the model before answering.
Types of data: the shape of the input decides the model
Data for AI comes in a handful of shapes, and each shape has its natural algorithms, its storage on AWS and its own labelling cost; the two questions to ask of any dataset are whether it is labelled and whether it is structured.
Labelled versus unlabelled is the supervised-or-not question already covered: labelled data carries the answer for each example, unlabelled does not. Most raw data in a company is unlabelled; labelling it is a project (SageMaker Ground Truth exists for this), which is why unsupervised and self-supervised methods are attractive.
Structured data is rows and columns with a fixed schema: a relational table, a CSV, a Parquet file in a data lake. Every row is the same shape and every column has a type. It is what classical ML eats, it is easy to query, and it is where most business prediction problems live. Unstructured data has no fixed schema and cannot be dropped into a table without processing: images, video, audio, free text, PDFs. It is the bulk of the world's data by volume and it is deep learning's territory. Semi-structured data sits between: JSON, XML and log lines have structure (keys, nesting, tags) but not a fixed set of columns; it is parsed into structured features or fed to models that handle text.
The shapes by name
| Type | What it is | Structured? | Typical models | Where it lives on AWS | Examples |
|---|---|---|---|---|---|
| Tabular | Rows and typed columns | Structured | Linear and logistic regression, trees, XGBoost, k-means | Amazon S3 (CSV, Parquet), Amazon Redshift, Amazon RDS, Amazon Athena queries | Customer records, transactions, sensor summaries |
| Time series | Values with timestamps, order matters | Structured | ARIMA, Prophet-style models, DeepAR, LSTM, transformers | Amazon Timestream, Amazon Kinesis, S3 | Sales per day, CPU per minute, stock prices, vibration readings |
| Image and video | Grids of pixels, frames over time | Unstructured | CNNs, vision transformers | Amazon S3 | Product photos, camera feeds, X-rays, satellite tiles |
| Text | Sequences of characters or tokens | Unstructured | Naive Bayes, LSTM, transformers and LLMs | Amazon S3, Amazon OpenSearch Service, Amazon Kendra indexes | Reviews, tickets, contracts, emails, web pages |
| Audio | Sampled sound waves | Unstructured | Speech recognition networks, audio transformers | Amazon S3, streamed to Amazon Transcribe | Call recordings, voice commands, podcasts |
| Semi-structured | Nested keys and values without a fixed schema | Semi-structured | Parsed into tabular features, or treated as text | Amazon DynamoDB, Amazon S3 (JSON lines), Amazon CloudWatch Logs | JSON events, API logs, XML feeds, clickstreams |
Time series deserves a note because the exam treats forecasting as its own problem. The rows are ordered, the next value depends on the previous ones, and the usual random shuffling into train and test would leak the future into the past; you split by time instead. Seasonality (weekly, yearly), trend and holidays are the features that matter, and Amazon Forecast (no longer taking new customers, but still on the exam) and SageMaker's built-in DeepAR algorithm were built for it.
- Amazon.com holds all six: tabular order histories, time-series demand per product, product images, review text, Alexa audio, and JSON clickstreams from every page view, and uses a different family of models for each.
- Hospital imaging is unstructured image data with expensive labels: each scan needs a radiologist's annotation, which is why medical vision projects start with pre-trained models and few labels.
- Amazon S3 is where nearly every AWS ML pipeline reads its data from and writes its results to, whatever the shape; SageMaker training channels, Batch Transform and Bedrock batch inference all speak S3.
Time series are not shuffled. A random 80/20 split of daily sales puts future days in the training set and the model learns to "predict" what it has already seen. Split by date, train on the past, validate on the more recent past, and test on the most recent.
The exam pairs data type with technique and service: tabular means classical ML or SageMaker built-ins; time series means forecasting (Forecast, DeepAR); images mean CNNs and Rekognition; text means NLP and Comprehend or Bedrock; audio means Transcribe or Polly. "Unstructured" plus "no ML expertise" is nearly always a managed AI service.
- Structured data
- Data with a fixed schema of typed columns: tables, CSV, Parquet. Query it with SQL, model it with classical ML.
- Unstructured data
- Data without a fixed schema: images, video, audio, free text. Needs deep learning or a managed AI service to turn into features.
- Semi-structured data
- Data with tags or keys but no fixed columns: JSON, XML, logs. Parsed into structured features before classical modelling.
- Time series
- Observations ordered by time where the past predicts the future. Split by time, never shuffled; forecast with DeepAR, ARIMA or a sequence model.
Recap
- AI is the goal, ML the method that learns from data, deep learning the ML that uses many-layer neural networks, generative AI the deep learning that produces content. Each is a subset of the one before.
- An algorithm is the recipe; a model is the recipe's output, learned parameters saved as an artifact. Training fits the parameters once, expensively; inference uses the model on new inputs, cheaply and constantly. Hyperparameters are set before training, not learned.
- A neural network is neurons in layers: weighted sum, plus a bias term, through an activation function. Backpropagation computes each weight's share of the error; gradient descent moves the weights against it; the learning rate sets the step; one pass over the data is an epoch.
- Supervised learning needs labels. Regression predicts a number (linear regression, XGBoost); classification predicts a category (logistic regression, random forest, SVM, naive Bayes, CNNs). Logistic regression is a classifier.
- Unsupervised learning needs no labels: k-means clusters, PCA reduces dimensions, Random Cut Forest and the Lookout services detect anomalies.
- Reinforcement learning is an agent, an environment, states, actions, a reward and a policy; AWS DeepRacer is the canonical example. Semi-supervised uses few labels plus many unlabelled rows; self-supervised makes labels from the data, which is how LLMs are pre-trained.
- Underfitting is high bias: bad on training and validation data. Overfitting is high variance: great on training, bad on validation. Fix overfitting with more data, regularisation, early stopping, dropout, a simpler model and cross-validation. The test set is opened once.
- Bias in the responsible-AI sense enters through sampling, measurement, history, labels and class imbalance; fairness is measured across groups. SageMaker Clarify measures it, A2I adds human review, Model Monitor watches for drift.
- Computer vision (classification, detection, segmentation, OCR) runs on CNNs; NLP (sentiment, entities, translation, generation) runs on tokens, embeddings and sequence models, now transformers; speech is sequence-to-sequence in both directions.
- A large language model is a transformer with billions of parameters trained to predict the next token; it is a foundation model reused through prompts, RAG and fine-tuning, and it can hallucinate, has a cut-off, and costs per token.
- Real-time inference answers one request in milliseconds from an always-on endpoint; batch scores a whole dataset in a job at the lowest cost per prediction; serverless scales to zero for spiky traffic; asynchronous queues large or slow requests. Edge runs on the device.
- Data is labelled or not, and structured (tabular, time series), semi-structured (JSON, logs) or unstructured (image, text, audio). The shape picks the model family and the AWS service; time series are split by date, never shuffled.
Questions
Try answering each one out loud before opening it. Lead with the one-line answer, then the reasoning, then one detail that shows you have used it.
How do AI, machine learning and deep learning relate to each other?
They nest: deep learning is a subset of machine learning, which is a subset of artificial intelligence, and generative AI is a subset of deep learning.
- AI is any technique that makes a machine behave intelligently, including hand-written rules and search with no learning at all.
- ML learns a model from data instead of having the rules written; DL does that with many-layer neural networks that learn their own features.
- The containment is one-way: every deep learning model is ML, but a random forest is ML without a neural network, and a chess engine is AI without learning.
The practical dividing line is the data: tabular rows suit classical ML, while raw pixels, audio and text are where deep learning earns its extra cost.
What is the difference between an algorithm and a model, and between training and inference?
The algorithm is the learning procedure, the model is what that procedure produces from a dataset, training is running the procedure, and inference is using the finished model on new inputs.
- The same algorithm (XGBoost) on two datasets gives two different models; the model is the learned parameters plus the architecture, saved as an artifact.
- Training is rare, expensive and needs the whole dataset, often on GPUs; inference is per request, cheap per call and runs constantly.
- Hyperparameters are chosen before training (learning rate, tree depth); parameters are what training learns (weights).
On SageMaker the algorithm is a container image, a training job writes model.tar.gz to S3, and an endpoint or Batch Transform job loads that artifact for inference.
Explain in plain words how a neural network learns its weights.
It makes predictions on a batch, measures how wrong they were with a loss function, uses backpropagation to work out how much each weight contributed to the error, and moves every weight a small step in the direction that reduces the loss; then it repeats for the next batch.
- A neuron computes a weighted sum of its inputs plus a bias and passes it through an activation function such as ReLU; layers of neurons stack input to output.
- Backpropagation passes the error backwards layer by layer to compute each weight's gradient; gradient descent applies the update, scaled by the learning rate.
- One pass over all the training data is an epoch; training runs until the validation loss stops improving.
A learning rate that is too high shows up as a loss that oscillates and never settles; too low and training crawls, which is why it is the first hyperparameter anyone tunes.
A retailer has five years of daily sales per store and wants to predict next month's sales. What type of learning and problem is this?
Supervised learning, specifically regression on time-series data, because the historical sales are the labels and the target is a continuous number.
- Labels exist (each past day's sales), so it is supervised; the answer is a quantity, so it is regression rather than classification.
- Because the rows are ordered in time, the split must be by date, not a random shuffle, or future values leak into training.
- Seasonality, trend and holidays are the features that matter; DeepAR on SageMaker or Amazon Forecast (still on the exam) were built for this shape.
If the question instead asked "will sales exceed the target, yes or no" the same data would become a binary classification problem.
What is the difference between regression and classification, and which is logistic regression?
Regression predicts a continuous number, classification predicts one of a fixed set of classes, and logistic regression, despite its name, is a classification algorithm.
- Regression: house price, demand, temperature; judged by MAE or RMSE.
- Classification: spam or not (binary), which digit (multi-class), which tags apply (multi-label); judged by accuracy, precision, recall, F1 and AUC.
- Logistic regression fits a linear score and pushes it through a sigmoid to give a probability, then a threshold turns the probability into a class.
Moving the threshold trades precision against recall, which is why a fraud model and a spam model with the same architecture are tuned to very different cut-offs.
A company has millions of customer records and no labels, and wants to group customers with similar behaviour. Which approach fits?
Unsupervised learning, specifically clustering with an algorithm such as k-means.
- "No labels" rules out every supervised option; "group similar" is the definition of clustering.
- k-means places k centres, assigns each customer to the nearest, moves the centres and repeats; you choose k, often with the elbow method.
- Features should be standardised first, or the column with the largest numbers dominates the distance.
k-means is a SageMaker built-in algorithm, and the marketing team usually names the clusters after the fact by looking at what each group buys.
What are the components of reinforcement learning, and what AWS example does the exam use?
An agent takes actions in an environment, observes the new state and a reward, and learns a policy that maps states to actions so as to maximise total reward; AWS DeepRacer is the exam's example.
- There are no labelled examples, only a reward signal that may arrive many steps after the action that earned it.
- The reward function is written by the designer, and the agent optimises it literally, so a poorly designed reward produces surprising behaviour.
- Training usually happens in a simulator because real trials are slow and can damage hardware; exploration versus exploitation is the central tension.
DeepRacer's reward function is Python you write yourself (reward staying near the centre line, penalise leaving the track), and the trained policy is downloaded to a 1/18th-scale car.
What distinguishes supervised, unsupervised and reinforcement learning in one line each?
Supervised learns from examples with the right answer attached, unsupervised finds structure in examples with no answers, and reinforcement learns which actions earn the most reward by trying them.
- Supervised: regression and classification; the hard part is getting labels.
- Unsupervised: clustering, dimensionality reduction, anomaly detection; the hard part is judging whether the result is useful.
- Reinforcement: agent, environment, state, action, reward, policy; the hard part is reward design and delayed credit.
Semi-supervised sits between the first two (few labels, many unlabelled rows), and self-supervised manufactures labels from the data itself, which is how large language models are pre-trained.
A model reaches 99 percent accuracy on its training data but 70 percent on new data. What is happening and what are the fixes?
The model is overfitting: it has memorised the training set, including its noise, and does not generalise.
- The signature is a large gap between training and validation performance; this is the high-variance end of the bias-variance trade-off.
- Fixes: more training data, regularisation (L1, L2), early stopping, dropout for neural networks, a simpler model or fewer features, and cross-validation to choose hyperparameters honestly.
- The opposite pattern, poor on both, is underfitting (high bias), fixed by adding capacity.
SageMaker Debugger has a built-in rule that watches training and validation loss and can stop a job as soon as the gap starts to open.
Explain the bias-variance trade-off.
Bias is error from a model too simple to capture the truth; variance is error from a model so flexible that it changes with every training sample; making a model more flexible lowers bias and raises variance, and the best model sits where the total is lowest.
- High bias shows as underfitting: poor on training and validation data alike.
- High variance shows as overfitting: excellent on training data, poor on validation data.
- The validation set is how you find the balance; hyperparameter tuning is the search along the curve.
Ensembles such as random forests reduce variance by averaging many high-variance trees, which is why they generalise better than any single deep tree.
Two different things in this exam are called "bias". What are they?
In a neural network, the bias is a learned constant added to a neuron's weighted sum; in responsible AI, bias is a systematic slant in the data or predictions that treats some groups worse than others.
- The neuron bias is arithmetic, one parameter per neuron, learned by training like any weight.
- The fairness kind enters through sampling, measurement, historical data, labelling and class imbalance.
- There is a third use in "bias-variance", where bias means the error of a model too simple for the data.
SageMaker Clarify measures the fairness kind with pre-training metrics such as class imbalance and difference in proportions of labels, and post-training metrics on the predictions.
A loan model approves applicants from one region far less often than others with similar finances. What kind of problem is this and what would you do?
It is a fairness problem caused by bias in the training data or its proxies, and the response is to measure the disparity, fix the data, and add explanations and human review, not to switch algorithms.
- Removing the region column is not enough; postcode, employer and other features encode it.
- Use SageMaker Clarify to compute bias metrics before and after training and to explain which features drive each decision.
- Rebalance or collect more representative data, and route borderline decisions to human reviewers with Amazon A2I.
After deployment, SageMaker Model Monitor can watch for bias drift so the disparity does not creep back as the applicant mix changes.
Which neural network architectures go with images, with sequences, and with modern language models?
Convolutional neural networks for images, recurrent networks and LSTMs for sequences, and transformers for modern language (and increasingly vision) models.
- CNNs slide learned filters across the image, so a feature detector works anywhere in the frame, and pool to see the whole scene.
- RNNs and LSTMs read a sequence one step at a time carrying a hidden state; LSTMs remember over longer spans.
- Transformers read all tokens at once and let each attend to every other, which parallelises on GPUs and scales to billions of parameters.
Amazon Rekognition is CNN territory, while every model on Amazon Bedrock is a transformer.
What is a large language model, and what are its main limitations?
A transformer with billions of parameters, trained by self-supervision on vast text to predict the next token, that can answer, write, summarise, translate and code from a prompt; its limits are hallucination, a knowledge cut-off, non-determinism, bias from its training data and cost per token.
- It is a foundation model: trained once, reused for many tasks through prompting, retrieval-augmented generation or fine-tuning.
- Pre-training needs no human labels because the label is the next word in real text; fine-tuning and RLHF then shape its behaviour.
- It predicts plausible text rather than looking facts up, which is why grounding it with your own documents matters.
On AWS the same model is reachable through Amazon Bedrock as an API, or deployed on your own SageMaker endpoint through JumpStart when you need the weights.
A company must score every customer account for churn risk each night and store the scores in a database. Which inference type fits, and why?
Batch inference, on SageMaker a Batch Transform job, because nobody is waiting for an individual answer and the whole dataset is scored at once.
- Batch reads inputs from S3, runs on temporary instances, writes results back and releases the hardware, so it is the cheapest per prediction.
- A real-time endpoint would sit idle 23 hours a day; the exam treats that as the wrong cost choice when latency does not matter.
- Keywords: "overnight", "entire dataset", "results needed by morning", "lowest cost".
If the same scores were needed the moment a customer opened a support chat, that would be a real-time endpoint, and if traffic were rare and spiky, Serverless Inference.
When would you choose SageMaker Asynchronous Inference or Serverless Inference over a standard real-time endpoint?
Asynchronous Inference for large payloads or long-running requests where the caller can be notified later, and Serverless Inference for intermittent or unpredictable traffic where you want no instances to manage and are willing to accept a cold start.
- Asynchronous queues each request, handles payloads up to about a gigabyte and processing up to about an hour, writes the result to S3 and can scale to zero when the queue is empty.
- Serverless bills per invocation and compute time, scales to zero between calls, and has limits on payload size and duration.
- A standard real-time endpoint is for steady traffic and strict millisecond latency, at the cost of always-on instances.
Scoring an uploaded video is a classic asynchronous case; a demo chatbot used a few times an hour is a classic serverless one.
Classify these as structured, semi-structured or unstructured: a CSV of orders, product photos, JSON click events, call recordings, and a Parquet table of sensor readings per minute.
The CSV and the Parquet table are structured (the Parquet table is also a time series), the JSON events are semi-structured, and the photos and call recordings are unstructured.
- Structured data has a fixed schema of typed columns and suits classical ML: XGBoost, linear models, k-means.
- Semi-structured data has keys and nesting but no fixed columns; it is parsed into features or treated as text.
- Unstructured data (image, audio, free text) needs deep learning or a managed AI service such as Rekognition or Transcribe.
The sensor table must be split by time rather than shuffled, or the model will be validated on data that came before its training rows.