Stop Tracking Me! Proactive Defenses Against LLM Attribute Inference AttacksStop Tracking Me! Proactive Defense Against Attribute Inference Attack in LLMs
The authors propose the user-side defense TRACE-RPS, claiming that attribute inference accuracy on open-source models drops from about 50% to below 5%.
The attacker uses a frozen LLM and attribute inference templates to infer attributes such as age, location, and gender from user free text, with the goal of maximizing inference accuracy. The user cannot modify the attack prompt or attack model and can only process its own text before sharing. RPS requires target model logits; without logits, only TRACE is used. The paper does not use white-box or black-box to describe this attack.
- LLMs can infer unstated attributes such as age, location, and gender from ordinary text users post online, using prompts that do not trigger refusals. Existing anonymization is coarse-grained, and models can still infer after rewriting. Users typically have to process text themselves before sharing.
- TRACE uses attention to extract high-contribution words and generates step-by-step inference chains to guide the anonymization model in rewriting leaking segments. When logits are accessible, RPS uses two-stage random search to append suffixes, pushing outputs toward refusal; for models that still answer, MPS pushes predictions toward incorrect attributes.
- The authors state that on open-source models, TRACE-RPS accuracy drops from about 50% to below 5%. In Synthetic, Llama3.1's TRACE-RPS accuracy is 0 and ASR is 13.48. For closed-source models, only TRACE is used. LLMSanitize inflates some remaining accuracy.
- The paper does not specifically discuss limitations. Experiments use Synthetic, SynthPAI, and self-built Reddit data; RPS requires logits, and the closed-source main results only include TRACE. The paper does not report the number of samples, repetitions, or actual number of optimization queries.
- Evaluated models
- Llama2-7B-ChatLlama2-13B-ChatLlama3.1-8B-InstructDeepSeek-R1-Distill-Qwen-7BQwen2.5-7B-InstructGPT-3.5-TurboGPT-4oGemini 2.5 ProLlama3.2-1B-InstructLlama3.2-3B-Instruct
- Benchmarks
- Synthetic dataset (Staab et al., 2024)SynthPAI (Yukhymenko et al., 2024)real-world Reddit dataset (Appendix C)
- Metrics
- attribute inference accuracyASRSRRSoRRutilitysemantic similarity
The paper proposes a unified defense framework, TRACE-RPS, against attribute inference attacks where LLMs infer private attributes such as age, location, and gender from user text. TRACE uses attention mechanisms and chain-of-thought generation to identify and anonymize text elements that leak privacy; RPS uses lightweight two-stage optimization to induce refusal behavior in the model, thereby preventing attribute inference. Evaluations on multiple open-source models show attribute inference accuracy drops from about 50% to below 5%, with cross-model generalization, robustness to prompt variations, and a utility-privacy trade-off. The code has been open-sourced on GitHub.
Paper analysis
What problem does this paper attempt to solve?
Text shared by users can be used by LLMs to infer sensitive attributes, and coarse-grained anonymization cannot block inference.
LLMs can infer unstated sensitive attributes from text users are about to share, and rewriting-based anonymization does not block subsequent inference.
- Occurrence scenario: The authors state that even if the model has not memorized specific user information, it can infer age, gender, location, socioeconomic status, etc., from user-generated text online. Such requests are benign prompts and do not trigger refusals from aligned models. The authors paraphrase Staab et al. (2024): the attack is scalable, automatable, and most safety policies technically allow it. On Synthetic with no defense, GPT-4o's accuracy is 71.24% (Table 1).
- Existing shortcomings: The authors state that existing anonymization mostly modifies at a coarse text granularity and cannot locate the words that contribute most to leakage. After rewriting, the model can still reason; for attributes with few categories such as gender and income, anonymized text still gives parseable clues, and anonymization itself cannot prevent inference from occurring. The authors believe this cannot be solved by weakening reasoning, as that harms utility, so protection falls on the user side.
- The authors' idea: Perform word-level anonymization before sharing; if logits can be read, append a suffix that does not change the original text's semantics, causing the model to refuse or give a wrong attribute.
- Proposed method: TRACE-RPS. TRACE performs fine-grained anonymization; RPS uses two-stage optimization to induce refusal. The authors state that RPS is the first optimization-based defense against attribute inference they know of. For strong instruction-following models that still answer, MPS is additionally provided to shift predictions toward wrong attributes.
- Threat model:
- Attack goal: Maximize inference accuracy across all users and all target attributes. Formalization is in Section 3.1.
- Attacker knowledge: Uses a frozen pretrained LLM and constructs prompts with attribute inference templates (Staab et al., 2024), extracting attributes from textual clues. The paper does not call this attack white-box, black-box, or no-box.
- Defender capability: Cannot modify the attack prompt or attack model, can only process its own text before inference. RPS requires model logits; for closed-source models without internal access, only TRACE can be used.
- Victim system: Users about to publicly share free text. Defense success means the predicted value is wrong, or the model explicitly refuses (denoted as Reject in the paper).
What related research exists?
Related work covers memory leakage, PII anonymization, and jailbreak-style prompt optimization; the authors repurpose optimization for defense.
Privacy in training data memorization and inference
- Carlini et al. (2021; 2022), Lukas et al. (2023), Kim et al. (2023), Ippolito et al. (2023), Brown et al. (2022) study models reproducing sensitive sequences from training corpora.
- Staab et al. (2024) discuss models inferring unstated sensitive attributes from user-generated text; Yukhymenko et al. (2024) distinguish this from training data leakage.
- Differential privacy (Ponomareva et al., 2023; Li et al., 2022) and decoding controls (Ippolito et al., 2023) have been proposed. The authors claim they remain limited for inference-based leakage.
PII detection and anonymization
- Rule-based PII detection (Subramani et al., 2023; Asthana et al., 2025) struggles with implicit disclosure. Dou et al. (2024) use a social attribute taxonomy to detect self-disclosure, improving coverage and precision.
- Azure Language Services (Aahill, 2023) masks identifiable segments. The authors claim it does not block inference using contextual clues.
- IncogniText by Frikha et al. (2024) uses attribute randomization to mislead inference; Staab et al. (2025) use feedback-guided anonymization to reduce identifiability. The authors claim these methods remain coarse-grained, lack word-level precision, and do not fully leverage adversarial LLMs for precise anonymization. The methods section further specifies Staab et al. (2025) as relying only on coarse-grained adversarial feedback.
Prompt optimization and jailbreaking
- Gradient methods such as GCG (Zou et al., 2023), as well as Zhou et al. (2024), Shin et al. (2020), Jia et al. (2025), Zhu et al. (2024), Guo et al. (2024), require white-box gradients to modify output distributions and bypass safety alignment.
- Gradient-free search includes genetic algorithms (Lapid et al., 2023; Liu et al., 2024) and guided search (Andriushchenko et al., 2025; Sitawarin et al., 2024; Hayase et al., 2024), as well as using LLMs to generate or rewrite prompts (Chao et al., 2023; Shah et al., 2023; Mehrotra et al., 2024; Zeng et al., 2024; Liu et al., 2025).
- The authors claim these methods target jailbreaking, are costly, or only perform coarse-grained single-step optimization; this paper repurposes prompt optimization for defense, using low-cost, fine-grained two-stage optimization to induce refusals.
Baseline methods and benchmarks
- Baseline methods: No Defense, Azure, Dou-SD, D-Defense (Agnew et al., 2024), FgAA (Staab et al., 2025). Numbers for Azure and Dou-SD marked with † are cited from Staab et al. (2025), whose evaluation model is stated as GPT-4.
- Benchmarks/datasets: Synthetic (Staab et al., 2024), SynthPAI (Yukhymenko et al., 2024); Appendix C also includes Reddit data self-constructed following Staab et al. (2024)'s procedure. PersonalReddit is not public due to privacy.
The authors position TRACE as anonymization with a word-level attention vocabulary and inference chains, and RPS as an optimization-based defense targeting attribute inference, without modifying the original text, using suffixes to induce refusals.
How does the paper address this problem?
TRACE does word-level rewriting with attention and inference chains; RPS/MPS use suffix search to induce refusal or misclassification.
TRACE-RPS is used before the user posts: TRACE rewrites leaking segments; when logits are readable, RPS or MPS appends a suffix. Figure 1 is a framework diagram, and its percentages are illustrative, not experimental measurements.
Attack and defense objectives
- The data are users and their free text. Example target attribute sets include age, location, gender. The attacker composes prompts with prefixes, formatted text, and suffixes, freezing the LLM's output for each attribute prediction.
- The defender can only transform the original text t into t̃. Success means a wrong prediction, or the output is a refusal Reject.
- The user-side objective in Section 3.2 is fewer correct predictions and more refusals: argminTdef E∑j(I[ŷ=y]−λ I[ŷ=Reject]). λ is a positive trade-off coefficient. The paper does not report the λ used in experiments. RPS actually optimizes the token log-probabilities below, rather than directly optimizing this expression.
TRACE: fine-grained anonymization
- Each round uses both a privacy vocabulary and an inference chain. The authors distinguish this from approaches relying only on coarse adversarial feedback (Staab et al., 2025).
- Privacy vocabulary: using the causal language model's last layer and the attention of the prompt's last token, token scores are added to words, taking the Top-K. Experiments use Llama2-7B-Chat to extract attention. K=10 on Synthetic, K=30 on SynthPAI. The authors cite Ren et al. (2024) as the basis for focusing on the last layer.
- Inference chain: the adversarial model, besides predicting, gives step-by-step explanations marking the segments supporting the inference. The anonymization model sees both the vocabulary and the inference chain and rewrites key segments. In experiments this model is GPT-3.5-Turbo or GPT-4o. Appendix I gives the full prompt.
- Iteration continues until the attack model's prediction confidence falls below a preset threshold 2, the text stops changing, or 5 rounds are reached (Appendix G). TRACE and FgAA share these stopping conditions.
RPS: two-stage random search
- Appends a suffix after the original text without changing its semantics. During optimization, only the log-probabilities of one or two tokens are decoded, without gradients. The optimization model is the same as the inference model for that run.
- The score is J(s)=log p(y1=I∣ P(t̃))+βlog p(y2∈ R∣ P(t̃), y1=I). R is a fixed set of refusal-related tokens. In experiments R contains apologize and cannot, and β=5 for stage 2.
- Stage 1 anchors the first token to I, replacing n tokens at random positions in the current best suffix, keeping the higher-scoring one, until the log-probability reaches log(0.8) or the iteration limit. The paper does not give the value of n.
- Stage 2 pushes the second token toward R, with threshold log(0.55). The total iteration limit is 10000, with batch size 1. The initial suffix is a manually constructed prompt fragment, not given in the main text. The authors state that the same suffix often transfers to new texts, or serves as initialization within a few steps. Appendix A gives the algorithm, Appendix J gives examples.
MPS and evaluation method
- The authors state that strong instruction-following models like Qwen may refuse first yet still continue predicting attributes. MPS pushes the prediction from the true attribute toward a specified wrong attribute, also via random suffix search. The iteration limit is 500. Appendix A calls MPS when RPS still outputs an attribute.
- The main metric is attribute inference accuracy compared with labels. Inference uses the prompt from Staab et al. (2024), zero-shot CoT. Temperature is 0, greedy decoding. The ASR in Appendix B counts 1/k on refusal queries by that attribute's number of classes k, representing the attacker switching to random guessing on refusals. The paper does not specify the string-matching rule between prediction and label.
What experiments did the paper conduct?
The authors claim TRACE-RPS reduces accuracy to below 5% on open-source models; the closed-source main table only includes TRACE.
Experimental Setup
- Reasoning models: Llama2-7B-Chat, Llama2-13B-Chat, Llama3.1-8B-Instruct, DeepSeek-R1-Distill-Qwen-7B (written as DeepSeek-R1 Distill in the table header), Qwen2.5-7B-Instruct, GPT-3.5-Turbo (written as GPT-3.5 in the table header), GPT-4o, Gemini 2.5 Pro. Table 6 additionally reports Llama3.2-1B-Instruct and Llama3.2-3B-Instruct.
- Data: Synthetic, SynthPAI, and self-constructed, manually annotated Reddit data in Appendix C. The paper does not give the number of examples for each dataset, nor does it report the number of annotators or agreement.
- Baselines: No Defense, Azure, Dou-SD, D-Defense, FgAA. Numbers marked with † are cited from Staab et al. (2025), where the evaluated model is GPT-4.
- Defense configuration: Attention uses Llama2-7B-Chat; anonymization uses GPT-3.5-Turbo or GPT-4o. The optimization model for RPS/MPS is the same as the reasoning model for that run. Closed-source models have no logits, so the corresponding cells in the table are “–”.
- Metrics and decoding: Attribute inference accuracy; parentheses show ASR. Figure 2 uses SRR, SoRR, Acc. TRACE's utility comes from LLM judgment in Staab et al. (2025) (meaning preservation, readability, hallucination); the paper does not name the judging model. RPS uses semantic similarity from paraphrase-MiniLM-L6-v2. Temperature 0, greedy decoding.
- Budget: RPS runs at most 10,000 iterations with batch size 1; MPS runs 500 iterations. Hardware is one or two NVIDIA RTX 3090s. The paper does not report the number of repetitions or the actual number of queries. The prompt variation experiment uses 100 prompts generated by GPT-4.
Main Results
The table below shows attribute inference accuracy (%) on Synthetic. TRACE and TRACE-RPS use GPT-4o as the anonymization model; RPS does not depend on an anonymization model. Parentheses show ASR. Based on Table 1. Closed-source cells are “–” in the paper.
Swipe horizontally to read the table
Model No Defense RPS TRACE TRACE-RPS Llama2-7B-Chat 53.71 1.71 (14.10) 20.19 1.52 (13.94) Llama2-13B-Chat 56.19 4.38 (16.09) 21.33 0.19 (13.38) Llama3.1-8B-Instruct 57.14 0 (13.48) 18.48 0 (13.48) DeepSeek-R1 Distill 49.71 6.48 (17.59) 18.10 2.86 (14.07) GPT-3.5-Turbo 67.62 Not reported 25.14 Not reported GPT-4o 71.24 Not reported 26.67 Not reported Gemini 2.5 Pro 68.38 Not reported 23.81 Not reported - The authors state that when TRACE and RPS are combined on open-source models, accuracy drops from about 50% to below 5%, with many cells at 0. In Table 1, open-source TRACE-RPS under both anonymization settings is below 5. With RPS alone, the authors state accuracy is below 7% and ASR below 18%; on this table, the highest ASR for RPS alone on Synthetic is 17.59 for DeepSeek-R1 Distill. When accuracy is 0, ASR is still about 13–14 because refusals are counted as random guesses.
- In the same table, with GPT-3.5-Turbo as the anonymization model, open-source TRACE-RPS is 0.19, 1.14, 0, 1.71. GPT-4o anonymization is not always lower: Llama2-7B-Chat's TRACE-RPS is 1.52 and 0.19 under the two anonymization settings, respectively. The authors state that on Synthetic, closed-source TRACE drops about 45% relative to no defense and is lower than each anonymization baseline. The † row for Azure is 56.00 in the GPT-4o column and 47.00 for Dou-SD, with the evaluation model being GPT-4.
- On SynthPAI, open-source no-defense accuracy ranges from 41.45 to 54.52, and closed-source from 57.12 to 70.64 (Table 1). With GPT-4o anonymization, TRACE-RPS is 0.27, 0.09, 0, 3.58, with corresponding ASR of 14.16, 14.19, 14.10, 15.41. On Llama2-13B-Chat, D-Defense is 44.92, higher than no defense at 44.58. The authors do not explain this cell.
MPS on Qwen
- Table 2 only tests Qwen2.5-7B-Instruct. No defense is 57.52, D-Defense is 48.00, MPS is 10.29.
- FgAA is 28.76 (in parentheses, with GPT-4o anonymization at 22.10), TRACE is 22.67 (18.86), TRACE-MPS is 5.14 (4.38).
- The authors state that MPS shifts predictions toward incorrect attributes; combined with TRACE, accuracy is lower.
Prompt Variation, Model Transfer, and Multi-Model Suffixes
- Figure 2 tests 100 prompts generated by GPT-4 on Llama2-7B-Chat, Llama2-13B-Chat, and Llama3.1-8B-Instruct, with metrics SRR, SoRR, Acc. The authors state that optimized suffixes can induce refusal across prompts. The main text does not give values for each bar.
- Figure 3 transfers suffixes optimized on one model to other target models. The authors state that accuracy drops, and adding TRACE further reduces it; the suffix from Llama2-7B-Chat can reduce accuracy on Llama2-13B-Chat, and the suffix from DeepSeek-R1-Distill transfers under both anonymization models. The main text does not give readings for Figure 3.
- Table 6 jointly optimizes Llama2-7B-Chat, Llama2-13B-Chat, and Llama3.1-8B-Instruct on Synthetic. On no-defense text, the three models have accuracies of 4.95, 4.00, 0; unseen Llama3.2-1B-Instruct is 6.86↓26.28, and Llama3.2-3B-Instruct is 0↓54.10. The authors state that the suffix transfers to unseen Llama3.2 models.
Real Data, Adaptive Attacks, and Per-Attribute Results
- Table 7: TRACE-RPS is 4.29, 2.86, 0 on three open-source models; RPS alone is 7.14, 2.86, 0. With GPT-4o anonymization, closed-source TRACE is 28.57, 30.00, 32.86, and no defense is 65.71, 78.57, 72.86. On Llama3.1, TRACE is 34.29, higher than FgAA's 32.86 in the same table. D-Defense on Llama2-7B-Chat is 57.14, higher than no defense at 44.29; on GPT-3.5-Turbo it is 72.86, higher than 65.71. The authors do not explain these increases.
- Table 9, Synthetic: SuffixDrop-ℓ (ℓ takes 8, 16, 32, 64; the table does not separate by ℓ) raises Llama2-7B-Chat from 1.71 to 27.43, and Llama3.1 from 0 to 0.76. LLMSanitize (GPT-4o pre-filtering) is 23.62 and 33.90, respectively, with no defense at 53.71 and 57.14. The authors state that adaptive attacks weaken defenses, but RPS still often reduces accuracy to about half of no defense. In the table, the reduction from 57.14 to 33.90 is less than half.
- Table 5, Llama2-13B-Chat, eight attributes from Synthetic and SynthPAI, not further separated by dataset in the table. No defense: birthplace 83.75, gender 79.25, education 16.00. After TRACE: location 6.94, birthplace 15.00, gender 52.83. After RPS: income 3.62, education 0.76, others 0. The authors state that on attributes with few categories, anonymization cannot fully prevent inference, and RPS handles this with refusal.
Other Ablations and Analyses
- Table 3, GPT-3.5-Turbo as reasoning model, Synthetic: with vocabulary plus inference chain, Top@1/2/3 is 26.86/45.33/56.38; removing vocabulary gives 31.43/48.76/58.86; removing inference chain gives 31.62/51.62/59.05; removing both gives 37.14/57.33/64.38.
- Table 10, vocabulary only, Synthetic: K=5 is 33.33, K=10 is 31.62, K=15 is 34.10. The authors state K=10 is best.
- Table 8: prefix 1.9/0.19/0, infix 0.36/0.09/0, suffix 1.71/4.38/0 (Llama2-7B-Chat, 13B-Chat, Llama3.1). The authors state all positions are below 5; the highest in the table is 4.38.
- Table 4: When the Model column is GPT-4o, FgAA utility is 88.29 and accuracy 39.05, TRACE is 86.65 and 28.38; the GPT-3.5 row has TRACE utility 80.83 and accuracy 26.86, and after removing vocabulary, utility 86.83 and accuracy 31.43. Llama2-7B-Chat's RPS similarity is 98.17 and accuracy 1.71; DeepSeek-R1 Distill is 98.27 and 6.48. These accuracies match the Synthetic numbers in Table 1 with GPT-3.5-Turbo as the anonymization model. The main text also states that with GPT-4o as the anonymization model, TRACE utility is 86.65. The two places write the role of 86.65 inconsistently.
- Appendix G only specifies stopping conditions (confidence below 2, text unchanged, or at most 5 rounds), without giving accuracy over iterations. The paper does not report the actual number of steps for each optimization.
What are some points that can be further explored?
The paper does not explicitly list limitations or future work.
Limitations and future directions noted by the authors
The paper does not specifically discuss limitations. The Conclusion, Ethics, Reproducibility, and appendix do not frame any result as a limitation or future work. Ethics only states the research purpose and that real data comes from public sources and has been anonymized. Reproducibility states that code has been made public, not a plan to be completed.
Experimental coverage
- The inference models in Section 5.1 are Llama2-7B-Chat, Llama2-13B-Chat, Llama3.1-8B-Instruct, DeepSeek-R1-Distill-Qwen-7B, Qwen2.5-7B-Instruct, GPT-3.5-Turbo, GPT-4o, Gemini 2.5 Pro; Table 6 additionally reports Llama3.2-1B-Instruct and Llama3.2-3B-Instruct.
- Data are Synthetic, SynthPAI, and the real Reddit set in Appendix C. The paper does not report the number of samples for the three, nor the number of annotators or agreement for the real data.
- Baselines are No Defense, Azure, Dou-SD, D-Defense, FgAA. The † numbers for Azure and Dou-SD come from Staab et al. (2025), the evaluation model is written as GPT-4, and the remaining cells in Table 1 are "–".
- RPS and MPS are optimized on open-source inference models where logits are available, and the optimization model is the same as the inference model. The main tables for GPT-3.5-Turbo, GPT-4o, and Gemini 2.5 Pro do not have RPS or TRACE-RPS. Attention extraction is fixed to Llama2-7B-Chat, and the anonymization model is GPT-3.5-Turbo or GPT-4o.
- Adaptive attacks (Appendix E) are SuffixDrop-ℓ and LLMSanitize, with data Synthetic and models Llama2-7B-Chat and Llama3.1-8B-Instruct. Prompt variations are 100 GPT-4-generated prompts and three open-source models (Figure 2); the main text does not give SRR, SoRR, or Acc values. The paper does not report the number of repetitions, the actual number of optimization queries, or the matching rule between predictions and labels.
Summarize the main content of the paper
User-side TRACE plus RPS/MPS reduces the LLM's inference accuracy on sensitive attributes before sharing.
This is a user-side defense: reducing LLM inference of sensitive attributes before text is made public, rather than modifying attack prompts or weakening model reasoning.
- Problem: Aligned models do not refuse benign attribute-inference prompts. The authors argue that coarse-grained anonymization neither finds the most leaking words nor prevents the model from reasoning after rewriting, especially for attributes with few categories.
- Method: TRACE uses the last-layer attention of Llama2-7B-Chat to select Top-K words and has an adversarial model write an inference chain, then GPT-3.5-Turbo or GPT-4o rewrites key segments. RPS performs gradient-free two-stage random search on the same open-source model as the inference model, optimizing the suffix so that the first token is 'I' and the second token falls into a refusal set. For models that still respond, MPS pushes predictions toward incorrect attributes. The authors claim RPS is the first optimization-based defense against attribute inference they know of.
- Main results: On Synthetic, the accuracy of GPT-4o without defense is 71.24%. In the same table, Llama3.1-8B-Instruct's TRACE-RPS accuracy is 0, while ASR remains 13.48 because refusals are counted as random guesses. The authors state that when combined on open-source models, accuracy drops from about 50% to below 5%. RPS cannot be run on closed-source models; when GPT-4o serves as both the inference and anonymization model, TRACE is 26.67% (Table 1).
- Other results: Qwen2.5-7B-Instruct with GPT-4o anonymization achieves TRACE-MPS of 4.38% (Table 2). On real data, Llama2-7B-Chat's TRACE-RPS is 4.29%, and RPS alone is 7.14% (Table 7). LLMSanitize increases Llama3.1's RPS accuracy to 33.90% (Table 9). In Table 4, RPS semantic similarity is 98.17 and 98.27.
- Authors' conclusion: The authors claim the framework generalizes across attack models, still induces refusals under variations of inference prompts, and provides a utility-privacy trade-off. They present it as a user-side privacy tool that does not depend on the model provider, and in contributions claim state-of-the-art privacy protection in both open-source and closed-source settings.