Size of public keys with small depth circuit


I would like to understand the size of the public key generated with this simple circuit:

import time
import numpy as np
import concrete.numpy as cnp

nfeatures = 1000
nclasses = 10

w = np.random.randint(0,16,(nfeatures,10))
X_train = np.random.randint(0,2, (1000, nfeatures)).astype(np.int16)


cfg = cnp.Configuration(show_graph=True)

@cnp.compiler({"x": "encrypted"})
def g(x):
    return x @ w

inputset = X_train[0:4,:]
inpt = X_train[5,:]
t = time.time()
circuit = g.compile(inputset, configuration=cfg)
print('compiled in ', time.time()-t)
t = time.time()
print("Keygen done in ", time.time()-t)

print(f"Encryption keys: {circuit.size_of_secret_keys} bytes")
print(f"Evaluation keys: {circuit.size_of_bootstrap_keys + circuit.size_of_keyswitch_keys} bytes")
print(f"Inputs: {circuit.size_of_inputs} bytes")
print(f"Outputs: {circuit.size_of_outputs} bytes")

enc = circuit.encrypt(inpt)

t = time.time()
res_enc =
print("Run time : ", time.time()-t)
dec = circuit.decrypt(res_enc)

Which gives the following output :

Encryption keys: 8200 bytes
Evaluation keys: 0 bytes
Inputs: 8200000 bytes
Outputs: 82000 bytes

I understand from PBS paper that no PBS is required as only leveled operations are required for this linear regression, but shouldn’t there be a public key anyway ? Or as no PBS is needed no public key is generated ?

Thanks in advance

Hello @tricycl3,

Or as no PBS is needed no public key is generated ?

This is the behavior, at least for the time being. In the future, hidden bootstraps could be introduced to manage noise in case it gets too large. But it’s not done at the moment, so if every operation in the circuit is leveled, no public keys will be generated.

Hope this answers your question!

1 Like

Thanks for your answer, it was what I was looking for !

1 Like