Memory Tokens: Large Language Models Can Generate Reversible Sentence Embeddings

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. 1

Authors

Institutions

Publication Details

Published
2025-01-01
DOI
https://doi.org/10.18653/v1/2025.l2m2-1.14
Primary Topic
Topic Modeling
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Memory Tokens: Large Language Models Can Generate Reversible Sentence Embeddings

Ignacio Sastre, Aiala Rosá
Topic Modeling
article

Memory Tokens: Large Language Models Can Generate Reversible Sentence Embeddings

Ignacio Sastre, Aiala Rosá
article en

Abstract

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. 1

Universidad de la República de Uruguay (UY)
Agencia Nacional de Investigación e Innovación
Openalex Percentile: Top 90%
Topic Modeling
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.