An AI algorithm is a computational procedure used to perform an artificial-intelligence task, such as learning from data, making predictions, searching a problem space, planning actions, recognising patterns, reasoning from knowledge, or selecting actions under uncertainty. The term is broader than any single machine-learning method. AI algorithms include decision-tree learning, nearest-neighbour methods, clustering procedures, gradient-based optimisation, neural-network training, search algorithms, Bayesian inference methods, reinforcement-learning algorithms, genetic algorithms, constraint-solving techniques, and symbolic reasoning procedures.
An algorithm is a defined method, whereas an AI model is usually the parameterised representation produced or used by an algorithm. For example, gradient descent can be an algorithm used to train a neural network, while the trained neural network is the model. Similarly, Q-learning is an algorithm for reinforcement learning, while the learned Q-values or resulting policy represent learned information used to choose actions.
AI algorithms can be broadly divided between symbolic and statistical or machine-learning approaches, although modern systems frequently combine them. Symbolic AI algorithms manipulate explicit representations such as logical statements, rules, symbols, constraints, or knowledge graphs. Search algorithms explore possible states to find solutions, as in game-playing or planning. Statistical machine-learning algorithms instead infer patterns or parameters from data. Some methods combine both approaches, for example systems that use neural networks for perception and symbolic planners for action sequencing.
AI algorithms can also be classified by task, including classification, regression, clustering, dimensionality reduction, recommendation, planning, optimisation, prediction, generation, and control. There is no single algorithm called "the AI algorithm"; artificial intelligence is an umbrella field containing many algorithmic approaches with different assumptions, objectives, computational requirements, and limitations.
Learning algorithms generally optimise some objective based on data or environmental feedback. In supervised learning, an algorithm uses training examples and target values to adjust model parameters so that predicted outputs correspond more closely to targets. Gradient-based algorithms calculate derivatives of a loss function and use those derivatives to determine parameter updates. Decision-tree algorithms choose feature-based splits according to criteria such as impurity reduction or information gain.
Clustering algorithms such as k-means iteratively assign observations to clusters and update cluster centres. Reinforcement-learning algorithms instead use reward signals and interactions with an environment to improve a policy or value estimate. The objective function, optimisation method, data representation, and assumptions about the environment all influence the resulting model. An algorithm therefore does not independently determine intelligence; its behaviour depends on the problem formulation, data, representation, hyperparameters, and evaluation criteria.
Search and planning are important AI algorithm families that do not necessarily require neural networks. A search algorithm explores a set of possible states or actions to identify a path or solution. Breadth-first and depth-first search provide basic strategies, while heuristic methods such as A* use estimates of remaining cost to prioritise promising states. Minimax can evaluate adversarial game positions under a simplified opponent model, while alpha-beta pruning can reduce the number of game-tree nodes that need evaluation.
Constraint-satisfaction algorithms assign values to variables subject to defined constraints. Planning algorithms determine sequences of actions that achieve goals under specified conditions. These approaches demonstrate that AI historically included substantial algorithmic work involving symbolic representations, combinatorial search, logic, probability, and optimisation before the modern dominance of large neural networks. Many current systems still combine learned models with classical algorithms for search, planning, retrieval, scheduling, and verification.
AI algorithms have computational properties that determine their practical usefulness. Time complexity describes how computational work grows as problem size increases, while space complexity concerns memory requirements. Some AI problems involve enormous search spaces, high-dimensional data, or optimisation landscapes with many local or global structures. Approximation, heuristics, pruning, sampling, caching, dynamic programming, parallelisation, and specialised hardware can make otherwise expensive algorithms practical.
A heuristic can substantially reduce search effort but may sacrifice guarantees if it is not admissible or otherwise appropriately constrained. Stochastic algorithms can trade exact reproducibility for exploration or computational efficiency. Distributed algorithms can scale computation across multiple machines, although communication overhead, synchronisation, fault tolerance, and consistency become important. AI algorithm design therefore involves balancing accuracy, optimality, computational cost, latency, memory, robustness, and the characteristics of the available data or environment.
AI algorithms can be used during both training and inference. A training algorithm changes model parameters or otherwise learns from examples. An inference algorithm applies a trained model to new inputs, potentially involving search, decoding, sampling, ranking, or optimisation. For example, a language model may be trained using gradient-based optimisation, while text generation uses a decoding algorithm such as greedy selection, beam search, or probabilistic sampling.
An image-recognition model may be trained using stochastic gradient descent but perform straightforward forward inference after deployment. A reinforcement-learning system may use one algorithm to learn value estimates and another procedure to select actions from those estimates. This distinction is important because the algorithm responsible for learning a model is not necessarily the algorithm responsible for using that model. A complete AI application can therefore contain many algorithms operating at different stages.
AI algorithms have advantages and limitations determined by their underlying assumptions. A decision tree can be relatively interpretable and can handle nonlinear decision boundaries, but unrestricted trees can overfit. Nearest-neighbour methods can be simple and effective but may become computationally expensive at inference time and can be sensitive to feature representations. Neural-network optimisation can learn highly complex functions but often requires substantial data and computation and can converge to solutions whose internal reasoning is difficult to interpret.
Bayesian methods can represent uncertainty explicitly but may require tractable probabilistic assumptions or expensive inference. Symbolic reasoning can provide precise logical guarantees within its formal system but may struggle with noisy, ambiguous, or unstructured real-world data. There is consequently no universally superior AI algorithm. Algorithm selection depends on the task, data, constraints, required guarantees, interpretability requirements, deployment environment, and acceptable error characteristics.
The terms AI algorithm, machine-learning algorithm, AI model, and AI system are closely related but should not be treated as synonyms. A machine-learning algorithm is specifically concerned with learning patterns or parameters from data, while an AI algorithm can also perform reasoning, search, planning, or rule-based processing without learning. A model is the learned or specified representation used by an algorithm during inference.
An AI system is the broader deployed arrangement that may include multiple models, algorithms, data stores, tools, interfaces, policies, and monitoring components. An algorithm is also not necessarily a mathematical formula; it can be a complex sequence of computational operations with data structures, loops, branching, optimisation, and state. Understanding these distinctions allows technical discussions to specify whether a particular claim concerns how a system learns, how it represents knowledge, how it searches for solutions, how it generates outputs, or how the entire application behaves.