Inferensys

Glossary

Garbled Circuits

Garbled circuits are a cryptographic protocol used in secure multi-party computation where a Boolean circuit is encrypted, allowing parties to compute a function on private inputs while revealing only the final output.
Developer demonstrating multi-agent tool use, agent tool selection interface on laptop, casual tech demo moment.
CRYPTOGRAPHIC PROTOCOL

What is Garbled Circuits?

A foundational technique in secure multi-party computation for evaluating functions on private data.

Garbled circuits are a cryptographic protocol enabling secure two-party computation, where one party (the garbler) encrypts a Boolean circuit representing a function, and another party (the evaluator) computes the output on private inputs without learning intermediate values. The protocol ensures that only the final output is revealed, protecting the privacy of each party's input data and the function's internal logic. This makes it a cornerstone for privacy-preserving applications like private set intersection and oblivious transfer.

In practice, the garbler encodes each logic gate's truth table with unique cryptographic keys, producing a garbled circuit. The evaluator then uses oblivious transfer to obtain keys corresponding only to their specific private input bits. By sequentially decrypting the garbled gates, the evaluator computes the final output keys, which are mapped back to plaintext results. While computationally intensive, modern optimizations like the Yao's protocol and Free XOR technique have made garbled circuits practical for complex, privacy-sensitive operations in domains such as genomic analysis and secure auctions.

CRYPTOGRAPHIC PROTOCOL

Key Characteristics of Garbled Circuits

Garbled circuits are a foundational protocol for secure two-party computation, enabling the joint evaluation of a function on private inputs without revealing the inputs or intermediate values.

01

Two-Party Secure Computation

Garbled circuits are a specific protocol for secure two-party computation (2PC). One party, the garbler, encrypts (garbles) a Boolean circuit representing the function to be computed. The other party, the evaluator, receives the garbled circuit and, using oblivious transfer to obtain encrypted input labels, evaluates it to produce an encrypted output, which only the garbler can decrypt. This allows both parties to learn the result while keeping their respective inputs private from each other.

02

Boolean Circuit Representation

The function to be computed must be expressed as a Boolean circuit composed of logic gates (AND, OR, XOR, NOT). Each wire in the circuit is assigned two random cryptographic labels (or keys), one representing logical '0' and one representing '1'. The computation proceeds gate-by-gate in this encrypted form. This requirement means complex functions can become large, deep circuits, impacting performance, which is a key engineering consideration.

03

One-Time Garbling & Oblivious Transfer

A core security property is that a garbled circuit is usable only once. If evaluated on multiple input sets, it would leak information. The garbling scheme (the algorithm for encrypting the circuit) ensures this. Furthermore, the evaluator must obtain the correct input labels for their private inputs without the garbler learning which values they correspond to. This is achieved through a 1-out-of-2 oblivious transfer (OT) protocol for each of the evaluator's input bits.

04

Computational vs. Information-Theoretic Security

Standard garbled circuit constructions provide computational security, relying on cryptographic assumptions like the existence of one-way functions. The garbler's security (hiding the circuit logic) is often information-theoretic, meaning it's secure even against a computationally unbounded evaluator. The evaluator's security (hiding their input) is typically computational, based on the security of the oblivious transfer protocol and the encryption used for the garbled tables.

05

Practical Optimizations (Free XOR, GRR3)

Several optimizations make practical implementation feasible:

  • Free XOR: Allows XOR gates to be garbled and evaluated without cryptographic cost, drastically improving performance for circuits with many XOR gates.
  • Garbled Row Reduction (GRR3): Reduces the size of the encrypted truth table (garbled table) for non-XOR gates from 4 entries to 3 or even 2, cutting communication overhead.
  • Pipelining & Parallelization: The circuit evaluation is highly parallelizable, as each gate can be processed as soon as its input wire labels are available.
06

Use Case: Privacy-Preserving Machine Learning

In privacy-preserving machine learning (PPML), garbled circuits enable secure inference. For example, a client with a private medical image (input) can interact with a server holding a proprietary diagnostic model (the circuit). The server garbles the model circuit, and through oblivious transfer and evaluation, the client learns only the diagnosis (output), while the server learns nothing about the image or the result. This is a concrete application within privacy-preserving RAG for querying encrypted knowledge bases.

COMPARATIVE ANALYSIS

Garbled Circuits vs. Other Privacy Techniques

A comparison of core cryptographic and privacy-preserving techniques used for secure computation on sensitive data, highlighting their distinct mechanisms, trust models, and performance characteristics.

Feature / DimensionGarbled Circuits (GC)Homomorphic Encryption (HE)Differential Privacy (DP)Federated Learning (FL)

Primary Cryptographic Foundation

Symmetric-Key Cryptography (e.g., AES)

Public-Key Cryptography (Lattice-based)

Randomized Algorithms & Noise Addition

Secure Aggregation Protocols

Core Privacy Guarantee

Input & intermediate value secrecy in multi-party computation

Data remains encrypted during computation

Statistical privacy of individuals in aggregated outputs

Raw training data never leaves the client device

Trust Model

Semi-honest (honest-but-curious) adversaries

Untrusted server (cloud)

Untrusted data curator/analyst

Central server coordinates; clients are semi-honest

Computational Overhead

High (circuit garbling & evaluation)

Very High (ciphertext operations)

Low to Moderate (noise injection)

Moderate (local training, secure aggregation)

Communication Overhead

High (transfer of garbled tables)

Low (send encrypted data once)

Low (send noisy statistics)

High (iterative model update exchange)

Supported Operations

Arbitrary Boolean/arithmetic circuits (fixed function)

Addition & multiplication (FHE), limited circuits (SHE)

Aggregate queries (count, sum, mean, histograms)

Distributed gradient-based optimization

Output Type

Deterministic, exact result

Deterministic, exact encrypted result

Noisy, approximate statistic

Trained global model

Primary Use Case in ML/AI

Secure inference on private models/data

Encrypted inference on cloud servers

Privacy-preserving data analysis & model training

Decentralized model training across data silos

Data Movement

Parties exchange cryptographic material

Encrypted data sent to server for processing

Centralized data collection (noisy answers released)

Only model updates (gradients) are shared

Hardware Acceleration Support

Limited (custom FPGA/ASIC possible)

Emerging (specialized HE accelerators)

Not required

GPU/TPU for local client training

GARBLED CIRCUITS

Frequently Asked Questions

Garbled circuits are a foundational cryptographic protocol for secure multi-party computation. This FAQ addresses common technical questions about how they enable private computation on sensitive data.

A garbled circuit is a cryptographic protocol for secure two-party computation that allows two distrusting parties to jointly compute a function on their private inputs without revealing those inputs to each other. It works by one party, the garbler, encrypting (or "garbling") a Boolean circuit representing the function. The other party, the evaluator, then uses a cryptographic technique called oblivious transfer to obtain encrypted labels corresponding only to their private input bits. The evaluator can then propagate these labels through the garbled gates to compute an encrypted output, which can be decrypted by both parties to learn the result, while the intermediate wire values remain hidden.

Key Steps:

  1. Circuit Creation: The function (e.g., f(a, b) = a > b) is represented as a Boolean circuit of logic gates (AND, XOR, etc.).
  2. Garbling: The garbler assigns two random cryptographic keys (labels) to each wire in the circuit: one for a 0 value, one for a 1. For each gate, they create a garbled truth table that encrypts the output wire label using the corresponding pair of input wire labels as keys.
  3. Oblivious Transfer: The evaluator learns only the labels corresponding to their secret input bits, without the garbler learning which bits they were.
  4. Evaluation: The evaluator sequentially decrypts the garbled tables using the labels they hold, propagating values through the circuit to obtain the final output label(s).
  5. Output Decryption: The garbler provides a mapping from output wire labels to plaintext bits (0/1), allowing both parties to decode the final result.
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.