arXiv:2503.12217cs.CRcs.LG2025-03被引 12

用大模型生成加密计算代码,提升安全计算的可用性。

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

  • 结合检索增强与少量样本提示,优化大模型生成加密代码
  • 开源与闭源模型生成错误率高,但优化后代码准确性显著提升
  • 为全同态加密代码生成提供首个基准,适合安全计算研究者

基于环面的全同态加密(TFHE)可在不解密情况下对加密数据进行计算,是隐私保护机器学习、多方安全计算、私有区块链交易和医疗诊断等领域的核心技术。然而,其复杂性和使用门槛限制了实际应用。尽管已有多种TFHE库和编译器,代码生成仍面临挑战。本文提出一个集成编译器框架,评估大模型推理与代理优化在TFHE代码生成中的表现,重点针对逻辑门和ReLU激活函数。通过分析误差率、可编译性及结构相似性,发现现成模型存在明显局限,而检索增强生成(RAG)和少样本提示等代理优化手段可有效降低错误率并提升代码质量。本工作建立了首个TFHE代码生成基准,证明通过领域特定反馈,大模型可弥合全同态加密编程的知识鸿沟。

原文摘要 · Abstract (English)

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.

全同态加密大模型生成安全计算代码生成

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。