---
title: "Non-deterministic operations"
description: "Learn how GenLayer contains variable web and LLM outputs and reaches consensus on their meaning."
source: https://docs.genlayer.com/understand-genlayer-protocol/core-concepts/non-deterministic-operations-handling
last_updated: 2026-08-19
---

# Non-deterministic operations

A non-deterministic operation can return different raw output when two validators run it. LLM responses, live web content, time-sensitive APIs, and rendered pages are common examples.

GenLayer does not require these outputs to become identical. It contains the variability in a non-deterministic block, then asks validators to judge the leader's proposed output under a rule defined by the Intelligent Contract.

## Leader and validator paths

Each non-deterministic block has two logical paths:

- The **leader function** obtains or produces a candidate output.
- The **validator function** receives that output and decides whether it is acceptable.

The validator can reproduce the operation and compare results, inspect the proposed output against objective constraints, or use another LLM judgment. The best choice depends on what a correct result means for the application.

## What remains deterministic

Code outside the non-deterministic block must produce the same result from the same inputs and accepted block outputs. In particular:

- contract state is read and written on the deterministic path;
- validators must reproduce deterministic computation exactly; and
- only a returned value crosses from a non-deterministic block into the surrounding execution.

If validators detect a provable mismatch in deterministic execution, they can report a deterministic violation. That is different from legitimately disagreeing about a subjective output.

## Designing for consensus

Use the narrowest validation rule that captures the application's real requirement. Prefer structured outputs and check objective properties before asking an LLM for a qualitative judgment. Account for unavailable sources, timeouts, malformed data, and adversarial content.

See the [Equivalence Principle](/understand-genlayer-protocol/core-concepts/optimistic-democracy/equivalence-principle) for the conceptual model and [implement non-determinism](/developers/intelligent-contracts/features/non-determinism) for current APIs and code restrictions.
