A framework for generic hybrid two-party computation and private inference with neural networks


MOTION2NX -- A Framework for Generic Hybrid Two-Party Computation and Private Inference with Neural Networks

This software is an extension of the MOTION framework for multi-party computation. We additionally implemented five 2PC protocols with passive security together with all 20 possible conversions among each other to enable private evaluation of hybrid circuits:

  • Yao's Garbled Circuits with FreeXOR and Half-Gates
  • Arithmetic and Boolean variants of Goldreich-Micali-Wigderson
  • Arithmetic and Boolean variants of the secret-sharing-based protocols from ABY2.0 (Patra et al., USENIX Security '21)

Moreover, we support private inference with neural networks by providing secure tensor data types and specialized building blocks for common tensor operations. With support of the Open Neural Network Exchange (ONNX) file format, this makes our framework interoperable with industry-standard deep learning frameworks such as TensorFlow and PyTorch.

Compared to the original MOTION codebase, we made architectural improvements to increase flexibility and performance of the framework. Although the interfaces of this work are currently not compatible with the original framework due to the concurrent development of both branches, it is planned to integrate the MOTION2NX features into MOTION itself.

More information about this work is given in this extended abstract which was accepted at the [email protected] 2021 workshop. It is the result of Lennart Braun's master's thesis in the ENCRYPTO group at TU Darmstadt supervised by Thomas Schneider and Rosario Cammarota.

This code is provided as a experimental implementation for testing purposes and should not be used in a productive environment. We cannot guarantee security and correctness.

  • /usr/bin/ld: cannot find -lBoost::json

    /usr/bin/ld: cannot find -lBoost::json

    Hello, I have this problem while compiling, how can I solve it.

    [ 39%] Building CXX object src/motioncore/CMakeFiles/motion.dir/statistics/analysis.cpp.o [ 39%] Building CXX object src/motioncore/CMakeFiles/motion.dir/utility/fiber_thread_pool/fiber_thread_pool.cpp.o [ 40%] Building CXX object src/motioncore/CMakeFiles/motion.dir/utility/fiber_thread_pool/pooled_work_stealing.cpp.o [ 40%] Building CXX object src/motioncore/CMakeFiles/motion.dir/utility/logger.cpp.o [ 41%] Building CXX object src/motioncore/CMakeFiles/motion.dir/utility/runtime_info.cpp.o [ 42%] Building CXX object src/motioncore/CMakeFiles/motion.dir/wire/bmr_wire.cpp.o [ 42%] Building CXX object src/motioncore/CMakeFiles/motion.dir/wire/wire.cpp.o [ 42%] Building CXX object src/motioncore/CMakeFiles/motion.dir/version.cpp.o [ 43%] Linking CXX static library ../../lib/libmotion.a [ 62%] Built target motion [ 63%] Built target gtest [ 64%] Built target gtest_main [ 65%] Linking CXX executable ../../bin/motiontest /usr/bin/ld: cannot find -lBoost::json collect2: error: ld returned 1 exit status make[2]: *** [src/test/CMakeFiles/motiontest.dir/build.make:577: bin/motiontest] Error 1 make[1]: *** [CMakeFiles/Makefile2:71

    opened by Cryptographer63 5
  • Build instructions for MOTION2NX

    Build instructions for MOTION2NX


    Are there any build instructions available, on how to get this running?

    I followed the same instructions that were present in the MOTION repository - mkdir build && cd build, followed by cmake .. and make.

    The first two steps worked fine - here's the output of cmake ..:

    -- The CXX compiler identification is GNU 11.1.0
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Looking for C++ include pthread.h
    -- Looking for C++ include pthread.h - found
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
    -- Looking for pthread_create in pthreads
    -- Looking for pthread_create in pthreads - not found
    -- Looking for pthread_create in pthread
    -- Looking for pthread_create in pthread - found
    -- Found Threads: TRUE  
    -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f")  
    -- Found OpenMP_CXX: -fopenmp (found version "4.5") 
    -- Found OpenMP: TRUE (found version "4.5")  
    -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.69.0") found components: context fiber filesystem log log_setup program_options system thread 
    fmt was not found: add fmt subdirectory
    flatbuffers was not found: add flatbuffers subdirectory
    -- The C compiler identification is GNU 11.1.0
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Looking for strtof_l
    -- Looking for strtof_l - found
    -- Looking for strtoull_l
    -- Looking for strtoull_l - found
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/gokul/MOTION2NX/build

    However, make fails for some reason - here's the error log attached

    I was able to build MOTION without any problems by installing the mentioned pre-requisites, so I thought the same would work here. Is there any dependency that I am missing?

    Here are some of the relevant specs, please let me know if you need anything else:

    [email protected]:~/MOTION2NX/build$ g++ --version
    g++ (Ubuntu 11.1.0-1ubuntu1~20.04) 11.1.0
    Copyright (C) 2021 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    [email protected]:~/MOTION2NX/build$ cmake --version
    cmake version 3.16.3
    CMake suite maintained and supported by Kitware (kitware.com/cmake).
    [email protected]:~/MOTION2NX/build$ make --version
    GNU Make 4.2.1
    Built for x86_64-pc-linux-gnu
    Copyright (C) 1988-2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    opened by goxul 4
  • Error in base/party.h

    Error in base/party.h

    I am seeing an error while compiling using cmake . Following are the commands I used. cd MOTION2NX/src/examples/example_template cmake . make

    Then I am getting the following error - /home/atom/MOTION2NX/src/examples/example_template/example_template_main.cpp:35:10: fatal error: base/party.h: No such file or directory 35 | #include "base/party.h" | ^~~~~~~~~~~~~~ compilation terminated. make[2]: *** [CMakeFiles/example_template.dir/build.make:76: CMakeFiles/example_template.dir/example_template_main.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/example_template.dir/all] Error 2 make: *** [Makefile:91: all] Error 2 image

    Attached is the screenshot of the error.

    Can someone help me out. Thanks.

    opened by mayank-kabra2001 3
  • fatal error: 'parallel/algorithm' file not found

    fatal error: 'parallel/algorithm' file not found

    My compilation environment is: os:macos 12.3.1 cpu:Intel i7 Compiler: Apple clang version 13.0.0 (clang-1300.0.27.3)

    1 warning generated.
    [ 29%] Building CXX object src/motioncore/CMakeFiles/motion.dir/crypto/base_ots/ot_hl17.cpp.o
    [ 29%] Building CXX object src/motioncore/CMakeFiles/motion.dir/crypto/blake2b.cpp.o
    [ 30%] Building CXX object src/motioncore/CMakeFiles/motion.dir/crypto/bmr_provider.cpp.o
    [ 30%] Building CXX object src/motioncore/CMakeFiles/motion.dir/crypto/curve25519/mycurve25519.cpp.o
    [ 30%] Building CXX object src/motioncore/CMakeFiles/motion.dir/crypto/garbling/half_gates.cpp.o
    /Users/zhangshuguang/Desktop/MOTION2NX-motion2nx/src/motioncore/crypto/garbling/half_gates.cpp:25:10: fatal error: 'parallel/algorithm' file not found
    #include <parallel/algorithm>
    1 error generated.
    make[2]: *** [src/motioncore/CMakeFiles/motion.dir/crypto/garbling/half_gates.cpp.o] Error 1
    make[1]: *** [src/motioncore/CMakeFiles/motion.dir/all] Error 2
    make: *** [all] Error 2
    opened by Cryptographer63 0
  • Three little suggestions

    Three little suggestions

    I'm a big fan of motion, and I've read the frame for a long time, and I almost understand it. However, I still have a few suggestions:

    1. I have been working on macos for a long time, but it has not been compiled successfully, and there are various problems. But it's ok on ubuntu.
    2. I hope that each example can give a command line example, for example, to open several terminals, what command should be entered in each terminal. I see an example is given in the readme, but it would be nice if every example could have a corresponding.
    3. There are few documents. I have seen some development documents for the motion framework, which are relatively few. There should be less motion2nx. I would love to have some ABYguide kind of documentation. I have to say, the ABY frame is really great.

    Finally, I would like to say that your work is very fascinating. I will keep following and learning.

    opened by Cryptographer63 0
  • Tensor examples

    Tensor examples

    I had a few queries regarding the usage of tensor functions

    1. When trying to run the cryptonets file, I always get the help as an output, it would be great if the command to run the file could be made available
    2. When trying to use the cryptonets code for general matrix multiplication (GEMM) the backend simply hangs
    3. If something similar to the millionaire's problem example could be done for tensor operations, it would be really helpful

    Thanks in advance!

    opened by Udbhavbisarya23 1
  • onnx


    the onnx bin files are not being created. ONNXConfig.cmake onnx-config.cmake not compatible with repo. Kindly show an example of building the onnx workload.

    opened by SuviSree 0
  • ABY2.0 examples

    ABY2.0 examples


    Thanks for providing this library! and I have some questions:

    (1) As mentioned this repo provides some implementation of ABY2.0 protocols. However, I'm not able to find some example code that uses ABY2.0 protocols, may I know how to use them or benchmark them? especially, I may want to test the performance of the secure comparison protocol(Bit extraction) of ABY2.0.

    (2) As ABY is supported by the MOTION, I think additive secret sharing is supported, right? I assume if I initialize an arithmetic sharing, it will be additive sharing, is it the case?

    (3) For arithmetic sharing, is there an API such that parties can provide their share as input? (such API in ABY is called PutSharedINGate()) e.g. If we assume additive secret sharing, where the secret is 10, party 0 has share value 3 and party 1 has share value 7, so that 3+7=10. Is there an API such that there is a share and party 0 can take 3 as its input and party 1 can take 7 as its input?

    Thank you! Looking forward to your reply!

    opened by lu562 4
Cryptography and Privacy Engineering Group at TU Darmstadt
SecMML: Secure MPC(multi-party computation) Machine Learning Framework

SecMML 介绍 SecMML是FudanMPL(Multi-Party Computation + Machine Learning)的一个分支,是用于训练机器学习模型的高效可扩展的安全多方计算(MPC)框架,基于BGW协议实现。此框架可以应用到三个及以上参与方联合训练的场景中。目前,SecMM

null 90 Dec 27, 2022
Benchmark framework of compute-in-memory based accelerators for deep neural network (inference engine focused)

DNN+NeuroSim V1.3 The DNN+NeuroSim framework was developed by Prof. Shimeng Yu's group (Georgia Institute of Technology). The model is made publicly a

NeuroSim 32 Nov 24, 2022
ffcnn is a cnn neural network inference framework, written in 600 lines C language.

+----------------------------+ ffcnn 卷积神经网络前向推理库 +----------------------------+ ffcnn 是一个 c 语言编写的卷积神经网络前向推理库 只用了 500 多行代码就实现了完整的 yolov3、yolo-fastes

ck 54 Dec 28, 2022
ncnn is a high-performance neural network inference framework optimized for the mobile platform

ncnn ncnn is a high-performance neural network inference computing framework optimized for mobile platforms. ncnn is deeply considerate about deployme

Tencent 16.2k Jan 5, 2023
Tensors and Dynamic neural networks in Python with strong GPU acceleration

PyTorch is a Python package that provides two high-level features: Tensor computation (like NumPy) with strong GPU acceleration Deep neural networks b

null 61.4k Jan 4, 2023
Raspberry Pi guitar pedal using neural networks to emulate real amps and pedals.

NeuralPi NeuralPi is a guitar pedal using neural networks to emulate real amps and pedals on a Raspberry Pi 4. The NeuralPi software is a VST3 plugin

Keith Bloemer 865 Jan 5, 2023
A library for creating Artificial Neural Networks, for use in Machine Learning and Deep Learning algorithms.

iNeural A library for creating Artificial Neural Networks, for use in Machine Learning and Deep Learning algorithms. What is a Neural Network? Work on

Fatih Küçükkarakurt 5 Apr 5, 2022
Parallel library for approximate inference on discrete Bayesian networks

baylib C++ library Baylib is a parallel inference library for discrete Bayesian networks supporting approximate inference algorithms both in CPU and G

Massimiliano Pronesti 26 Dec 7, 2022
A lightweight C library for artificial neural networks

Getting Started # acquire source code and compile git clone https://github.com/attractivechaos/kann cd kann; make # learn unsigned addition (30000 sam

Attractive Chaos 617 Dec 19, 2022
Convolutional Neural Networks

Darknet Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation. D

Joseph Redmon 23.7k Jan 9, 2023
Low dependency(C++11 STL only), good portability, header-only, deep neural networks for embedded

LKYDeepNN LKYDeepNN 可訓練的深度類神經網路 (Deep Neural Network) 函式庫。 輕量,核心部份只依賴 C++11 標準函式庫,低相依性、好移植,方便在嵌入式系統上使用。 Class diagram 附有訓練視覺化 demo 程式 訓練視覺化程式以 OpenCV

Lin Kao-Yuan 44 Nov 7, 2022
Tiny CUDA Neural Networks

This is a small, self-contained framework for training and querying neural networks. Most notably, it contains a lightning fast "fully fused" multi-layer perceptron as well as support for various advanced input encodings, losses, and optimizers.

NVIDIA Research Projects 1.9k Jan 7, 2023
An Efficient Implementation of Analytic Mesh Algorithm for 3D Iso-surface Extraction from Neural Networks

AnalyticMesh Analytic Marching is an exact meshing solution from neural networks. Compared to standard methods, it completely avoids geometric and top

Jiabao Lei 45 Dec 21, 2022
An Efficient Implementation of Analytic Mesh Algorithm for 3D Iso-surface Extraction from Neural Networks

AnalyticMesh Analytic Marching is an exact meshing solution from neural networks. Compared to standard methods, it completely avoids geometric and top

null 45 Dec 21, 2022
A header-only C++ library for deep neural networks

MiniDNN MiniDNN is a C++ library that implements a number of popular deep neural network (DNN) models. It has a mini codebase but is fully functional

Yixuan Qiu 336 Dec 22, 2022
InsNet Runs Instance-dependent Neural Networks with Padding-free Dynamic Batching.

InsNet documentation InsNet (documentation) is a powerful neural network library aiming at building instance-dependent computation graphs. It is desig

Chauncey Wang 62 Jan 3, 2023
TS-9 guitar pedal clone using neural networks.

TS-M1N3 TS-M1N3 is a guitar plugin clone of the TS-9 Tubescreamer overdrive pedal. Machine learning was used to train a model of both the drive and to

Keith Bloemer 29 Nov 23, 2022
A Tool for Verifying Neural Networks using SMT-Based Model Checking

Project Title QNNVerifier Description A Tool for Verifying Neural Networks using SMT-Based Model Checking. Using Frama-C and ESBMC as the backends. Yo

null 2 Dec 11, 2021
CoDi is a cellular automaton model for spiking neural networks

CoDi CoDi is a cellular automaton (CA) model for spiking neural networks (SNNs). CoDi is an acronym for Collect and Distribute, referring to the signa

Jett LaRue 6 May 5, 2022