CryptoRec: Secure Recommendations as a Service

Jun Wang, Afonso Arriaga, Qiang Tang, Peter Y. A. RyanarXiv 2018 · OpenReview

Abstract

Recommender systems are essential for modern digital services but pose significant privacy risks to both users and service providers. We present CryptoRec, a secure two-party computation protocol for Recommendation as a Service (RaaS). By co-designing a novel recommender model with homomorphic encryption (HE) primitives, CryptoRec achieves high accuracy while maintaining strict privacy. The model utilizes an item-only latent feature space and relies exclusively on linear operations, making it natively compatible with HE. Evaluations on real-world datasets show that CryptoRec can provide private recommendations in seconds with accuracy competitive with non-private state-of-the-art systems.

Introduction: The Privacy Paradox

Modern recommendation engines require massive datasets of user interactions (ratings, history, preferences) to function effectively. This creates a privacy paradox: users must surrender sensitive personal data for better service, while providers must protect their proprietary models and datasets.

Existing privacy-preserving solutions usually fall into two traps:

  1. Efficiency: Using general cryptographic tools like Secure Multi-Party Computation (SMC) often results in prohibitive latency.
  2. Accuracy: Standard machine learning models rely on non-linear functions (like Sigmoid or ReLU) that are extremely difficult to compute on encrypted data. Approximating these functions often leads to a significant drop in recommendation quality.

The CryptoRec Framework

CryptoRec addresses these challenges by constructing a "crypto-friendly" machine learning algorithm. Unlike traditional models that jointly learn user and item features, CryptoRec operates in an item-only latent feature space.

Personalized Representations and Linearity

In this framework, a user's representation is not a static vector but is dynamically captured by aggregating the features of items they have previously rated ($p_u = r_u A$). This approach ensures that the model only requires addition and multiplication operations, which are natively supported by Homomorphic Encryption.

Operational Modes

The protocol supports two primary modes of operation:

  1. Direct Mode: The server provides immediate recommendations using a pre-trained model. This mode uses the Paillier cryptosystem for additive HE, ensuring high efficiency.
  2. Re-training Mode: The server fine-tunes the model using the client’s encrypted data to improve accuracy, utilizing "Somewhat Homomorphic Encryption" (SWHE) to handle both additions and multiplications on ciphertexts.
The Direct Mode protocol for secure recommendation generation.

To further optimize performance, CryptoRec employs pruning—removing near-zero parameters—and computation reuse, which identifies and recycles identical encrypted operations.

Experimental Evaluation

The authors evaluated CryptoRec using three industry-standard benchmarks: MovieLens-1M (ml1m), Netflix, and Yahoo-R4. These datasets vary in scale and density, providing a robust test for the system's performance.

Characteristics of the datasets used for evaluation.

Key Results

  • Competitive Accuracy: In Direct Mode, CryptoRec’s Root Mean Square Error (RMSE) was within 0.1% to 4.9% of non-private models like I-AutoRec. Re-training further closed this gap to within 0.7% on the Netflix dataset.
  • Practical Latency: On the MovieLens-1M dataset, a private recommendation query is processed in approximately 10.9 seconds on a standard PC.
  • Low Communication Overhead: Queries are lightweight, typically requiring only 3-5 MB of data transfer, making the system practical for mobile or web applications.

Conclusion

CryptoRec demonstrates that privacy-preserving recommendations do not have to come at the cost of extreme latency or poor accuracy. By designing algorithms specifically for the constraints of cryptographic primitives, we can build secure systems that are practical for deployment. Future work will focus on scaling the system to handle millions of items and incorporating contextual metadata while maintaining the linear efficiency required for real-time performance.

Summary updated

Abstract

Recommender systems rely on large datasets of historical data and entail serious privacy risks. A server offering Recommendation as a Service to a client might leak more information than necessary regarding its recommendation model and dataset. At the same time, the disclosure of the client's preferences to the server is also a matter of concern. Devising privacy-preserving protocols using general cryptographic primitives (e.g., secure multi-party computation or homomorphic encryption), is a typical approach to overcome privacy concerns, but in conjunction with state-of-the-art recommender systems often yields far-from-practical solutions. In this paper, we tackle this problem from the direction of constructing crypto-friendly machine learning algorithms. In particular, we propose CryptoRec, a secure two-party computation protocol for Recommendation as a Service, which encompasses a novel recommender system. This model possesses two interesting properties: (1) It models user-item interactions in an item-only latent feature space in which personalized user representations are automatically captured by an aggregation of pre-learned item features. This means that a server with a pre-trained model can provide recommendations for a client whose data is not in its training set. Nevertheless, re-training the model with the client's data still improves accuracy. (2) It only uses addition and multiplication operations, making the model straightforwardly compatible with homomorphic encryption schemes. We demonstrate the efficiency and accuracy of CryptoRec on three real-world datasets. CryptoRec allows a server with thousands of items to privately answer a prediction query within a few seconds on a single PC, while its prediction accuracy is still competitive with state-of-the-art recommender systems computing over clear data.
BibTeX
@misc{wang2018cryptorec,
  author = {Jun Wang and Afonso Arriaga and Qiang Tang and Peter Y. A. Ryan},
  title = {{CryptoRec: Secure Recommendations as a Service}},
  year = {2018},
  eprint = {1802.02432},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1802.02432},
}
Figure