Approximate Homomorphic Encryption and Privacy Preserving ...Β Β· β€’ Idea1: Restriction of domain...

50
Jung Hee Cheon (SNU, CryptoLab ) Approximate Homomorphic Encryption and Privacy Preserving Machine Learning Thanks to YongSoo Song, Kiwoo Lee, Andrey KIM

Transcript of Approximate Homomorphic Encryption and Privacy Preserving ...Β Β· β€’ Idea1: Restriction of domain...

Jung Hee Cheon (SNU, CryptoLab)

Approximate Homomorphic Encryption and Privacy Preserving Machine Learning

Thanks to YongSoo Song, Kiwoo Lee, Andrey KIM

1. Homomorphic Encryption2. HEAAN3. Bootstrapping of HEAAN4. Toolkit for Homomorphic Computation

Outline

Integer-based HE scheme

- RAD PH[1]

β€’ (Secret Key, Operation Key) = (a large prime 𝑝, 𝑛 = π‘π‘ž0)β€’ Encryption: 𝐸𝑛𝑐 π‘š = π‘š + π‘π‘ž π‘šπ‘œπ‘‘ 𝑛‒ Decryption: 𝐸𝑛𝑐 π‘š π‘šπ‘œπ‘‘ 𝑝 = π‘šβ€’ 𝐸𝑛𝑐 π‘š1 + 𝐸𝑛𝑐 π‘š2 = π‘š1 + π‘π‘ž1 + π‘š2 + π‘π‘ž2

= π‘š1 +π‘š2 + 𝑝 π‘ž1 + π‘ž2= 𝐸𝑛𝑐 π‘š1 +π‘š2

- DGHV HE scheme (on β„€2)[2]

β€’ 𝐸𝑛𝑐(π‘š ∈ 𝑍2100) = π‘š + 2100𝑒 + π‘π‘žβ€’ SECURE against quantum computingβ€’ Use a polynomial ring π‘…π‘ž = β„€π‘ž[π‘₯]/(π‘₯𝑛 + 1)

Homomorphic Encryption

But, INSECURE!

2100𝑒1 π‘š1

2100𝑒2 π‘š2

2200𝑒1𝑒2 + 2100 π‘š1𝑒2 +π‘š2𝑒1 + π‘š1π‘š2

X

- On Polynomials (RingLWE)β€’ [Gen09] ideal latticeβ€’ NTRU: LTV12β€’ Ring-LWE: BV11b, GHS13, BLLN13, HEAAN etc

- On Integers (AGCD)β€’ [DGHV10] FHE over the Integers. Eurocrypt 2010β€’ CMNT11, CNT12, CCKLLTY13, CLT14, etc

- On Matrices (LWE)β€’ [BV11a] Efficient FHE from (Standard) LWE. FOCS11β€’ Bra12, BGV12, GSW13

Fully Homomorphic Encryption

1. 2009~2012: Plausibility and Scalable for Large Circuitsβ€’ [GH11] A single bit bootstrapping takes 30 minutesβ€’ [GHS12b] 120 blocks of AES-128 (30K gates) in 36 hours

2. 2012~2015: Depth-Linear Constructionβ€’ [BGV12] Modulus/Key Switchingβ€’ [Bra12] Scale Invariant Schemeβ€’ [HS14] IBM's open-source library Helib: AES evaluation in 4 minutes

3. 2015~Today: Usabilityβ€’ Various schemes with different advantages (HEAAN, TFHE)β€’ Real-world tasks: Big data analysis, Machine learningβ€’ Competitions for Private Genome Computation (iDash, 2014~)β€’ HE Standardization meetings (2017~)

Continued on next page

Summary of Progress in HE

Standardization: HomomorphicEncryption.org

1st Workshop (2017.7.13-14) 2nd Workshop (2018.3.15-16) 3rd Workshop (2018.10.20)

Jul 2017 in Microsoft, Redmond

Mar 2018 in MIT

Oct 2018 in Toronto

Best Performing HE Schemes

Type Classical HE Fast Bootstrapping Approximate Computation

Scheme[BGV12] BGV

[Bra12, FV12] B/FV[DM15] FHEW[CGGI16] TFHE

[CKKS17] HEAAN

PlaintextFinite Field

PackingBinary string

Real/Complex numbers

Packing

Operation Addition, Multiplication Look-up table & bootstrapping Fixed-point Arithmetic

LibraryHElib (IBM)

SEAL (Microsoft Research)

Palisade (Duality inc.)

TFHE(Inpher, Gemalto, etc.)

HEAAN (SNU)

Homomorphic Encryption

2. HEAAN: Approximate Homomorphic Encryption

Exact Multiplication

1.23

4.56

0.78

0.91

5.6088

0.7098

3.98112624

2.34

5.67

8.91

0.23

13.2678

2.0493

27.18970254

108.2456382397886496

- The plaintext size is doubled after a multiplication.2 4

8

16

Approximate Multiplication

HEAAN [CKKS17]β€’ Rescale after a multiplicationβ€’ Tracing # of significandsβ€’ Most data is processed approximately in Data analysis or ML

1.23

4.56

0.78

0.91

5.6188

0.7198

3.98112624

2.34

5.67

8.91

0.23

13.2778

2.0593

27.19970254

108.2556382397886496

2 2

2

2

HEAAN = ζ…§ηœΌ = Insightful Minds

[CKKS, AC17] Homomorphic Encryption for Arithmetic of Approximate Numbershttps://eprint.iacr.org/2016/421.pdf

Numerical Representation

- Encode π‘š into an integer π‘š β‰ˆ 𝑝π‘₯ for a scaling factor 𝑝 : 2 ↦ 1412 β‰ˆ 2 β‹… 103

- Fixed–Point Multiplicationβ€’ Compute π‘š = π‘š1π‘š2 and extract its significant digits π‘šβ€² β‰ˆ π‘βˆ’1 β‹… π‘š

: 1.234 Γ— 5.678 = 1234 β‹… 10βˆ’3 Γ— 5678 β‹… 10βˆ’3 = 7006652 β‹… 10βˆ’6 ↦ 7007 β‹… 10βˆ’3 = 7.007

Previous HE on LWE problem (Regev, 2005)

β€’ ct = Encsk π‘š , ct, sk =π‘ž

π‘‘π‘š + 𝑒 mod π‘ž

β€’ Modulo 𝑑 plaintext vs Rounding operation

Approximate Computation

π‘š

π‘ž/𝑑

𝑒

𝑑

A New Message Encodingβ€’ ct = Encsk π‘š , ct, sk = π‘π‘š + 𝑒 mod π‘ž

β€’ Consider 𝑒 as part of approximation error

Homomorphic Operations

Support for the (approximate) fixed-point arithmetic

- Leveled HE : π‘ž = 𝑝𝐿

HEAAN

Input πœ‡1 β‰ˆ π‘π‘š1, πœ‡2 β‰ˆ π‘π‘š2

Addition πœ‡1 + πœ‡2 β‰ˆ 𝑝 β‹… (π‘š1 +π‘š2)

Multiplication πœ‡ = πœ‡1πœ‡2 β‰ˆ 𝑝2 β‹… π‘š1π‘š2

Rounding πœ‡β€² β‰ˆ π‘βˆ’1 β‹… πœ‡ β‰ˆ 𝑝 β‹… π‘š1π‘š2

πœ‡1 = π‘π‘š1 + 𝑒1

π‘žπœ‡2 = π‘π‘š2 + 𝑒2

πœ‡ = 𝑝2π‘š1π‘š2 + 𝑒

πœ‡β€² = 𝑝 β‹… π‘š1π‘š2 + 𝑒′

π‘ž/𝑝

Construction over the ringβ€’ A single ctx can encrypt a vector of plaintext values 𝑧 = (𝑧1, 𝑧2, … , 𝑧ℓ)β€’ Parallel computation in a SIMD manner 𝑧 βŠ—π‘€ = (𝑧1𝑀1, 𝑧2𝑀2, … , 𝑧ℓ𝑀ℓ)

HEAAN Packed Ciphertext

Continued on next page

