Watch: Reverse Prompting: Reconstructing Prompts from AI-Generated Text

A fine-tuned Gemma 3 270M model reconstructs the most likely prompts from AI-generated responses using synthetic data and contrastive search configurations.

Transcript

Large language models usually take a prompt and write a response. But what if we flipped that process? What if we gave a model an AI-generated response, and asked it to reconstruct the question that most likely created it?

To do this, developers fine-tuned a tiny version of Google's Gemma 3 model, which has just two hundred and seventy million parameters. First, they used a larger model to generate one hundred thousand prompt and response pairs for training. During fine-tuning, they masked out the response text, forcing the model to focus purely on predicting the prompt. The entire training process took just over four hours on a single consumer graphics card.

To generate candidate prompts from a given text, the system sweeps through twenty-four search configurations. This produces a diverse set of questions, which are then ranked by how confident the model is in each answer.

The results show that even tiny models can learn complex, reversed mappings. It also proves that synthetic training data generalizes incredibly well, meaning this small model can successfully reverse-engineer responses from other artificial intelligence systems. It is a highly practical approach for refining prompt engineering, analyzing web content, and verifying data quality.