用部分同态加密实现隐私保护的向量相似度搜索,比全同态更高效。
Encrypted Vector Similarity Computations Using Partially Homomorphic Encryption: Applications and Performance Analysis
- 先归一化向量,用点积代替余弦相似度计算
- 在LFW数据集上验证,加密计算速度比全同态快3倍以上
- 适合边缘设备和内存受限场景的隐私保护应用
本文研究使用部分同态加密(PHE)实现加密向量相似度搜索,重点应用于人脸识别及反向图像搜索、推荐系统和大语言模型。尽管存在全同态加密(FHE),我们证明可通过PHE计算加密余弦相似度,提供更实用方案。由于PHE不直接支持余弦相似度,我们提出预先归一化向量,以点积作为替代。同时采用最小-最大归一化处理负维度值。实验基于LFW数据集,使用DeepFace的FaceNet128d、FaceNet512d和VGG-Face(4096d)模型,在双塔架构中,预加密嵌入存储于一端,边缘设备捕获图像并计算嵌入,通过加法同态加密执行加密-明文点积。采用LightPHE实现Paillier、Damgard-Jurik和Okamoto-Uchiyama方案,排除其他因性能或解密复杂性。在80位与112位安全强度(符合NIST至2030年标准)下,对比PHE与FHE(TenSEAL)的加密/解密时间、操作时延、余弦相似度损失、密钥/密文大小。结果表明,PHE计算开销更低、速度更快、密文与密钥更小,适用于内存受限环境及真实世界的隐私保护相似度搜索。
原文摘要 · Abstract (English)
This paper explores the use of partially homomorphic encryption (PHE) for encrypted vector similarity search, with a focus on facial recognition and broader applications like reverse image search, recommendation engines, and large language models (LLMs). While fully homomorphic encryption (FHE) exists, we demonstrate that encrypted cosine similarity can be computed using PHE, offering a more practical alternative. Since PHE does not directly support cosine similarity, we propose a method that normalizes vectors in advance, enabling dot product calculations as a proxy. We also apply min-max normalization to handle negative dimension values. Experiments on the Labeled Faces in the Wild (LFW) dataset use DeepFace's FaceNet128d, FaceNet512d, and VGG-Face (4096d) models in a two-tower setup. Pre-encrypted embeddings are stored in one tower, while an edge device captures images, computes embeddings, and performs encrypted-plaintext dot products via additively homomorphic encryption. We implement this with LightPHE, evaluating Paillier, Damgard-Jurik, and Okamoto-Uchiyama schemes, excluding others due to performance or decryption complexity. Tests at 80-bit and 112-bit security (NIST-secure until 2030) compare PHE against FHE (via TenSEAL), analyzing encryption, decryption, operation time, cosine similarity loss, key/ciphertext sizes. Results show PHE is less computationally intensive, faster, and produces smaller ciphertexts/keys, making it well-suited for memory-constrained environments and real-world privacy-preserving encrypted similarity search.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。