Let 𝑅 = β„€ 𝑋 𝑋𝑛 + 1 and π‘…π‘ž = 𝑅 mod π‘ž = β„€π‘ž 𝑋 𝑋𝑛 + 1

β€’ A ciphertext can encrypt a polynomial π‘š 𝑋 ∈ 𝑅‒ Note (m0+m1X+ … ) (m0’+m1’X+ … )= m0m0’+(m0m1’ +m0’m1)X+…

β€’ Decoding/Encoding function𝑅 = β„€ 𝑋 𝑋𝑛 + 1 βŠ† ℝ 𝑋 𝑋𝑛 + 1 β†’ ℂ𝑛/2

where 𝑋𝑛 + 1 = 𝑋 βˆ’ 𝜁1 𝑋 βˆ’ 𝜁1βˆ’1 𝑋 βˆ’ 𝜁2 𝑋 βˆ’ 𝜁2

βˆ’1 β‹― 𝑋 βˆ’ 𝜁 𝑛 2 𝑋 βˆ’ 𝜁 𝑛 2βˆ’1

β€’ Example: 𝑛 = 4, 𝜁1 = 𝑒π‘₯𝑝(πœ‹π‘–/4), 𝜁2 = 𝑒π‘₯𝑝(5πœ‹π‘–/4)

β€’ 𝑧 = 1 βˆ’ 2𝑖, 3 + 4𝑖 ↦ π‘š 𝑋 = 2 βˆ’ 2 2 𝑋 + 𝑋2 βˆ’ 2 𝑋3

β€’ ↦ πœ‡ 𝑋 = 2000 βˆ’ 2828𝑋 + 1000𝑋2 βˆ’ 1414 𝑋3

β€’ πœ‡ 𝜁1 β‰ˆ 1000.15 βˆ’ 1999.55 𝑖, πœ‡ 𝜁2 β‰ˆ 2999.85 + 3999.55 𝑖

RLWE-based HEAAN

π‘š 𝑋 ↦ 𝑧 = 𝑧1, … , π‘§π‘›βˆ•2 , 𝑧𝑖 = πœ‡ πœπ‘– ,

3. Bootstrapping of HEAAN

Bootstrapping

DecryptionπΈπ‘›π‘π‘˜(𝐾)

𝐸𝑛𝑐(𝑐)

c = πΈπ‘›π‘π‘˜(π‘š; π‘Ÿ)

𝐾

π‘š

πΈπ‘›π‘π‘˜ π‘š; π‘Ÿβ€² , π‘Ÿβ€²: small

Safe Box

[1] Cheon-Han-Kim-Kim-Song: Bootstrapping for Approximate Homomorphic Encryption. EUROCRYPT 2018

β€’ Old Ciphertext with large noise

β€’ Encrypted Secret Key

β€’ New ciphertext with small noise

β€’ Evaluate Decrypt circuit

Input

Output

Process

β€’ Ciphertexts of a leveled HE have a limited lifespanβ€’ Refresh a ciphertext ct = Encsk π‘š

by evaluating the decryption circuit homomorphically: Decsk ct = π‘š ⟺ 𝐹ct sk = π‘š where 𝐹ct βˆ— = Decβˆ— ct

β€’ Bootstrapping key BK = Encsk(sk): 𝐹ct BK = 𝐹ct Encsk sk = Encsk 𝐹ct sk = Encsk(π‘š)

β€’ Homomorphic operations introduce errors Fine: 𝐹ct BK = 𝐹ct Encsk sk = Encsk 𝐹ct sk + 𝑒 = Encsk(π‘š + 𝑒)

β€’ How to evaluate the decryption circuit (efficiently)?: Decsk ct = ct, sk (mod π‘ž)

Bootstrapping

π·π‘’π‘π‘ π‘˜ 𝑐𝑑 ↦ 𝑑 = 𝑐𝑑, π‘ π‘˜ ↦ 𝑑 π‘ž = πœ‡,

𝑑 = π‘žπΌ + πœ‡ for some 𝐼 < 𝐾

β€’ NaΓ―ve solution: polynomial interpolation on [βˆ’πΎπ‘ž, πΎπ‘ž]β€’ Huge depth, complexity & inaccurate result

