MLR meets MPC – Utilizing Muli-Level Compilation for Automated Protocol Translation

Bachelor Thesis, Master Thesis


Secure Multi-Party Computation (MPC) allows two or more mutually distrusting parties to compute a function on their private inputs such that nothing beyond the output data is revealed to the other parties. It has found a wide range of applications, such as secure auctions, money-laundering detection, and secure cloud computing. Besides the theoretical efforts to make MPC protocols more and more efficient on paper, the practical side of MPC is concerned with improving the efficiency of the protocols’ implementations.

One particular challenge is the compilation of a given program in a high-level language, such as C/C++, Java, or Python, into a function representation that allows different MPC frameworks to assign efficient protocols for specific program parts. Taking Machine Learning (ML) as an example application for MPC, there are frameworks which support highly optimized protocols for the ReLU layer, but others that do not. Now the following question arises: “How do we represent a function such that we can both opt in for special ReLU protocols but on the other hand also fall back to ‘general-purpose’ MPC protocols (i.e., Add, Sub, Mul) when there are no special ReLU protocols available?”

This problem of compilation for secure computation has been addressed by the Secretflow-SPU [1] for MPC and HECO compiler [2] for Fully Homomorphic Encryption. Both frameworks build on top of MLIR [3] which itself is built upon the well-known LLVM compiler framework. MLIR allows to define dialects to support building domain specific compilers.


The goal of this topic is to design and use dialects in MLIR to achieve a similarly easy framework as HECO for MPC. In our efforts to move from C++ to Rust, the student should implement at least two MPC dialects with MLIR in Rust and corresponding conversion passes. Additionally, more dialects or passes can be implemented.


  • Programming skills in Rust, (maybe a little) C++
  • Basic knowledge of cryptography
  • Familiarity with compilers
  • High motivation + ability to work independently
  • Knowledge of the English language, Git, LaTeX, etc.