google / heir

A compiler for homomorphic encryption
https://heir.dev/
Apache License 2.0
237 stars 34 forks source link

Integrate Lattigo as a library implementation to target at various levels #323

Open asraa opened 7 months ago

asraa commented 7 months ago

The Lattigo library (https://github.com/tuneinsight/lattigo) is an open source library for lattice-based homomorphic encryption in Go. At v5, they have organized the library into many packages, from low-level Ring package that contains NTT / ring automorphism and operations, and higher level encrypted arithmetic for ints and fixed-point arithmetic.

It would be very cool for HEIR to target Lattigo at a number of levels:

I also found it interesting that there is a unified representation for BGV/BFV up to a scaling factor, which is similar to what we converged on for the LWE toolbox dialect.

Creating this issue to track progress here and other ideas for integration points.

cc @Pro7ech

j2kun commented 7 months ago

As a start, it would be great to have our tf2fhe flow branch at some step to lower to one of the arithmetic schemes, and have that codegen to lattigo. Then we could get e2e comparisons of ML models across boolean/arithmetic FHE.

Pro7ech commented 7 months ago

Great initiative :)

Some precision about the unification of BFV/BGV, it is unified under the same scaling factor: T^-1 mod Q, i.e. the BFV scaling factor.