Approximate Decryption

π·π‘’π‘π‘ π‘˜ 𝑐𝑑 ↦ 𝑑 = 𝑐𝑑, π‘ π‘˜ ↦ 𝑑 π‘ž = πœ‡,

𝑑 = π‘žπΌ + πœ‡ for some 𝐼 < 𝐾

β€’ Idea1: Restriction of domain πœ‡ β‰ͺ π‘ž

Approximate Decryption

β€’ Idea1: Restriction of domain πœ‡ β‰ͺ π‘ž

β€’ Idea 2: Sine approximation πœ‡ β‰ˆπ‘ž

2πœ‹sin πœƒ for πœƒ =

2πœ‹

π‘žπ‘‘ (period:π‘ž , slope at 0=1)

π‘ž

1

π·π‘’π‘π‘ π‘˜ 𝑐𝑑 ↦ 𝑑 = 𝑐𝑑, π‘ π‘˜ ↦ 𝑑 π‘ž = πœ‡,

𝑑 = π‘žπΌ + πœ‡ for some 𝐼 < 𝐾

Approximate Decryption

Sine Evaluation

Bootstrapping of HEAAN

Sine Evaluation

- Direct Taylor approximationβ€’ Huge depth & complexity

Bootstrapping of HEAAN

Sine Evaluation

- Direct Taylor approximationβ€’ Huge depth & complexity

- Idea 1: Low-degree approx. near 0

β€’ 𝐢0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜ ! πœƒ 2π‘Ÿ 2π‘˜ β‰ˆ cos πœƒ 2π‘Ÿ

β€’ 𝑆0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜+1 ! πœƒ 2π‘Ÿ 2π‘˜+1 β‰ˆ sin( πœƒ 2π‘Ÿ)

0

Bootstrapping of HEAAN

Sine Evaluation

- Direct Taylor approximationβ€’ Huge depth & complexity

- Idea 1: Low-degree approx. near 0

β€’ 𝐢0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜ ! πœƒ 2π‘Ÿ 2π‘˜ β‰ˆ cos πœƒ 2π‘Ÿ

β€’ 𝑆0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜+1 ! πœƒ 2π‘Ÿ 2π‘˜+1 β‰ˆ sin( πœƒ 2π‘Ÿ)

- Idea 2: Iterate by double-angle formula

β€’ πΆπ‘˜+1 πœƒ = πΆπ‘˜2 πœƒ βˆ’ π‘†π‘˜

2 πœƒ , π‘†π‘˜+1 πœƒ = 2π‘†π‘˜ πœƒ β‹… πΆπ‘˜ πœƒ

1

Bootstrapping of HEAAN

Sine Evaluation

- Direct Taylor approximationβ€’ Huge depth & complexity

- Idea 1: Low-degree approx. near 0

β€’ 𝐢0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜ ! πœƒ 2π‘Ÿ 2π‘˜ β‰ˆ cos πœƒ 2π‘Ÿ

β€’ 𝑆0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜+1 ! πœƒ 2π‘Ÿ 2π‘˜+1 β‰ˆ sin( πœƒ 2π‘Ÿ)

- Idea 2: Iterate by double-angle formula

β€’ πΆπ‘˜+1 πœƒ = πΆπ‘˜2 πœƒ βˆ’ π‘†π‘˜

2 πœƒ , π‘†π‘˜+1 πœƒ = 2π‘†π‘˜ πœƒ β‹… πΆπ‘˜ πœƒ

2

Bootstrapping of HEAAN

Sine Evaluation

- Direct Taylor approximationβ€’ Huge depth & complexity

- Idea 1: Low-degree approx. near 0

β€’ 𝐢0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜ ! πœƒ 2π‘Ÿ 2π‘˜ β‰ˆ cos πœƒ 2π‘Ÿ

β€’ 𝑆0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜+1 ! πœƒ 2π‘Ÿ 2π‘˜+1 β‰ˆ sin( πœƒ 2π‘Ÿ)

- Idea 2: Iterate by double-angle formula

