Extracting Prompts by Inverting LLM Outputs

Collin Zhang, John X. Morris, Vitaly Shmatikov
5/23/2024
cs.CLcs.LG

No official code found. Best implementation: collinzrj/output2prompt (61 stars, MIT, last commit 2025-03-12).

Abstract

We consider the problem of language model inversion: given outputs of a language model, we seek to extract the prompt that generated these outputs. We develop a new black-box method, output2prompt, that learns to extract prompts without access to the model's logits and without adversarial or jailbreaking queries. In contrast to previous work, output2prompt only needs outputs of normal user queries. To improve memory efficiency, output2prompt employs a new sparse encoding techique. We measure the efficacy of output2prompt on a variety of user and system prompts and demonstrate zero-shot transferability across different LLMs.

View on arXivView PDF

Code Implementations(1)

MIT
617PythonMay 22, 20241 years agoMIT

Similar Papers

Cite this paper

@article{zhang2024extracting,
  title  = {Extracting Prompts by Inverting LLM Outputs},
  author = {Collin Zhang and John X. Morris and Vitaly Shmatikov},
  year   = {2024},
  eprint = {2405.15012},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.15012v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.15012.svg)](https://codeofpaper.com/paper/2405.15012)

Discussion