> For the complete documentation index, see [llms.txt](https://sn2-docs.inferencelabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sn2-docs.inferencelabs.com/proof-of-inference.md).

# Proof-of-Inference

Proof-of-Inference is a cryptographic mechanism that proves an AI model was executed correctly on given inputs. Developed by Inference Labs, it transforms AI inference from a trust-based operation into a mathematically verifiable one.

## The Mechanism

### Step 1: Circuit Conversion

Before a model can generate proofs, it must be converted into a zero-knowledge circuit. This process:

1. Takes a trained AI model (PyTorch, ONNX, etc.)
2. Converts it into an arithmetic circuit representation
3. Generates a **proving key** (used by miners to create proofs)
4. Generates a **verification key** (used by validators to verify proofs)

The circuit is a mathematical representation of the model where every operation can be proven.

### Step 2: Inference with Proof Generation

When a miner receives an inference request:

1. Input data is fed into the zero-knowledge circuit
2. The circuit executes the model's computations
3. A **witness** is generated containing all intermediate values
4. The proving key and witness produce a **zero-knowledge proof**
5. Both the output and proof are returned

### Step 3: Verification

Validators verify the proof using the verification key. This confirms:

* The correct model was executed (not a different or modified model)
* The claimed inputs were actually used
* The outputs are the genuine result of that computation
* No tampering occurred at any stage

Verification is orders of magnitude faster than re-running the inference.

## What Proof-of-Inference Guarantees

### Model Existence

The proof confirms an AI model exists and was used, without requiring the model weights to be public.

### Model Execution

The proof guarantees inference was performed by an AI model, not looked up from a table, copied, or calculated through other means.

### Model Identity

The proof verifies the exact model specified by the requester was the one executed. Using a different model produces an invalid proof.

### Tamper Resistance

Any modification to the model after circuitization invalidates the proof. The circuit is cryptographically bound to the original model.

### Input Integrity

The proof includes commitments to the input data. Altered inputs produce invalid proofs.

### Output Authenticity

The proof binds the output to the computation. The output cannot be forged or modified.

## Prover-Agnostic Architecture

Subnet 2 is designed to be **prover-agnostic**, supporting multiple zero-knowledge proving systems through a unified orchestration layer.

### DSperse

DSperse is the orchestration layer that manages the full zkML pipeline. It takes ONNX models, slices them into segments for parallel proving, and coordinates execution across backends. The pipeline:

```
Model → Slice → Compile → Run → Prove → Verify
```

### Supported Proving Systems

| System       | Backend                  | Use Case                               |
| ------------ | ------------------------ | -------------------------------------- |
| **JSTprove** | GKR/Expander (Polyhedra) | Fast proof generation for ML inference |
| **Circom**   | Groth16/PLONK            | Custom arithmetic circuits             |

Miners can select backends per-slice, enabling optimization for different model architectures and proof requirements.

### Supported Operations

The proving infrastructure supports standard ML operations: Conv2D, GEMM/MatMul, ReLU, MaxPool, Add, Mul, Sub, BatchNorm, Reshape, Flatten, and more.

## Performance Incentives

Miners on Subnet 2 compete across three dimensions:

| Metric            | Description                                             |
| ----------------- | ------------------------------------------------------- |
| **Proof Size**    | Smaller proofs are more efficient to transmit and store |
| **Response Time** | Faster proof generation earns higher scores             |
| **Accuracy**      | Output quality compared to baseline models              |

This creates an incentive to develop optimized circuits and efficient proving infrastructure.