β€’ πΆπ‘˜+1 πœƒ = πΆπ‘˜2 πœƒ βˆ’ π‘†π‘˜

2 πœƒ , π‘†π‘˜+1 πœƒ = 2π‘†π‘˜ πœƒ β‹… πΆπ‘˜ πœƒ

3

Bootstrapping of HEAAN

Sine Evaluation

- Direct Taylor approximationβ€’ Huge depth & complexity

- Idea 1: Low-degree approx. near 0

β€’ 𝐢0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜ ! πœƒ 2π‘Ÿ 2π‘˜ β‰ˆ cos πœƒ 2π‘Ÿ

β€’ 𝑆0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜+1 ! πœƒ 2π‘Ÿ 2π‘˜+1 β‰ˆ sin( πœƒ 2π‘Ÿ)

- Idea 2: Iterate by double-angle formula

β€’ πΆπ‘˜+1 πœƒ = πΆπ‘˜2 πœƒ βˆ’ π‘†π‘˜

2 πœƒ , π‘†π‘˜+1 πœƒ = 2π‘†π‘˜ πœƒ β‹… πΆπ‘˜ πœƒ

4

Bootstrapping of HEAAN

Sine Evaluation

- Direct Taylor approximationβ€’ Huge depth & complexity

- Idea 1: Low-degree approx. near 0

β€’ 𝐢0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜ ! πœƒ 2π‘Ÿ 2π‘˜ β‰ˆ cos πœƒ 2π‘Ÿ

β€’ 𝑆0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜+1 ! πœƒ 2π‘Ÿ 2π‘˜+1 β‰ˆ sin( πœƒ 2π‘Ÿ)

- Idea 2: Iterate by double-angle formula

β€’ πΆπ‘˜+1 πœƒ = πΆπ‘˜2 πœƒ βˆ’ π‘†π‘˜

2 πœƒ , π‘†π‘˜+1 πœƒ = 2π‘†π‘˜ πœƒ β‹… πΆπ‘˜ πœƒ

5

Bootstrapping of HEAAN

Sine Evaluation

- Direct Taylor approximationβ€’ Huge depth & complexity

- Idea 1: Low-degree approx. near 0

β€’ 𝐢0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜ ! πœƒ 2π‘Ÿ 2π‘˜ β‰ˆ cos πœƒ 2π‘Ÿ

β€’ 𝑆0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜+1 ! πœƒ 2π‘Ÿ 2π‘˜+1 β‰ˆ sin( πœƒ 2π‘Ÿ)

- Idea 2: Iterate by double-angle formula

β€’ πΆπ‘˜+1 πœƒ = πΆπ‘˜2 πœƒ βˆ’ π‘†π‘˜

2 πœƒ , π‘†π‘˜+1 πœƒ = 2π‘†π‘˜ πœƒ β‹… πΆπ‘˜ πœƒ

6

Bootstrapping of HEAAN

Sine Evaluation

- Direct Taylor approximationβ€’ Huge depth & complexity

- Idea 1: Low-degree approx. near 0

β€’ 𝐢0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜ ! πœƒ 2π‘Ÿ 2π‘˜ β‰ˆ cos πœƒ 2π‘Ÿ

β€’ 𝑆0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜+1 ! πœƒ 2π‘Ÿ 2π‘˜+1 β‰ˆ sin( πœƒ 2π‘Ÿ)

- Idea 2: Iterate by double-angle formula

β€’ πΆπ‘˜+1 πœƒ = πΆπ‘˜2 πœƒ βˆ’ π‘†π‘˜

2 πœƒ , π‘†π‘˜+1 πœƒ = 2π‘†π‘˜ πœƒ β‹… πΆπ‘˜ πœƒ

7

Bootstrapping of HEAAN

Sine Evaluation

- Direct Taylor approximationβ€’ Huge depth & complexity

- Idea 1: Low-degree approx. near 0

β€’ 𝐢0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜ ! πœƒ 2π‘Ÿ 2π‘˜ β‰ˆ cos πœƒ 2π‘Ÿ

β€’ 𝑆0 πœƒ = π‘˜=0𝑑 βˆ’1 π‘˜

