Can AI prompts be reconstructed from chatbot responses?

A new research paper describes a way to work backward from a chatbot's answer to the question that prompted it, and its authors say the method recovers prompts with near-exact accuracy. The paper, titled "PTP: Previous-Token Prediction based LLM Inversion for Near-Exact Prompt Reconstruction," was posted to the arXiv preprint server on July 31, 2026, and submitted by Pirzada Suhail.

The problem starts with how large language models work. They generate text by sampling one token at a time, predicting the next piece of text based on what came before. That process means many different prompts can produce similar responses, and many responses can come from different prompts. Working out the original prompt from the output is hard, which is what researchers call LLM inversion.

Earlier efforts treated the task mainly as a semantic problem. Those approaches typically fine-tuned pretrained sequence-to-sequence models on large external datasets to produce prompts that sounded plausible. Many also needed access to the model's weights or its logits, the raw probability scores behind each word choice. The authors say that setup limits where such methods can be used.

The new approach takes a different route. The researchers describe it as a functional method for inverting a given model in a black-box setting, meaning it works without access to the model's internals and without auxiliary tools. They train an explicit inverse language model entirely from scratch, using data synthetically generated by the target model itself.

How does previous-token prediction work in prompt reconstruction?

The inverse model is trained with what the authors call previous-token prediction. It mirrors the forward process of predicting the next token, but runs in reverse, predicting the token that came before. The authors argue this creates a generative link between the forward and inverse directions, which they say is what allows faithful prompt reconstruction.

The method also produces more than one answer. Because the inverse model can be sampled, it can generate diverse candidate prompts. According to the paper, all of those candidates induce similar responses when fed back into the original target model, so they are interchangeable from the model's point of view even when the wording differs.

The researchers report that the approach generalizes across datasets. They also say it can reconstruct prompts from responses generated by different language models, which they describe as transferability. On the token-based metrics used to evaluate prompt and response reconstruction, the authors report that their method outperforms prior work.

The paper is a preprint and has not gone through formal peer review. Its findings rest on the authors' own experiments, and the abstract does not describe the specific models or datasets used in those tests.

Este artigo foi escrito com a assistência de IA.
News Factory APP - notícias agênticas para impulsionar seu SEO e AEO.