- Foundation
- About 15 min
- 5 practice questions
How AI works at a glance: data, algorithms, models, training and inference
Describe the parts of an AI system - data, algorithm and model - explain the difference between training and inference, and compare rules-based systems with learning systems.
If something looks wrong, please tell us.
You do not need to code to understand how AI works. A handful of words - data, algorithm, model, training and inference - explain almost every AI system, from a spam filter to a chatbot. These words appear often in questions, so learn exactly what each one means.
The building blocks
| Term | Plain meaning | Exam-preparation comparison |
|---|---|---|
| Data / dataset | The examples the system learns from - numbers, text, images, sounds | Previous papers and practice questions |
| Algorithm | The step-by-step method used to learn from the data | Your study method |
| Model | What the algorithm produces after learning: the stored patterns used to make predictions | The knowledge in your head after studying |
| Training | The stage in which the model learns patterns from data | The months of preparation |
| Inference | Using the trained model on new input to produce an answer | Writing the exam on new questions |
Notice that the model and the algorithm are not the same thing. The algorithm is the recipe for learning; the model is the result of following that recipe on a particular dataset. The same algorithm trained on different data gives different models.
From data to a model
- Data The examples the system learns from.
- Algorithm The step-by-step method used to learn from the data.
- Training The model learns patterns from the data.
- Model The stored patterns used to make predictions.
Training versus inference
Training happens first, usually once or now and then, and needs a lot of data and computing power. Inference happens every time someone uses the system, for example each time you unlock your phone with your face. Training is like years of medical college; inference is the doctor seeing one patient. A model that is not retrained keeps the patterns it learned, so its knowledge can go out of date.
Training vs inference
-
Training
- Happens first, usually once or now and then
- Needs a lot of data and computing power
- Like years of medical college
-
Inference
- Happens every time someone uses the system
- Example: each time you unlock your phone with your face
- Like the doctor seeing one patient
Steps in building a learning AI system
- Define the task, for example 'sort mangoes into ripe and unripe'.
- Collect data - many examples related to the task.
- Clean and label the data - remove errors and mark the right answer for each example.
- Choose an algorithm suited to the task.
- Train the model on most of the data.
- Test the model on data it has never seen, to check that it really learned and did not just memorise.
- Deploy it so people can use it (inference), then monitor it and retrain when needed.
Rules-based systems versus learning systems
| Feature | Rules-based system | Learning system |
|---|---|---|
| Source of knowledge | Rules written by people | Patterns learned from data |
| Needs large data? | No | Yes |
| Easy to explain its decision? | Yes - you can read the rule | Often hard - patterns are spread across the model |
| Handles messy, varied input | Poorly | Well, if trained on similar examples |
| Example | Expert system, fixed fraud rule 'block payments above a set limit' | Face recognition, speech recognition, recommendations |
Neither is always better. Rules suit clear, stable tasks where every decision must be explained; learning suits tasks such as recognising faces, where nobody can write down all the rules.
Worked example 1: a mango-sorting machine
- Data: thousands of photos of mangoes, each labelled 'ripe' or 'unripe' by experienced sorters.
- Algorithm: a learning method suited to images.
- Training: the system adjusts itself until it links colour, texture and shape to the labels.
- Testing: on photos it never saw, it labels most mangoes the way the sorters would.
- Inference: at the packing house, a camera photographs each new mango and the model says ripe or unripe in a fraction of a second.
Worked example 2: predicting a flat's price
Suppose a model is trained on past sales in one locality, and in that data flats sell for about ₹5,000 per square foot (an illustrative figure). Inference: a new 1,000 square-foot flat is entered. Working: 1,000 × 5,000 = ₹50,00,000, so the model predicts about ₹50 lakh. If the market changes and the model is not retrained, it will keep predicting from the old pattern - one reason models need monitoring.
Data + algorithm → training → model. Model + new input → inference → output. Garbage in, garbage out: a model is only as good as its data.
Key takeaways: data are the examples, the algorithm is the learning method, and the model is the learned result. Training builds the model; inference uses it. Test on unseen data. Rules-based systems follow human-written rules and are easy to explain; learning systems find patterns in data and handle messy input.
Check your understanding
-
1. In AI, using an already trained model to give an answer for new input is called:
- Labelling
- Training
- Data collection
- Inference
Show answer
Answer: D. Inference is the use stage: the trained model receives new input, such as a fresh photo, and produces an output. Training is the earlier learning stage, and labelling and data collection come before training.
-
2. What is a 'model' in AI?
- The raw photographs collected for training
- The learned patterns produced by training, used to make predictions
- The computer screen that shows the results
- A person who poses for photographs
Show answer
Answer: B. The model is the result of running the learning algorithm on data: it stores the patterns and is what makes predictions. The raw data are the input to training, not the model.
-
3. Why is a model tested on data it has never seen?
- To make training faster
- To reduce the size of the dataset
- To check that it has learned general patterns and not just memorised the training examples
- Because training data cannot be stored
Show answer
Answer: C. Doing well on familiar examples can be memorisation. Testing on unseen data shows whether the model works on new cases, which is what it will face when people use it.
-
4. Which task is best suited to a rules-based system rather than a learning system?
- Applying a fixed rule such as 'a form is incomplete if the date of birth is blank'
- Recognising a person's face in different lighting
- Understanding many accents in speech
- Suggesting videos a user might like
Show answer
Answer: A. Checking whether a field is blank is a clear, stable rule that a programmer can write exactly. Faces, accents and taste vary too much for people to write all the rules, so learning systems suit them.
-
5. A model trained on past flat sales at about ₹4,000 per square foot is asked to price an 800 square-foot flat. Its prediction is about:
- ₹3.2 crore
- ₹4 lakh
- ₹80 lakh
- ₹32 lakh
Show answer
Answer: D. 800 × 4,000 = 32,00,000 rupees, which is ₹32 lakh. This is inference: the trained pattern is applied to a new input.
Sign in to keep track of the lessons you finish.