# Language Model Inversion

Source: [Language Model Inversion](<https://www.sota2.com/research/paper/68fa71481e209131cea5065a>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2025-10-26T02:02:40.220Z

Authors: John X. Morris, Wenting Zhao, Justin T. Chiu, Vitaly Shmatikov, Alexander M. Rush

Published: 2023-11-22T19:04:04.000Z

## Abstract

Language models produce a distribution over the next token; can we use this information to recover the prompt tokens? We consider the problem of language model inversion and show that next-token probabilities contain a surprising amount of information about the preceding text. Often we can recover the text in cases where it is hidden from the user, motivating a method for recovering unknown prompts given only the model's current distribution output. We consider a variety of model access scenarios, and show how even without predictions for every token in the vocabulary we can recover the probability vector through search. On Llama-2 7b, our inversion method reconstructs prompts with a BLEU of $59$ and token-level F1 of $78$ and recovers $27\\%$ of prompts exactly. Code for reproducing all experiments is available at http://github.com/jxmorris12/vec2text.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Prompt Recovery on Arxiv Math](<https://www.sota2.com/research/sota/prompt-recovery-on-arxiv-math.md>): Prompt Recovery; Arxiv Math; BLEU-1: 35.

- [Prompt Recovery on Alpaca](<https://www.sota2.com/research/sota/prompt-recovery-on-alpaca.md>): Prompt Recovery; Alpaca; BLEU-1: 19.71.

- [Prompt Recovery on Self-Instruct](<https://www.sota2.com/research/sota/prompt-recovery-on-self-instruct.md>): Prompt Recovery; Self-Instruct; BLEU-1: 22.14.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2311.13647>)

[PDF](<https://arxiv.org/pdf/2311.13647.pdf>)
