Memory Tokens: Large Language Models Can Generate Reversible Sentence Embeddings

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Sastre, Ignacio, Rosá, Aiala
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911359534366720
author Sastre, Ignacio
Rosá, Aiala
author_facet Sastre, Ignacio
Rosá, Aiala
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2506_15001
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Memory Tokens: Large Language Models Can Generate Reversible Sentence Embeddings
Sastre, Ignacio
Rosá, Aiala
Computation and Language
Artificial Intelligence
Machine Learning
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.
title Memory Tokens: Large Language Models Can Generate Reversible Sentence Embeddings
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2506.15001