arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2512.11135cs.CR
收藏

用于私有Transformer推理的网络和编译器优化以提高线性代数内核效率

Network and Compiler Optimizations for Efficient Linear Algebra Kernels in Private Transformer Inference

New York University(纽约大学)

Karthik Garimella, Negar Neda, Austin Ebel, Nandan Kumar Jha, Brandon Reagen

AI总结:

本研究通过网络和编译器优化提升FHE环境下Transformer推理的效率,发现BSGS方法比打包行方法快13.7倍,并通过剪枝策略减少FHE运行时间11.46倍。

摘要:

基于大型语言模型(LLM)的服务主要以客户端-服务器交互的方式构建,客户端直接将查询发送到托管LLM的云提供商。目前,这种模式在数据隐私方面存在缺陷,因为所有查询必须在云端以明文形式处理。全同态加密(FHE)是解决此数据隐私问题的解决方案,它允许在加密查询上直接进行计算。然而,运行加密的Transformer推理具有挑战性,因为程序员必须将标准内核映射到FHE提供的受限指令集。在本工作中,我们探索了Transformer推理所需的线性代数内核的实现,并了解网络优化如何帮助缓解FHE成本,同时保持性能。我们利用Orion PyTorch到FHE框架来基准测试几种线性代数内核,以分析两种线性变换方法,即打包行和BSGS,并发现BSGS在Transformer级别规模下比打包行方法快多达13.7倍。我们还结合了网络层面的剪枝策略,可将前馈层的FHE运行时间减少高达11.46倍。此外,我们扩展了Orion,以包含密文-密文矩阵-矩阵乘法,这是自注意力块中的关键组件。最后,我们对FHE原语和加密线性变换进行了屋顶分析,并发现(SIMD编码)实现是内存受限的,原语在DRAM流量中每字节大约有0.1个整数运算。这些发现表明,需要探索CKKS中的替代编码方案和计算模型,以解锁可扩展的私有Transformer推理。所有实验均使用Orion框架进行,该框架可在:https://github.com/baahl-nyu/orion上找到。

英文摘要:

Large language model (LLM) based services are primarily structured as client-server interactions, with clients sending queries directly to cloud providers that host LLMs. This approach currently compromises data privacy as all queries must be processed in the cloud and in the clear. Fully Homomorphic Encryption (FHE) is a solution to this data privacy issue by enabling computations directly upon encrypted queries. However, running encrypted transformer inference is challenging as programmers must map standard kernels to the constrained instruction set provided by FHE. In this work, we explore implementations of linear algebra kernels needed for transformer inference in FHE and understand how network optimization can help mitigate FHE costs while remaining performant. We leverage the Orion PyTorch to FHE framework to benchmark several linear algebra kernels in order to profile two linear transformation methods, packed row and BSGS, and find that BSGS outperforms packed row methods by up to $13.7 \times$ at transformer-level scales. We also incorporate network-level pruning strategies that reduce FHE runtimes of feed forward layers by up to $11.46\times$. Furthermore, we extend Orion to include ciphertext-ciphertext matrix-matrix products, a key component in the self-attention blocks. Finally, we perform a roofline analysis of FHE primitives and encrypted linear transformations and find that (SIMD encoded) implementations are memory-bound with primitives having roughly $0.1$ integer operations per byte of DRAM traffic. These findings illustrate the need for exploring alternative encoding schemes and models of computation within CKKS to unlock scalable private transformer inference. We conduct all experiments using the Orion framework which can be found at: https://github.com/baahl-nyu/orion.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