1 of 31

Gazelle & Delphi

2021-10-18

Presenter

Yifan Ning

2 of 31

Agenda

  • Motivation & Background
  • Gazelle
    • Threat Model
    • Architecture Design
    • Major Techniques (PAHE)
    • Evaluation

  • Delphi
    • Motivation
    • Major Techniques
    • Evaluation
  • Discussion

3 of 31

Background - Secure Inference

3

Private Input

(the client)

Private Trained Model

(the server / service provider)

4 of 31

Background - CNN

4

Linear Layers:

  • Convolution Layers
  • Fully Connected Layers

Non-Linear Layers:

  • Activation
  • Max-Pooling

5 of 31

Gazelle - Threat Model

5

Semi-honest

  • Adhere to protocol
  • Attempt to learn other party’s sensitive data

client

server

6 of 31

Gazelle - Security Guarantees

6

Never able to hide the network architecture 100%

Hides:

  • Client input
  • Network weights
  • Filter & Stride size of convolution

Doesn’t hide:

  • Number of layers
  • Size of each layer
  • Client’s Input size

7 of 31

Gazelle - Inefficiencies from previous work

7

Use one scheme for both linear and non-linear layers

  • 2PC (Garbled Circuit / Secret Sharing)
    • Efficient Computation
    • Expensive Communication cost

  • Homomorphic Encryption
    • Cheap Communication
    • Large Computation on server

8 of 31

Gazelle - Inefficiencies from previous work

8

  • Garbled Circuit / Secret Sharing
    • Better when generated circuit size is small / linear to input

  • Homomorphic Encryption
    • Better when multiplicative depth is small
    • Or large circuit size (eg. quadratic to input)

Non-Linear Layers

Linear Layers

Non-Linear Layers

Linear Layers

9 of 31

Gazelle - Key Ideas

Switch (customized) Schemes for Linear / Non-Linear Layers!

10 of 31

Gazelle - Key Ideas

  • For linear layer: Packed Additively Homomorphic Encryption (PAHE)

  • For non-linear layers: Garbled Circuit

  • Use Secret Sharing to patch different layers together and switch accordingly

11 of 31

Gazelle - Protocol Overview

11

GC to PAHE

PAHE Enc

PAHE Eval (Kernel)

PAHE to GC

PAHE Dec

Conv/FC Layer (PAHE)

Cy

[ Cy ]

Sy

[ y ] = [ Cy ] + [ Sy ]

[ x ]

[ Cx ] = [x + r]

Eval GC

Send Labels

Cx

sx = r

{ sx }, { sy },

Cy

sy

RELU Layer (GC)

Client

Server

a: plaintext

[a]: ciphertext

{a}: GC label

12 of 31

Gazelle - PAHE Abstraction

12

  • Fit plaintext into “slot” vectors, which hold the content plus some noise for security.
  • Supported Operations:
    • SIMDAdd: SIMD homomorphic addition
    • SIMDScMult: SIMD homomorphic scalar multiplication (between a ciphertext and a plaintext)
    • Perm (Automorphism): Plaintext slots permutation, mostly just rotation

13 of 31

Gazelle - PAHE Techniques - FC Layer

13

Fast Homomorphic Matrix Multiplication, the naive way

  • Setup:
    • plaintext weight matrix W, shape n0 * ni
    • Input vector v, shape ni
    • Wants to evaluate W*v
    • Each slot is length n, holding some plaintext vector (plus some noise for security)

14 of 31

Gazelle - PAHE Techniques - FC Layer

14

Fast Homomorphic Matrix Multiplication, the naive way

  • Process
    • For each row wi of W, pad it to length n
    • SIMDScMult: [wi * v], gives component-wise product vector, need its sum
    • Rotate by half and sum
    • repeat for all n0 rows
  • Cost: n0 * SIMDScMult + n0logn rotations + n0logn SIMD additions
  • Shortcomings:
    • Produces n0 ciphertext for one component of result
    • Leads to communication quadratic to input size

