acceptodds
Under review as a conference paper at ICLR 2027

Mitigating Privacy Leakage in Text Corpora via Adaptive Masking and Contextual Reconstruction

Abstract

Large-scale, high-quality data is central to advances in artificial intelligence, yet raw corpora are riddled with private information, exposing their direct use to serious security and privacy risks. Existing methods struggle to reconcile semantic preservation with private content removal, thereby limiting both privacy protection and downstream data utility. In this paper, we introduce PrivMask, a method that mitigates privacy leakage in text corpora via adaptive masking and contextual reconstruction, while preserving task-relevant semantics and downstream utility. Specifically, we first propose a category-aware sensitive proportion masking mechanism that adaptively masks sensitive content by modeling category-level sensitivity and contextual risk. Instead of using coarse placeholders, it abstracts privacy entities into semantically meaningful labels, enabling fine-grained removal of sensitive information while preserving semantic structure and preventing over-sanitization. We then present a context-aware reconstruction model that generates fluent and semantically consistent substitutes from masked text. To simultaneously achieve grammatical coherence and fine-grained semantic alignment, we optimize the model with a joint loss that integrates reconstruction and contrastive objectives. This joint training ensures that the reconstructed substitutes retain task-relevant semantics without leaking the original private data, achieving a robust privacy-utility trade-off. Extensive experiments across diverse domains show that PrivMask outperforms existing methods, achieving high accuracy in privacy entity recognition while preserving semantic coherence. Notably, models trained on PrivMask-anonymized data retain competitive downstream performance, confirming that PrivMask effectively balances privacy protection and data utility.

Primary area:
alignment, fairness, safety, privacy, and societal considerations
Keywords:
Privacy-Preserving Machine Learning, Text Anonymization, Adaptive Masking, Contextual Reconstruction, Large Language Models, Privacy-Utility Trade-off

Reviews

Among:
Shape:
1234this paper, Bottom 27%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.00 over 3 reviews, above 27% of the others.
Reviewer_TzBTOpenReview ↗
Rating
3
Confidence
3
Informativeness
1
Presentation
2
Soundness
2
Read review
Paper summary

The paper proposes a defense against privacy leakage in text corpora. The author propose PrivMask, which mitigates privacy leakage in text corpora via adaptive masking and contextual reconstruction, while preserving task-relevant semantics and downstream utility. Extensive experiments across diverse domains show that PrivMask outperforms existing methods, achieving high accuracy while preserving semantic coherence.

Critical strengths
  1. The work first proposes a category-aware sensitive proportion masking mechanism that adaptively masks sensitive content by modeling category-level sensitivity and contextual risk.
  2. The context-aware reconstruction model retains task-relevant semantics without leaking the original private data, achieving a robust privacy-utility trade-off.
Critical weaknesses
  1. The implementation and training complexity of this method are relatively high.
  2. The evaluation is limited to text and does not account for multimodal scenarios.
  3. Which specific llm served as the evaluating attackers in the experiments related to Table 2? For strategies involving prompt optimization and iterative feedback, the paper could consider introducing TRACE-RPTS [1] as a baseline.

[1] Stop Tracking Me! Proactive Defense Against Attribute Inference Attack in LLMs. In Proc. ICLR, 2026.

Questions for authors

Please refer to the weaknesses detailed above.

3 comments
AuthorsOpenReview ↗

Clarifications on Implementation, Evaluation Scope, and Additional TRACE-RPS Experiments

Q: Implementation and Training Complexity

A: We appreciate this concern. While PrivMask requires an initial training phase, this is a one-time cost. Once trained, PrivMask enables efficient sanitization without repeated attacker–defender interactions or iterative API calls. To further demonstrate this advantage, we measured end-to-end (E2E) latency across three datasets. PrivMask achieves mean E2E latencies of 1.92/31.35/31.43s/sample, compared with 7.41/53.56/56.32s/sample for fine-tuned Gemma3-4B and 71.85/125.15/155.18s/sample for AF. These results demonstrate PrivMask's favorable inference efficiency and deployment potential.

Q: Text-Only Evaluation and Multimodal Scope