2π‘˜+1 ! πœƒ 2π‘Ÿ 2π‘˜+1 β‰ˆ sin( πœƒ 2π‘Ÿ)

- Idea 2: Iterate by double-angle formulaβ€’ πΆπ‘˜+1 πœƒ = πΆπ‘˜

2 πœƒ βˆ’ π‘†π‘˜2 πœƒ , π‘†π‘˜+1 πœƒ = 2π‘†π‘˜ πœƒ β‹… πΆπ‘˜ πœƒ

β€’ Numerically stable & Linear complexityπ‘†π‘Ÿ πœƒ β‰ˆ sin πœƒ

8

Bootstrapping of HEAAN

Iteration vs Direct Computation

- π‘†π‘Ÿ(πœƒ) is obtained from 𝑆0(πœƒ) and 𝐢0(πœƒ) by π‘Ÿ iterationsβ€’ One computation of Double–angle formula: 2 squarings + 1 additionβ€’ π‘Ÿ iterations take 2π‘Ÿ squarings + π‘Ÿ additionsβ€’ Degree of π‘†π‘Ÿ(πœƒ) β‰ˆ 2π‘Ÿ

- Direct Taylor Approximationβ€’ 2π‘Ÿ multiplications to get 2π‘Ÿ degree approximation 𝑇2π‘Ÿ of sine function

Bootstrapping of HEAAN

Slot-Coefficient Switching

- Ring–based HEAANβ€’ Homomorphic operations on plaintext slots, not on coefficientsβ€’ We need to perform the modulo reduction on coefficients

