The basics

Algorithm

An algorithm is a precise, step-by-step set of instructions that a computer follows to solve a problem or complete a task.

A recipe is an algorithm for food: do this, then this, until done. Computer algorithms are the same idea for tasks like sorting a list, finding the fastest route, or compressing a video. They must be exact, because a computer cannot guess what you meant. Every case has to be spelled out in advance.

In AI the word shows up in two places. A learning algorithm is the procedure that trains a model, such as gradient descent, which nudges a model's settings toward better answers. The trained model itself is then often called 'the algorithm' in everyday speech, as in 'the YouTube algorithm.'

That everyday use is a bit loose. The recommendation system on a video app is really a trained model plus the code around it. Still, both meanings share the core idea: a fixed procedure that turns an input into an output the same way every time.

Example

When a maps app finds the quickest way to school, it runs a route-finding algorithm that checks roads one by one and keeps the shortest total.

Read: How machines learn →