AI Glossary / Governance, ethics and safety / Intermediate

Deterministic algorithm

Definition

A deterministic algorithm follows rules that produce the same result whenever it starts with the same complete inputs and state. Its behavior does not depend on an uncontrolled random choice. In AI work, determinism helps with repeatable testing and investigation, but it does not establish that a result is correct, fair, or useful.

What it means

The word complete matters. A visible prompt may be only one input to an AI service. Model weights, retrieved documents, configuration, previous conversation, and other state can also affect the answer. If any of those change, different outputs do not necessarily contradict determinism. Likewise, a repeatable mistake remains a mistake. Determinism describes the relationship between inputs and computation, not the quality of the decision. It is useful when a team wants to reproduce a failure or determine whether a deliberate change altered behavior.

How it works

At each step, a deterministic algorithm chooses its next operation from the current state according to fixed rules. A sorting procedure with a specified rule for ties is a simple example. A pseudorandom generator can also produce a repeatable sequence from a fixed initial state, even though the sequence is used to simulate random choices. In a real machine-learning workflow, controlling a seed is only part of the story. Parallel execution, numerical operations, external services, and software changes can affect repeatability. Teams therefore distinguish an algorithm's mathematical definition from the reproducibility guarantees of its implementation and environment.

Three practical examples

  • A document classifier uses fixed model parameters and a fixed preprocessing procedure to reproduce the category assigned to a stored test document.
  • A test suite uses a fixed pseudorandom seed to generate the same synthetic examples while developers investigate a bug.
  • A ranking system specifies how to order equal scores, so that tied items do not change position merely because their incoming order changed. The required behavior should be stated rather than assumed.

Think of it this way

Think of a recipe whose ingredients, quantities, sequence, and conditions are all fixed. Repeating those conditions is intended to repeat the result. The analogy has limits because real kitchens contain uncontrolled variation, and computers also have implementation details that a high-level description may omit. Its useful lesson is that repeating the visible instruction alone is insufficient if important inputs or starting conditions differ.

Worked example

Consider three records with IDs A, B, and C and scores 8, 8, and 5. The rule is to sort by decreasing score, then by alphabetical ID for a tie. The output is A, B, C, even if the incoming list is C, B, A. Now suppose the rule instead preserves incoming order among equal scores. For input C, B, A, the output is B, A, C; for input C, A, B, it is A, B, C. Both procedures can be deterministic. Their outputs differ because the second procedure treats input order as relevant. This example shows why an investigation must record the full input and tie rule. It also shows that reproducibility does not select the best policy: the organization still needs to decide whether alphabetical order, arrival order, or another criterion is appropriate.

Illustrative case study

Fictional case: Birch Analytics investigates a report that its AI scoring workflow changes results between runs. The team initially records only the input file and a seed. It later finds that the retrieved reference table is updated overnight and that preprocessing settings differ between environments. The team versions those dependencies and states which comparisons are expected to match exactly and which permit a documented numerical tolerance. This invented case illustrates reproducibility work, not proof that every source of variation can be removed or that fixed results are accurate.

Common misconceptions and mistakes

A fixed seed is not a universal guarantee of identical results across machines, library versions, or execution settings. A deterministic model can still receive changing data, and an otherwise repeatable service can include a nondeterministic component. Another mistake is equating determinism with simplicity: a very large computation can be deterministic even when predicting its result without running it is difficult. Randomized algorithms are not inherently inferior; randomization can serve useful learning and statistical purposes. Finally, observed repetition in a few trials does not prove that every relevant input will behave deterministically.

Business use

Decide where exact repeatability is needed, such as incident reproduction, regression checks, or audit evidence. Record model versions, configuration, preprocessing, data snapshots, relevant state, and execution details proportionate to that need. State the comparison rule: exact text, identical labels, or numerical agreement within a justified tolerance are different requirements. Check whether deterministic settings change cost or performance in the chosen implementation. Keep repeated runs where variation is part of the intended method, since a single fixed run may hide instability. Use reproducibility to strengthen investigation rather than to substitute for outcome validation.

People also ask

Can an algorithm using pseudorandom numbers be repeatable?

Yes, if the generator state and all other relevant conditions are controlled, although the implementation may have additional sources of variation.

Does deterministic mean predictable by a person?

No. The result follows from the inputs, but the computation may still be too complex to anticipate mentally.

Is a language model always deterministic at a low temperature?

That setting alone does not establish whole-service determinism. Decoding, ties, implementation, and changing context also matter.

Check your understanding

A deterministic ranking rule preserves arrival order for equal scores. Two runs have the same records but different arrival orders and produce different rankings. Is the rule necessarily nondeterministic?

Answer: No. Arrival order is part of the input to that rule, so the complete inputs were different.

Related terms

  • State
  • Stochastic process
  • reproducibility
  • random seed
  • pseudorandom number generator
  • randomized algorithm
  • tie breaking
  • numerical precision
  • regression testing

Learn next

Pick one repeatability claim in an AI workflow and list everything that must remain fixed for it to hold. Re-run a stored example under those conditions, then change one dependency deliberately and record the resulting difference.

More in Governance, ethics and safety

  • Dependability - Dependability is the ability of a system to provide a service that people have sound reasons to rely on.
  • Deployment Bias - Deployment bias arises when the way an AI system is actually used differs from the role or context for which it was designed and evaluated, creating...
  • Detection Bias - Detection bias is a systematic distortion caused by differences in how outcomes are noticed, measured, or classified across groups.
  • Differential privacy - Differential privacy is a mathematical framework for limiting how much the output of an analysis can reveal about the contribution of a particular protected...
  • Differential validity - Differential validity concerns whether the relationship between a score or predictor and an intended outcome differs across groups.
  • Disparate impact - Disparate impact refers to a practice producing disproportionately unfavorable outcomes for a group, even when the practice appears neutral on its face.

Sources

NIST Dictionary of Algorithms and Data Structures, deterministic algorithm: https://xlinux.nist.gov/dads/HTML/deterministicAlgorithm.html NIST CSRC, deterministic algorithm glossary: https://csrc.nist.gov/glossary/term/deterministic_algorithm PyTorch, Reproducibility documentation: https://docs.pytorch.org/docs/stable/notes/randomness.html

Previous: Determining the number of clusters in a data set Next: Deterministic annealing

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer