Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: keyswitching is not supported by the context #253

Open
ffrusli opened this issue Jan 18, 2025 · 1 comment
Open

RuntimeError: keyswitching is not supported by the context #253

ffrusli opened this issue Jan 18, 2025 · 1 comment
Labels

Comments

@ffrusli
Copy link

ffrusli commented Jan 18, 2025

Hi I am doing my master thesis and trained a neural network model. These models and Test Set supposed to be encrypted using BFV FHE Pyfhel. I did validate my contextGen(), output shows Success:valid. But I am experiencing issues saying keyswitching is not supported by the context when the code arrived at he.relinKeyGen(). I don't understand. I read, it said by default BFV Pyfhel does support keyswitching and I don't need to enable anywhere. Please help, I am stucked.

Code To Reproduce Error
import Pyfhel
self.he = Pyfhel.Pyfhel()
self.he.contextGen(scheme="bfv", n=2048, t_bits=14, sec=128)
self.he.keyGen()
self.he.relinKeyGen()

Traceback (most recent call last):
File "", line 1, in
File "Pyfhel/Pyfhel.pyx", line 323, in Pyfhel.Pyfhel.Pyfhel.relinKeyGen
File "Pyfhel/Pyfhel.pyx", line 339, in Pyfhel.Pyfhel.Pyfhel.relinKeyGen
RuntimeError: keyswitching is not supported by the context

Setup:

  • OS: Kali Linux
  • Python: 3.9
  • C compiler version: 13.3.0
  • Pyfhel Version: 3.4.2
@ffrusli ffrusli added the bug label Jan 18, 2025
@AlexanderViand-Intel
Copy link

I think the issue might be that you're manually specifying a very small parameter setting (n=2048), and there's just not enough "room" (coefficient modulus q) to do relinearization (a form of keyswitching) with such small parameters. Try either not specifying these values (n, t_bits) or choose larger values (e.g., n=2^13 or 2^14)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants