Rep2Text: Decoding Full Text from a Single LLM Token Representation
Organizations: New Jersey Institute of Technology · National University of Singapore · Wake Forest University · Cisco Research ·
Abstract
Large language models represent text as hidden numerical patterns, but what information these representations actually contain remains a mystery. Can we recover the original text from just one of them? In this paper, we introduce Rep2Text, a method designed to answer this question by reconstructing text from a single hidden representation. We find that these representations preserve much more information than we might expect. For short texts of about 16 words, Rep2Text can recover roughly half of the original words while preserving their overall meaning. As the text gets longer, recovering the exact wording becomes harder, but the main ideas can still be recovered. These findings offer a new way to understand what language models store internally and highlight potential privacy risks, as hidden representations may reveal parts of the original input.
Figures & tables
| Target Model | Decoding Model | Layer | ROUGE-1 | ROUGE-2 | ROUGE-L | BERTScore | Structure | Entity | Topic |
|---|---|---|---|---|---|---|---|---|---|
| (0-1) | (0-1) | (0-1) | (0-1) | (0-1) | (0-1) | (0-1) | |||
| (A) Fixed Llama-3.1-8B decoder, best layer per target: target invertibility | |||||||||
| Gemma-7B | Llama-3.1-8B | L26 | 0.64 (0.24) | 0.42 (0.30) | 0.61 (0.25) | 0.80 (0.14) | 0.71 (0.22) | 0.64 (0.27) | 0.86 (0.22) |
| Mistral-7B-v0.1 | Llama-3.1-8B | L15 | 0.55 (0.25) | 0.35 (0.28) | 0.53 (0.25) | 0.81 (0.13) | 0.70 (0.23) | 0.75 (0.25) | 0.92 (0.17) |
| Llama-3.1-8B | Llama-3.1-8B | L10 | 0.48 (0.23) | 0.28 (0.24) | 0.47 (0.22) | 0.78 (0.11) | 0.66 (0.22) | 0.74 (0.23) | 0.91 (0.14) |
| Llama-3.2-3B | Llama-3.1-8B | L9 | 0.46 (0.22) | 0.25 (0.22) | 0.44 (0.21) | 0.76 (0.11) | 0.64 (0.22) | 0.72 (0.24) | 0.89 (0.16) |
| Target model/ | Data | Inversion Model | R1 | R2 | RL | Token F1 | BLEU | BS | SS | ES | TS |
|---|---|---|---|---|---|---|---|---|---|---|---|
| decoding model | (0-1) | (0-1) | (0-1) | (0-1) | (0-1) | (0-1) | (0-1) | (0-1) | (0-1) | ||
| Mistral-7B-v0.1/ Qwen-2.5-14B | Wiki | Rep2Text (Ours) | 0.41 | 0.19 | 0.38 | 0.42 | 0.15 | 0.73 | 0.57 | 0.66 | 0.86 |
| Vec2Text Base | 0.38 | 0.17 | 0.35 | 0.31 | 0.15 | 0.71 | 0.53 | 0.53 | 0.80 | ||
| * + Corrector (50 Steps) | 0.38 | 0.17 | 0.35 | 0.31 | 0.15 | 0.71 | 0.53 | 0.55 | 0.79 | ||
| Clinical | Rep2Text (Ours) | 0.37 | 0.15 | 0.34 | 0.26 | 0.10 | 0.74 | 0.59 | 0.48 | 0.64 | |
| Vec2Text Base | 0.14 | 0.02 | 0.13 | 0.13 | 0.04 | 0.53 | 0.17 | 0.16 | 0.21 |
| Method | Ground-truth Sequence | Inverted Sequence | Token F1 | BLEU |
| In-distribution, Llama-3.1-8B target | ||||
| Ours | Phil LaMarr Phillip LaMarr (born January 24, 1967) is an American actor, voice actor, comedian and writer. | Phil LaMarr Philip LaMarr (born January 24, 1967) is an American actor, voice actor, comedian and writer. | 0.94 | 0.89 |
| Vec2Text Base | David A. Smith David A. Smith (born December 16, 1964) is an American actor, voice actor, writer, and voice actor. | 0.43 | 0.32 | |
| Vec2Text + Corrector (50 Steps) | David A. Smith David A. Smith (born August 24, 1964) is an American actor, voice actor, writer, and voice actor. | 0.49 | 0.33 | |
| In-distribution, Mistral-7B-v0.1 target | ||||
| Ours | List of submissions to the 37th Academy Awards for Best Foreign Language Film The following 18 films, all from different countries, were | List of films submitted to the 80th Academy Awards for Best Foreign Language Film The following 14 films, from 14 different countries, | 0.77 | 0.46 |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Layer | ROUGE-1 | ROUGE-2 | ROUGE-L | BERTScore | Structure | Entity | Topic |
|---|---|---|---|---|---|---|---|
| Llama-3.1-8B (32 layers) | |||||||
| L5 | 0.46 | 0.26 | 0.44 | 0.76 | 0.62 | 0.69 | 0.88 |
| L10 | 0.48 | 0.28 | 0.47 | 0.78 | 0.66 | 0.74 | 0.91 |
| L15 | 0.48 | 0.28 | 0.45 | 0.77 | 0.62 | 0.75 | 0.91 |
| L20 | 0.44 | 0.24 | 0.42 | 0.74 | 0.56 | 0.72 | 0.91 |
| L25 | 0.42 | 0.21 | 0.39 | 0.72 | 0.54 | 0.71 | 0.89 |
| Tokens | Model | ROUGE-1 | ROUGE-2 | ROUGE-L | BERTScore | Structure | Entity | Topic |
|---|---|---|---|---|---|---|---|---|
| 8 | 8B | 0.62 | 0.42 | 0.59 | 0.83 | 0.78 | 0.77 | 0.93 |
| 16 | 8B | 0.48 | 0.28 | 0.47 | 0.78 | 0.66 | 0.74 | 0.91 |
| 32 | 8B | 0.40 | 0.18 | 0.36 | 0.72 | 0.57 | 0.68 | 0.86 |
| 64 | 8B | 0.36 | 0.13 | 0.28 | 0.68 | 0.49 | 0.60 | 0.82 |
| 16 | 3B | 0.46 | 0.26 | 0.45 | 0.76 | 0.64 | 0.69 | 0.88 |
| 128 | 3B | 0.30 | 0.08 | 0.22 | 0.63 | 0.37 | 0.41 | 0.72 |
| Emb Model | Dec Model | Max Len | #GPU | Mini batch | Grad Accum | Eff. Batch | LR | Warmup Ratio | |
| Transfer experiments | |||||||||
| Gemma-7B | Llama-3.1-8B | 16 | 16 | 2 | 32 | 16 | 1024 | 0.15 | |
| Llama-3.2-3B | Llama-3.1-8B | 16 | 16 | 2 | 32 | 16 | 1024 | 0.15 | |
| Mistral-7B | Llama-3.1-8B | 16 | 16 | 2 | 32 | 16 | 1024 | 0.15 | |
| Mistral-7B | Llama-3.2-3B | 16 | 16 | 2 | 64 | 8 | 1024 | 0.15 | |
| Mistral-7B | Qwen2.5-14B | 16 | 16 | 2 | 32 | 16 | 1024 | 0.30 | |
| Train Size | Epochs | Per-GPU BS | Grad. Accum. | GPUs | Eff. BS | LR |
|---|---|---|---|---|---|---|
| 10K | 15 | 32 | 2 | 1 | 64 | |
| 50K | 6 | 32 | 4 | 1 | 128 | |
| 100K | 5 | 32 | 4 | 2 | 256 | |
| 320K | 4 | 64 | 4 | 2 | 512 | |
| 640K | 3 | 64 | 8 | 2 | 1024 |
| Tokens (#) | Ground-truth Sequence | Inverted Sequence | R1 | R2 | RL | BS | SS | ES | TS |
| 8 | in the Centre-Val de Loire | in the Centre-Val de Loire | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| is the second era of the Hade | is the third era of the Hade | 0.86 | 0.67 | 0.86 | 0.99 | 1 | 0.8 | 1 | |
| who enforce New Zealand’s regulatory building control | the enforcement of New Zealand statutory building control | 0.63 | 0.29 | 0.63 | 0.77 | 0.4 | 0.6 | 1 | |
| Tyler, the Creator production discography\n\n | Metro Boomin production discography\n\n | 0.44 | 0.29 | 0.44 | 0.77 | 0.8 | 1 | 1 | |
| biologist \n Stanley Fields (actor) ( | :\n\n John Allen (actor) (born | 0.25 | 0 | 0.25 | 0.78 | 0.6 | 0.8 | 0.8 | |
| 16 | species within the genus Conus, these snails are predatory and venomous. | species within the genus Conus, these snails are predatory and venomous. | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 64 | Rush Hour 2\n\nRush Hour 2 is a 2001 American action comedy film directed by Brett Ratner and written by Jeff Nathanson, based on the characters created by Ross LaManna. A sequel to Rush Hour, it is the second installment in the Rush Hour series and stars Jackie Chan, | Rush Hour 2\n\nRush Hour 2 is a 2001 American buddy cop action comedy film directed by Brett Ratner and written by Jeff Nathanson. It is the sequel to the 1998 film Rush Hour and the second installment in the Rush Hour film series. The film stars Jackie Chan, | 0.84 | 0.67 | 0.78 | 0.91 | 0.8 | 1 | 1 |
| hull length of, a beam of, a height of, and a draught of. The submarine was powered by two Germaniawerft F46 four-stroke, six-cylinder supercharged diesel engines producing a total of for use while surfaced, two AEG GU 460/8\u201327 double- | . The U-boat had a displacement of when at the surface and while submerged. The U-boat had a total length of, a pressure hull length of, a beam of, a height of, and a draught of. The submarine was powered by two Germaniawerft F46 six- | 0.61 | 0.48 | 0.49 | 0.8 | 0.4 | 1 | 1 | |
| the same rights of audience as members of the Bar of Northern Ireland.\n\nThe Advocate General was created as a separate office upon the devolution of policing and justice powers to the Northern Ireland Assembly on 12 April 2010.\n\nUnlike the Advocate General for Scotland, the position is not supported by a distinct government department. | the Scottish Parliament. The office was created in 1999, and is the equivalent of the Parliamentary Under-Secretary of State in the United Kingdom Government.\n\nThe office is not a ministerial post, and the holder is not a member of the Scottish Government. Responsibility for the office is held by the Scottish Secretary. | 0.41 | 0.08 | 0.24 | 0.66 | 0.4 | 0.4 | 0.8 | |
| producer Thom Wilson and released in 1982 as catalog number VIRUS 10. Singer Jack Grisham credited himself as Jack Ladoga on the sleeve, following a tradition of using a different pseudonym on each release both to confuse audiences and to hide his true identity from the police. Drummer Todd Barnes credited himself | the band’s first album, and the first to feature the band’s new lineup. The band members used pseudonyms on the album, with the exception of guitarist and vocalist John "Baz" Bascaran, who used his real name because he was the only member of the band with a driver’s license. Drum | 0.21 | 0.04 | 0.15 | 0.59 | 0.8 | 0.6 | 0.8 | |
| Linux kernel.\n\nXC3018\nIt is a variant that only supports analog reception and DVB-T digital reception.\n\nTechnical specification\nOutline Dimensions: 7 x 7 x 0.85\u00a0mm\nSupply Voltage (DC): 1.8V, 3.3V\nSystem setting time: | 2010.\n\nSpecifications\nFrequency: 2.4\u00a0GHz\nData rate: 1, 2, 5.5, 11\u00a0Mbps\nModulation: DSSS\nPower consumption: 0.1\u00a0W\nOperating temperature: 0\u00a0\u00b0C to 70\u00a0\u00b0C\n | 0.09 | 0 | 0.09 | 0.62 | 0 | 0 | 0.8 |
LLM Interpretability
Large language model (LLM) interpretability studies how internal representations and computations produce outputs, and how they can be explained or controlled.
See all 778 papers