TFHE-Coder: Evaluating LLM-agentic Fully Homomorphic Encryption Code Generation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Kumar, Mayank, Xue, Jiaqi, Zheng, Mengxin, Lou, Qian
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910877326770176
author Kumar, Mayank
Xue, Jiaqi
Zheng, Mengxin
Lou, Qian
author_facet Kumar, Mayank
Xue, Jiaqi
Zheng, Mengxin
Lou, Qian
contents Fully Homomorphic Encryption over the torus (TFHE) enables computation on encrypted data without decryption, making it a cornerstone of secure and confidential computing. Despite its potential in privacy preserving machine learning, secure multi party computation, private blockchain transactions, and secure medical diagnostics, its adoption remains limited due to cryptographic complexity and usability challenges. While various TFHE libraries and compilers exist, practical code generation remains a hurdle. We propose a compiler integrated framework to evaluate LLM inference and agentic optimization for TFHE code generation, focusing on logic gates and ReLU activation. Our methodology assesses error rates, compilability, and structural similarity across open and closedsource LLMs. Results highlight significant limitations in off-the-shelf models, while agentic optimizations such as retrieval augmented generation (RAG) and few-shot prompting reduce errors and enhance code fidelity. This work establishes the first benchmark for TFHE code generation, demonstrating how LLMs, when augmented with domain-specific feedback, can bridge the expertise gap in FHE code generation.
format Preprint
id arxiv_https___arxiv_org_abs_2503_12217
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle TFHE-Coder: Evaluating LLM-agentic Fully Homomorphic Encryption Code Generation
Kumar, Mayank
Xue, Jiaqi
Zheng, Mengxin
Lou, Qian
Cryptography and Security
Machine Learning
Fully Homomorphic Encryption over the torus (TFHE) enables computation on encrypted data without decryption, making it a cornerstone of secure and confidential computing. Despite its potential in privacy preserving machine learning, secure multi party computation, private blockchain transactions, and secure medical diagnostics, its adoption remains limited due to cryptographic complexity and usability challenges. While various TFHE libraries and compilers exist, practical code generation remains a hurdle. We propose a compiler integrated framework to evaluate LLM inference and agentic optimization for TFHE code generation, focusing on logic gates and ReLU activation. Our methodology assesses error rates, compilability, and structural similarity across open and closedsource LLMs. Results highlight significant limitations in off-the-shelf models, while agentic optimizations such as retrieval augmented generation (RAG) and few-shot prompting reduce errors and enhance code fidelity. This work establishes the first benchmark for TFHE code generation, demonstrating how LLMs, when augmented with domain-specific feedback, can bridge the expertise gap in FHE code generation.
title TFHE-Coder: Evaluating LLM-agentic Fully Homomorphic Encryption Code Generation
topic Cryptography and Security
Machine Learning
url https://arxiv.org/abs/2503.12217