CHEHAB RL: Learning to Optimize Fully Homomorphic Encryption Computations
Bilel Sefsaf, Abderraouf Dandani, Abdessamed Seddiki, Arab Mohammed, Eduardo Chielle, Michail Maniatakos, Riyadh Baghdadi
Abstract
Fully Homomorphic Encryption (FHE) enables computations directly on encrypted data, but its high computational cost remains a significant barrier. Writing efficient FHE code is a complex task requiring cryptographic expertise, and finding the optimal sequence of program transformations is often intractable. In this paper, we propose CHEHAB RL, a novel framework that leverages deep reinforcement learning (RL) to automate FHE code optimization. Instead of relying on predefined heuristics or combinatorial search, our method trains an RL agent to learn an effective policy for applying a sequence of rewriting rules to automatically vectorize scalar FHE code while reducing instruction latency and noise growth. The proposed approach supports the optimization of both structured and unstructured code. To train the agent, we synthesize a diverse dataset of computations using a large language model (LLM). We integrate our proposed approach into the CHEHAB FHE compiler and evaluate it on a suite of benchmarks, comparing its performance against Coyote, a state-of-the-art vectorizing FHE compiler. The results show that our approach generates code that is 5.3× faster in execution, accumulates 2.54× less noise, while the compilation process itself is 27.9× faster than Coyote (geometric means).
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext e3a04640-3eab-439a-b5e1-4c26990e2c8aBuilds on11
- Ansor: Generating High-Performance Tensor Programs for Deep LearningLianmin Zheng, Chengfan Jia, Minmin Sun, Zhao Wu et al.OSDI 2020 · 551 citations
- Learning Performance-Improving Code EditsAlexander Shypula, Aman Madaan, Yimeng Zeng, Uri Alon et al.ICLR 2024 · 141 citations
- SoK: Fully Homomorphic Encryption CompilersAlexander Viand, Patrick Jattke, Anwar HithnawiS&P 2021 · 117 citations
- EVA: an encrypted vector arithmetic language and compiler for efficient homomorphic computationRoshan Dathathri, Blagovesta Kostova, Olli Saarikivi, Wei Dai et al.PLDI 2020 · 117 citations
- VeGen: a vectorizer generator for SIMD and beyondYishen Chen, Charith Mendis, Michael Carbin, Saman P. AmarasingheASPLOS 2021 · 43 citations
Related papers
- CHLOE: Loop Transformation over Fully Homomorphic Encryption via Multi-Level Vectorization and Control-Path ReductionSong Bian, Zian Zhao, Ruiyu Shen, Zhou Zhang et al.S&P 2025
- Optimizing homomorphic evaluation circuits by program synthesis and term rewritingDongKwon Lee, Woosuk Lee, Hakjoo Oh, Kwangkeun YiPLDI 2020 · 30 citations
- A Tensor Compiler with Automatic Data Packing for Simple and Efficient Fully Homomorphic EncryptionAleksandar Krastev, Nikola Samardzic, Simon Langowski, Srinivas Devadas et al.PLDI 2024 · 23 citations
- HECO: Fully Homomorphic Encryption CompilerAlexander Viand, Patrick Jattke, Miro Haller, Anwar HithnawiUSENIX Security 2023
- FHE-Coder: Benchmarking Secure Agentic Code Generation for Fully Homomorphic EncryptionMayank Kumar, Jiaqi Xue, Mengxin Zheng, Qian LouICLR 2026