A: We thank the review for this valueable comment. PrivMask currently focuses on privacy protection in text corpora, covering general, legal, and medical domains. Text anonymization is itself an independent and widely studied task, and it is the modality in which most privacy regulations (e.g., GDPR, HIPAA) are operationalized and most existing anonymization benchmarks are defined. Extending PrivMask to multimodal scenarios (e.g., scanned documents with embedded text, or image-text pairs) would require OCR, cross-modal entity linking, and PII detection over visual and layout cues, which involve distinct technical challenges beyond the scope of this paper. We therefore leave multimodal anonymization to future work.

Q: Evaluation Attacker for Table 2

A: We thank the review for pointing this out. We employ GPT-5.5 as the evaluation attacker for the ASR results in Table 2. The attack prompts and parameter settings follow the free-text inference attack paradigm (Staab et al., 2024), in which the attacker is allowed to generate unrestricted natural-language responses to infer hidden sensitive information from the sanitized context.

Q: Additional TRACE-RPS Baseline

A: We sincerely appreciate the reviewer for recommending TRACE-RPS (ICLR 2026), which provides a valuable approach to privacy protection through adversarial feedback and attention-guided sanitization. We have carefully considered this strong baseline and conducted additional experiments using the following configurations:

  • Models: GPT-4o serves as TRACE's adversarial anonymization model with temperature = 0, while top_p and the random seed retain API defaults. Llama2-7B-Chat is used for attention extraction.
  • Token limits: Following the released implementation, we set the maximum output tokens to 2,000, 500, and 2,000 for attribute inference, privacy-leakage reasoning, and anonymization rewriting, respectively.
  • Iteration settings: Each sample undergoes at most 5 rounds, with inference confidence scored from 1 to 5. Early stopping considers confidence ≤2\leq 2, invalid guesses, or unchanged rewritten text.
  • Attribute adaptation: Since the original implementation does not cover certain categories, such as identity-card and phone numbers, we added corresponding attention queries (e.g., "What is the author's identity card number?").
  • Multi-category adaptation: As our datasets frequently contain multiple sensitive categories, we extended the original single-target implementation to extract keywords and reasoning chains for each target separately, aggregate the evidence for rewriting, and evaluate feedback across all targets before early stopping.

These adaptations allow the baseline to address the multi-category privacy characteristics of our datasets while preserving its core adversarial feedback mechanism.

Additional utility results for TRACE-RPS (2026):

DatasetBERTScore (%) TRACE-RPSBERTScore (%) OursBLEURT TRACE-RPSBLEURT OursRPPL TRACE-RPSRPPL Ours
PII-Masking-300k-sub94.7997.2376.8581.602.751.97
SPY-Legal97.8197.3271.9174.082.152.09
SPY-Medical97.1497.4971.3576.002.081.55

Additional privacy results for TRACE-RPS (2026):

DatasetPLR Count TRACE-RPSPLR Count OursPLR (%) TRACE-RPSPLR (%) OursASR Count TRACE-RPSASR Count OursASR (%) TRACE-RPSASR (%) Ours
PII-Masking-300k-sub8836844.403.41117710595.875.28
SPY-Legal114975.174.401421486.446.71
SPY-Medical139965.623.881761297.125.22

These results highlight TRACE-RPS's strong privacy protection and semantic preservation and confirm that PrivMask remains competitive across both utility and privacy metrics. Further results are provided in the revised main text and appendix.

Dear Reviewer,

We would like to express our sincere appreciation for your constructive feedback and recognition of our work. Your suggestions have been particularly valuable in strengthening the experimental evaluation of PrivMask.

In response to your concerns, we have clarified the implementation complexity, multimodal scope, and evaluation attacker configuration. More importantly, following your recommendation, we have implemented TRACE-RPS and conducted additional experiments across all three datasets, providing further evidence of PrivMask's effectiveness in balancing privacy and utility.

We hope you have had an opportunity to review our responses and the new experimental results. We would greatly appreciate any further feedback you may have. If these additional results and clarifications have strengthened your assessment of our work, we would be grateful if you could consider updating your score accordingly.

Thank you again for your time, thoughtful suggestions, and continued consideration.

Thank you for the detailed responses. I will maintain my positive score.

