Repurposing Pre-trained LLMs as High Fidelity Continuous Text Autoencoders

Arkanath Pathak, Unnat Jain, Alexander C. Berg
9/23/2026
cs.LG

Official code: arkanath/LLMAE (2 stars, Python, MIT, last commit 2026-10-02).

Abstract

Next-token prediction has enabled highly fluent autoregressive language models, but it represents global structure only indirectly through sequential factorization. In contrast, high-fidelity autoencoders have become a standard primitive in image generation, enabling generative models to operate over continuous latent spaces; text lacks a comparably faithful continuous representation.

Show full abstract

We propose LLMAE, a method for repurposing a pretrained decoder-only language model as a continuous text autoencoder by exposing the activations of an intermediate layer as a fixed-length latent bottleneck. LLMAE achieves this interface with structured attention masks and LoRA adaptation, leveraging the generative prior of the original LLM. Across two backbones (270M Gemma 3 and 0.5B Qwen2.5), LLMAE reconstructs sequences up to 1024 tokens with high accuracy, reproducing up to 97% of documents verbatim. We demonstrate downstream utility by training a lightweight diffusion model that generates detailed image captions directly in the frozen LLMAE latent space. By mapping text into a fixed-length continuous latent space, our approach provides an effective substrate for downstream adaptation while benefiting from the fluency of the original LLM. Code and models are available at https://github.com/arkanath/LLMAE.

View on arXivView PDF

Code Implementations(1)

arkanath/LLMAEOfficial100%
MIT

LLMAE turns an LLM into a text autoencoder with a fixed-length continuous latent established at an intermediate layer.

20PythonAug 18, 20262 months agoMIT

Similar Papers

Cite this paper

@article{pathak2026repurposing,
  title  = {Repurposing Pre-trained LLMs as High Fidelity Continuous Text Autoencoders},
  author = {Arkanath Pathak and Unnat Jain and Alexander C. Berg},
  year   = {2026},
  eprint = {2609.27248},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2609.27248v2}
}

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

Discussion