BeamClean: Language Aware Embedding Reconstruction

Kaan Kale, Kyle Mylonakis, Jay Roberts, Sidhartha RoyarXiv 2025 · DOI

Introduction

As Large Language Models (LLMs) transition toward a Model-as-a-Service (MaaS) paradigm, users frequently transmit sensitive data to third-party servers. To mitigate privacy risks, many proposed frameworks employ "local differential privacy" (LDP), where clients add random noise (e.g., Gaussian or Laplacian) to word embeddings before transmission.

The prevailing standard for evaluating these protections has been the "Nearest Neighbor" (NN) attack, which checks if a noisy vector remains closest to its original token in the embedding table. However, this metric is fundamentally limited as it treats tokens in isolation. BeamClean demonstrates that by leveraging the inherent structure of natural language, an attacker can "denoise" obfuscated embeddings with far greater efficacy than previously assumed.

Methodology: The BeamClean Framework

BeamClean is an iterative inversion algorithm designed to jointly estimate noise parameters and decode original token sequences. Unlike naive distance-based methods, it treats linguistic context as a powerful error-correction mechanism.

Overview of the BeamClean attack framework compared to the Nearest Neighbor baseline.

The architecture comprises three core components:

  1. Surrogate Noise Model: BeamClean treats unknown noise parameters as variables, estimating them on the fly using a Maximum-a-Posteriori (MAP) approach.
  2. Language Model Prior: Utilizing a pretrained LLM (specifically Llama-3.2-1B-Instruct), the system scores the likelihood of token sequences, ensuring reconstructed text is grammatically and contextually coherent.
  3. Causal Beam Search: The algorithm maintains a "beam" of the top-$k$ partial sequences. At each step, it ranks candidates by multiplying the likelihood from the noise model with the probability from the language model.

This "blind" attack scenario assumes the adversary has access only to the noisy embeddings and the model’s embedding table, without knowledge of the target model's internal weights or the specific obfuscation settings.

Experimental Setup

The researchers evaluated BeamClean across three distinct datasets to test different aspects of reconstruction:

  • Open-Orca: Used for general sequence reconstruction.
  • MRPC (Microsoft Research Paraphrase Corpus): A standard benchmark used to measure Attack Success Rate (ASR).
  • PAPILLON: A specialized benchmark for evaluating the recovery of Personally Identifiable Information (PII), such as names and sensitive strings.

Key Results and Insights

BeamClean consistently and substantially outperformed the Nearest Neighbor baseline across all noise types and privacy levels (represented by $\epsilon$).

Attack Success Rate (ASR) of BeamClean vs. Nearest Neighbor under Gaussian and Laplace noise mechanisms.
  • Superior Recovery: Under Laplacian noise at $\epsilon = 8.5$, BeamClean achieved an 86% recovery rate, compared to just 18% for the NN baseline. Similarly, with Gaussian noise at $\epsilon = 15$, BeamClean recovered 74.3% of tokens, nearly doubling the baseline's 42.1%.
  • PII Vulnerability: On the PAPILLON dataset, BeamClean recovered 60% of sensitive PII strings, while the NN baseline recovered a negligible 1.9%.
  • Context as a Denoising Superpower: Linguistic structure allows the model to "clean" sequences even when noise pushes embeddings toward unrelated words. If a noisy embedding suggests a random word in a specific context, the LLM prior correctly identifies the original, more probable term.
  • Cross-Model Transferability: The attack is robust; a Llama-based prior can successfully invert embeddings generated by different models, such as GPT-2.

Conclusion and Future Work

The success of BeamClean suggests that simple noise injection is insufficient for protecting text embeddings in MaaS environments. To truly safeguard data, the noise levels required would likely degrade embedding utility beyond practical use.

While powerful, BeamClean faces challenges such as error propagation—where an initial decoding mistake can lead the beam search astray—and high computational costs. Future research should focus on more robust, learned obfuscation techniques that specifically account for the reconstructive power of linguistic priors.

Summary updated

BibTeX
@misc{kale2025beamclean,
  author = {Kaan Kale and Kyle Mylonakis and Jay Roberts and Sidhartha Roy},
  title = {{BeamClean: Language Aware Embedding Reconstruction}},
  year = {2025},
  eprint = {2505.13758},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.13758},
}
Figure