Reviewer_khgTOpenReview ↗
Rating
1
Confidence
2
Informativeness
2
Presentation
2
Soundness
1
Read review
Paper summary

PrivMask sanitizes text by partially masking entities and reconstructing the masked content. Entity statistics and sensitivity determine how much to mask; semantic tags guide a Flan-T5 model trained with generation and contrastive objectives. The evaluation covers general, legal, and medical corpora, including downstream training on sanitized medical QA data.

Critical strengths

Reusing sensitive corpora without losing their training value is an important problem. Compared with RUPTA's iterative privacy and utility feedback, PrivMask offers explicit control over masking by entity category, followed by learned, tag-conditioned reconstruction. The BERT/Flan-T5 pipeline is a useful way to preserve corpus structure while generating replacements. Figure 1 explains the two stages clearly, and the main text follows the same organization. The evaluation goes beyond text quality to ask whether the sanitized data remains useful for training. On SPY-Medical, BLEURT is 76.00, compared with 68.42 for RLAA and 57.20 without CAR. On medical flashcards, training LLaMA2-7B/13B with PrivMask data gives SBERT scores of 0.909/0.912, versus 0.900/0.903 with unsanitized data. The corresponding SPriv scores are 0.006/0.005 versus 0.023/0.023. These are encouraging results for the proposed use of reconstructed text.

Critical weaknesses
  1. The masking rule as written cannot produce the reported floor ablation. Equations (3) to (7) imply Ic≥τ≥τ∗I_c \geq \tau \geq \tau^\ast, so σ(Ic−τ∗)≥0.5\sigma(I_c - \tau^\ast) \geq 0.5. The floor rmin⁡=0.1r_{\min} = 0.1 in Appendix F can never take effect. Removing it should therefore make no difference, yet PII attack success rises from 5.28 to 13.46 percent (Table 3). The rule used in these experiments needs to be identified.
  2. The two descriptions of contrastive training disagree on what counts as a positive. Appendix B uses sanitized synthetic reconstructions as positives and the corresponding original private text as a negative. Appendix I instead makes that original sentence the positive. This reverses the role of the same sentence. It is unclear which objective was used for the main results and the contrastive ablation.
Questions for authors

Which masking rule, ranges for τ\tau and τ∗\tau^\ast, and rmin⁡r_{\min} value were used in the full-model and ablation runs? Under those settings, when does the floor take effect? Which definition of positive and negative examples was used for the main results and the contrastive ablation?

2 comments
AuthorsOpenReview ↗

Clarifications on Masking Configuration and Contrastive Sample Construction

We sincerely thank the reviewer for the careful and detailed comments, which have helped us identify two description inconsistencies with our actual implementation. We have re-checked the configurations, and below we clarify the exact settings used in the experiments, along with the corrections we will make in the revision.

Q: Masking Rule and Minimum Masking Ratio Ablation

A: We thanks the reviewer for this careful mathematical check. The review is correct that as written in Appendix F, the masking rule cannot produce the reported floor ablation. We have traced this to a reporting error in Appendix F: the minimum masking ratio was incorrectly stated as rmin⁡=0.1r_{\min}=0.1, whereas the actual setting used in all experiments was rmin⁡=0.6r_{\min}=0.6.

Specifically, we determine the masking ratio according to Eq. (7):

rc=max⁡(0.6,σ(Ic−τ∗)).r_c = \max\left(0.6,\sigma(I_c-\tau^{\ast})\right).

With the actual rmin⁡=0.6r_{\min}=0.6, the floor becomes active whenever

