Approximate Homomorphic Encryption and Privacy Preserving Machine - - PowerPoint PPT Presentation
Approximate Homomorphic Encryption and Privacy Preserving Machine - - PowerPoint PPT Presentation
Approximate Homomorphic Encryption and Privacy Preserving Machine Learning Jung Hee Cheon (SNU, CryptoLab) Thanks to YongSoo Song, Kiwoo Lee, Andrey KIM Outline 1. Homomorphic Encryption 2. HEAAN 3. Bootstrapping of HEAAN 4. Toolkit for
- 1. Homomorphic Encryption
- 2. HEAAN
- 3. Bootstrapping of HEAAN
- 4. 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 Plaintext Finite Field Packing Binary string Real/Complex numbers Packing Operation Addition, Multiplication Look-up table & bootstrapping Fixed-point Arithmetic Library HElib (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 Numbers https://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π )
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 by Sp Sponsored by by AIM 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 Chimera Version 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 Blue Delft Blue HEAAN 1,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 Inc Logistic 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 IBM IBM-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. T
Too
- olkit
it for
- r H
Hom
- mom
- mor
- rphic
hic Com
- mput
utati ation
- n
οΆ Packing Method
- HEAAN supports vector operations
- How can we compute matrix operations for ciphertexts?
- Matrix Encoding method
How
- w to
- Pack
ck
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
- w to
- ro
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
- w to
- ro
rotate
16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
β
1 1 1 1 1 1 1 1 1 1 1 1
=
1 2 3 5 6 7 9 10 11 13 14 15
π ππ’ π, 1 β πππ‘π =
4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3
β
1 1 1 1
=
4 8 12 16
π ππ’ π, β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 hod Scheme eme (Amor mortized) tized) Ru Runnin nning tim ime # of pair irs Error Bit-wise HElib β 1 ms 1800 TFHE β 1 ms
- Ours
s
(W (Word rd-wi wise se)
HEAA AAN 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)
So Sort rting ng on
- n E
Enc ncry rypted 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
- ward Hom
- mom
- mor
- rphi
phic c Ma Mach chine ne Learn rning ng
οΆ 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)