mlsanityData to 7 Oct 2026

Recovering Input Text from Hidden States: Study of Gradient-Based Inversion of Decoder-Only Language Models

arXiv 2607.00852 ↗First posted 1 Jul 2026cs.CL cs.AIcited by 0

Not on the map. Why?

Abstract (arXiv)

This work studies the hidden-state inversion problem: recovering the original input token sequence of a decoder-only language model from its last-layer hidden states. Rather than treating inversion as a one-shot reconstruction, we study it as a continuous embedding-space optimisation in which a soft proxy is driven towards the leaked target without any hard-token projection during the search, and a token is committed only once, at the end of the inner loop. This design choice has two consequences which are the main focus of this paper. First, keeping the optimisation entirely in continuous space exposes a rich set of internal signals: rank trajectories of the ground-truth token, per-position loss curves, and a discrete loss measured at commit time. Second, the discrete loss allows assessing the correctness of recovery via cumulative discrete loss. We further analyse which tokens break the reconstructions and find a sharp categorical asymmetry: space-prefixed, high-frequency function words in dense regions of the embedding matrix dominate the failures, while content-bearing tokens are recovered almost perfectly. On 10-token C4 prompts the exact-match rate rises from 66.9% to 97.5% (mean similarity 0.994) as the candidate window is widened, confirming that most errors are recoverable near-misses rather than genuine ambiguities. A comparison with the released SIPIT reference situates these findings: per-step hard projection is faster, but the continuous formulation is what makes the optimisation observable and its failures detectable. The results show that last-layer hidden states of GPT-2 are as sensitive as the original text.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 16 of its 21 references that are in the map. First posted on arXiv 1 Jul 2026.

Builds on

16 of 21 references.

References · 16

  1. 2017Attention Is All You Needcited by 59,932
  2. 2014Adam: A Method for Stochastic Optimizationcited by 36,960
  3. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  4. 2016Communication-Efficient Learning of Deep Networks from Decentralized Datacited by 7,592
  5. 2016Layer Normalizationcited by 5,579
  6. 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,898
  7. 2016Deep Learning with Differential Privacycited by 2,682
  8. 2019Deep Leakage from Gradientscited by 1,004
  9. 2019Fast Transformer Decoding: One Write-Head is All You Needcited by 700
  10. 2018Split learning for health: Distributed deep learning without sharing raw patient datacited by 391
  11. 2020Information Leakage in Embedding Modelscited by 199
  12. 2023Text Embeddings Reveal (Almost) As Much As Textcited by 189
4 more
  1. 2023Sentence Embedding Leaks More Information than You Expect: Generative Embedding Inversion Attack to Recover the Whole Sentencecited by 81
  2. 2021TAG: Gradient Attack on Transformer-based Language Modelscited by 63
  3. 2022LAMP: Extracting Text from Gradients with Language Model Priorscited by 52
  4. 2025Language Models are Injective and Hence Invertiblecited by 31

Built on by

Not cited yet.