An AI algorithm is a step-by-step procedure that lets a computer learn from data, search through possibilities or make decisions without a programmer writing a rule for every case. The word algorithm itself is old and general: it means any finite, well-defined sequence of steps that solves a problem. In artificial intelligence, the term usually refers to either a learning algorithm, which builds a model from data, or a search or reasoning algorithm, which explores options to reach a goal.
History of AI algorithms
The word comes from the name of the ninth-century Persian scholar al-Khwarizmi, whose writings introduced systematic methods of calculation to Europe. In the twentieth century, Alan Turing and others formalized what it means for a procedure to be computable. When artificial intelligence became a named field in 1956, early programs relied on search and logic. They explored game trees, proved theorems and followed hand-written rules. From the 1980s and 1990s, machine learning algorithms that improve from examples took center stage. The 2010s brought deep learning, powered by the backpropagation algorithm, large datasets and fast chips.
Types of AI algorithms
AI algorithms fall into a few broad families.
- Learning algorithms build models from data. Examples include linear regression, decision tree induction, k-means clustering and gradient descent for neural networks.
- Search algorithms explore a space of possible states to find a path to a goal. Examples include A-star search for route planning and minimax search for two-player games.
- Optimization algorithms find the best values of some quantity. Genetic algorithms, inspired by natural selection, are one example.
- Reasoning algorithms draw conclusions from stored facts and rules, as in expert systems and logic programming.
- Probabilistic algorithms handle uncertainty, for example Bayesian inference and hidden Markov models.
How AI algorithms work
A learning algorithm typically works in a loop. It starts with a model whose parameters are set to initial values. It shows the model a batch of training examples and measures the error with a loss function. It then updates the parameters in the direction that reduces the error, and repeats until performance stops improving. A search algorithm works differently. It keeps track of candidate states, scores them with a heuristic that estimates how close they are to the goal, and expands the most promising ones first. Both kinds are instructions a computer carries out mechanically. Intelligence in the system comes from how well the procedure fits the problem and the data.
A worked example
Consider a spam filter. A learning algorithm is given thousands of emails already labeled as spam or not spam. It counts which words and features appear more often in each group and adjusts the weights of a model so that spam-like patterns raise a spam score. After training, the filter no longer runs the learning algorithm for each message. It simply applies the trained model to the new email and returns a score. If many users start to mark a new kind of message as spam, the learning algorithm can be run again on the updated data to produce a better model. The example shows the two roles clearly: the algorithm creates the model, and the model does the daily work.
AI algorithm vs. AI model
People often use these words interchangeably, but they name different things. The algorithm is the recipe, and the model is the dish. Running the same learning algorithm on different data produces different models. A model, once trained, can be used without running the learning algorithm again. When a news story says an algorithm decided something, it usually means a trained model inside a larger AI system.
Applications of AI algorithms
Search algorithms power navigation apps and game-playing programs. Learning algorithms power spam filters, recommendation engines, medical image analysis and fraud detection. Optimization algorithms schedule airline crews and design antennas. Reasoning algorithms support configuration tools and some legal and tax software. Many products mix families, such as a robot that uses learned perception to see its surroundings and a search algorithm to plan a path.
Advantages and disadvantages of AI algorithms
Algorithms can process far more data than a person and apply the same procedure consistently. They can find patterns that humans overlook. Their weaknesses are equally important. A learning algorithm reflects the quality of its data, so biased data can yield biased results. Some algorithms are hard to interpret, which complicates accountability. Others are expensive in computing power or energy. Choosing an algorithm is therefore a trade-off among accuracy, speed, cost and transparency, and the right choice depends on the problem, the amount of data and the consequences of an error.
Choosing an algorithm
Practitioners rarely pick an algorithm by name alone. They start with the question being asked, whether it is a category, a number, a grouping or a sequence of actions. They look at the amount and type of data, such as tables, images or text, and at constraints such as speed and the need to explain results. Simple methods like linear regression or decision trees are often tried first because they are fast and easy to understand. More complex methods are used when the simple ones fall short.
Algorithms and bias
An algorithm is not neutral simply because it is mathematical. A learning algorithm optimizes the objective it is given, and if the data reflects historical unfairness, the resulting model can repeat or amplify it. A hiring tool trained on past decisions, for example, may learn to favor the groups that were favored before. Designers try to reduce this by auditing data, choosing fairness measures, testing results across groups and keeping humans involved in high-stakes decisions. The choice of objective matters too. An algorithm that maximizes clicks may promote sensational content, while one that maximizes accuracy on average may do poorly on a minority group.
Future directions for AI algorithms
Research continues on algorithms that need less data, use less energy and explain their results. Methods such as self-supervised learning aim to learn from unlabeled data, and techniques such as transfer learning reuse knowledge between tasks. Efficiency work seeks to cut the energy used to train and run large models. Another active area combines learned components with search and reasoning, so systems can plan as well as recognize patterns. As AI spreads, algorithms are also being designed with privacy and security in mind, for example by training across many devices without gathering raw data in one place.
FAQs
Are all algorithms artificial intelligence? No. Sorting a list or adding numbers uses algorithms but is not considered AI. The label applies when an algorithm learns, reasons or searches in ways associated with intelligent behavior.
What is the most common AI algorithm? Gradient descent, used to train neural networks, is among the most widely used in modern machine learning.
Who decides how an AI algorithm behaves? Its designers choose the procedure and objective, and the training data shapes the outcome.
More in Artificial Intelligence
Key facts
Related concepts
Quick checkWhat is the relationship between a learning algorithm and an AI model?Show answer
The learning algorithm is the procedure that trains the model. The model is the result, a set of learned parameters used to make predictions.
Sources
- Britannica, Algorithm, https://www.britannica.com/science/algorithm
- Google, Machine Learning Glossary, https://developers.google.com/machine-learning/glossary
- Russell and Norvig, Artificial Intelligence: A Modern Approach, https://aima.cs.berkeley.edu/
Editorially reviewed by Specialty Digest Editorial TeamLast reviewed November 17, 2026Researched and drafted with AI assistanceReport an issue
