AI FUNDAMENTALS / BEGINNER

How A Machine Learning Model Is Built: Data, Training, Parameters And Inference

A plain walk through the life of a machine learning model, from collecting data and training it to running it on new inputs and keeping it healthy in production.

Checked against primary sources and independently reviewed on . Sources are listed at the end.

People often talk about “the AI” as a single thing, but a machine learning model goes through distinct stages, and each one creates different risks. Bad data at the start, a flawed test in the middle or no monitoring at the end can each cause a model to fail in use.

This article follows one simple example, a supervised model that predicts whether an invoice is a duplicate, through its whole life. Other kinds of model, covered in Three Ways Machines Learn, differ in the details, but the same broad stages apply. Along the way it explains four words that come up in every AI conversation: data, training, parameters and inference.

A Model Is A Function With Adjustable Numbers

At its core, a model is a mathematical function. It takes an input, such as the supplier, amount, date and reference number of an invoice, and produces an output, such as a score from 0 to 1 for how likely the invoice is to be a duplicate.

What makes it a learned model is that the function contains adjustable numbers called parameters, such as weights and a bias. In the common approach Google’s course teaches, these start as small random values, so the model’s first answers are no better than guesses, and training nudges them until the answers become useful.1 The simplest models have only a handful of parameters. Large language models have far more: GPT-3, described in 2020, had 175 billion.2

The Life Of A Model

  1. Collect And Label Data

    Gather past invoices and mark which ones turned out to be duplicates.

  2. Split The Data

    Keep separate training, validation and test sets so the model is judged on examples it has not seen.

  3. Train

    Repeatedly adjust the parameters to reduce the error on the training set.

  4. Validate And Tune

    Check performance on the validation set and adjust settings such as model size.

  5. Test Once

    Measure final performance on the untouched test set before release.

  6. Deploy And Run Inference

    Score each new invoice as it arrives.

  7. Monitor And Retrain

    Watch for falling accuracy and retrain on fresh data when needed.

A typical lifecycle for a supervised model. The last step leads back to the first: monitoring tells you when fresh data and retraining are needed.

Data: The Raw Material

The patterns a model learns come from its data. For the invoice example, that means a history of invoices with a label saying which were duplicates. If the history only covers one country, or if past staff missed many duplicates and labelled them wrongly, the model will learn those blind spots.

Before training, the data is divided into three parts. The training set is what the model learns from. The validation set is used during development to compare versions of the model and tune settings. The test set is held back for a final, independent check. Google’s machine learning course warns that the more often the same test set guides decisions, the more the model ends up tuned to that particular set, which weakens what its score says about real data.3

Training: Reducing The Error

For models like this one, training usually works in a loop called gradient descent. The model makes predictions on a batch of training examples, and a loss function measures how far those predictions are from the correct labels. The algorithm then works out which direction to move each parameter to make the loss smaller, moves it a small step that way, and repeats until the loss stops improving.1 Not every method trains this way; decision trees, for example, are built by repeatedly splitting the data instead.

The developer chooses some settings that training itself does not learn, such as the learning rate (how large each step is), the batch size and the number of passes through the data. These are called hyperparameters, to tell them apart from the parameters the model learns, and the validation set is where they are tuned.4

Inference: Using The Trained Model

Once training ends, the parameters are frozen and the model is deployed. Running it on new input is called inference. Each new invoice goes in and a duplicate score comes out. No learning happens at this stage unless the system is specifically built to keep updating.

TrainingInference
What happensParameters are adjusted to reduce errorFixed parameters turn a new input into an output
How oftenOnce, then occasionally to retrainEvery time the model is used
Data involvedA historical dataset, labelled in this exampleNew inputs, singly or in batches
Main risksPoor or biased data, data poisoning, overfittingUnexpected inputs, misuse, drift from training conditions
Training and inference are separate activities with different costs and risks.

This split matters for security and privacy. NIST lists data poisoning and the extraction of models or training data through a system’s interfaces among common security concerns for AI.5 Training data can be tampered with before the model learns from it, and personal data in it may later be exposed. Inference is where a deployed model meets real users and real attackers. Both kinds of attack are covered in AI Security.

After Deployment: Monitoring And Retraining

The world changes after a model ships. New suppliers appear, invoice formats change, and fraudsters adapt. When live data starts to look different from the training data, accuracy can fall without anyone noticing. This is usually called drift, and NIST lists data, model and concept drift among the reasons AI systems may need more frequent maintenance than ordinary software.5

NIST’s AI Risk Management Framework says AI systems should be tested before deployment and regularly while in operation.5 In practice that means tracking the model’s accuracy on recent, correctly labelled cases, alerting when it drops, and retraining on fresh data. The lifecycle is a loop, not a straight line.

Footnotes

  1. Google for Developers, “Linear regression: Gradient descent”, Machine Learning Crash Course, last updated 3 February 2026. developers.google.com ↩ ↩2

  2. T. B. Brown et al., “Language Models are Few-Shot Learners”, arXiv:2005.14165, May 2020. arxiv.org ↩

  3. Google for Developers, “Datasets: Dividing the original dataset”, Machine Learning Crash Course, last updated 3 December 2025. developers.google.com ↩

  4. Google for Developers, “Linear regression: Hyperparameters”, Machine Learning Crash Course, last updated 3 December 2025. developers.google.com ↩

  5. NIST, AI 100-1, “Artificial Intelligence Risk Management Framework (AI RMF 1.0)”, January 2023, sections 3.3 and 5.3 and Appendix B. nvlpubs.nist.gov ↩ ↩2 ↩3

Knowledge Hub content is general information. It is not legal advice, a compliance certification, a guarantee of security or a substitute for an assessment of your own systems. Standards and rules change; check the sources for the latest position.