I am new to OpenFHE library. After going through the binfhe examples, I tried generating keys for a TFHE BinFHEContext() using the following code :-
auto cc = BinFHEContext();
cc.GenerateBinFHEContext(STD128, true, 12, 0, GINX);
auto sk = cc.KeyGen();
After serialising the keys generated by the above code in binary format, I noticed that the size of switching key is around 4.84GB. As far as I know, for TFHE scheme, the size of switching key should be around 100-200 MB and most probably, I have generated keys for FHEW scheme. Is my suspicion correct? If yes, then how do I generate a TFHE context using OpenFHE library? If no, then what am I doing wrong?
Hi, you are using the parameters for larger-precision evaluation, which are a bit larger than for Boolean arithmetic. If you simply use one argument (STD128), or two, with the method set to GINX or LMKCDEY, you will see smaller parameters.
Also, the bootstrapping key includes both switching key and refreshing key.
A more advanced (custom) constructor for BINFHE context can also be used to generate even smaller parameters for the desired functionality. There is a special parameter estimation repository with scripts for these.
I am traveling this week and first half of the next week. If you have a specific configuration in mind, I can post some parameters space-efficient parameters when I am back.
Thanks @ypolyakov for the explanation. I tried changing parameters and indeed I see smaller switching keys(~398 MB). However, it provides less precision. I will try to play around with parameters for now. If I don’t find any suitable set of parameters, I will ask in the forum. I have one last question - How do i know whether I am using FHEW or TFHE scheme? In case of levelled schemes(BGV, BFV and CKKS), we have different crypto contexts which makes it very clear. However, while using binary fhe schemes, its not clear. Is it differentiated based on which bootstrapping technique we choose?
That is correct. What is different between the schemes is the bootstrapping method, which you can select by specifying GINX, AP or LMKCDEY.
Thanks @andreea.alexandru for confirming that.