- Pre/post computation before/after sine evaluationβ€’ Depth consumption: Sine evaluationβ€’ Complexity: Slot-Coefficient switchings (# of slots)

- Performance of Bootstrapping

- Experimental Resultsβ€’ 127 + 12 = 139 s / 128 slotsΓ—12 bitsβ€’ 456 + 68 = 524 s / 128 slotsΓ—24 bits

Coefficient Plaintext Slots

ℝ 𝑋 𝑋𝑛 + 1 β„‚ 𝑛 2

𝑑 𝑋 = π‘ž β‹… 𝐼 𝑋 + πœ‡(𝑋)

(𝑑0, 𝑑1, … π‘‘π‘›βˆ’1)

(πœ‡0, πœ‡1, … , πœ‡π‘›βˆ’1)

πœ‡ 𝑋 = πœ‡0 +β‹―+ πœ‡π‘›βˆ’1π‘‹π‘›βˆ’1

β‘  coeff to slotβ‘‘ sine eval

β‘’ slot to coeff

Bootstrapping of HEAAN

Speed of FHE

2011 2013 2014 2015 2016 2018

1-bit Amortized

1bit, 1800s

1bit, 0.7s

1bit, 0.052s

*120s, 250K bit

172s, 531bit 320s, 16K bit

1800s β†’ 0.05s (1bit) 1800s β†’ 0.00046s (Amortized)

: 30K~300K times

*[CHH18]Faster Homomorphic Discrete Fourier Transforms and Improved FHE Bootstrapping, eprint, 1073, 2018/ Intel Xeon CPU E5-2620 2.10GHz, 64RAM

[GH11] Implementing Gentry’s Fully-Homomorphic Encryption Scheme, Eurocrypt 2011.[CCK+13] Batch Fully Homomorphic Encryption over the Integers, Eurocrypt 2013.[CLT14] Scale-Invariant Fully Homomorphic Encryption over the Integers, PKC 2014.[HS15] Bootstrapping for Helib, Eurocrypt 2015[DM15] FHEW: Boostrapping Homomorpic Encryption in Less Than a Second, Eurocrypt 2015.[CGGI16] Faster Fully Homomorphic Encryption: Bootstrapping in less than 0.1 Seconds, Asiacrypt 2016.

Secure Genome Analysis Competition

Hosted by Sponsored by AIM

Privacy Preserving Genom Analysis

Slide Courtesy of Xiaoqian Jiang (β–³ = too small iteration β†’ hard to adapt for other data)

Rank

1

3

β–³

β–³2

X

X

2017 Track 3: Logistic Regression Training on Encrypted Data

2018 Track 2 : Secure Parallel Genome Wide Association Studies using HE

Team Submission Schemes

End to End Performance Evaluation result ( F1- Score ) at different cutoffs

Running

time

(mins)

Peak

Memory (M)

0.01 0.001 0.0001 0.00001

Gold Semi Gold Semi Gold Semi Gold Semi

A*FHE

A*FHE -1 +

HEAAN

922.48 3,777 0.977 0.999 0.986 0.999 0.985 0.999 0.966 0.998

A*FHE -2 1,632.97 4,093 0.882 0.905 0.863 0.877 0.827 0.843 0.792 0.826

ChimeraVersion 1 + TFHE & HEAAN

(Chimera)

201.73 10,375 0.979 0.993 0.987 0.991 0.988 0.989 0.982 0.974

Version 2 215.95 15,166 0.339 0.35 0.305 0.309 0.271 0.276 0.239 0.253

Delft BlueDelft Blue

HEAAN1,844.82 10,814 0.965 0.969 0.956 0.944 0.951 0.935 0.884 0.849

UC San

Diego

Logistic Regr + HEAAN 1.66 14,901 0.983 0.993 0.993 0.987 0.991 0.989 0.995 0.967

Linear Regr 0.42 3,387 0.982 0.989 0.980 0.971 0.982 0.968 0.925 0.89

Duality IncLogistic Regr +

CKKS (Aka HEAAN),

pkg: PALISADE

3.8 10,230 0.982 0.993 0.991 0.993 0.993 0.991 0.990 0.973

Chi2 test 0.09 1,512 0.968 0.983 0.981 0.985 0.980 0.985 0.939 0.962

Seoul

National

University

SNU-1

HEAAN

52.49 15,204 0.975 0.984 0.976 0.973 0.975 0.969 0.932 0.905

SNU-2 52.37 15,177 0.976 0.988 0.979 0.975 0.974 0.969 0.939 0.909

IBMIBM-Complex CKKS

(Aka HEAAN),

pkg: HElIb

23.35 8,651 0.913 0.911 0.169 0.188 0.067 0.077 0.053 0.06

IBM- Real 52.65 15,613 0.542 0.526 0.279 0.28 0.241 0.255 0.218 0.229

Slide Courtesy of Xiaoqian Jiang

4. Toolkit for Homomorphic Computation

Packing Method

- HEAAN supports vector operations- How can we compute matrix operations for ciphertexts?

- Matrix Encoding method

How to Pack

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

Encode

1 2 β‹― 16𝑐 = 𝐸𝑛𝑐( )

Packing Method

- Matrix addition : trivial- Matrix multiplication : non-trivial (exercise)- Row/column rotation?

How to rotate

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

4 1 2 3

8 5 6 7

12 9 10 11

16 13 14 15

π‘Ÿπ‘œπ‘‘ 𝑐, 1 = 𝐸𝑛𝑐( 16 1 β‹― 15 ) =

16 1 2 3

4 5 6 7

18 9 10 11

12 13 14 15

(wrong)

Packing Method

- Solution : using masking vector

How to rotate

16 1 2 3

4 5 6 7

8 9 10 11

12 13 14 15

βŠ™

0 1 1 1

0 1 1 1

0 1 1 1

0 1 1 1

=

0 1 2 3

0 5 6 7

0 9 10 11

0 13 14 15

π‘Ÿπ‘œπ‘‘ 𝑐, 1 βŠ™π‘šπ‘Žπ‘ π‘˜ =

4 5 6 7

8 9 10 11

12 13 14 15

16 1 2 3

βŠ™

1 0 0 0

1 0 0 0

1 0 0 0

1 0 0 0

=

4 0 0 0

8 0 0 0

12 0 0 0

16 0 0 0

π‘Ÿπ‘œπ‘‘ 𝑐, βˆ’3 βŠ™π‘šπ‘Žπ‘ π‘˜β€² =

∴ πΆπ‘œπ‘™π‘…π‘œπ‘‘ (𝑐) = π‘Ÿπ‘œπ‘‘ 𝑐, 1 βŠ™π‘šπ‘Žπ‘ π‘˜ + π‘Ÿπ‘œπ‘‘ 𝑐, βˆ’3 βŠ™π‘šπ‘Žπ‘ π‘˜β€² =

4 1 2 3

8 5 6 7

12 9 10 11

16 13 14 15

Message Space

- Bit-wise HE: β„€2={0,1} with logical gatesβ€’ Good at gate operations but slow at arithmetic.

- Word-wise HE: β„‚ or ℀𝑝 with add. & mult.

β€’ Good at poly evaluation but hard to evaluate non-poly function.

Idea: Use Polynomial Approximation for Non-Poly Functions!- Don’t use naΓ―ve Taylor Approx. It is local i.e. approx at a point- Minimize errors on an interval- Methods: Least Square, Chevyshev, Minimax …

Polynomial Approximation

Application : Homomorphic Logistic Regression [HHCP]- Need to evaluate sigmoid function : 1/(1+exp(-x))

Real Financial Large Data (Provided by KCB) About 400,000 samples with 200 features. Target value = β€œcredit score”

Polynomial Approximation

Idea: πΆπ‘œπ‘šπ‘ π‘Ž, 𝑏 = limπ‘˜β†’βˆž

π‘Žπ‘˜

π‘Žπ‘˜+π‘π‘˜for a,b>0

1. Compute approximately (Take only the msb of the results)

2. Choose k as a power of 2

3. Use iteration algorithms for division

Comparison

Method Scheme(Amortized)Running time

# of pairs Error

Bit-wiseHElib β‰ˆ 1 ms 1800

0TFHE β‰ˆ 1 ms -

Ours (Word-wise)

HEAAN 0.73 ms 216 < 2-8

General Max

π‘€π‘Žπ‘₯ π‘Ž1, … , π‘Žπ‘‘ = limπ‘˜β†’βˆž

π‘Ž1π‘˜+1+β‹―+π‘Ž

π‘‘π‘˜+1

π‘Ž1π‘˜+β‹―+π‘Ž

π‘‘π‘˜ for ai>0

2nd π‘€π‘Žπ‘₯ π‘Ž1, … , π‘Žπ‘‘ = limπ‘˜β†’βˆž

π‘Ž1π‘˜+1+β‹―+π‘Ž

π‘‘π‘˜+1βˆ’π‘šπ‘Žπ‘₯π‘˜+1

π‘Ž1π‘˜+β‹―+π‘Ž

π‘‘π‘˜βˆ’π‘šπ‘Žπ‘₯π‘˜

Applications: k-max, threshold counting, clustering, …

Min/Max

Fast\Merge Sort: O(klogk)

- Comparison-based algorithm doesn’t work on HE- We cannot check min-max condition

Sorting Network: O(klog2k)

- Comparison network that always sort their inputs- Data-independent algorithm

Results

- 64 slots : about 12 min. (previous work : 42 min. [EGN+15])- 32,768 slots : about 10.5 hour (previous work: impractical)

Sorting on Encrypted Data

Basic Tools:

Packing, Matrix Operation, Comparison, Approximate inv/sigmoid,

Decision Tree: Packing, Comparison

Boosting: Comparison and Gradient Decent

Deep Neural Network: Fast matrix operations + Approximate

Convolution Neural Network: + Comparison

Toward Homomorphic Machine Learning

HEAAN natively supports for the (approximate) fixed point arithmetic

Ciphertext modulus log π‘ž = 𝐿 log 𝑝 grows linearly

Useful when evaluating analytic functions approximately:β€’ Polynomialβ€’ Multiplicative Inverseβ€’ Trigonometric Functionsβ€’ Exponential Function (Logistic Function, Sigmoid Function)

Packing technique based on DFTβ€’ SIMD (Single Instruction Multiple Data) operationβ€’ Rotation on plaintext slots:

HEAAN: Summary

𝑧 = 𝑧1, … , 𝑧 𝑛 2 ↦ 𝑧′ = (𝑧2, … , 𝑧 𝑛 2, 𝑧1)

Thank you for your attention!κ°μ‚¬ν•©λ‹ˆλ‹€.