用截断操作实现私有大模型推理,大幅降低延迟。
TruncFormer: Private LLM Inference Using Only Truncations
- 通过加乘与截断分离,用截断序列逼近非线性函数。
- 在固定字段大小下静态插入截断点,减少计算开销。
- 适用于新架构大模型,无需针对每种非线性重新优化。
私有推理(PI)在保护用户数据隐私方面至关重要,尤其在使用专有大语言模型(LLM)时。然而,由于LLM中存在大量非线性函数,导致现有方法面临巨大延迟问题。现有工作主要针对特定非线性(如Softmax、GeLU)进行近似以提升效率,但新架构不断引入新型非线性,使研究陷入持续追赶。本文提出TruncFormer,一种将任意LLM转换为明文模拟私有推理的框架。该框架利用非线性函数的可微性,通过一系列加法、乘法和截断操作实现高精度近似。同时,将加/乘与截断操作解耦,并基于给定字段大小和输入表示尺寸,静态确定截断位置。相比需在每次乘法后强制截断的加密协议,该方法显著降低延迟。代码已开源,供社区使用。
原文摘要 · Abstract (English)
Private inference (PI) serves an important role in guaranteeing the privacy of user data when interfacing with proprietary machine learning models such as LLMs. However, PI remains practically intractable due to the massive latency costs associated with nonlinear functions present in LLMs. Existing works have focused on improving latency of specific LLM nonlinearities (such as the Softmax, or the GeLU) via approximations. However, new types of nonlinearities are regularly introduced with new LLM architectures, and this has led to a constant game of catch-up where PI researchers attempt to optimize the newest nonlinear function. We introduce TruncFormer, a framework for taking any LLM and transforming it into a plaintext emulation of PI. Our framework leverages the fact that nonlinearities in LLMs are differentiable and can be accurately approximated with a sequence of additions, multiplications, and truncations. Further, we decouple the add/multiply and truncation operations, and statically determine where truncations should be inserted based on a given field size and input representation size. This leads to latency improvements over existing cryptographic protocols that enforce truncation after every multiplication operation. We open source our code for community use.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。