Language Model Inversion

John X. Morris, Wenting Zhao, Justin T Chiu, Vitaly Shmatikov, Alexander M. Rush
11/1/2023

No official code found. Best implementation: vec2text/vec2text (1,137 stars, last commit 2025-12-27). 1 more below.

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.

View on arXivView PDF

Code Implementations(2)

vec2text/vec2textCommunity100%

utilities for decoding deep representations (like sentence embeddings) back to text

1,137118Shell, PythonFeb 25, 20239 months agoNOASSERTION
sled-group/InfEditCommunity100%

[CVPR 2024] Official implementation, Inversion-Free Image Editing with Natural Language"

3609PythonDec 4, 20232 years agoNOASSERTION
attention-is-all-you-needconsistency-modelsdiffusion-modelsimage-editinversion+1 more

Similar Papers

Cite this paper

@article{morris2023language,
  title  = {Language Model Inversion},
  author = {John X. Morris and Wenting Zhao and Justin T Chiu and Vitaly Shmatikov and Alexander M. Rush},
  year   = {2023},
  eprint = {2311.13647},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2311.13647},
  journal = {ICLR 2023 2023}
}

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/2311.13647.svg)](https://codeofpaper.com/paper/2311.13647)

Discussion