Research · ICP
On-chain AI
Last reviewed 2026-09-21Source: ICP Developer Docs — On-chain AI and the LLM canisterThe service and its interfaces are described as documented; model availability, output limits and cost are properties of the service and change over time.
Why inference on-chain is hard
A canister's state is replicated, and every node must reach the same state from the same messages. A language model breaks that assumption in an obvious way: sampling is random, floating-point arithmetic can differ between machines, and a model served by an external provider may return a different completion on each call. Two nodes that ask the same question can get different answers, and the canister then has no agreed state.
The documentation describes the network's approach as providing an inference service that a canister calls, with the response made deterministic so that the nodes can agree on it. The mechanism the documentation describes is a deterministic sampling procedure seeded from the network's random beacon, so that every node that evaluates the call derives the same output. That is what turns a model call into something a replicated canister can use.
The alternative — an ordinary HTTPS outcall to a model provider — is also possible, and the documentation treats it as a different thing. An outcall to a provider gives the canister whatever that provider returns, which is not agreed state unless the response is transformed into something deterministic. The HTTPS outcalls page covers that path and its constraints.
The inference service
The documentation describes a canister that exposes model inference to other canisters. A caller sends a request describing the model, the prompt and the generation parameters, and receives a response containing the generated text. The interface is a canister interface, so a caller reaches it the same way it reaches any other canister: through a Candid call.
The documentation describes two styles of request. One is a completion-style interface, where the caller supplies a prompt and the service returns generated text. The other is a chat-style interface, where the caller supplies a sequence of messages with roles and the service returns the next message. Both are ordinary canister methods, and both are subject to the network's message limits.
The documentation notes the practical constraints. Generation is bounded in the number of tokens produced, and a request that asks for more than the bound allows is truncated. The service is a shared resource, so a canister that depends on it is depending on something it does not control. And the model behind the service is chosen by the service, not by the caller, which means a canister cannot pin itself to a particular model version.
Determinism and the random beacon
The random beacon is the network's source of randomness that all nodes agree on. The documentation describes it as produced by the consensus protocol and available to canisters, and it is what makes a deterministic sampling procedure possible: if every node seeds its sampling from the same beacon value, every node draws the same sample.
The consequence is that the same request produces the same output across the subnet, which is what allows the result to be stored in the canister's state. It also means the output is not random in the sense a user might expect from a chat interface: the same prompt with the same parameters yields the same completion, because the randomness is fixed by the beacon rather than drawn fresh.
The documentation is careful about the security implication. A canister that uses model output to make a decision is trusting the model and the service, and the determinism does not make the output correct — it makes it agreed. A model that produces a wrong answer produces the same wrong answer on every node, and the network's consensus does not detect it.
What it enables
The documentation presents on-chain inference as the piece that lets an application use a model without an off-chain service in the loop. A canister can classify an input, summarise a document, generate a response, or extract structured data, and the result can be stored in the canister's state as agreed data rather than as a cached response from a provider.
The applications that follow from that are the ones where the model output is part of the application's logic rather than a convenience. A governance system that summarises proposals, a marketplace that classifies listings, an assistant whose answers are part of a canister's state — these are cases where the determinism matters, because the output is something the network has to agree on.
The honest limits are the ones the documentation states. The service is shared and its capacity is finite; the output is bounded; the model is not chosen by the caller; and the cost is paid in cycles by the calling canister, which puts it under the reverse-gas model like everything else. A canister that calls a model on every request is a canister with a real and variable burn rate.
Sources and references
The inference service, its interfaces and the determinism mechanism are described from the Internet Computer's own documentation. Model availability, output limits and cost are properties of the service and are not fixed here.
- On-chain AI and the inference service. ICP Developer Docs, On-chain AI: describes the service, the request styles and the constraints on generation.
- The LLM canister interface. ICP Developer Docs, LLM canister reference: documents the prompt and chat methods, the request and response records, and the token bound.
- The random beacon and deterministic sampling. ICP Developer Docs, Internet Computer interface specification: specifies the raw_rand method and the beacon value canisters can read.
Related reading
- Research HubEvery dataset on the site, with methodology and provenance.
- Altcoin ResearchAltcoins measured against Bitcoin: design intent, consensus, execution, scaling and market structure.
- The ETH-BTC Correlation RecordHow the correlation is measured, how it behaves across windows, and where it breaks down.
- The ETH/BTC RatioWhat the ratio measures, how to read its trend, and why it is not a forecast.
- ETH During Bitcoin Bull PhasesAssociation within a common market factor, and what co-movement cannot establish.
- ETH During Bitcoin Bear PhasesDrawdown depth and duration compared over identical windows, and the limits of the comparison.