FHE-CodeEval: Benchmarking Large Language Models for Fully Homomorphic Encryption Code Generation

Qiuchu Yu, Guangli Li, Shuoming Zhang, Ruiyuan Xu, Qihan Cai, Jingling Xue, Xiaobing Feng, Huimin Cui


Abstract
Large language models (LLMs) are increasingly used for code generation, but their ability to program specialized cryptographic systems remains poorly understood. Cheon-Kim-Kim-Song (CKKS), a fully homomorphic encryption (FHE) scheme supporting approximate arithmetic over packed real- and complex-valued vectors, is particularly relevant to machine-learning workloads. Prior work has not systematically examined the CKKS-specific challenges of LLM-generated encrypted programs. To address this gap, we introduce FHE-CodeEval, a 46-case benchmark that evaluates three core challenges: packing, nonlinear approximation, and level/scale management, as well as how models coordinate decisions across them. We further introduce communication-aware efficiency, an FHE-specific metric comparing generated programs with compiler baselines using server-side runtime and ciphertext footprint.

We evaluate eight recent proprietary and open-weight LLMs on FHE-CodeEval. Across all 46 cases, the best observed scores reach 51.7% Pass@1 and 69.6% Pass@5 with iterative execution feedback, but only 7.8% Pass@1 and 13.0% Pass@5 in the one-shot setting. For efficiency, even the best-performing model achieves a geometric-mean communication-aware efficiency of only 0.44 over its valid rollouts in the compiler-comparable subset. These results reveal a substantial gap between functional correctness and efficiency in LLM-generated CKKS programs. Code is available at https://github.com/qiuchuy/FHE-CodeEval.
Anthology ID:
2026.findings-emnlp.600
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
12657–12673
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.600/
DOI:
Bibkey:
Cite (ACL):
Qiuchu Yu, Guangli Li, Shuoming Zhang, Ruiyuan Xu, Qihan Cai, Jingling Xue, Xiaobing Feng, and Huimin Cui. 2026. FHE-CodeEval: Benchmarking Large Language Models for Fully Homomorphic Encryption Code Generation. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 12657–12673, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
FHE-CodeEval: Benchmarking Large Language Models for Fully Homomorphic Encryption Code Generation (Yu et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.600.pdf