The following are notes taken on lecture 11 of the Harvard CS229br seminar on machine learning theory, concerning privacy in machine learning. Thanks to Prof. Boaz Barak and his team for producing this seminar and sharing it freely.
Privacy
Background
Models are often trained on private data, in which case model outputs may be problematically compromising. Work by Latanya Sweeny demonstrated that simple, publicly-available demographic data can uniquely identify individuals, and managed to obtain the medical records of the governor of Massachusetts in the year
With access to enough queries, one can partially reconstruct a model’s weights, and in turn partially reconstruct the training data. Carlini et al. (2021) demonstrated this weakness in GPT
Possible solutions come with tradeoffs:
- Cryptographic methods can ensure privacy at a large cost to efficiency, and restriction on control of access to the information.
- Differential privacy methods let us manually tune the privacy/utility tradeoff, but presently the tradeoff is not good enough to be desirable.
- Heuristic approaches can get good privacy for minimal utility tradeoff, but do not offer guarantees.
Cryptography
Private Key Encryption
In private key encryption, some key and plain text message are encrypted to produce a cipher, which can be decrypted using the key.
An encryption is correct if encrypting and decrypting a message with the same key retrieves the message:
One-Time Pad
The one-time pad is a private key encryption algorithm, performed by simply combining the message and the key using modular addition (the XOR bitwise operation), which is reversible when the key is known:
The one-time pad scheme is perfectly secret, meaning that an adversary with access to the cipher and not the key cannot guess the message any better than by chance:
Perfect Secrecy
Shannon proved that the one-time pad achieves perfect secrecy with
The one-time pad can be extended to messages over some set of integers, setting the modular addition according to the minimum value:
Note that our observation that
Shannon also proved that every perfectly-secret scheme requires
Historically, the reusing of keys allowed Gene Grabeel and her collaborators to decrypt Soviet communications and expose many of their operatives in the west. Modern encryption uses computational schemes where keys can be shared between messages, making the key exponentially smaller than the volume of data it can encrypt.
Fully Homomorphic Encryption
FHE schemes have the property that even without knowing the private key, known operations can be performed on the ciphers which compute ciphers of bitwise operations of messages:
or equivalently,
which forms a universal basis for computation.
Encryption in FHE is a randomized algorithm. Each bit is encrypted and decrypted using a key, and any two ciphers can be evaluated using NAND. The correctness of evaluation is defined as an approximation such that the total variation between the NAND of the ciphers and the cipher or the NAND of the messages is exponentially small in
The computational secrecy property shows that each bit cannot be guessed better than chance, considers only algorithms that run in polynomial time, a similar equivalency condition that the advantage over half is exponentially small in
Computational Secrecy
This holds even if an adversary has seen exponentially many samples of ciphers using the same key! This means perfect secrecy in practice, for cheap.
FHE in Practice
FHE was proven to exist under reasonable assumptions by Gentry (2009). Further work has limited this to standard assumptions of learning with error. Some implementations exist, although still slow.
FHD for Learning
FHD is promising for machine learning, and there’s active research on this topic. Since NAND is a universal basis for computation, we can express any algorithm
Differential Privacy
Another candidate direction for enforcing privacy in machine learning is differential privacy (For more see The Algorithmic Foundations of Differential Privacy by Cynthia Dwork and Aaron Roth).
For dataset
Differential Privacy
More formally, considering two datasets that differ only in one coordinate,
where the probability is over the randomness in
In a context of data privacy, where there might be fear that the inclusion of some datapoint might lead to an undesirable decision, differential privacy ensures that the effect of the inclusion of any datapoint on the probability of any decision is smaller than a factor of
One might suggest that a weaker requirement of an additive factor is enough to satisfy privacy needs. However, let’s examine a worst case where the algorithm
While this algorithm is obviously not private, it does satisfy the additive definition. If
Properties of Differential Privacy
1)
2) Differential privacy is also retained under post-processing.
If
3) Differential privacy can guarantee that training mechanisms are not blatantly broken.
Define a training mechanism
Differentially Private Statistics
Suppose we want to publish estimates of some functions summed over our dataset. We want the estimates to be as close as possible while making sure that we respect privacy.
Why should we worry about privacy when publishing sums?
Suppose we have a dataset of COVID cases in Cambridge, Massachusetts. A sum statistic for example could be the number of cases corresponding to Harvard professors, or to people who own cats. It turns out that while innocuous on their own, multiple sum statistics can be used to infer private information. Take the following example publication:
- There are 30 total cases in Cambridge.
- There are 29 cases of people under the age of
. - There are 12 cases of people with preexisting liver diseases.
- There are 11 cases of people under the age of
with preexisting liver diseases.
From the first two, we can already deduce that only one positive case in Cambridge is aged
We can protect privacy by adding noise proportional to our desired
Assume our functions are binary functions
The Laplace mechanism is
Generalizing for functions outside of sum we can achieve
Definition versus Mechanism
The Laplace mechanism is so popular that it’s often confused to be synonymous with differential privacy, but in truth differential privacy is a definition of privacy, and the Laplace mechanism is but one approach to achieve it. Other noise distributions can be used, including Gaussian noise, usually achieving some
DP for SGD
Abadi et al. demonstrate differential privacy in the context of deep learning by injecting noise into the SGD step. They also introduce gradient clipping, where
They show that for constant
They achieved 97% on MNIST with very large epsilon (
Some approaches other than noise injection have shown promise for better scaling: Papernot et al. trained teacher models on disparate private datasets, and let a public student model query a noisy private aggregate of the teacher ensembles (PATE). Subsequent research was published on scaling this architecture.
Heuristics
Heuristic methods can provide better privacy, with lower cost to accuracy and faster execution. The price is abandoning absolute guarantees.
InstaHide
Huang et al. (2018) introduced InstaHide, inspired by FHE, and optimized for standard training procedures. The private data is mixed together with public data before training.
While the authors do not provide a definition of the privacy conditions the method satisfy, or proof thereof, but they attempt to justify a claim for privacy empirically. At the very least, one would hope that the encoding will be robust against reconstruction attacks. That is, that it would not be possible to efficiently reconstruct the private information from the encoded information.
Mixup Augmentation
The intuition for InstaHide is taken from Mixup data augmentation, where networks are trained on convex combinations of examples from different label to favor linear interpolation behavior, which has been shown to decrease memorization in the context of corrupted labels.
The procedure takes two private (secret) examples
While the authors have shown that this method does not degrade accuracy much, Carlini at al. (2020) have shown that InstaHide is insecure. Their attack was able to retrieve visually-recognizable reconstructions of
The attackers used that fact that the random flipping transformation, performed on floating point numbers, preserves their absolute value which retains a non-trivial amount of information, enough to even recognize by eye.
Since every encoded image contains information about two private images, many are bound to overlap and share information from the same private image, in which case the encoded images will have some agreement. Even with only absolute value data, the attackers managed to train a neural network to leverage that agreement to classify whether a pair of encoded images share an image in common with high accuracy. Clustering the encoded images, the average of the cluster will retrieve the absolute value of the original image.
The attackers could have stopped there, but they used the data to reconstruct the encoding graph, the values of
The challenge answered by the attackers contained
Ambiguous Privacy
This example demonstrates the need for a definition of security that can be proven or tested, which might be more relaxed than that of differential privacy to allow for efficiency.
Why not avoid repeated use of private datapoints?
We must remember that data providers always have a maximum privacy alternative: not to share the data. If we increased the proportion of public data in the encoding, we’d rapidly lose the benefit of our private data, whether if due to noise or distribution shift.
Black Box Recovery
Carlini et al. (2020) showed that even with limitations on queries from a black-box model, the model’s parameters can often be reconstructed.
Summary
Queries can allow to reconstruct models, knowledge of the model can allow to reconstruct training data and knowledge of the training data, even if encrypted, can allow to reconstruct original private data.
Therefore, definitions of security need to be proposed and mechanisms to ensure them need to be proven. The state of the field today can be summarized in three approaches:
- Cryptographic approaches can ensure privacy, at great cost to performance and efficiency.
- Differential privacy can allow for a tuned trade-off between privacy and utility, currently with high cost.
- Heuristic approaches can be the best of both worlds, but lack guarantees and are in risk of attacks that can break them completely.