Venue: NAACL 2022

# Provably Confidential Language Modelling

Xuandong Zhao Lei Li Yu-Xiang Wang

University of California, Santa Barbara

{xuandongzhao,leili,yuxiangw}@cs.ucsb.edu

###### Abstract

Large language models are shown to memorize privacy information such as social security numbers in training data. Given the sheer scale of the training corpus, it is challenging to screen and filter all privacy data, either manually or automatically. In this paper, we propose **C**onfidentially **R**edacted **T**raining (CRT), a method to train language generation models while protecting the confidential segments. We borrow ideas from differential privacy (which solves a related but distinct problem) and show that our method is able to _provably prevent_ unintended memorization by randomizing parts of the training process. Moreover, we show that redaction with an approximately correct screening policy _amplifies_ the confidentiality guarantee. We implement the method for both LSTM and GPT language models. Our experimental results show that the models trained by CRT obtain almost the same perplexity while preserving strong confidentiality1.

Footnote 1: Our code is available at [https://github.com/XuandongZhao/CRT](https://github.com/XuandongZhao/CRT)

+
Footnote †: _Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies_, pages 943 - 955

## 1 Introduction

Language models (LM) have rich real-world applications in, among others, machine translation Bahdanau et al. (2015), AI chatbots Hosseini-Asl et al. (2020), question answering Kwiatkowski et al. (2019), and information retrieval Ganguly et al. (2015). The advent of transformers Vaswani et al. (2017) has fostered a dramatic advancement in the capabilities of generative neural language models, yet they come at a cost to privacy, as the amount of excess parameters in the LM enables it to memorize certain training samples. Recent works show that sensitive user information from the training dataset, such as address and name, can be extracted verbatim from text generation models by querying the LM as an API Carlini et al. (2019, 2021); Lee et al. (2022). How to train a high-performing language model without memorizing sensitive text has become a major research challenge.

Existing solutions to this problem primarily leverage differential privacy (DP) Dwork et al. (2006).

Differentially private learning algorithms ensure that an attacker could not infer whether a data point is used for training, let alone extracting the sensitive information within that data point.

However, there are several mismatches between the problem of _privacy_ that DP addresses, and our problem of preventing the memorization of sensitive text (henceforth referred to as _confidentiality_). First, confidential information in a natural language dataset is sparse (e.g., the bulk of an email might not carry confidential information). DP's undiscriminating protection for all sentences could be unnecessarily conservative which limits the utility of the trained model. Second, what needs to be protected is the content of the sensitive text, rather than the data context. For example, in the sentence "My SSN is 123-45-6789.", it is the actual SSN that we hope to conceal rather than the general information that someone entered her SSN in a chatbot dialogue. Thirdly, the same sensitive content could appear in many data points, which makes the protection of the content more challenging than protecting one data sample. These differences motivate us to treat the problem of confidentiality protection in LM separately with new definitions.

Besides DP, we also consider classical techniques of redaction and deduplication. _Redaction_ refers to the process of removing sensitive or classified information from a document prior to its publication in governmental and legal contexts. _Deduplication_ is the procedure of detecting and removing identical and nearly identical texts from a corpus. The main challenge of applying these techniques is that it is hard to manually redact a gigantic dataset and automated tools are far from being perfect.



The contribution of this paper is fivefold.

1. We show that in the absence of a perfect screening policy, the risk of a language model memorizing sensitive content is real and can be efficiently exploited with only blackbox access to the model even if the learning algorithm satisfies the recently proposed notion of _selective differential privacy_(Shi et al., 2021).
2. Inspired by differential privacy, we introduce a new definition of _confidentiality_ which precisely quantifies the risk of leaking sensitive text.
3. We propose CRT to train language generation models while protecting confidential text. The method with deduplication and redaction operations work even under imperfect confidential text labeling policies.
4. We theoretically prove that CRT, combined with differentially private stochastic gradient descent (DP-SGD), provides strong confidentiality guarantees.
5. Our experiments on both MultiWOZ 2.2 and CustomerSim datasets show that different models trained by CRT can achieve the same or better perplexity than existing solutions (against the attacks of Carlini et al. (2019, 2021)).

To the best of our knowledge, we are the first that rigorously establish the role of deduplication and redaction in achieving provably stronger confidentiality (or the related differential privacy) guarantees; and the first that achieve provably confidentiality in transformer models with only a mild utility loss.

## 2 Background & Related Work

Next, we briefly introduce the relevant background and discuss the related work to put our work in context.

Language modeling is a fundamental problem in natural language processing Devlin et al. (2019); Howard and Ruder (2018); Raffel et al. (2020). Consider a text sequence that consists of multiple tokens from a vocabulary \({\cal V}\), i.e., \(\mathbf{w}=(w_{1},w_{2},\ldots,w_{n})\), where \(w_{i}\) is the \(i\)-th token. The goal of language modeling is to construct a generative model of the distribution \(\Pr(\mathbf{w})\), by applying the chain rule \(\Pr(\mathbf{w})=\prod_{i=1}^{n}\Pr\left(w_{i}~{}|~{}\mathbf{w}_{<i}\right).\) We let \(f_{\theta}(w_{i}|\mathbf{w}_{<i})\) denote the likelihood of token \(w_{i}\) when evaluating the neural network \(f\) with parameters \(\theta\). A language model is trained to maximize the probability of the data in a training set \({\cal W}\), by minimizing the negative log-likelihood over each training example with the loss function \(\mathcal{L}(\theta)=-\log\prod_{i=1}^{n}f_{\theta}\left(w_{i}~{}|~{}\mathbf{w}_{< i}\right).\) Recurrent neural networks (RNNs) used to be a common choice for the neural network architecture to estimate the probability distribution \(\Pr(\mathbf{w})\). Hochreiter and Schmidhuber (1997); Mikolov et al. (2010). More recently, large-scale Transformer-based language models have replaced RNNs in state-of-the-art

Figure 1: An example from simulated dialog dataset CustomerSim. The yellow highlights are confidential content (middle). Left shows the text after _Redaction_ by a sequence labeling policy \(\pi\). However, if the policy is not perfect, there exists false negative or false positive samples as shown on the right.

 

models for all sorts of NLP tasks (Vaswani et al., 2017; Radford et al., 2019). Nevertheless, common language models are vulnerable to privacy attacks and possibly expose information about their sensitive training data (Carlini et al., 2019, 2021).

Differentially private (DP) learning methods (see, e.g., Abadi et al., 2016) has been applied to language models as a blanket solution for a number of privacy and security risks. McMahan et al. (2018) trained an RNN language model with DP guarantees in a federated learning setup. Anil et al. (2021) pre-trained BERT under DP on datasets with hundreds of millions of examples. These paper also demonstrated that DP can effectively prevent data-extraction attacks in practice even for algorithms with DP guarantees that are considered too weak from a theoretical-perspective (e.g., \(\epsilon=8\) or \(16\)). However, the strong protection of DP often results in a substantial drop in the utility of the trained model, which makes them less desirable in practice. In fact, it was recently shown that it is _necessary_ for deep learning models to memorize certain training data to achieve high accuracy (Feldman, 2020), which suggests that DP or any other techniques that require the model to not memorize any training data will perform poorly in the high-dimensional, power-law distributed real datasets. This motivates us to consider weakened models that only prevent memorizing the sensitive part of the text.

Recent works (Lee et al., 2022; Kandpal et al., 2022) show that deduplication enables language models to emit memorized text less frequently with same or better accuracy. However, deduplicating training datasets can not prevent all unintended memorization. We combine deduplication and redaction and then apply both techniques to the training process of LM to achieve confidentiality with provable guarantee.

The closest to us is perhaps the work of Shi et al. (2021), who proposed _selective differential privacy_ (S-DP), which requires indistinguishability between two datasets that differ only on a sensitive message. Correspondingly, they propose an algorithm (Selective DP-SGD) for training RNN that adds noise only to the part of computation that involves sensitive tokens. To define S-DP and to run Selective DP-SGD, one needs to have access to a policy function \(F\) which determines which token is sensitive. This requirement limits the applicability of their approach to those applications where such perfect \(F\) is known. We note that even for name-entity recognition the state-of-the-art model is far from being perfect, and which part of the text is considered sensitive is often ambiguous even for human annotators. We will see that naively running Selective DP-SGD with an approximate policy function does not provide a meaningful confidentiality guarantee and is vulnerable to practical data extraction attacks. Finally, we note that in the case when a perfect policy function is available, we can simply use it for redaction, which provides a perfect S-DP with \(\epsilon=0\). A big part of our contribution is to refine S-DP to a (slightly different) definition called "confidentiality" and to demonstrate that we use an approximate screening policy to amplify the confidentiality parameter.

## 3 The CRT Method and Theory

In this section, we develop our method with provable confidentiality.

### Formally defining confidentiality

Let the dataset be a collection of \(n\) data points -- each being a sequence of tokens. A "secret" \(x\) is a contiguous subsequence of tokens within a data point that is considered _sensitive_ or _confidential_. The goal of our research is to allow us to train language models on such datasets that could contain secrets while provably prevent the model from remembering that these secrets were. We start by defining a formal definition of confidentiality, which uses the following idea of indistinguishability from the DP literature.

**Definition 1** (Indistinguishability).: _We say that a pair of distributions \(P,Q\) defined on the same probability space are \((\epsilon,\delta)\)-indistinguishable if for any measurable set \(S\),_

\[{\Pr}_{P}[S]\leq e^{\epsilon}\operatorname*{Pr}_{Q}[S]+\delta.\]

**Definition 2** (Confidentiality).: _We say that \(\mathcal{A}\) ensures that a secret \(x\) is \((\epsilon(x),\delta)\)-confidential, if for any dataset \(D\) that contains \(x\) in one of its data points, and an alternative dataset \(D^{\prime}\) that replaces \(x\) in \(D\) with a generic <MASK>, it holds that \((\mathcal{A}(D),\mathcal{A}(D^{\prime}))\) are \((\epsilon(x),\delta)\)-indistinguishable. In addition, we simply say that \(\mathcal{A}\) ensures \((\epsilon,\delta)\)-confidentiality if \(\epsilon(x)\leq\epsilon\) for all secret \(x\)._

This definition ensures that an attacker cannot distinguish from the output of \(\mathcal{A}\) (the trained language model) whether it was \(x\) or <MASK> that 

was used for training, thus formalizing the idea of confidentiality. The protection should be viewed as relative, rather than absolute. The definition bounds the risk of any bad event by an multiplicative factor of and an additive factor of , which implies that anything that could happen when we run on the sensitive data could've happened with with similar probability even if runs on an alternative world where these sensitive information are perfectly masked.

Connections to differential privacy.Our definition of confidentiality is related to (and inspired by)-differential privacy (DP) but is different in several ways. DP is stronger (and implies confidentiality!) requires to ensure -indistinguishability for all that can be modified from each other by adding or removing one individual person / data point (or tokens, depending on the desired granularity); but for to ensure -confidentiality, it only requires -infistinguishability for specific where replaces with . Moreover, it is more informative to define as a function of each specific , which is different from DP (it resembles personalized DP Ghosh and Roth [2015]).

The confidentiality definition makes sense for our problem because it protects the content of the sensitive text rather than its existence. Specifically, a pre-processing algorithm that masks all sensitive text ensures -confidentiality but does not satisfy any non-trivial DP guarantees.

Sometimes, it is useful to consider the confidentiality of multiple secret texts. For example, a secret key could appear multiple times in multiple data points. Also, there might be multiple secret texts that are correlated to each other such that the knowledge of one would reveal other secrets.

**Definition 3** (Group Confidentiality).: _We say that **\({\cal A}\)**ensures** that a **list** of sensitive texts is -(group) confidential, if for any dataset that contains in up to data points, and being the version that replaces each element in \({\cal S}\) with , it holds that are -indistinguishable._

A special case of such group confidentiality is when collects the _all secret text_ in , which protects all secret texts uniformly. We call this _uniform-confidentiality_. Note that the standard definition of confidentiality also protect every secret , except that it protects each secret individually, rather than together.

Inspired by the recent development of Bayesian DP Triastcyn and Faltings [2020], we also define Bayesian confidentiality as follows.

**Definition 4** (Bayesian Confidentiality).: _Let be a dataset that is fixed except a random secret drawn from some distribution . Let be obtained by replacing with . Then ann 

\({\rm Redact}\) and \({\rm Dedup}\) could be implemented manually, but with the large text corpus nowadays it is more common that these procedures are implemented using automated tools. For example, \({\rm Dedup}\) could be implemented efficiently with just one pass of data using a _bloom filter_[1] (or other hashing tricks that also catches near-duplicates). Bloom filter in particular, enjoys the nice property that it could have false positives but never any false negatives. \({\rm Redact}_{\pi}\) could be realized by a named entity recognition (NER) model or a personal-identifiable information (PII) detector.

Finally, CRT combines the two pre-processing steps with normal optimizer and DP-SGD, the standard algorithm for deep learning with differential privacy. A pseudo-code of the algorithm is given in Algorithm 1.

Besides using a sequence labeling policy \(\pi\) with balanced precision/recall as part of the redaction process. The algorithm uses another, more conservative, policy \(\pi_{c}\) with nearly perfect recall to decide on the data points that do not contain sensitive text. In the situation when such \(\pi_{c}\) isn't available, we simply choose \(\pi_{c}(s,x)=1\) for all tokens \(x\) in a sentence \(s\) and the second part becomes the vanilla DP-SGD. It is also important that every data point that contains a <MASK> requires protection.

```
Input: Dataset \(D\) (after tokenization / splitting), labelling policies \(\pi,\pi_{c}\), number of epochs \(T\)
1\(D^{\prime}\leftarrow{\rm Dedup}(D)\)
2\(D^{\prime\prime}\leftarrow{\rm Redact}_{\pi}(D^{\prime})\)
3\(D^{pri}\leftarrow\{s\in D^{\prime\prime}|\exists x\in s\text{ s.t. }\pi(s,x)=1\text{ or } \exists x\subset s\text{ s.t. }\pi_{c}(s,x)=1\}\)
4\(D^{pub}=\{s\in D^{\prime\prime}|s\notin D^{pri}\}\).
5for\(e=1,...,T\)do
6 Run one epoch of SGD with \(D^{pub}\).
7 Run one epoch3 of DP-SGD with \(D^{pri}\).
8 end for
```

**Algorithm 1**CRT

### Theoretical analysis

We analyze the theoretical properties of the above method and show that they result in provable improvements in the (regular, group and Bayesian) confidentiality parameters for any algorithms that are provably \((\epsilon(x),\delta)\)-confidential as defined in Section 3.1.

The following theorem captures the benefit of redaction in improving confidentiality.

**Proposition 5** (Confidentiality under redaction).: _If \(\mathcal{A}\) ensures \((\epsilon(x),\delta)\)-Confidentiality for each token \(x\) of sentence \(s\in\mathcal{S}\) (\(\mathcal{S}\) is a corpus), then \(\mathcal{A}\circ{\rm Redact}_{\pi}\) ensures \((\tilde{\epsilon}(x),\delta)\)-confidentiality with_

\[\tilde{\epsilon}(x)=\begin{cases}\epsilon(x)&\text{ if $\pi(s,x)=0$}\\ 0&\text{ otherwise.}\end{cases}\]

_In addition, \(\mathcal{A}\circ{\rm Redact}_{\pi}\) also satisfies \((\tilde{\epsilon}(S),\tilde{\delta}(S))\)-group confidentiality with_

\[\tilde{\epsilon}(S) =\sum_{x\in sk\in S}\epsilon(x){\bf 1}(\pi(s,x)=0),\] \[\tilde{\delta}(S) =\tilde{k}e^{\tilde{\epsilon}(S)}\delta\]

_where \(\tilde{k}:=\sum_{x\in S}{\bf 1}(\pi(s,x)=0)\)._

As an application of the above, if \(\mathcal{A}\) ensures \((\epsilon,\delta)\)-confidentiality, and that the empirical recall rates of the redaction policy on \(D\) is \(1-\gamma\), then the above proposition suggests that \(\mathcal{A}\circ{\rm Redact}_{\pi}\) improves the uniform-confidentiality over applying \(\mathcal{A}\) without redaction by a factor of \(\gamma\). The proof is in the appendix.

Redaction also improves Bayesian confidentiality in a way that mirrors the privacy amplification by sampling from the DP literature.

**Proposition 6** (Bayesian Confidentiality under Redaction).: _If \(\mathcal{A}\) ensures \((\epsilon,\delta)\)-Bayesian Confidentiality with respect to \(\mu[x|\pi(s,x)=0]\) for a token \(x\) in a sentence \(s\), then \(\mathcal{A}\circ{\rm Redact}_{\pi}\) ensures \((\log(1+\gamma(e^{\epsilon}-1)),\gamma\delta)\)-Bayesian Confidentiality under \(\mu\) if \(\pi\) has a false negative rate (i.e., \(1-\)"Recall") of \(\gamma\) under \(\mu\)._

The proposition says that if the redaction policy is accurate for secrets \(x\sim\mu\), then we can have a stronger confidentiality parameter that scales roughly at \(\tilde{\epsilon}=O(\gamma\epsilon)\). The idea behind the proof is that over the distribution of \(x\sim\mu\), with probability \(1-\gamma\), \({\rm Redact}_{\pi}(D)={\rm Redact}_{\pi}(D^{\prime})\), thus \(\mathcal{A}\circ{\rm Redact}_{\pi}(D)\equiv\mathcal{A}\circ{\rm Redact}_{\pi}( D^{\prime})\). With probability \(\gamma\), \({\rm Redact}_{\pi}(D),{\rm Redact}_{\pi}(D^{\prime})\) are different and conditioning on the fact that \({\rm Redact}_{\pi}\) fails to detect \(x\). Note that \(\pi\) is also applied to other text that are not sensitive, and could result in false positives, but they do not matter as the modification 

of \({\rm Redact}_{\pi}\) to \(D\) and \(D^{\prime}\) will be identical. A full proof is given in the appendix.

Next we turn to deduplication.

**Proposition 7** (Group confidentiality under deduplication.).: _If \(\mathcal{A}\) ensures \((\epsilon(S),\delta(S))\)-Group Confidentiality, then \(\mathcal{A}\circ{\rm Dedup}\) ensures \((\epsilon({\rm Unique}(S)),\delta({\rm Unique}(S)))\)-Group Confidentiality._

Deduplication provides a stronger protection for those cases where some secret \(x\) could appear multiple times in the dataset.

**Theorem 8**.: _Let DP-SGD from Algorithm1 satisfies \((\epsilon,\delta)\)-differential privacy._

1. _Assume_ \(\pi_{c}(s,x)=1\) _for all secret tokens_ \(x\) _in a sentence_ \(s\) _such that_ \(\pi(s,x)=0\)_, then Algorithm_ 1 _satisfies_ \((\epsilon{\bf 1}(\pi(s,x)=0),\delta)\)_-confidentiality._
2. _Let_ \(S\) _be a group containing_ \(m\) _unique secrets such that_ \(\pi_{c}(s,x)=1\forall x\in s\text{ and }s\in\mathcal{S}\) _and that_ \(\pi\) _detects_ \(\tilde{\gamma}\)_-proportion of the unique secrets in_ \(S\)_. Then Algorithm_ 1 _satisfies_ \((\tilde{\gamma}m\epsilon,\tilde{\gamma}me^{\tilde{\gamma}m\epsilon}\delta)\)_-group confidentiality for_ \(S\)_._
3. _Let_ \(\pi,\pi_{c}\) _has as a recall of_ \(1-\gamma\) _and_ \(1-\delta_{2}\) _respectively on_ \(\mu\)_, then Algorithm_ 1 _satisfies_ \((\log(1+\gamma(e^{\epsilon}-1)),\gamma\delta+\delta_{2})\)_-Bayesian Confidentiality for_ \(\mu\)_._

The theorem demonstrates that our CRT algorithm enjoys a full suite of confidentiality guarantees and they all benefit from the deduplication and redaction, particularly if \(\pi\) has high recall.

Note that the CRT algorithm achieves the worst-case confidentiality guarantee if we have a non-trivial conservative screening policy that outputs \(\pi_{c}(x)=1\) for _all_ secret \(x\) that \(\pi\) misses, or we simply run vanilla DP-SGD after deduplication and redaction. On the other hand, CRT still satisfies Bayesian confidentiality for each \(\mu\) depending on the recall rate of \(\pi_{c}\) under \(\mu\).

## 4 Experiments

We evaluate CRT by training two types of language model, LSTM and GPT-2, on two datasets: 1) MultiWOZ 2.2, a well-known human-written dialogue dataset and 2) CustomerSim, a simulated dialogue dataset for conversation generation.