\iff I_c-\tau^{\ast}<\ln 1.5 \approx 0.405.$$ Equivalently, since $I_c=5+\sum_j w_j\widetilde{x}_{cj}$, the floor is active when $$\sum_j w_j\widetilde{x}_{cj}<\tau^{\ast}-4.595.$$ Because the left-hand side is nonegative, this requires $\tau^{\ast}>4.595$. At $\tau^{\ast}=5$, the floor is active for categories with $\sum_j w_j\widetilde{x}_{cj}<0.405$. Thus, under the actual configuration, **the minimum masking ratio can meaningfully affect masking decisions**. We will correct Appendix F in the revised manuscript, document the exact full-model configurations, and release the configuration files with the code. **Q: Positive and Negative Samples in Contrastive Learning** **A:** We thank the reviewer for identifying the inconsistency between Appendices B and I. We clarify that **both the main results and the constrastive ablation use the sample construction described in Appendix B**. The **w/o Contrastive Learning** ablation removes only the InfoNCE object while retaining the generative reconstruction object, thereby isolating the contribution of the contrastive term without change the positive/negative definition. The statement in Appendix I is incorrect and will be corrected in the revision. Specifically, **positive samples are privacy-preserving synthetic reconstructions generated from masked inputs**, while **explicit negative samples are the corresponding original privacy-containing training texts**. In addition, the contrastive objective incorporates in-batch negatives drawn from other samples' positive representations. This design encourages the model to align with semantically consistent, privacy-preserving reconstructions while distinguishing them from representations that contain original sensitive information, thereby complementing the reconstruction objective by jointly promoting semantic fidelity and privacy preservation.

Dear Reviewer,

We would like to kindly follow up on our earlier response regarding the masking rule and contrastive sample construction. As clarified in our rebuttal, both concerns stem from inconsistencies in the manuscript descriptions rather than differences in the actual experimental implementation. We have identified the corresponding corrections and clarified the configurations used to obtain the reported results.

Since these two issues were central to your soundness concerns, we sincerely hope you could revisit our explanations and reconsider whether they still warrant the original assessment. We would particularly appreciate your reconsideration of the score if the clarifications have resolved your concerns.

We value your careful mathematical examination and would welcome any further questions or comments.

Reviewer_kNUWOpenReview ↗
Rating
2
Confidence
2
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper proposes PrivMask to balance text privacy and utility using category aware masking and context aware substitute generation. Extensive experiments across various domains show promising results, though important issues remain regarding method definition consistency and privacy evaluation adequacy.

Critical strengths
  1. The authors point out that privacy sensitivity and downstream utility contributions vary across different entity categories and contexts, meaning they should not be masked uniformly. This observation holds practical significance.

  2. The design featuring the two stages of CASPM and CAR is clear, and combining category aware masking with context aware reconstruction shows strong application potential.

  3. The evaluation spans general, legal, and medical domains. It reports multiple metrics including semantic quality, fluency, privacy leakage, and attack success rates, and is supplemented by downstream question answering tasks.

Critical weaknesses
  1. While combining adaptive masking and generative reconstruction holds practical value, the methodological novelty remains weak. The utilized features are common, and the paper fails to differentiate its approach from existing LLM anonymization methods like IncogniText and RUPTA. Instead, the framework appears to rely heavily on module combination and engineering tuning.

  2. The method preserves at least one original subword and applies no masking to single subword entities, leaving substantial fragments of sensitive identifiers in the output. Although Context Aware Reconstruction might mitigate these risks, current metrics fail to prove protection against fragment disclosure or linkage attacks. Therefore, the true strength of the privacy protection against residual disclosure remains unclear.

  3. The paper compares average token counts but omits crucial metrics like end to end inference latency or throughput. Since the evaluated methods differ in architecture, token counts alone cannot fully reflect actual computational efficiency. Consequently, the claimed advantages for large scale deployments lack sufficient validation.

  4. Existing experiments do not analyze how NER errors (missed detections and boundary errors) affect the final privacy leakage (PLR or ASR), nor do they evaluate CAR's ability to remedy missed entities.

Questions for authors
  1. Is the evaluation recognizer for PLR independent of the anonymization recognizer?
  2. How is the end to end inference latency performance?
  3. For long-tail categories, does the extreme variance in the empirical estimation of p(w∣c)p(w\vert{}c) (Eq. 2) cause the context entropy HcH_c calculation to fail?
4 comments
AuthorsOpenReview ↗

Comment 1: Clarifications on Methodological Novelty, Privacy Evaluation, and CAR

We thank the reviewer for the constructive feedback and recognition of PrivMask's practical significance. We provide the following clarifications and additional evidence to further substantiate our contributions.

Q: Methodological Novelty and Contributions

