---
title: "LLM integration"
description: "Learn how Intelligent Contracts use LLMs and how validators assess model-generated results."
source: https://docs.genlayer.com/understand-genlayer-protocol/core-concepts/large-language-model-llm-integration
last_updated: 2026-08-19
---

# LLM integration

Intelligent Contracts can use large language models (LLMs) inside non-deterministic blocks. This enables decisions based on natural-language instructions, unstructured evidence, text classification, extraction, and multimodal inputs.

An LLM response does not become trusted state merely because a model returned it. The leader proposes a result, and the selected validators apply the contract's validation logic before consensus can accept the transaction.

## Model diversity and equivalence

Validators can use different supported models or providers. Their raw wording may differ while their conclusions remain equivalent. Contracts should therefore define the properties an acceptable response must satisfy instead of depending on exact prose unless exact equality is intentional.

Common patterns include:

- require JSON with a fixed schema, then check its fields;
- independently repeat a classification and compare the label;
- ask validators whether the proposal satisfies explicit natural-language criteria; or
- combine objective checks with an LLM judgment for the remaining subjective question.

## Design considerations

- Treat prompts and retrieved content as untrusted input.
- Keep prompts specific and define the evidence and criteria validators should use.
- Request structured output where possible.
- Handle timeouts, provider errors, and malformed responses.
- Avoid making the validation rule a paraphrase of “agree with the leader.”

See [prompt and data techniques](/developers/intelligent-contracts/crafting-prompts) and [non-determinism](/developers/intelligent-contracts/features/non-determinism) for current contract APIs.
