{"id":38877784,"url":"https://github.com/mc2-project/delphi","last_synced_at":"2026-01-17T14:37:49.208Z","repository":{"id":37689683,"uuid":"234144768","full_name":"mc2-project/delphi","owner":"mc2-project","description":"A Cryptographic Inference Service for Neural Networks","archived":false,"fork":false,"pushed_at":"2024-07-22T22:58:22.000Z","size":9952,"stargazers_count":131,"open_issues_count":4,"forks_count":32,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-10T00:23:36.982Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mc2-project.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-15T18:23:13.000Z","updated_at":"2025-08-28T16:13:19.000Z","dependencies_parsed_at":"2022-07-12T16:43:26.002Z","dependency_job_id":null,"html_url":"https://github.com/mc2-project/delphi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mc2-project/delphi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc2-project%2Fdelphi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc2-project%2Fdelphi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc2-project%2Fdelphi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc2-project%2Fdelphi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mc2-project","download_url":"https://codeload.github.com/mc2-project/delphi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc2-project%2Fdelphi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28510146,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-17T14:37:49.121Z","updated_at":"2026-01-17T14:37:49.201Z","avatar_url":"https://github.com/mc2-project.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eDelphi\u003c/h1\u003e\n\n___Delphi___ is a Python, C++, and Rust library for **Secure Deep Neural Network Inference**\n\nThis library was initially developed as part of the paper *\"[Delphi: A Cryptographic Inference Service for Neural Networks][delphi]\"*, and is released under the MIT License and the Apache v2 License (see [License](#license)).\n\n**WARNING:** This is an academic proof-of-concept prototype, and in particular has not received careful code review. This implementation is NOT ready for production use.\n\n## Overview\n\nThis library implements a cryptographic system for efficient inference on general convolutional neural networks.\n\nThe construction utilizes an array of multi-party computation and machine-learning techniques, as described in the [Delphi paper][delphi].\n\n## Directory structure\n\nThis repository contains several folders that implement the different building blocks of Delphi. The high-level structure of the repository is as follows.\n* [`python`](python): Example Python scripts for performing neural architecture search (NAS)\n\n* [`rust/algebra`](rust/algebra): Rust crate that provides finite fields\n\n* [`rust/crypto-primitives`](rust/crypto-primitives): Rust crate that implements some useful cryptographic primitives\n\n* [`rust/experiments`](rust/experiments): Rust crate for running latency, bandwidth, throughput, accuracy, and memory usage experiments\n\n* [`rust/neural-network`](rust/neural-network): Rust crate that implements generic neural networks\n\n* [`rust/protocols`](rust/protocols): Rust crate that implements cryptographic protocols\n\n* [`rust/protocols-sys`](rust/crypto-primitives): Rust crate that provides the C++ backend for Delphi's pre-processing phase and an FFI for the backend\n\nIn addition, there is a  [`rust/bench-utils`](rust/bench-utils) crate which contains infrastructure for benchmarking. This crate includes macros for timing code segments and is used for profiling the building blocks of Delphi.\n\n\n## Build guide\n\nThe library requires a few dependencies to run. On Ubuntu these can be installed via:\n```bash\nsudo apt install cmake pkg-config g++ gcc libssl-dev libclang-dev\n```\n\nThe library compiles on the `nightly` toolchain of the Rust compiler. To install the latest version of Rust, first install `rustup` by following the instructions [here](https://rustup.rs/), or via your platform's package manager. Once `rustup` is installed, install the Rust toolchain by invoking:\n```bash\nrustup install nightly\n```\n\nAfter that, use `cargo`, the standard Rust build tool, to build the library:\n```bash\ngit clone https://github.com/mc2-project/delphi\ncd delphi/rust\ncargo +nightly build --release\n```\n\nThis library comes with unit tests for each of the provided crates. Run the tests with:\n```bash\ncargo +nightly test\n``` \nBenchmarks are included for the following crates:\n- [`algebra`](algebra)\n- [`crypto-primitives`](algebra)\n- [`neural-network`](algebra)\n\nRun the benchmarks with:\n```bash\ncargo +nightly bench\n```\n\n## End-to-End Example \nLet's walk through a full example of using Delphi with the pretrained MiniONN model at `python/minionn/pretrained/relu/model`.\n\nUsing Python3.6/7, install the following packages:\n```bash\npip install ray[tune]==0.8.4 requests scipy tensorflow==1.15.0 \n```\nOptionally, visualizing results requires the `tensorboard` package:\n```bash\npip install tensorboard==1.15.0\n```\n### Model Preprocessing\nFor this step we will be working exclusively in the `python/` subdirectory:\n```bash\ncd python/\n```\n#### 1. Neural Architecture Search\nIn order to achieve optimal performance, we need to run NAS on our pretrained model to optimize which activation layers to approximate (see [Delphi paper][delphi] for more details).\n\nStart by running NAS on the total number of activation layers (`-a` flag), in this case 7, with the following command: \n```bash\npython minionn/minionn_cifar10.py -n 7_layers -d /tmp -a 7 -r minionn/pretrained/relu/model \n```\nAfter that has finished, we can review the results by running:\n```bash\ntensorboard --logdir=/tmp/7_layers\n```\nand visiting `localhost:6006` in a web browser.\n\n If the resulting networks don't have satisfactory accuracy, rerun the above command with a lower number of activation layers.\n\n#### 2. Serialization\n\nOnce a satisfactory network is trained (say at `/tmp/model`), we need to extract the model weights for use in the Rust cryptographic protocol. This can be done by running the following command.\n```bash\npython extract_keras_weights.py 0 -w /tmp/model -a {approx layers}\n```\nWhere `{approx layers}` is the list of layers being approximated. \n\nThis will output a `model.npy` file which is ready to be used by Delphi for secure inference.\n\nPassing the `-q` flag additionally quantizes the model for additional performance, but may lower accuracy. Additionally passing the `-t` flag will test accuracy of the original and quantized network in order for you to decide which is best. Currently, quantizing requires Tensorflow 2.0.\n\n### Performing inference with the model\nWe will now use this model to perform inference on an image using the code in `rust/experiments/src/inference`:\n```bash\ncd ../rust/experiments/src/inference\n```\nRun the following python script to generate a test image:\n```bash\npython3 generate_test_images.py\n```\nand perform inference on that image by running:\n```bash\ncargo +nightly run --release --bin minionn-inference -- --weights /tmp/model.npy --layers {num of approx layers}\n```\n\n## License\n\nDelphi is licensed under either of the following licenses, at your discretion.\n\n * Apache License Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nUnless you explicitly state otherwise, any contribution submitted for inclusion in Delphi by you shall be dual licensed as above (as defined in the Apache v2 License), without any additional terms or conditions.\n\n[delphi]: https://eprint.iacr.org/2020/050.pdf\n\n## Reference paper\n\n[_Delphi: A Cryptographic Inference Service for Neural Networks_][delphi]    \n[Pratyush Mishra](https://www.github.com/pratyush), [Ryan Lehmkuhl](https://www.github.com/ryanleh), Akshayaram Srinivasan, Wenting Zheng, and  Raluca Ada Popa    \n*Usenix Security Symposium 2020*\n\n## Acknowledgements\n\nThis work was supported by:\nthe National Science Foundation;\nand donations from Sloan Foundation, Bakar and Hellman Fellows Fund, Alibaba, Amazon Web Services, Ant Financial, Arm, Capital One, Ericsson, Facebook, Google, Intel, Microsoft, Scotiabank, Splunk and VMware\n\nSome parts of the finite field arithmetic infrastructure in the `algebra` crate have been adapted from code in the [`algebra`](https://github.com/scipr-lab/zexe) crate.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmc2-project%2Fdelphi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmc2-project%2Fdelphi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmc2-project%2Fdelphi/lists"}