A: We agree that masking and reconstruction individually have precedents, and we would like to clarify that the essential difference lies not in module composition but in the design premise and optimization objective of privacy control.

IncogniText aims to prevent inference of a specific attribute by fully rewriting the corresponding text, treating the corpus as a vehicle for misleading the adversary. RUPTA formulates anonymization as lexicographic multi-objective optimization and repeatedly rewrites the entire passage under privacy and utility evaluators, treating the full text as the unit of optimization. Its control is therefore coarse-grained and driven by the optimization loop.

By contrast, PrivMask builds on the observation that different data samples, and even different entity categories within the same sample, contribute unevenly to downstream utility, and their privacy sensitivity varies with context. According, instead of applying a uniform rewrite (IncogniText) or full-text iterative optimization (RUPTA), PrivMask controls what and how much to anonymize. Specifically, it analyzes category-level sensitivity and contextual risk to compute a specific masking decision for each sensitive entity in each corpus, and subsequently reconstructs the masked content locally.

Q: Residual Fragments and Linkage Risks

A: We thank the reviewr for this important concern. Retaining limited subword information is a deliberate privacy–utility design choice rather than unrestricted disclosure. Our evaluation considers both PLR and ASR. PLR assesses residual exposure against annotated sensitive entities, while ASR measures whether an attacker can recover sensitive information from residual context, including retained fragments. Under a free-text inference attack (Staab et al., 2024), if a retained fragment is informative enough to enable recovery, ASR rises. Across three datasets, PrivMask achieves PLR of 3.41%/4.40%/3.88% and ASR of 5.28%/6.71%/5.22%, indicating that residual fragments do not, in practice, enable recovery of the original entities. Although single-subword entities and auxiliary-information linkage remain limitations of the current masking rule, the experimental results indicate substantial empirical privacy protection.

Q: PLR Evaluation Independence and NER Errors

A: Apps. D.4–D.5 already clarify the PLR and ASR evaluation protocols. Specifically, NpN_p is obtained from dataset-provided ground-truth sensitive-entity annotations, while NrN_r is determined using a separate privacy entity recognizer, independent of the NER model employed in CASPM. Therefore, NER missed detections are not automatically excluded from PLR evaluation, as residual sensitive entities can still be identified by the independent evaluation recognizer. Moreover, boundary errors may leave sensitive fragments exposed, whose potential inference risks are further captured by ASR through free-text inference. Thus, both types of NER errors are reflected in the overall privacy leakage assessment, although their individual contributions are not separately quantified.

Q: CAR's Ability to Remedy Missed Entities

A: We have investigated CAR's ability to mitigate residual leakage under imperfect privacy recognition. Table 3 includes the w/o CASPM ablation, which retains CAR alone and evaluates its privacy protection capability without category-aware masking. Although CAR alone cannot fully prevent leakage, the comparison with the complete model highlights the complementary contributions of CASPM and CAR. More directly, App. H.3 (Table 7) evaluates CAR with four different front-end privacy recognizers while keeping the reconstructor fixed. Across all three datasets, integrating CAR consistently reduces PLR and ASR compared with recognizer-only removal and substitution. These results indicate that CAR can further mitigate sensitive information insufficiently handled by upstream recognition, including missed entities. This capability is supported by Tag-Enhanced Input Embeddings and Contrastive Learning-Based Optimization, which leverage semantic tags and contextual information to recognize and guide privacy-preserving reconstruction.

AuthorsOpenReview ↗

Comment 2: End-to-End Inference Efficiency and Long-Tail Category Analysis

Q: End-to-End Inference Latency

A: We agree that token counts alone cannot fully reflect computational efficiency, and that end-to-end latency and throughput provide a more comprehensive assessment. Our initial cost analysis focused on token counts rather than latency/throught because several baselines (RUPTA, AF, ATA, and TRACE-RPS) rely on external API calls, while the remaining methods are executed locally. Differences in hardware, network overhead, and API execution environments could make direct comparisons misleading. Nevertheless, following the reviewer's suggestion, we have conducted additional E2E evaluations and added a Deployment column to explicitly distinguish local, API-based, and hybrid execution environments. Each cell reports Mean/P95 (s/sample); Throughput (samples/s):

