用同态加密保护LLM推理,实现隐私安全的文本生成。
Fully Homomorphic Encryption on Llama 3 model for privacy preserving LLM inference

- 在Llama 3推理流程中嵌入基于格的同态加密,保护数据隐私。
- 在i9 CPU上实现98%生成准确率,延迟237毫秒,达80词/秒。
- 为医疗、金融等敏感领域提供抗量子攻击的隐私保护方案。
生成式人工智能(GenAI)在医疗、金融、交通和信息安全等数据驱动领域的应用显著提升了服务效率与低延迟。然而,大语言模型(LLM)的安全性问题引发对企业和用户数据隐私的担忧。现有技术如输入输出净化、去中心化学习、访问控制虽可降低风险,但仍面临量子计算攻击威胁,可能破解传统加密算法并窃取密钥、解密数据与模型。本文将基于格的后量子密码学同态加密(HE)集成至LLM推理流程中,对Llama-3模型的Transformer架构进行改造,并通过concrete-ml库注入同态加密操作。实验表明,在i9 CPU上实现高达98%的文本生成准确率,延迟237毫秒,每秒生成80个词,验证了该方法在隐私保护下的可行性与有效性。进一步分析讨论了生成延迟与行为特性。
原文摘要 · Abstract (English)
The applications of Generative Artificial Intelligence (GenAI) and their intersections with data-driven fields, such as healthcare, finance, transportation, and information security, have led to significant improvements in service efficiency and low latency. However, this synergy raises serious concerns regarding the security of large language models (LLMs) and their potential impact on the privacy of companies and users' data. Many technology companies that incorporate LLMs in their services with a certain level of command and control bear a risk of data exposure and secret divulgence caused by insecure LLM pipelines, making them vulnerable to multiple attacks such as data poisoning, prompt injection, and model theft. Although several security techniques (input/output sanitization, decentralized learning, access control management, and encryption) were implemented to reduce this risk, there is still an imminent risk of quantum computing attacks, which are expected to break existing encryption algorithms, hence, retrieving secret keys, encrypted sensitive data, and decrypting encrypted models. In this extensive work, we integrate the Post-Quantum Cryptography (PQC) based Lattice-based Homomorphic Encryption (HE) main functions in the LLM's inference pipeline to secure some of its layers against data privacy attacks. We modify the inference pipeline of the transformer architecture for the LLAMA-3 model while injecting the main homomorphic encryption operations provided by the concrete-ml library. We demonstrate high text generation accuracies (up to 98%) with reasonable latencies (237 ms) on an i9 CPU, reaching up to 80 tokens per second, which proves the feasibility and validity of our work while running a FHE-secured LLAMA-3 inference model. Further experiments and analysis are discussed to justify models' text generation latencies and behaviours.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。