Copied and Perturbed: A String-Based Likelihood-Ratio Membership Inference Attack on LLM In-Context Table Synthesis

Joshua Ward, Haoyuan Cheng, Yue Zhang, Guang ChengarXiv 2026

TL;DR

When you ask a Large Language Model (LLM) to generate synthetic tabular data by putting a few real examples in its prompt, it doesn't just learn statistical patterns—it often copies values verbatim or with tiny numeric tweaks. This paper introduces String-LRA, a fast, "no-box" privacy attack that spots this string-level memorization and perturbation, outperforming existing privacy audits without needing any access to the underlying model.

What Problem Does This Paper Address?

Synthetic data is supposed to let organizations share useful datasets—like medical or financial records—without exposing the real people in them. Recently, practitioners have started using LLMs for in-context table synthesis: you paste a small private table into the prompt, and the LLM generates new, similar-looking rows. Because this requires no model training, it's especially attractive for small datasets.

To test whether synthetic data leaks private information, auditors use Membership Inference Attacks (MIAs), which try to guess whether a specific person's record was in the original private dataset. Traditionally, MIAs for tabular data work in feature space—turning rows into numerical vectors and looking for synthetic records that sit suspiciously close to a target record.

But LLMs don't think in feature vectors; they generate tables as text, token by token. An LLM might copy a rare category label or a distinctive digit sequence from its prompt while slightly changing other fields. Feature-space attacks miss this. A prior string-based attack called LevAtt tried using edit distance (how many character changes separate two strings), but edit distance treats all numbers uniformly and has no idea whether a matching value is rare or common in the general population.

Methods

The authors propose String-LRA (String Likelihood Ratio Attack), a no-box MIA. "No-box" means the attacker only sees the released synthetic table, the target record, and a small reference sample from the general population—no model weights, no logits, and no ability to query the generator.

String-LRA frames membership inference as a likelihood-ratio test. For each cell in a synthetic row, it asks: How likely is it that this value was generated by copying (or slightly perturbing) the target record, versus being drawn from the population by chance?

To answer this, String-LRA builds two types of tries (prefix trees) on the reference sample:

  • For text/categorical cells: It fits a character-level Witten–Bell model to estimate how rare an exact string is in the population.
  • For numeric cells: It aligns numbers into fixed-point digit strings and indexes them in a digit trie. Instead of demanding an exact match, it checks a ladder of 22 numeric neighborhoods (radii) around the target's value, measuring how much population mass falls inside each neighborhood.
Figure 1: Scoring a numeric target with the digit trie. We diagram a worked example of how a trie can find evidence of membership (measured in bits) between a target, a synthetic release with a perturbed digit string, and a reference dataset. (a) Consider a target 𝑥★= 123456, release 𝑆, and reference sample 𝑅(|𝑅| = 1000). (b) Each row expands one node on the trie path of 𝑥★into its children, labeled with reference counts. The blue interval is the neighborhood Nℓ(𝑥★) of radius 𝑟ℓ. Neighborhoods cross digit boundaries (e.g., 123462 at 𝑟ℓ= 10), and 𝑠1 = 123455 lies in every one except the exact match. (c) Every neighborhood except the exact match contains 𝑠1; the narrower the neighborhood, the less reference mass it holds and the more bits of membership evidence it gives. Appendix A.1 works through the computation.

As shown above, if a target's value is 123456 and a synthetic row has 123455, an exact-match check would fail. By checking neighborhoods of increasing radius, String-LRA captures the near-miss and weights it by how rare that neighborhood is in the reference data—all measured in bits of evidence.

Datasets

The authors replicate and expand a recent benchmark using 34 regression datasets from the OpenML-CTR23 suite, which include real-world tables of up to 82 columns (such as health-insurance charges, wages, student performance, and house sales).

They test small-sample in-context generation with private context tables of $n \in \{8, 16, 32, 64, 128\}$ rows across three random seeds, generating 4,088 synthetic releases across nine generators: eight LLMs (including Gemma-4-E4B, Gemma-4-31B, Qwen3.6-27B, OLMo-3.1-32B, gpt-oss-120b, Llama-4-Scout, Llama-3.3-70B, and GPT-4o-mini) plus the tabular foundation model TabPFN-v2.

Key Insights and Ideas

  • LLMs leak differently—some copy, others perturb: By testing fixed neighborhood radii, the authors show that models have distinct memorization "personalities." Llama-3.3-70B tends to copy values verbatim, so adding perturbation tolerance barely changes the attack's success. In contrast, Gemma-4-31B and Qwen3.6-27B frequently perturb the numbers they memorize; roughly half of String-LRA's signal on these models comes from tolerating small numeric shifts.
  • Small tables leak the most: Privacy leakage is highest when the prompt contains fewer rows ($n = 8$ to $32$)—precisely the data-scarce regime where in-context synthesis is most appealing.
  • Post-hoc defenses struggle: Editing a synthetic table after generation (adding Gaussian noise, coarsening numbers into bins, or using a "Digit Modifier" to swap digits) barely slows String-LRA down, because the attack is specifically built to tolerate perturbations. Generation-time defenses (like flattening digit probabilities with a Tendency-based Logit Processor, or clipping token probabilities to a "safe" model) work much better, but come at a noticeable cost to data utility.

Key Results

  • Outperforms all no-box baselines: Across all nine generators, String-LRA achieves a mean AUC of 0.688 (ranging from 0.582 on GPT-4o-mini to 0.776 on Gemma-4-31B), beating LevAtt (0.643) and the strongest feature-space baseline, DCR (0.661). At a 10% false-positive rate, it identifies roughly half of the members in the two Gemma models.
Figure 2: Mean per-release AUC (top) and TPR at 10% FPR (bottom) against the number of context rows 𝑛for String-LRA (left) and LevAtt (right), by generator. Leakage is largest for small tables, the setting in which in-context synthesis is most attractive.
  • Fast and data-efficient: Auditing a release takes a median of 0.06 to 0.10 CPU-seconds on a single core (and under a second even on 82-column tables). It also needs very little reference data: with just 64 reference rows, it stays within 0.02 AUC of its full-reference performance.
  • Competitive with shadow-model attacks: At a budget of 32 shadow releases per target (which takes 0.15–0.48 GPU-hours per release and requires generator access), none of the tested shadow-model attacks significantly outperformed no-box String-LRA.

Limitations and Future Work

The authors note several boundaries to their study:

  • Scope: They focus on in-context generation (not fine-tuning) with contexts up to 128 rows, and assume the reference sample comes from the same population as the private table without distribution shift.
  • Row-by-row scoring: String-LRA scores one synthetic row at a time, meaning it cannot detect leakage that is spread across multiple rows.
  • Defense assumptions: Their defense evaluations assume an attacker who does not adapt to the defense, with generation-time protections tested on only one open-weight model (Gemma-4-E4B).

For future work, the authors plan to extend String-LRA to fine-tuned generators, multi-row leakage, and adaptive defenses.

Summary updated

BibTeX
@misc{ward2026copied,
  author = {Joshua Ward and Haoyuan Cheng and Yue Zhang and Guang Cheng},
  title = {{Copied and Perturbed: A String-Based Likelihood-Ratio Membership Inference Attack on LLM In-Context Table Synthesis}},
  year = {2026},
  eprint = {2612.02259},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2612.02259},
}
Figure