• 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

TermPlain meaningExam-preparation comparison
Data / datasetThe examples the system learns from - numbers, text, images, soundsPrevious papers and practice questions
AlgorithmThe step-by-step method used to learn from the dataYour study method
ModelWhat the algorithm produces after learning: the stored patterns used to make predictionsThe knowledge in your head after studying
TrainingThe stage in which the model learns patterns from dataThe months of preparation
InferenceUsing the trained model on new input to produce an answerWriting 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

  1. Data The examples the system learns from.
  2. Algorithm The step-by-step method used to learn from the data.
  3. Training The model learns patterns from the data.
  4. 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

  1. Define the task, for example 'sort mangoes into ripe and unripe'.
  2. Collect data - many examples related to the task.
  3. Clean and label the data - remove errors and mark the right answer for each example.
  4. Choose an algorithm suited to the task.
  5. Train the model on most of the data.
  6. Test the model on data it has never seen, to check that it really learned and did not just memorise.
  7. Deploy it so people can use it (inference), then monitor it and retrain when needed.

Rules-based systems versus learning systems

FeatureRules-based systemLearning system
Source of knowledgeRules written by peoplePatterns learned from data
Needs large data?NoYes
Easy to explain its decision?Yes - you can read the ruleOften hard - patterns are spread across the model
Handles messy, varied inputPoorlyWell, if trained on similar examples
ExampleExpert 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

  1. Data: thousands of photos of mangoes, each labelled 'ripe' or 'unripe' by experienced sorters.
  2. Algorithm: a learning method suited to images.
  3. Training: the system adjusts itself until it links colour, texture and shape to the labels.
  4. Testing: on photos it never saw, it labels most mangoes the way the sorters would.
  5. 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. 1. In AI, using an already trained model to give an answer for new input is called:

    1. Labelling
    2. Training
    3. Data collection
    4. 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. 2. What is a 'model' in AI?

    1. The raw photographs collected for training
    2. The learned patterns produced by training, used to make predictions
    3. The computer screen that shows the results
    4. 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. 3. Why is a model tested on data it has never seen?

    1. To make training faster
    2. To reduce the size of the dataset
    3. To check that it has learned general patterns and not just memorised the training examples
    4. 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. 4. Which task is best suited to a rules-based system rather than a learning system?

    1. Applying a fixed rule such as 'a form is incomplete if the date of birth is blank'
    2. Recognising a person's face in different lighting
    3. Understanding many accents in speech
    4. 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. 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:

    1. ₹3.2 crore
    2. ₹4 lakh
    3. ₹80 lakh
    4. ₹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.

Privacy · Terms · Refunds · Delivery