MultiWOZ 2.2is an already-public dialogue dataset written by crowd-workers, which collects over 10,000 annotated dialogues spanning 8 domains [5]. We use this dataset to show how CRT works in real-world applications. Following US Department of Labor's guidance4 on personal-identifiable information (PII), we treat all confidential information (e.g. email address, reference number, telephone number, etc.) as secrets. For the sequence labeling policy \(\pi\) and conservative policy \(\pi_{c}\), we build upon an NER model to do redaction. See Appendix A.4 for more details.

Footnote 4: [https://www.dol.gov/general/ppi](https://www.dol.gov/general/ppi)

CustomerSimFollowing S-DP Shi et al. (2021), we simulate a dialog dataset called CustomerSim with synthetic user information. The dialog flow is simulated based on a fixed agenda and the language generation is template-based [69]. CustomerSim consists of 10 thousand examples and over one million tokens. We treat user name, address, phone number, order, and tracking number as secrets, and use a regular expression tester (regex) to detect them for the redaction process.

Experiment details.For LSTM model, we follow the setting in S-DP to choose a one-layer LSTM. Because S-DP requires hidden states of the sensitive input to be protected, it doesn't support more layers nor Bidirectional LSTM. Since the advent of Transformers [10] significantly improves the capabilities of generative language models, we also test transformer-based language model GPT-2 [11] from HuggingFace [12]. As for deduplication, we use SHA-1 [13] hash function to encode sequences to SHA-1 hash code and then remove identical sequences based on the same hash code. For Bayesian Confidentiality, we treat the uniform distribution over the secret sequences as the distribution \(\mu\). More experiment details can be found in Appendix A.3.

Baselines.For LSTM model, we compare four different training approaches: (1) vanilla SGD (denoted by "Non-private-LSTM"), (2) Selective DPSGD (denoted by "S-DP-LSTM") (3) DPSGD (denoted by "DPSGD-LSTM") and (4) confidentially redacted training (denoted by "CRT-LSTM"). While for GPT-2 model, we compare three different training approaches: (1) vanilla SGD (denoted by "Non-private-GPT"), (2) DPSGD (denoted by "DPSGD-GPT") and (3) CRT (denoted by "CRT-GPT"). Our implementation of S-DP-LSTM 

model is built upon Shi et al. (2021)5. We run the experiment for the GPT-2 model following Li et al. (2021)6, in which they propose ghost clipping method to alleviate the computational challenge of running DP-SGD with large Transformers.

Footnote 5: [https://github.com/wyshi/lm_privacy](https://github.com/wyshi/lm_privacy)

Footnote 6: [https://github.com/kuchen/private-transformers](https://github.com/kuchen/private-transformers)

All the models are trained five times to reduce randomness, and the parameters are tuned based on the validation set performances.

## 5 Experimental Results

### Evaluation procedure

We need to evaluate both model utilities and privacy guarantees of the language models. We measure predictive perplexity (PPL) for the quality of LM. We also analyze the theoretical privacy budget \((\epsilon,\delta)\) and test whether language models are private under attacks detailed below.

Canary insertion attack.Cenary insertion is proposed as a testing methodology for quantitatively assessing the risk of _unintended memorization_Carlini et al. (2019). It inserts random sequences called canaries into the training dataset, then trains the model, and finally calculates the following exposure for the inserted canaries to measure a model's potential for privacy risks. In our experiment, we randomly generate 10 canaries in the form of "My ID is: <random 6-digit number here>". Each canary is inserted into the training dataset 20 times to generate more salient differences between models.

**Definition 9** (Canary Exposure).: _Given a canary \(s[r]\), a model with parameters \(\theta\), and the randomness space \({\cal R}\), the exposure of \(s[r]\) is_

\[\operatorname*{exposure}_{\theta}=\log_{2}|{\cal R}|-\log_{2}\mathrm{rank}_{ \theta}(s[r])\]

After training, we calculate empirical model perplexity for all possibly-instantiated canaries and list them in sorted order. Then we can get the canary exposure based on the rank of a specific canary sequence \(\mathrm{rank}_{\theta}(s[r])\) and the number of all possible candidates \(|{\cal R}|\). In our setting, we show the highest canary exposure in 10 canaries. For example, if a canary ranks 1st among 1M candidates, the canary exposure is 19.93.

Membership inference attack.Membership Inference is a widely used privacy attack method. Given a non-privately trained model, an adversary can predict whether or not a particular example was used to train the model. We adopt the membership inference attack in Carlini et al. (2021). The general idea is to calculate the given samples' perplexities under the model, rank them and choose the ones with the lowest perplexities, i.e., highest likelihood by the model. We can think of this process as training a binary classifier based on the perplexity feature. We also implement the group membership inference attack to show the group confidentiality. More details about the implementation can be found in the Appendix A.5.

### Overall performance

Figure 2 presents the results of model utilities and confidentiality guarantees across our models of interest on MultiWOZ 2.2 and CustomerSim datasets. Each point denotes a model for different epochs in a training process. Since the X-axis is \(\epsilon\) in Bayesian Confidentiality (the lower the better) and the Y-axis is perplexity (the lower the better), a perfect model will lie in the bottom-left corner. CRT-GPT and DPSGD-GPT in general, perform better than S-DP-LSTM, CRT-LSTM and, DPSGD-LSTM on the test sets. Our model CRT-GPT's performance is

Figure 2: Model utility and confidentiality guarantee on MultiWOZ 2.2 and CustomerSim datasets with \(\mu\) being a uniform distribution over the secret sequences in each dataset. PPL: Perplexity on the test set. \(\epsilon\): Privacy guarantee in Bayesian Confidentiality. We fix \(\delta=8e-5\) for all models. Since Selective DP-SGD with approximate policy gives \(\epsilon=+\infty\), we show its result with a perfect screen policy. But when a perfect policy is available, Redaction only gives \(\epsilon=0\) and achieves the PPL of vanilla training with no noise added (Non-private-GPT/LSTM). For other models we set \(\gamma=0.1\) to show the result under approximate policy.

 

close to Non-private-GPT in terms of PPL while preserving strong confidentiality. Besides, CRT-GPT is better than DPSGD-GPT manifested by a much lower \(\epsilon\), which demonstrates that approximately correct screening policy amplifies the confidentiality guarantee.

Differences can be witnessed in the results from two different datasets: the models trained on CustomerSim achieve overall better performances than those trained on MultiWOZ. We think it's due to the fact that CustomerSim contains simple dialogs from template-based simulations.

### Attack results

Figure 3, 4, and 5 present the results from canary insertion attack and individual/group membership inference attack on MultiWOZ 2.2 and CustomerSim datasets. The X-axis is the false negative rate \(\gamma\) of screening policy \(\pi\), ranging from 0.0 to 0.5; the Y-axis is the canary exposure (in Figure 3) and membership inference accuracy (in Figure 4 and 5), which measures the effectiveness of the attacks. The lower the canary exposure or inference accuracy, the better protection the model provides against the attacks.

For canary insertion attack, it can be seen from Figure 3 that the canary exposures for CRT-LSTM and CRT-GPT are both close to 0 which thus guarantee excellent confidentiality. Non-private-LSTM and Non-private-GPT with mask can also attain great protection at perfect screening policy accuracy (\(\gamma=0\)), nonetheless a rise in \(\gamma\) results in a sharp increase in the exposure. It should be noticed that S-DP-LSTM also has high exposure, similar to Non-private models, given any \(\gamma\) above 0. This is because that many sensitive data has been falsely identified as non-sensitive by the approximate policy, S-DPSGD does not protect these false negative samples and hence a privacy leakage.

For membership inference attack, we compare the inference accuracy with the benchmark value of 0.5, which equals the random guess performance. In Figure 4 and 5, we see that CRT-LSTM and CRT-GPT align well with the 0.5 horizontal line, suggesting that they are rather safe to the attack. The inference accuracy for Non-private-LSTM/Non-private-GPT/S-DP-LSTM, in contrast, surges above 0.5 as the false negative rate \(\gamma\) deviates from 0.0, indicating that these models become vulnerable to the attack under non-perfect screen policy. In addition, Non-private and S-DP models show even worse protection under the group attack than the individual one in view of a higher inference accuracy at certain \(\gamma\).

### CRT amplifies Bayesian Confidentiality guarantees

Figure 6 shows that confidentially redacted training can help to amplify the confidentiality guarantees. We set the \(\epsilon^{\prime}\) in DP-SGD fixed and show the

Figure 4: Membership inference attack result. CRT attains nearly 50% accuracy, indicating that the adversary could not infer whether a data point is used for training.

Figure 5: Group membership inference attack result.

Figure 3: Canary insertion attack result. CRT achieves almost 0 canary exposure, which means it can prevent unintended memorization.

Figure 6: Bayesian Confidentiality amplification result. CRT helps to amplify the confidentiality guarantee.

 

corresponding \(\epsilon\) in Bayesian Confidentiality with different screen policy \(\pi\). Both \(\epsilon^{\prime}\) and \(\epsilon\) are for \(\delta=8e-5\). If the approximately screening policy \(\pi\) has a high recall (\(\gamma\) is small), we will achieve much improvement in the Bayesian Confidentiality parameter \(\epsilon\) by deduplication and redaction. For example, with \((\epsilon^{\prime}=1.0,\gamma=0.1)\), we reduce the \(\epsilon\) to 0.12.

## 6 Conclusion

In this paper, we propose confidentially redacted training (CRT), a method to train language models while protecting the secret texts. We introduce a new definition of confidentiality which quantifies the risk of leaking sensitive content. We prove the effectiveness of CRT both theoretically and empirically on multiple datasets and language models.

## 7 Broader Impact

This work will alleviate ethical concerns of large-scale pre-trained language models. This paper provides one promising solution to an important aspect of NLP: training high quality language models for text generation without compromising confidential information. The current use cases of language models involve pretraining on public web corpus and fine-tuning on individual application data. However, the private application specific data often contains user-generated sensitive information. The proposed method in this paper aims to use as much individual fine-tuning data as possible, while does not leak or memorize any confidential information with provable guarantees. Without the method, one has to either use the general pretraining LM without fine-tuning or manually filter sensitive information and fine-tuning on the remaining. It can be applied in broader applications that need language models or text generation models.

In our experiments, we use a simulation scheme to mimic confidential content in a real corpus. We did not compromise any real user's confidential information.

## Acknowledgements

The work was partially supported by NSF Award # 2048091. XZ was supported by UCSB Chancellor's Fellowship. We would like to thank the anonymous reviewers for their thoughtful comments. We would also like to thank Siqi Ouyang for the helpful discussion and Yang Gao for polishing up the draft.

## References

* Abadi et al. (2016) Martin Abadi, Andy Chu, Ian J. Goodfellow, H. Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. 2016. Deep learning with differential privacy. _Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security_.
* Anil et al. (2021) Rohan Anil, Badih Ghazi, Vineet Gupta, Ravi Kumar, and Pasin Manurangsi. 2021. Large-scale differentially private bert. _ArXiv_, abs/2108.01624.
* Bahdanau et al. (2015) Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly learning to align and translate. _CoRR_, abs/1409.0473.
* Balle et al. (2018) Borja Balle, Gilles Barthe, and Marco Gaboardi. 2018. Privacy amplification by subsampling: tight analyses via couplings and divergences. In _Advances in Neural Information Processing Systems_, pages 6280-6290.
* Barthe and Olmedo (2013) Gilles Barthe and Federico Olmedo. 2013. Beyond differential privacy: Composition theorems and relational logic for f-divergences between probabilistic programs. In _International Colloquium on Automata, Languages, and Programming_, pages 49-60. Springer.
* Bloom (1970) Burton H Bloom. 1970. Space/time trade-offs in hash coding with allowable errors. _Communications of the ACM_, 13(7):422-426.
* Carlini et al. (2019) Nicholas Carlini, Chang Liu, Ulfar Erlingsson, Jernej Kos, and Dawn Xiaodong Song. 2019. The secret sharer: Evaluating and testing unintended memorization in neural networks. In _USENIX Security Symposium_.
* Carlini et al. (2021) Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom B. Brown, Dawn Xiaodong Song, Ulfar Erlingsson, Alina Oprea, and Colin Raffel. 2021. Extracting training data from large language models. In _USENIX Security Symposium_.
* Devlin et al. (2019) Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. _ArXiv_, abs/1810.04805.
* Dwork et al. (2006) Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam Smith. 2006. Calibrating noise to sensitivity in private data analysis. In _Theory of cryptography conference_, pages 265-284. Springer.
* Feldman (2020) Vitaly Feldman. 2020. Does learning require memorization? a short tale about a long tail. In _Proceedings of the 52nd Annual ACM SIGACT Symposium on Theory of Computing_, pages 954-959.
* Ganguly et al. (2015) Debasis Ganguly, Dwaipayan Roy, Mandar Mitra, and Gareth J.F. Jones. 2015. Word embedding based generalized language model for information retrieval. _Proceedings of the 38th International ACM SIGIR Conference on Research and Development in Information Retrieval_ 

* Ghosh and Roth (2015) Arpita Ghosh and Aaron Roth. 2015. Selling privacy at auction. _Games and Economic Behavior_, 91:334-346.
* Hochreiter and Schmidhuber (1997) Sepp Hochreiter and Jurgen Schmidhuber. 1997. Long short-term memory. _Neural Computation_, 9:1735-1780.
* Hosseini-Asl et al. (2020) Ehsan Hosseini-Asl, Bryan McCann, Chien-Sheng Wu, Semih Yavuz, and Richard Socher. 2020. A simple language model for task-oriented dialogue. _ArXiv_, abs/2005.00796.
* Howard and Ruder (2018) Jeremy Howard and Sebastian Ruder. 2018. Universal language model fine-tuning for text classification. In _ACL_.
* Jarvinen (2004) Kimmo Jarvinen. 2004. Design and implementation of a sha-1 hash module on fpgas. _Helsinki University of Technology Signal Processing Laboratory_.
* Kandpal et al. (2022) Nikhil Kandpal, Eric Wallace, and Colin Raffel. 2022. Deduplicating training data mitigates privacy risks in language models. _arXiv preprint arXiv:2202.06539_.
* Kwiatkowski et al. (2019) Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur P. Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoc V. Le, and Slav Petrov. 2019. Natural questions: A benchmark for question answering research. _Transactions of the Association for Computational Linguistics_, 7:453-466.
* Lee et al. (2022) Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris Callison-Burch, and Nicholas Carlini. 2022. Deduplicating training data makes language models better. In _Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics_. Association for Computational Linguistics.
* Li et al. (2021) Xuechen Li, Florian Tramer, Percy Liang, and Tatsumori Hashimoto. 2021. Large language models can be strong differentially private learners. _ArXiv_, abs/2110.05679.
* McMahan et al. (2018) H. Brendan McMahan, Daniel Ramage, Kunal Talwar, and Li Zhang. 2018. Learning differentially private recurrent language models. In _ICLR_.
* Mikolov et al. (2010) Tomas Mikolov, Martin Karafiat, Lukas Burget, Jan Honza Cernocky, and Sanjeev Khudanpur. 2010. Recurrent neural network based language model. In _INTERSPEECH_.
* Radford et al. (2019) Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners.
* Raffel et al. (2020) Colin Raffel, Noam M. Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. _ArXiv_, abs/1910.10683.
* Shi et al. (2021) Weiyan Shi, Aiqi Cui, Evan Li, R. Jia, and Zhou Yu. 2021. Selective differential privacy for language modeling. _ArXiv_, abs/2108.12944.
* Triastcyn and Faltings (2020) Aleksei Triastcyn and Boi Faltings. 2020. Bayesian differential privacy for machine learning. In _International Conference on Machine Learning_, pages 9583-9592. PMLR.
* Vaswani et al. (2017) Ashish Vaswani, Noam M. Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. _ArXiv_, abs/1706.03762.
* Weischedel et al. (2013) Ralph Weischedel, Martha Palmer, Mitchell Marcus, Eduard Hovy, Sameer Pradhan, Lance Ramshaw, Ninawen Xue, Ann Taylor, Jeff Kaufman, Michelle Franchini, and et al. 2013. Ontonotes release 5.0. _Linguistic Data Consortium, Philadelphia, PA, 23_.
* Wolf et al. (2019) Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, and Jamie Brew. 2019. Huuggingface's transformers: State-of-the-art natural language processing. _ArXiv_, abs/1910.03771.
* Zang et al. (2020) Xiaoxue Zang, Abhinav Rastogi, Srinivas Sunkara, Raghy Gupta, Jianguo Zhang, and Jindong Chen. 2020. Multiwoor 2.2: A dialogue dataset with additional annotation corrections and state tracking baselines. In _Proceedings of the 2nd Workshop on Natural Language Processing for Conversational AI, ACL 2020_, pages 109-117.
* Zhao and Eskenazi (2018) Tiancheng Zhao and Maxine Eskenazi. 2018. Zero-shot dialog generation with cross-domain latent actions. In _SIGDIAL Conference_.

 

Appendix

### Illustration of our proposed algorithm

Proof of Proposition 5.: The first statement straigtforwardly follows from that \({\rm Redact}_{\pi}(D)={\rm Redact}_{\pi}(D^{\prime})\) if \(\pi(s,x)=1\) and that \({\rm Redact}_{\pi}(D)\) and \({\rm Redact}_{\pi}(D^{\prime})\) remain a pair of neighbors differing by only \(x\). The group confidentiality claims follows from the standard calculation of small group privacy from differential privacy, which applies the (single \(x\)) confidentiality iteratively. Let \(\tilde{D}={\rm Redact}_{\pi}(D)\), \(\tilde{D}^{\prime}={\rm Redact}_{\pi}(D^{\prime})\) and \(\tilde{S}=[x_{1},...,x_{\tilde{k}}]\) be the list of \(S\) that are not masked by \(\pi\). For any measurable event \(E\)

\[\mathbb{P}[\mathcal{A}\circ{\rm Redact}_{\pi}(D)\in E]=\mathbb{P}[\mathcal{A}(\tilde{D})]\leq e^{\epsilon x_{1}}\mathbb{P}[\mathcal{A}(\tilde{D}_{-x_{1},+< \textsc{MASK>}})\in E]+\delta\] \[\leq e^{\epsilon x_{1}+\epsilon(x_{2})}\mathbb{P}[\mathcal{A}(\tilde{ D}_{-x_{1},+<\textsc{MASK>}})\in E]+e^{\epsilon x_{1}}\delta+\delta\] \[...\] \[\leq e^{\sum_{i=1}^{\tilde{k}}\epsilon x_{i}}\mathbb{P}[\mathcal{A}( \tilde{D}^{\prime})\in E]+\delta(1+e^{\epsilon x_{1}}+e^{\epsilon x_{1}+ \epsilon x_{2}}+...+e^{\epsilon x_{1}+\dots+\epsilon x_{\tilde{k}-1}})\] \[\leq e^{\tilde{\ell}(S)}\mathbb{P}[\mathcal{A}\circ{\rm Redact}_{\pi}( D^{\prime})\in E]+ke^{\tilde{\ell}(S)}\delta\]

Proof of Proposition 6.: Consider a dataset \(D\) (in which one of the data point has \(x\sim\mu\)) and a fixed \(D^{\prime}\). Denote the probability distributions \(p,q,r\) as shorthands for

\[p\sim\mathcal{A}\circ{\rm Redact}_{\pi}(D)|\pi(s,x)=1\] \[q\sim\mathcal{A}\circ{\rm Redact}_{\pi}(D)|\pi(s,x)=0\] \[r\sim\mathcal{A}\circ{\rm Redact}_{\pi}(D^{\prime})|\pi(s,x)=0\]

Moreover, we use \(\alpha p+(1-\alpha)q\) to denote the mixture distribution that samples from \(p\) with probability \(\alpha\) and \(q\) with probability \(1-\alpha\).

Recall that the Hockey-Stick-divergence characterization of \((\epsilon,\delta)\)-indistinguishshability (Barthe and Olmedo, 2013), which says that \((P,Q)\) are \((\epsilon,\delta)\)-indistinguishshe if and only if

\[H_{e^{c}}(P\|Q):=\mathbb{E}_{y\sim Q}[(\frac{dP}{dQ}(y)-e^{\epsilon})_{+}] \leq\delta.\]

Figure 7: An illustration of our proposed algorithm on a dataset with two data points. The first data point is the example from Figure 1, and the second data point is modified to illustrate the various aspects of the pre-processing steps. The red-colored mask indicates the masks produced by deduplication just for illustration purposes. In the algorithm, both of them replace a sequence of tokens with the same special token \(<\)MASK>.

 

It suffices for us to bound the following quantity:

\[H_{1+\gamma(e^{c}-1)}(\mathcal{A}\circ\mathrm{Redact}_{\pi}(D) \|\mathcal{A}\circ\mathrm{Redact}_{\pi}(D^{\prime}))=H_{e^{c}}((1-\gamma)p+ \gamma q\|(1-\gamma)p+\gamma r)\] \[= \gamma H_{e^{c}}(q\|(1-\beta)p+\beta r)\leq\gamma\left((1-\beta)H_ {e^{c}}(q\|p)+\beta H_{e^{c}}(q\|r)\right)\]

where \(\beta=\frac{1+\gamma(e^{c}-1)}{e^{c}}\). In the above, the second line follows from Theorem 2 of (Balle et al., 2018) (an identity called "Advanced Joint Convexity" by the authors) and the inequality is due to the (standard) joint convexity of the Hockey-Stick divergence. It remains to bound \(H_{e^{c}}(q\|p)\) and \(H_{e^{c}}(q\|r)\).

Check that \(p,r,\mathcal{A}\circ\mathrm{Redact}_{\pi}(D^{\prime})\) are identically distributed and that \(H_{e^{c}}(q\|r)\leq\delta\) by our assumption on \(\mathcal{A}\)'s Bayesian confidentiality guarantee w.r.t. \(\mu(x|\pi(s,x)=0)\). This completes the proof. 

Proof of Proposition 7.: The proof is straightforward as \(\mathrm{Dedup}(D)\) differs from \(\mathrm{Dedup}(D^{\prime})\) only by \(\mathrm{Unique}(S)\). 

Proof of Theorem 8.: The proof for the first statement follows from the fact that DP implies \((\epsilon,\delta)\)-confidentiality and Proposition 5. Notably, if \(\pi_{c}\) catches all \(x\) that is missed by \(\pi\), then we get that for all secret \(x\), \(\epsilon(x)\leq\epsilon\).

The proof of the second statement applies Proposition 7 and the second part of Proposition 5.

The proof of the third statement applies Proposition 6 but requires a separate treatment of the case when \(x\) is missed by both \(\pi\) and \(\pi_{c}\). Let the event that a secret \(x\) is not selected by the conservative policy be \(E\) and let \(\mathcal{A}\) be a generic algorithm satisfying \((\epsilon,\delta_{1})\) Bayesian confidentiality under \(\mu\),

\[\mathbb{P}[\mathcal{A}(D)\in S] \leq\mathbb{P}[\mathcal{A}\circ\mathrm{Radect}_{\pi}(D)\in S \subset E^{c}]+\delta\] \[\leq e^{\epsilon}\mathbb{P}[\mathcal{A}(D^{\prime})\in S\subset E ^{c}]+\delta_{1}+\delta_{2}\] \[\leq e^{\epsilon}\mathbb{P}[\mathcal{A}(D^{\prime})\in S]+\delta _{1}+\delta_{2}.\]

This completes the proof. 

### More details on experiments

We choose the one-layer LSTM with an embedding size of 200 and a hidden size of 200. We choose distill-gpt27 as the GPT-2 model, which has 6 layers, 768 dimension and 12 heads. Vocabulary size for GPT-2 is 50257. Our experiments are conducted on NVIDIA TITAN-Xp GPU. For LSTM models, we tune the hyperparameters of the learning rate (lr) among {20, 10, 5, 1, 0.1, 0.05, 0.01}, batch size (bs) and the epochs among {5, 10, 30, 50, 100}. We finally choose {lr=20, bs=256, epochs=50} for Non-private-LSTM, {lr=0.1, bs=5, epochs=50} for S-DPSGD-LSTM and {lr=0.05, bs=10, epochs=100} for CRT-LSTM. The same set of hyperparameters are tuned for GPT model as well. Our final choice for DPSGD-GPT/CRT-GPT model is {lr=5e-4, bs=256, epochs=10}. The actual run-time of algorithms depends on implementation details. Here, we outline estimates of the run-time for training. Running one epoch on CRT-LSTM takes 2 hours whereas the same task on CRT-GPT only takes 30 minutes since the implementation of Li et al. (2021) is highly efficient. We use autodp8, an automating differential privacy computation for the privacy analysis. Noise scale \(\sigma\) is calculated numerically so that a DP budget of \((\epsilon,\delta)\) is spent after \(T\) epochs.

Footnote 7: [https://huggingface.co/distilgpt2](https://huggingface.co/distilgpt2)

Footnote 8: [https://github.com/yuxiangw/autodp](https://github.com/yuxiangw/autodp)

### Redaction policy details

We build the sequence labeling policy based on trimming one NER model9 trained on OntoNotes-5.0 (Weischedel et al., 2013) dataset. We modify the last layer of the NER model and set the threshold for the output scores to enable abnormal/sensitive data detection. For the screen policy \(\pi\), we set the threshold to be 0.3 for all predictions with OntoNotes tags. For the conservative policy \(\pi_{c}\), we select all predictions with tags and all plain texts with scores smaller than 0.9 to be sensitive data. We manually label 200 data points and find that the conservative policy \(\pi_{c}\) can achieve 100% recall with lots of false positives and that \(\pi\) can achieve 90% recall with few false positives.

 



### Membership inference attack details

In our experiments, we manually construct a dataset with 2000 sequences. We select 1000 sequences from the protected secrets used in the training data. And we randomly generate 1000 samples of similar format which are not used in the training data. In this way, a random guess generates an accuracy of 50%. For MultiWoz 2.2, we use sentences with reference numbers as the secrets. For CustomerSim, we choose customer addresses as the secrets.

In order to show group confidentiality guarantees, we also conduct group membership inference attack. In this setting, we construct a dataset with 2000 groups, each of which includes 20 sentences. One half of the groups are "sensitive groups" with all 20 sentences drawn from protected secrets and the other half are "insensitive groups" with all 20 sentences being random. We build the classifier based on the sum of the perplexities in one group.

* how things could go wrong with seemingly inocuous changes to the algorithm.**

In this section, we highlight various aspects of our algorithms and why certain choices in the pre-processing steps need to be done in the specific way we recommend for our results to hold for them.

1. It is important that the definition of confidentiality is defined with respect to a perfectly redacted version of the dataset. If we define it as in selective differential privacy, then there will _not_ be an amplification effect from redaction. This is because if we replace a secret \(x\) that can be detected by \(\pi\) with another \(x^{\prime}\) that cannot be detected by \(\pi\), then even if \(x\) is replaced with <MASK>, \(x^{\prime}\) will not be and the two datasets are still different after redaction. In addition, the S-DP definition will not be useful for us we do not know how to define a confidentiality parameter specific for each \(x\) or Bayesian confidentiality parameter for each \(\mu\)
2. Tokenization and splitting into individual "sentences" (data points) should go before redaction / deduplication. Otherwise redaction with an approximate screening policy and with an ideal screening policy, or deduplication may cause _misalignments_, resulting in almost all data points being different in the preprocessed version of \(D\) and \(D^{\prime}\).
3. Each data point should contain only "whole" natural sentences, otherwise the sensitive part of a natural sentence could split into two data points.
4. Deduplication steps should replace duplicate text with the same <MASK>, otherwise <MASK_Dedup> and <MASK_Redact> are not the same so even if all secrets are masked, there will be a difference between the pre-processed versions of \(D\) and its neighbor, while in our approach there are no differences and we achieve perfect confidentility (with \(\epsilon=0\)).
5. Any data point containing <MASK> needs to be put in \(D^{pri}\). This is because otherwise our algorithm that works on \(D^{\prime}\) will be a deterministic algorithm that is perfectly distinguishable from the alternative world where the algorithm is random because the approximate policy \(\pi\) fails to redcat certain secrets \(x\).
6. In the DP-SGD algorithm, the sampled minibatches should contain the whole minibatch from \(D^{pri}\) or the whole minibatch from \(D^{pub}\). Otherwise the noise always need to be added and the algorithm is identical to the vanilla DP-SGD, and there is no benefit of having a portion of the data being public comparing to all of the data are private