PTP: Previous-Token Prediction based LLM Inversion for Near-Exact Prompt Reconstruction
Pangram verdict · v3.3
We believe that this entire text is human-written.
AI likelihood · overall
HumanArticle text · 233 words · 1 segments analyzed
View PDF HTML (experimental) Abstract:Large language models (LLMs) generate text by auto-regressively sampling the next token. This inherently leads to a many-to-many mapping between prompts and responses, complicating the task of inferring prompts from observed outputs. Prior work on LLM inversion frames prompt recovery as a semantic reconstruction task. They rely on fine-tuning pretrained sequence-to-sequence models on large external datasets--and requiring access to model weights or logits--to generate semantically plausible prompts. In contrast, we present a functional approach to inverting a given LLM in a black-box setting, without auxiliary aids. We train an explicit inverse language model entirely from scratch on data synthetically generated from the target LLM itself. Analogous to forward next-token prediction, our inverse model is trained using previous-token prediction, establishing a generative link between the forward and inverse processes that enables faithful prompt reconstruction. Moreover, it naturally supports diverse prompt reconstructions through sampling, whereby all such prompts induce similar responses under the forward, target LLM. Our approach generalises across datasets and exhibits transferability in reconstructing prompts from responses generated by different LLMs. Further, across the set of token based evaluation metrics for prompt and response reconstructions, our approach outperforms prior work. Subjects: Computation and Language (cs.CL); Machine Learning (cs.LG) Cite as: arXiv:2607.29378 [cs.CL] (or arXiv:2607.29378v1 [cs.CL] for this version) https://doi.org/10.48550/arXiv.2607.29378 arXiv-issued DOI via DataCite Submission history From: Pirzada Suhail [view email] [v1] Fri, 31 Jul 2026 13:01:43 UTC (658 KB)