Inferensys

Glossary

Witness

The secret auxiliary input known only to the prover that satisfies the constraints of a given circuit, such as private model weights or input data in a zkML context.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
CRYPTOGRAPHIC INPUT

What is a Witness?

The secret auxiliary input known only to the prover that satisfies the constraints of a given circuit, such as private model weights or input data in a zkML context.

In the context of zero-knowledge proofs and arithmetic circuits, a witness is the confidential data that satisfies the constraint system of a specific computation. It represents the prover's private knowledge—such as a valid input, a secret key, or the weights of a machine learning model—that causes the circuit's logical gates to evaluate to true, without which a valid proof cannot be generated.

Unlike public inputs shared with a verifier, the witness remains cryptographically hidden during proof generation. In zkML, the witness typically comprises the private model parameters and the user's input data, enabling a prover to attest to the correctness of an inference via a zkSNARK or zkSTARK without exposing the underlying proprietary model or sensitive information.

CORE PRIMITIVE

Key Characteristics of a Witness

The witness is the secret auxiliary input that satisfies the constraints of an arithmetic circuit, representing the private knowledge the prover must demonstrate without revealing.

01

Definition and Role

A witness is the secret data known only to the prover that satisfies a given constraint system. It is the assignment of values to all intermediate variables (the 'wire values') in an arithmetic circuit that makes the circuit evaluate correctly. In a zkML context, the witness typically includes the private model weights, the input data, and all intermediate activation values generated during a forward pass. The prover's fundamental task is to generate a proof that they possess a valid witness without disclosing it.

02

Witness in zkML Inference

When proving a machine learning inference, the witness encodes the entire execution trace. This includes:

  • Private Inputs: The user's sensitive data (e.g., a medical image).
  • Model Weights: The proprietary parameters of the neural network.
  • Intermediate State: The output of every matrix multiplication and activation function. The prover demonstrates that applying the committed model to the committed input yields a specific public output, all while keeping the witness hidden.
03

Witness Generation

Witness generation is the process of executing the computation to produce the full assignment of wire values. This step is performed by the prover and is typically the most computationally intensive phase of proof generation. The prover runs the actual machine learning model on the input data to calculate every intermediate tensor. These values are then arranged into a vector that satisfies the Rank-1 Constraint System (R1CS) or Plonkish constraint system representing the model's computation.

04

Witness vs. Instance

In zero-knowledge terminology, the computation's inputs are split into two categories:

  • Instance (Public Input): Data known to both the prover and verifier, such as the circuit definition and the claimed output of the inference.
  • Witness (Private Input): Data known only to the prover, such as the model weights and the input data. The proof asserts that for the given public instance, there exists a secret witness that satisfies all constraints.
05

Witness Extension for Lookups

Modern proving systems like Plonk and Halo2 use lookup arguments to optimize non-arithmetic operations. The witness is extended to include entries proving that specific wire values exist within a pre-computed lookup table. For example, an activation function like ReLU can be proven by showing the input-output pair exists in a table of valid ReLU transitions, with the witness containing the necessary sorted and multiplicity data to satisfy the lookup constraint.

06

Soundness and Witness Extraction

A proof system is knowledge-sound if a valid proof implies the prover actually 'knows' a valid witness. Formally, for any prover that generates a convincing proof, there exists an extractor algorithm that can recover the witness by interacting with the prover's internal state. This property guarantees that a valid proof is not a cryptographic fluke but a certificate of genuine computation. In zkSNARKs, this is often proven via knowledge of exponent assumptions.

WITNESS FUNDAMENTALS

Frequently Asked Questions

Clear, technical answers to common questions about the role of the witness in zero-knowledge proof systems, focusing on its application to private model weights and inputs in zkML.

A witness is the secret auxiliary input known only to the prover that satisfies the constraints of a given arithmetic circuit. In the context of zkML, the witness typically consists of the private model weights, the input data, and all intermediate activations generated during a forward pass. The prover's task is to demonstrate knowledge of this witness without revealing its contents, thereby proving that a specific inference was computed correctly on a specific model without exposing the proprietary model or the user's sensitive data. The witness is the 'solution' to the computational puzzle defined by the circuit.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.