Memory Tokens: Large Language Models Can Generate Reversible Sentence Embeddings
Not on the map. Why?
Abstract (arXiv)
In this work, we observe an interesting phenomenon: it is possible to generate reversible sentence embeddings that allow an LLM to reconstruct the original text exactly, without modifying the model's weights. This is achieved by introducing a special memory token, whose embedding is optimized through training on a fixed sequence. When prompted with this embedding, the model reconstructs the fixed sequence exactly. We evaluate this phenomenon across English and Spanish datasets, sequences of up to approximately 240 tokens, and model scales ranging from 100M to 8B parameters. Notably, Llama 3.1 8B successfully reconstructs all tested sequences. Our findings highlight an interesting capability of LLMs and suggest potential applications in memory-based retrieval, compression, and controlled text generation.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 8 of its 15 references that are in the map. First posted on arXiv 17 Jun 2025.
Builds on
8 of 15 references.
References · 8
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,915
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,795
- 2023Retrieval-Augmented Generation for Large Language Models: A Surveycited by 2,212
- 2022Prompt Compression and Contrastive Conditioning for Controllability and Toxicity Reduction in Language Modelscited by 97
- 2023Sentence Embedding Leaks More Information than You Expect: Generative Embedding Inversion Attack to Recover the Whole Sentencecited by 81
- 2024Prompt Compression for Large Language Models: A Surveycited by 67
- 2021InvBERT: Reconstructing Text from Contextualized Word Embeddings by inverting the BERT pipelinecited by 11
Built on by
Citing papers per year: 2025: 3; 2026: 3.
6 papers.
- 2025TokMem: One-Token Procedural Memory for Large Language Modelscited by 5
- 2026Skill Neologisms: Towards Skill-based Continual Learningcited by 4
- 2025Refine Thought: A Test-Time Inference Method for Embedding Model Reasoningcited by 2
- 2025Learning a Single Token to Replace Long System Prompts in LLMscited by 2
- 2026Learn Before Represent: Bridging Generative and Contrastive Learning for Domain-Specific LLM Embeddingscited by 2
- 2026Concept Tokens: Learning Behavioral Embeddings Through Concept Definitionscited by 1
- 2026Skill Neologisms: Towards Skill-based Continual Learning6 May 2026
- 2026Learn Before Represent: Bridging Generative and Contrastive Learning for Domain-Specific LLM Embeddings16 Jan 2026
- 2026Concept Tokens: Learning Behavioral Embeddings Through Concept Definitions8 Jan 2026
- 2025Learning a Single Token to Replace Long System Prompts in LLMs28 Nov 2025
- 2025Refine Thought: A Test-Time Inference Method for Embedding Model Reasoning14 Oct 2025
- 2025TokMem: One-Token Procedural Memory for Large Language Models1 Oct 2025