Encrypted Computation: What if Decryption Wasn’t Needed? • Katharine Jarmul • GOTO 2024
An exploration of encrypted computation, detailing how techniques like homomorphic encryption and multi-party computation can enable machine learning on encrypted data. The summary covers the core mathematical principles, real-world use cases, and open-source libraries to build more private and trustworthy AI systems.
The rapid adoption of AI, exemplified by ChatGPT reaching a million users in just five days, has brought powerful capabilities but also significant privacy concerns. Systems have become exceptionally good at user profiling and advertising, sometimes creating a “creepy” user experience. This raises a fundamental question for technologists: can we leverage AI’s power while building systems that are not inherently invasive? The solution may lie in the field of encrypted computation, which allows for machine learning and other calculations to be performed on data without ever decrypting it.
Homomorphic Encryption (HE)
Homomorphic encryption is a cryptographic method that allows computations to be performed directly on encrypted data. The core principle is commutativity: a mathematical operation performed on plaintext data has a corresponding operation in the encrypted space. If you encrypt two numbers, x and y, into ciphertexts c1 and c2, you can perform an operation on c1 and c2 to get a result c3. When c3 is decrypted, the result is the same as if you had performed the original operation on the plaintext x and y.
A classic example is the Paillier cryptosystem. In this system, multiplying two encrypted messages results in a new ciphertext that, when decrypted, yields the sum of the original two messages.
E(m1) * E(m2) -> E(m1 + m2)
This works by choosing numbers from a finite group with specific mathematical properties (group theory) and introducing randomness, which is essential for security.
Practical Considerations:
- Computational Cost: HE is computationally expensive. Specialized hardware like FPGAs and custom accelerators are often used to make it performant. Intel, for instance, collaborates with Zama to build such hardware.
- Use Cases: HE is ideal for scenarios where the data owner is separate from the data processor. For example, a user could upload their encrypted medical data to a cloud service for analysis, download the encrypted result, and be the only one able to decrypt it.
- Noise and Machine Learning: Some HE protocols, like CKKS, introduce a small amount of “noise” or randomness as a trade-off for speed. In machine learning, this is often a benefit, as noise injection can act as a form of regularization, helping to prevent model overfitting and memorization.
Multi-Party Computation (MPC)
Multi-party computation is another form of encrypted computation, described as “encrypting data with friends.” It’s a group activity where multiple parties want to compute a joint function on their private data without revealing that data to each other.
The process typically involves secret sharing:
- Each party takes their private data (a number) and splits it into multiple “shares.”
- These shares are distributed among the participating parties. A single share reveals nothing about the original number.
- The parties compute on their collection of shares, exchanging intermediary values.
- Finally, the parties combine their result shares to reveal the final answer. The protocol can be designed so that one, some, or all parties can decrypt the result.
Unlike some HE schemes, MPC is an extremely accurate form of computation with no noise buildup. Its real power lies in its ability to technologically enforce real-world trust models and contracts. Instead of relying solely on a legal agreement not to misuse data, MPC provides a technical guarantee.
Real-World Applications and Use Cases
Encrypted computation is not just theoretical; it’s actively used in various domains:
- Private Set Intersection (PSI): Used by Google AdWords, Visa, and MasterCard to calculate advertising ROI. It allows parties to find the intersection of their datasets (e.g., users who saw an ad and users who made a purchase) without revealing the entire dataset.
- Encrypted Auctions: Denmark ran the first large-scale encrypted auction for sugar beet contracts, where bids were submitted in encrypted form, and only the winning bid was ever decrypted.
- Private Inference: A user can send an encrypted medical image or identity document to a service for validation. The service can confirm its validity and return an encrypted “yes/no” answer without ever seeing the document itself.
- Private Information Retrieval (PIR): Used in national security and now in building encrypted RAG (Retrieval-Augmented Generation) systems. It allows a user to query a database without the database owner knowing what was queried.
Getting Started with Encrypted Computation
Developers don’t need to be cryptographers to use these technologies. Several libraries and platforms make them accessible:
- Zama AI: Provides the
Concretelibrary for fully homomorphic encryption, with a NumPy-like interface. - Apple: Has announced support for
Swift Homomorphic Encryptionon new iOS devices. - Carbynestack: A project from Bosch Research that provides a platform for deploying advanced MPC protocols.
- Moose: An open-source compiler for encrypted tensor and matrix operations, originating from the team that built TensorFlow Encrypted.
The ultimate goal is to build technology that users can trust, much like the collective effort that made HTTPS a standard for a safer internet. By using these advanced cryptographic libraries, developers can build systems that reflect the privacy and security standards users expect, ensuring data is protected by design.