Training vs Inference

Reading time: 10 minutes

Training and Inference are two major processes of Machine Learning and is deeply connected.

Training is the process by which we generate various parameters such as weights and biases which are used in a particular Machine Learning model which is focused on a particular task such as object detection.

Inference is the process of putting the trained model to test and do actual work.

Hence, inference can take place only after training.

Operations

Training consists of N epochs or passes or re-calculation. Each epoch consists of:

  1. Forward Convolution
  2. Backward Convolution
  3. Activation weight Updation

Inference consists of:

  1. Forward Convolution

Time taken

For Convolution:

Time for training = 3 * N * Time for inference

where N is the number of epochs during training (usually >= 500)

On avarage, training a model takes a few hours to several days

On the other hand, inference takes less than a minute (less than 10 milliseconds for production level applications)

Demonstration

training vs inference

Use in Industry

Training is a process which developers can concerned with. Companies like Amazon, Google and others train their Machine Learning models in a private server which can take days.

Inference is a process which is triggered by a user and is taking place in a large number of applications such as FaceID (Apple), suggesting videos (in YouTube) and others.

That being said, inference takes place with each user action while training is done once in a while when the model is improved or replace by another model.