# CipherFlow: Compiling AI Programs for Efficient Cryptographically Secure Inference

arXiv: https://arxiv.org/abs/2611.01450 · HTML: https://mlsanity.com/paper/2611.01450/

## Key facts

- No citing papers in the map yet (data through 26 Nov 2026).
- Builds on 33 of its 65 references that are in the map.
- Submitted 1 Nov 2026.

## Builds on (most cited first, 30 of 33)

- [Attention Is All You Need](https://mlsanity.com/paper/1706.03762/) (2017)
- [Transformers in Medical Imaging: A Survey](https://mlsanity.com/paper/2201.09873/) (2022)
- [Gazelle: A Low Latency Framework for Secure Neural Network Inference](https://mlsanity.com/paper/1801.05507/) (2018)
- [CrypTen: Secure Multi-Party Computation Meets Machine Learning](https://mlsanity.com/paper/2109.00984/) (2021)
- [CrypTFlow2: Practical 2-Party Secure Inference](https://mlsanity.com/paper/2010.06457/) (2020)
- [MPCFormer: fast, performant and private Transformer inference with MPC](https://mlsanity.com/paper/2211.01452/) (2022)
- [Chameleon: A Hybrid Secure Computation Framework for Machine Learning Applications](https://mlsanity.com/paper/1801.03239/) (2018)
- [Privacy-Preserving Machine Learning: Methods, Challenges and Directions](https://mlsanity.com/paper/2108.04417/) (2021)
- [SHE: A Fast and Accurate Deep Neural Network for Encrypted Data](https://mlsanity.com/paper/1906.00148/) (2019)
- [SIRNN: A Math Library for Secure RNN Inference](https://mlsanity.com/paper/2105.04236/) (2021)
- [HEMET: A Homomorphic-Encryption-Friendly Privacy-Preserving Mobile Neural Network Architecture](https://mlsanity.com/paper/2106.00038/) (2021)
- [nGraph-HE2: A High-Throughput Framework for Neural Network Inference on Encrypted Data](https://mlsanity.com/paper/1908.04172/) (2019)
- [Primer: Fast Private Transformer Inference on Encrypted Data](https://mlsanity.com/paper/2303.13679/) (2023)
- [Orion: A Fully Homomorphic Encryption Framework for Deep Learning](https://mlsanity.com/paper/2311.03470/) (2023)
- [CipherPrune: Efficient and Scalable Private Transformer Inference](https://mlsanity.com/paper/2502.16782/) (2025)
- [PrivCirNet: Efficient Private Inference via Block Circulant Transformation](https://mlsanity.com/paper/2405.14569/) (2024)
- [Breaking the Layer Barrier: Remodeling Private Transformer Inference with Hybrid CKKS and MPC](https://mlsanity.com/paper/2508.19525/) (2025)
- [AutoPrivacy: Automated Layer-wise Parameter Selection for Secure Neural Network Inference](https://mlsanity.com/paper/2006.04219/) (2020)
- [BoostCom: Towards Efficient Universal Fully Homomorphic Encryption by Boosting the Word-wise Comparisons](https://mlsanity.com/paper/2407.07308/) (2024)
- [DataSeal: Ensuring the Verifiability of Private Computation on Encrypted Data](https://mlsanity.com/paper/2410.15215/) (2024)
- [Trinity: A General Purpose FHE Accelerator](https://mlsanity.com/paper/2410.13405/) (2024)
- [Securing Transformer-based AI Execution via Unified TEEs and Crypto-protected Accelerators](https://mlsanity.com/paper/2507.03278/) (2025)
- [MATCHA: A Fast and Energy-Efficient Accelerator for Fully Homomorphic Encryption over the Torus](https://mlsanity.com/paper/2202.08814/) (2022)
- [AttestLLM: Efficient Attestation Framework for Billion-scale On-device LLMs](https://mlsanity.com/paper/2509.06326/) (2025)
- [CryptoGen: Secure Transformer Generation with Encrypted KV-Cache Reuse](https://mlsanity.com/paper/2602.08798/) (2026)
- [OFHE: An Electro-Optical Accelerator for Discretized TFHE](https://mlsanity.com/paper/2405.11607/) (2024)
- [SoK: Can Fully Homomorphic Encryption Support General AI Computation? A Functional and Cost Analysis](https://mlsanity.com/paper/2504.11604/) (2025)
- [zkVC: Fast Zero-Knowledge Proof for Private and Verifiable Computing](https://mlsanity.com/paper/2504.12217/) (2025)
- [SecureRouter: Encrypted Routing for Efficient Secure Inference](https://mlsanity.com/paper/2604.15499/) (2026)
- [CryptoLight: An Electro-Optical Accelerator for Fully Homomorphic Encryption](https://mlsanity.com/paper/2211.13780/) (2022)

## Abstract (arXiv)

Cryptographically secure inference faces two practical challenges: making secure programming accessible to AI developers and data scientists, and achieving efficient execution across deployment environments. Developers must compose cryptographic primitives correctly, while performance depends on hardware, networks, and evolving ciphertext states. We present CipherFlow, a compiler framework that takes a high-level AI computation graph, available cryptographic primitives, and a target hardware and network configuration to generate an executable, latency-optimized secure inference program. CipherFlow automates cryptographic execution decisions through three techniques: MicroBench profiles deployment-specific primitive costs; state-expanded planning jointly optimizes homomorphic encryption (HE) and secure multi-party computation (MPC) placement, conversions, and ciphertext maintenance under cryptographic-state constraints; and BlockFold summarizes branched regions to scale planning to Transformer graphs. Evaluation using measured HE/MPC backend costs across CPU/GPU and network settings shows up to 16.5× speedup on BERT-base and over 22× on ViT compared with static hybrid placement baselines. CipherFlow separates model programming from cryptographic execution decisions, enabling developers to express AI computations while the compiler constructs efficient secure programs.
