Nillion AIVM
AIVM is a cutting-edge framework designed for privacy-preserving inference using advanced cryptographic protocols. With AIVM, you can deploy a local development network (devnet) to explore private inference using provided examples or custom models.
Table of Contents
Installing AIVM
Recommended Instalation
-
Create a virtual environment:
python3 -m venv .venv
-
Activate the virtual environment:
On Linux/macOS:
source .venv/bin/activate
On Windows:
.\venv\Scripts\activate
-
Install the package:
If you are going to execute the examples execute:
pip install "nillion-aivm[examples]"
Otherwise, if you are going to produce your own code, you can just:
pip install nillion-aivm
Install using Poetry from source
-
Install Poetry (if not already installed):
pip install poetry
-
Install dependencies:
cd aivm poetry install -E examples
-
Activate the virtual environment:
poetry shell
Install using Pip from source
-
Install dependencies:
cd aivm pip install ".[examples]"
If it is used as a development environment it is recommended to install using:
cd aivm pip install -e ".[examples]"
Running AIVM
-
Start the AIVM devnet:
aivm-devnet
-
Open the provided Jupyter notebook examples/getting-started.ipynb to run private inference examples on AIVM.
-
After completing your tasks, terminate the devnet process by pressing
CTRL+C.
Usage
For additional usage, refer to the examples folder, which demonstrates how to set up private inference workflows using AIVM.
Performing Secure Inference
Basic Usage
- First, import the AIVM client and check available models:
import aivm_client as aic
# List all supported models
available_models = aic.get_supported_models()
print(available_models)
- Prepare your input data. Here's an example using PyTorch to generate a random input:
import torch
# Create a sample input (e.g., for LeNet5 MNIST)
random_input = torch.randn((1, 1, 28, 28)) # Batch size 1, 1 channel, 28x28 pixels
- Encrypt your input using the appropriate Cryptensor:
# Encrypt the input
encrypted_input = aic.LeNet5Cryptensor(random_input)
- Perform secure inference:
# Get prediction while maintaining privacy
result = aic.get_prediction(encrypted_input, "LeNet5MNIST")
The get_prediction function automatically handles the secure computation protocol with the aivm-devnet nodes, ensuring that your input data remains private throughout the inference process.
Custom Model Upload
You can deploy your own trained models to AIVM, provided they follow the supported architectures (BertTiny or LeNet5).
Uploading Custom Models
- Import the AIVM client:
import aivm_client as aic
- Upload your custom model:
# For BertTiny models
aic.upload_bert_tiny_model(model_path, "MyCustomBertTiny")
# For LeNet5 models
aic.upload_lenet5_model(model_path, "MyCustomLeNet5")
- Perform inference with your custom model:
# For BertTiny models
result = aic.get_prediction(private_berttiny_input, "MyCustomBertTiny")
# For LeNet5 models
result = aic.get_prediction(private_lenet5_input, "MyCustomLeNet5")
License
This project is licensed under the MIT License.
Metadata
Release files for nillion-aivm 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nillion_aivm-0.1.4.tar.gz | 18.2 MB | Without provenance | Details for nillion_aivm-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nillion_aivm-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for nillion_aivm-0.1.4-py3-none-any.whl |
Total release size: 36.6 MB
Release files / nillion_aivm-0.1.4.tar.gz
| Download URL | nillion_aivm-0.1.4.tar.gz |
|---|---|
| Size | 18.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8dfa09b4430579d4bf58f4898b28e0320064488b1455943127ced5dfd2a2f5a
|
|
BLAKE2b-256 checksum How to use checksums |
28267b74ab18d96e7db4ee27fe1a288ef5ba0af2fa505bae7fd2eb31215b0079
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure
|
Release files / nillion_aivm-0.1.4-py3-none-any.whl
| Download URL | nillion_aivm-0.1.4-py3-none-any.whl |
|---|---|
| Size | 18.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b54d7f3ed4fd6e3fb88c4bc0722787ae99053006d3e5707ccada2bdb5df92eb
|
|
BLAKE2b-256 checksum How to use checksums |
9e06625ccecbd73323dff69290bac6495c744a417cc5f05e5866129a50f0a441
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure
|
Security for nillion-aivm 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.