Lightweight model serving in Intel SGX TEE using Gramine and TensorFlow lite C++ API. For more details please refer to the companion blog post: https://medium.com/p/f17f26a65646.
The only prerequisite to run this proof of concept is https://docker.io. Once you have installed docker you can clone this repository, locate into it and launch the environment as if follows.
$ bin/launch.sh
This is going to build and start a container with all of the required dependencies to build and run the codebase.
To build the server
and the client
binaries you can run:
$ bin/build.sh
This command is going to build the binaries, sign the server
and generate other necessary Gramine files.
The gramine-direct
command can be used for testing purposed (or if a SGX machine is not available). To start the server in this manner you can run:
$ gramine-direct server resources/plain/model.tflite
Note
server
is the server executable andresources/plain/model.tflite
is a TensorFlow lite model.
To test the server you can open a new console and run e.g. ./client 0.5
.
The gramine-sgx
command can be used run the server in the SGX enclave as it follows.
$ gramine-sgx server resources/model.tflite
Note
server
is the server executable andresources/model.tflite
is an encrypted TensorFlow lite model.
To test the server you can open a new console and run e.g. ./client 0.5
.
Azure offers Intel SGX instances that you can get on demand: https://azure.microsoft.com/en-us/solutions/confidential-compute.