Concrete Numpy is an open-source set of tools which aims to simplify the use of fully homomorphic encryption (FHE) for data scientists.
With Concrete Numpy, data scientists can implement machine learning models using a subset of numpy that compiles to FHE. They will be able to train models with popular machine learning libraries and then convert the prediction functions of these models to FHE with concrete-numpy.
The preferred way to use concrete-numpy is through docker. You can get the concrete-numpy docker image by pulling the latest docker image:
docker pull zamafhe/concrete-numpy:latest
To install Concrete Numpy from PyPi, run the following:
pip install concrete-numpy
You can find more detailed installation instructions in installing.md
import concrete.numpy as hnp
def add(x, y):
return x + y
inputset = [(2, 3), (0, 0), (1, 6), (7, 7), (7, 1), (3, 2), (6, 1), (1, 7), (4, 5), (5, 4)]
compiler = hnp.NPFHECompiler(add, {"x": "encrypted", "y": "encrypted"})
print(f"Compiling...")
circuit = compiler.compile_on_inputset(inputset)
examples = [(3, 4), (1, 2), (7, 7), (0, 0)]
for example in examples:
result = circuit.run(*example)
print(f"Evaluation of {' + '.join(map(str, example))} homomorphically = {result}")
Installation steps are described in project_setup.md. Information about how to use Docker for development are available in docker.md.
Some information about how to build the documentation of concrete-numpy
are available in documenting.md. Notably, our documentation is pushed to https://docs.zama.ai/concrete-numpy/.
Some information about our terminology and the infrastructure of concrete-numpy
are available in terminology_and_structure.md. An in-depth look at what is done in concrete-numpy
is available in compilation.md.
Information about how to contribute are available in contributing.md.
This software is distributed under the BSD-3-Clause-Clear license. If you have any questions, please contact us at hello@zama.ai.