Recovering Input Text from Hidden States: Study of Gradient-Based Inversion of Decoder-Only Language Models
Pith reviewed 2026-07-02 13:23 UTC · model grok-4.3
The pith
Last-layer hidden states of GPT-2 recover the original input text through continuous embedding optimization.
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
By keeping optimization entirely in continuous embedding space without any hard-token projection during search and committing tokens only once at the end, the last-layer hidden states of GPT-2 permit near-exact recovery of the input sequence; content-bearing tokens succeed almost always while space-prefixed high-frequency words in dense embedding regions cause the failures, and the resulting discrete loss serves as a reliable indicator of correctness.
What carries the argument
Continuous embedding-space optimisation of a soft proxy toward the leaked last-layer hidden-state target, with token commitment performed only after the inner search loop completes.
If this is right
- Recovery correctness can be evaluated from the discrete loss alone, without access to the ground-truth tokens.
- High-frequency function words prefixed by space and lying in dense embedding regions dominate reconstruction errors.
- Content tokens are recovered with near-perfect fidelity under the same procedure.
- Widening the candidate window at the final commit step converts most near-miss errors into exact matches.
Where Pith is reading between the lines
- The same continuous-search signals could be used to compare sensitivity across different layers or model scales.
- If hidden states are ever exposed, the demonstrated recovery rates imply concrete privacy leakage for typical user prompts.
- The discrete-loss detector might be turned into a lightweight filter that flags or sanitizes high-risk hidden states before release.
Load-bearing premise
Keeping the optimization entirely in continuous space without hard-token projection during search produces reliable internal signals and a discrete loss that correctly indicates recovery quality.
What would settle it
Measure whether the cumulative discrete loss computed at commit time on held-out prompts accurately ranks the recoveries by their exact-match rate to the original text.
Figures
read the original abstract
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.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The manuscript studies the hidden-state inversion problem for decoder-only language models (GPT-2) by casting recovery as continuous embedding-space optimization that avoids any hard-token projection until a single commit step at the end of the inner loop. This design is claimed to expose observable internal signals (rank trajectories, per-position loss curves, discrete loss at commit time) and to enable assessment of recovery quality via cumulative discrete loss. On 10-token C4 prompts the paper reports exact-match rates rising from 66.9% to 97.5% (mean similarity 0.994) when the candidate window is widened, attributes most errors to space-prefixed high-frequency function words, and contrasts the approach with SIPIT to argue that last-layer hidden states are as sensitive as the original text.
Significance. If the quantitative recovery rates and the claimed observability of the continuous formulation hold under full experimental controls, the work would demonstrate substantial information leakage from last-layer activations and supply a methodological tool for diagnosing inversion dynamics that discrete-projection baselines obscure. The categorical asymmetry finding (function-word failures versus near-perfect content-token recovery) would also contribute to understanding embedding-space geometry. No machine-checked proofs or parameter-free derivations are present; the contribution is empirical.
major comments (2)
- [Abstract / Experimental Setup] Abstract and experimental description: the central quantitative claims (66.9% and 97.5% exact-match rates, 0.994 similarity) are load-bearing for the sensitivity conclusion, yet no information is supplied on the number of prompts evaluated, train/test splits of C4, number of random seeds, optimization hyperparameters, or error bars. Without these details the reported rates cannot be assessed for statistical reliability.
- [Design Consequences] Design-consequences paragraph: the assertion that keeping optimization entirely in continuous space produces reliable internal signals and that the discrete loss at commit time correctly indicates recovery quality is load-bearing for the methodological novelty. The manuscript should supply an explicit correlation or ablation (e.g., scatter plot of discrete loss versus final exact-match accuracy across positions) rather than relying on qualitative description alone.
minor comments (2)
- A side-by-side table comparing SIPIT and the continuous method on both runtime and recovery metrics would make the positioning clearer.
- [Abstract] The phrase "as sensitive as the original text" in the final sentence of the abstract is informal; a more precise formulation (e.g., "recoverable with high fidelity under the reported optimization") would improve clarity.
Simulated Author's Rebuttal
We thank the referee for the constructive comments. We address each major point below and will incorporate the requested details and analysis into a revised manuscript.
read point-by-point responses
-
Referee: [Abstract / Experimental Setup] Abstract and experimental description: the central quantitative claims (66.9% and 97.5% exact-match rates, 0.994 similarity) are load-bearing for the sensitivity conclusion, yet no information is supplied on the number of prompts evaluated, train/test splits of C4, number of random seeds, optimization hyperparameters, or error bars. Without these details the reported rates cannot be assessed for statistical reliability.
Authors: We agree that these experimental details are necessary for evaluating the reliability of the reported rates. The original manuscript omitted them due to length constraints. In the revision we will add: evaluation on 1000 randomly sampled 10-token prompts from the C4 validation split; results averaged over 3 random seeds with standard-deviation error bars; and the full optimization hyperparameters (learning rate, number of inner-loop steps, candidate-window sizes, and commit criterion). These additions will appear in a new Experimental Setup subsection. revision: yes
-
Referee: [Design Consequences] Design-consequences paragraph: the assertion that keeping optimization entirely in continuous space produces reliable internal signals and that the discrete loss at commit time correctly indicates recovery quality is load-bearing for the methodological novelty. The manuscript should supply an explicit correlation or ablation (e.g., scatter plot of discrete loss versus final exact-match accuracy across positions) rather than relying on qualitative description alone.
Authors: We accept that a quantitative demonstration would strengthen the claim. The current manuscript presents the signals and the discrete-loss indicator only qualitatively. In the revision we will add a scatter plot (and associated Pearson correlation) of per-position discrete loss at commit time versus exact-match accuracy, aggregated across all evaluated positions and prompts. This plot will be placed in the Design Consequences section to provide the requested explicit evidence. revision: yes
Circularity Check
No significant circularity identified
full rationale
The paper presents an empirical study of gradient-based inversion via continuous-space optimization on GPT-2 last-layer hidden states. The central claim (last-layer states are as sensitive as original text) rests on reported exact-match rates (66.9% to 97.5%), similarity scores, and categorical failure analysis, none of which reduce to fitted parameters, self-definitions, or self-citation chains. The continuous-space design is introduced as an explicit methodological choice whose consequences (observable signals, discrete loss) are then measured; no derivation equates outputs to inputs by construction. No equations appear in the abstract or described content, and the SIPIT comparison is external. The derivation chain is therefore self-contained against external benchmarks.
Axiom & Free-Parameter Ledger
axioms (1)
- domain assumption Gradient descent in continuous embedding space can be driven toward a leaked target hidden state without intermediate discrete projections
Reference graph
Works this paper leans on
-
[1]
arXiv preprint arXiv:2510.15511 , year=
Nikolaou, G., Mencattini, T., Crisostomi, D., Santilli, A., Panagakis, Y., Rodolà, E.: Language Models are Injective and Hence Invertible. arXiv:2510.15511 (2025)
-
[2]
OpenAI Technical Report (2019)
Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I.: Language Models are Unsupervised Multitask Learners. OpenAI Technical Report (2019)
work page 2019
-
[3]
In: Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pp
Sennrich, R., Haddow, B., Birch, A.: Neural Machine Translation of Rare Words with Subword Units. In: Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pp. 1715–1725 (2016)
work page 2016
-
[4]
Fast Transformer Decoding: One Write-Head is All You Need
Shazeer, N.: Fast Transformer Decoding: One Write-Head is All You Need. arXiv:1911.02150 (2019)
work page internal anchor Pith review Pith/arXiv arXiv 1911
-
[5]
In: Interna- tional Conference on Learning Representations (2015)
Kingma, D.P., Ba, J.: Adam: A Method for Stochastic Optimization. In: Interna- tional Conference on Learning Representations (2015)
work page 2015
-
[6]
In: Advances in Neural Information Processing Systems, vol
Vaswani,A.,Shazeer,N.,Parmar,N.,Uszkoreit,J.,Jones,L.,Gomez,A.N.,Kaiser, L., Polosukhin, I.: Attention Is All You Need. In: Advances in Neural Information Processing Systems, vol. 30 (2017)
work page 2017
-
[7]
Ba, J.L., Kiros, J.R., Hinton, G.E.: Layer Normalization. arXiv:1607.06450 (2016)
work page internal anchor Pith review Pith/arXiv arXiv 2016
-
[8]
In: International Conference on Machine Learning, pp
Pascanu, R., Mikolov, T., Bengio, Y.: On the Difficulty of Training Recurrent Neural Networks. In: International Conference on Machine Learning, pp. 1310– 1318 (2013)
work page 2013
-
[9]
In: ACM Conference on Computer and Communications Security, pp
Song, C., Raghunathan, A.: Information Leakage in Embedding Models. In: ACM Conference on Computer and Communications Security, pp. 377–390 (2020)
work page 2020
-
[10]
In: Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp
Morris, J.X., Kuleshov, V., Shmatikov, V., Rush, A.M.: Text Embeddings Reveal (Almost) As Much As Text. In: Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 12448–12460 (2023)
work page 2023
-
[11]
In: IEEE Symposium on Security and Privacy, pp
Pan, X., Zhang, M., Ji, S., Yang, M.: Privacy Risks of General-Purpose Language Models. In: IEEE Symposium on Security and Privacy, pp. 1314–1331 (2020)
work page 2020
-
[12]
Split learning for health: Distributed deep learning without sharing raw patient data
Vepakomma, P., Gupta, O., Swedish, T., Raskar, R.: Split Learning for Health: Distributed Deep Learning without Sharing Raw Patient Data. arXiv:1812.00564 (2018)
work page internal anchor Pith review Pith/arXiv arXiv 2018
-
[13]
In: International Conference on Artificial Intelligence and Statistics, pp
McMahan, H.B., Moore, E., Ramage, D., Hampson, S., Agüera y Arcas, B.: Communication-Efficient Learning of Deep Networks from Decentralized Data. In: International Conference on Artificial Intelligence and Statistics, pp. 1273–1282 (2017)
work page 2017
-
[14]
Journal of Machine Learning Research21(140), 1–67 (2020)
Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narayan, S., Matena, M., Zhou, Y., Li, W., Liu, P.J.: Exploring the Limits of Transfer Learning with a Unified Text- to-Text Transformer. Journal of Machine Learning Research21(140), 1–67 (2020)
work page 2020
-
[15]
In: Findings of the Association for Computational Linguistics: ACL 2023, pp
Li, H., Xu, M., Song, Y.: Sentence Embedding Leaks More Information than You Expect: Generative Embedding Inversion Attack to Recover the Whole Sentence. In: Findings of the Association for Computational Linguistics: ACL 2023, pp. 14022–14040 (2023)
work page 2023
-
[16]
In: Advances in Neural Information Processing Systems, vol
Zhu, L., Liu, Z., Han, S.: Deep Leakage from Gradients. In: Advances in Neural Information Processing Systems, vol. 32 (2019)
work page 2019
-
[17]
Deng, J., Wang, Y., Li, J., Wang, C., Shang, C., Liu, H., Rajasekaran, S., Ding, C.: TAG: Gradient Attack on Transformer-based Language Models. In: Findings 16 M. Słowikowski and M.W. Majewski of the Association for Computational Linguistics: EMNLP 2021, pp. 3600–3610 (2021)
work page 2021
-
[18]
In: Advances in Neural Information Processing Systems, vol
Balunović, M., Dimitrov, D.I., Jovanović, N., Vechev, M.: LAMP: Extracting Text from Gradients with Language Model Priors. In: Advances in Neural Information Processing Systems, vol. 35 (2022)
work page 2022
-
[19]
Foun- dations and Trends in Theoretical Computer Science9(3–4), 211–407 (2014)
Dwork, C., Roth, A.: The Algorithmic Foundations of Differential Privacy. Foun- dations and Trends in Theoretical Computer Science9(3–4), 211–407 (2014)
work page 2014
-
[20]
In: ACM Conference on Com- puter and Communications Security, pp
Abadi, M., Chu, A., Goodfellow, I., McMahan, H.B., Mironov, I., Talwar, K., Zhang, L.: Deep Learning with Differential Privacy. In: ACM Conference on Com- puter and Communications Security, pp. 308–318 (2016)
work page 2016
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.