AI models as the judge

Using an AI model's answer in a contract. TEE services, provider quorums versus a single attested enclave, and strict yes/no outputs.

A contract can't run a model, but it can act on a model's answer if that answer comes with proof of how it was produced. XE Services gives two kinds of proof: several independent providers agreeing, or a measured enclave whose hardware attestation every XE node verified. A contract then reads the answer the way it reads any XE result (Contracts using XE).

See XE check sealed hardware · Paid jobs providers must agree on

#Verification modes

A service's manifest names how its results are verified. The result tells your contract which mode produced it (verification & 0x7f).

ModeValueWhat it provesStatus
quorum1k of n selected providers returned the identical outputOn testnet
tee2One provider ran the service's measured code in an attested enclaveOn testnet (the zero-retention relay)
tee_quorum3k of n attested enclaves returned the identical outputIn the node; no service uses it yet
optimistic4One provider answered, and nobody challenged it within the window; a challenge goes to a fresh quorum and the loser's bond paysOn testnet
zk5Reserved

The 0x80 bit is set when the beacon selected the providers. With immediate selection, the requester could re-sign until it drew providers it liked. A contract that relies on answers it didn't request itself should require the beacon bit.

#A provider quorum

Several providers answer independently. The settle counts identical outputs and takes the answer only if k of n agree. Providers post a bond, and services v2 can slash it.

  • What you trust: that fewer than k of the selected providers collude or make the same mistake.
  • What it needs: a deterministic output. A quorum can only agree on identical bytes. Free text from a model rarely matches byte for byte. A yes/no does.
  • What it costs: n calls per answer.

#A single attested enclave

One provider runs the service inside an Intel TDX confidential VM under dstack, optionally with NVIDIA confidential-computing GPUs. It publishes a provider_attest block with:

  • the TDX quote, binding its enclave key, its XE account, the service's measurement and a fresh state-chain nonce;
  • the collateral to verify the quote offline;
  • dstack's event log, whose compose hash must equal the service manifest's artifact;
  • optionally, NVIDIA GPU evidence bound to the same attestation.

Every XE node verifies all of it inside consensus, against roots and a policy the DAO pinned in the state chain. On XE Sim Interop those are Intel's SGX root CA, NVIDIA's device identity CA and CPU policy 1. Each result then carries the enclave key's signature, and nodes check it against a live attestation record.

  • What you trust: Intel TDX (and NVIDIA's GPU attestation, when present), the measured code, and the model it runs.
  • What it allows: one call per answer, and outputs that needn't match anyone else's.
  • What it doesn't prove: that the model is right. It proves which code produced the answer.

tee_quorum combines the two: k of n attested enclaves must agree.

#Taking a TEE answer in a contract

XETeeConsumer (xe-kit evm/examples/XETeeConsumer.sol) stores an answer only if it came from an attested mode, together with its attestationHash, the aggregate of the hardware attestations the nodes verified:

solidity
function _onXEResult(XE.ServiceResult memory s) internal override {    uint8 mode = s.verification & 0x7f;    bool attested = s.status == XE.SERVICE_AGREED        && (mode == XE.VERIFY_TEE || mode == XE.VERIFY_TEE_QUORUM)        && s.attestationHash != bytes32(0);    answers[s.commandId] = Answer(        true,        s.status,        0,        s.verification,        attested ? s.outputHash : bytes32(0),        attested ? s.attestationHash : bytes32(0),        attested ? s.output : bytes("")    );}

Keep attestationHash with the decision. Anyone can later look up which enclaves and which measurement produced it.

#Strict outputs

A contract should never parse prose. Make the service answer in a fixed ABI and refuse anything else.

  • Judgments answer abi.encode(bool yes, uint8 confidence). That's the judgment kind's output ABI (bool,uint8, 64 bytes), and it's deterministic enough for a quorum to agree on.
  • The manifest caps the output (max_output_bytes, 64 for a judgment) and states the input ABI, so the question is structured data, not free text.
  • The contract requires the exact length and decodes strictly:
solidity
if (s.status != XE.SERVICE_AGREED || s.agreement < minAgreement) return false;if ((s.verification & 0x7f) != XE.VERIFY_QUORUM || s.output.length != 64) return false;(uint256 yes, uint256 confidence) = abi.decode(s.output, (uint256, uint256));return yes == 1 && confidence <= type(uint8).max;
  • The question is the context. Put what the answer authorises (chain, contract, order, price cap, deadline) in the input, so the answer can't be reused for something else. Act only if XE says yes shows it.

#Choosing

Provider quorumSingle attested enclaveAttested quorum
TrustIndependent providers and their bondsHardware and measured codeBoth
OutputMust match byte for byteAnything the code returnsMust match byte for byte
Cost per answern calls1 calln calls
FitsYes/no judgments, classifications, checks against public dataPrivate inputs, long outputs, models a quorum can't reproduceHigh-value decisions

Whatever the mode, the answer is only as good as the service. An XE result proves what the providers agreed under the service's rule, not that the answer is true. Treat the service id as the policy you trust, and pin it in your contract.

XE's AI Judge answers XE Markets' questions on XE's own provider account. A contract of yours that wants a model's answer uses its own provider account through the XE Key Service.

Private inputs to a model, sealed so that XE can't read them, are covered in Private AI.