MethodDeploymentPIILegalMedical
Gemma3-4B FTLocal7.41/10.06/0.13553.56/72.74/0.01956.32/76.49/0.018
Qwen2-7B FTLocal8.30/11.27/0.12063.30/85.97/0.01653.20/72.25/0.019
Mistral-7B FTLocal9.44/12.82/0.10695.34/129.49/0.01087.04/118.22/0.011
Gemma3-4B ITLocal10.44/14.18/0.09664.86/88.09/0.01556.41/76.61/0.018
Qwen2-7B ITLocal11.90/16.16/0.08466.42/90.21/0.01567.09/91.12/0.015
Mistral-7B ITLocal12.31/16.72/0.081110.64/150.27/0.009101.75/138.19/0.010
ATAAPI6.47/10.05/0.15414.58/15.64/0.06911.80/21.23/0.085
AFAPI71.85/92.42/0.015125.15/140.74/0.009155.18/233.38/0.006
RUPTAAPI68.67/115.30/0.01545.47/62.04/0.022128.43/166.11/0.008
RLAALocal56.51/85.88/0.015109.36/140.50/0.00931.62/34.77/0.032
TRACE-RPSLocal+API83.45/172.47/0.012156.42/196.12/0.006111.41/124.72/0.009
PrivMaskLocal1.92/2.61/0.52131.35/42.58/0.03231.43/42.69/0.032

FT/IT denote fine-/instruction-tuning. PrivMask achieves the lowest mean E2E latency among locally deployed methods across all three datasets, demonstrating favorable inference efficiency after one-time training. The deployment distinctions also enable a more transparent interpretation of efficiency across heterogeneous execution environments. We will incorporate these additional experimental results and their corresponding evaluation details into the revision.

Q: Long-Tail Categories and Contextual Entropy

A: Sparse observations can affect the empirical estimation of p(w∣c)p(w\mid c), but PrivMask incorporates two complementary mechanisms to mitigate this issue. First, smoothing estimation is applied to low-frequency categories, i.e., those with Nc<nmin⁡N_c<n_{\min}, in our experiments to stabilize contextual probability estimates. Second, the Entropy Weight Method (EWM) automatically determines the contributions of NcN_c, LcL_c, ScS_c, and HcH_c, ensuring that masking decisions do not depend solely on contextual entropy. Smoothing addresses sparse estimation directly, while EWM integrates multiple indicators for category importance modeling. We will make the corresponding clarifications and corrections in the Methodology section of the revised manuscript.

Dear Reviewer,

Thank you again for your constructive feedback and valuable suggestions. We have provided detailed responses to your concerns regarding methodological novelty, privacy evaluation, NER errors, and computational efficiency, along with additional experimental evidence and clarifications.

We would greatly appreciate it if you could review our responses and let us know whether any concerns remain. If our clarifications and additional results have satisfactorily addressed your concerns, we would be grateful if you could consider updating your assessment and score accordingly.

Thank you for your time and thoughtful consideration.

Reviewer_kNUWOpenReview ↗

Response to Author Rebuttals

Thank you very much for your detailed responses and for conducting the additional experiments. I appreciate the effort you put into addressing my feedback. Your clarification on the independent privacy recognizer resolves my concern about evaluator independence, and the added latency and throughput results nicely address the efficiency aspect.

Unfortunately, my primary concerns remain largely unresolved. While the differences in masking granularity and design goals are clearer now, the methodological novelty still feels somewhat incremental beyond combining adaptive masking with contextual reconstruction. On the privacy side, the aggregate PLR and ASR metrics are encouraging, but they do not directly verify robustness against specific risks like retained subword fragments, unmasked single-subword entities, or auxiliary information linkage, some of which you also acknowledge as ongoing limitations. Additionally, the cross-recognizer comparisons and the intuition behind the smoothing and weighting mechanisms are helpful, yet they stop short of isolating boundary or detection errors to quantify CAR's recovery or demonstrating clear stability in longtail estimates.

I appreciate your constructive engagement and the new evidence provided, which definitely moves the paper in a positive direction. However, because these core concerns still hold, I will maintain my original score of 2 (Weak Reject).

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.