Saving compiled models

(originally asked by cgordon on FHE.org discord)

Are there any easy ways to save a compiled concrete model? (currently compilation seems like the most expensive step in a model pipeline, so it would be great to have it stored)

Hi @alex ,

For now concrete-numpy only expose the compiler interface that allows you to JIT compile then run which basically generate keys, encrypts inputs, call the in memory compiled function and decrypts the result, so with this current state of concrete-numpy you cannot yet save your compiled model.
Under the hood in the concrete-compiler they have a compilation path that produce compiled libraries (.a, .so) and a specification of client parameters (i.e. which are crypto parameters and which inputs should be encrypted and how).
We will expose soon this compiler path on concrete-numpy that allows you to “save” your compilation result. We will also add tooling to concrete-numpy to allows you to easily load the produced dynamic library, generate/save/load keys, encrypts, call the compiled function and decrypts which are for now hidden.

1 Like