15 of 31

Gazelle - PAHE Techniques - FC Layer

15

Fast Homomorphic Matrix Multiplication, input packing

  • A small trick: when ni << n, rather than wasting a lot of space padding, packing n/ni rows into one plaintext vector, and n/ni copies of input vector into one ciphertext vector
  • Perform rotations block by block
  • Now number of rows change from n0 to n0 * ni / n

16 of 31

Gazelle - PAHE Techniques - FC Layer

16

Fast Homomorphic Matrix Multiplication, the diagonal way

  • Rationale: Arrange elements in a way such that after SIMDScMult, numbers need to added together never appear in same ciphertext, saving rotation
  • Process
    • Encode main diagonal a vector that will later SIMDScMult with input, encode every diagonal above or below SIMDScaMult with rotated input
  • Cost: ni * SIMDScMult + (ni-1) rotations + (ni-1) SIMD additions, and now the output produces a single ciphertext that has the entire output vector in packed form.
  • Shortcoming:
    • Noise grows for some amount compared to naive method, due to doing rotation before SIMDScMult, but still acceptable.

17 of 31

Gazelle - PAHE Techniques - FC Layer

17

Fast Homomorphic Matrix Multiplication, the hybrid way

  • In reality, weight matrix W of shape n0 * ni is usually rectangular, with ni >> n0
  • For diagonal method, rotation is in ni , not desirable
  • Combine both, pack the weights along these extended diagonals into plaintext vectors
  • Now we have n0 number of input vector rotation before scalar multiplication
  • Benchmarks show it almost always outperforms simple naive / diagonal

18 of 31

Gazelle - PAHE Techniques - Conv Layer

18

  • Techniques for convolution layer is similar to FC, except some adaptations specially for the operation of convolution

19 of 31

Gazelle - Evaluation

19

10~20x runtime speedup

10~100x less bandwidth

20 of 31

Gazelle - Evaluation

20

10~20x runtime speedup

10~100x less bandwidth

21 of 31

Delphi - Intro

22 of 31

Delphi - Intro

  • achieves semi-honest simulation-based security

  • supports arbitrary CNNs

  • Efficiency:
    • improves bandwidth (9x) and inference latency (22x)
    • can utilize GPU/TPU for linear layers
    • evaluated on realistic workloads (CIFAR-100, ResNet-32)

23 of 31

Delphi - Motivation

24 of 31

Delphi - Major Techniques

25 of 31

Delphi - Major Techniques

It would be great if we can replace some RELUs with quadratic activations, which are cheap in 2PC

Using quadratic activation affects accuracy

26 of 31

Delphi - Major Techniques

Use Network Architecture Search to figure out the right amount of RELUs to replace while maintaining certain accuracy threshold!

27 of 31

Delphi - Architecture

28 of 31

Delphi - Evaluation

29 of 31

Delphi - Evaluation

30 of 31

Clarifying Questions

  • How does model training work in this setting? Does it just proceed in the non private approach.

  • This might be out of scope of this paper, but are arithmetic circuits or boolean circuits better for matrix multiplication? I would assume that arithmetic circuits are better for multiplication. If my assumption is correct, why do the authors use boolean circuits for their kernels and non-linear layers?

31 of 31

Discussion Questions

  • Could this system be used for non linear networks? (iex, l1 = f1(x), l2 = f2(l1), l3 = f3(l1,l2))

  • The authors only consider semi-honest corruptions. Can their protocol be compiled into a malicious-secure protocol without incurring too many zero knowledge proofs (the GMW compiler would require one proof per message)?

  • Why do the authors use a boolean circuit when evaluating the non-linear layer instead of using the proposed methods from SecureML (mpc friendly activation functions + arithmetic circuits). What are the trade-offs here?

  • The paper mainly mentions the model with one client and one server. However, in many modern use cases, many users can share the same ML model by contributing their input data securely. How well does Gazelle apply to that setting?