Text Embeddings Reveal (Almost) As Much As Text
Paper • 2310.06816 • Published • 1
A T5-base model trained to invert Qwen3-Embedding-8B embeddings back into text. Given a 4096-dimensional embedding vector, the model autoregressively decodes the original text that produced it.
Built on the vec2text framework.
The model consists of three components:
The Qwen3-Embedding-8B embedder itself is not included in this checkpoint — only the T5 encoder-decoder and the embedding transform are saved. At inference time, you need to produce Qwen3-Embedding-8B embeddings separately and pass them as input.
| Parameter | Value |
|---|---|
| Base model | t5-base (220M params) |
| Embedder | Qwen/Qwen3-Embedding-8B (frozen) |
| Embedding dim | 4096 |
| Num repeat tokens | 16 |
| Max sequence length | 128 tokens |
| Optimizer | AdamW (fused) |
| Learning rate | 1e-4 |
| LR schedule | Constant with warmup (2500 steps) |
| Batch size | 128 |
| Training steps | 230,500 |
| Epochs | ~29.5 |
| Precision | FP32 |
| Freeze strategy | None (all params trainable) |
| Training data | ~1M English sentences with precomputed Qwen3-Embedding-8B embeddings |
Final training loss: ~1.61
This model uses a custom InversionModel architecture from vec2text. To load and run inference:
# 1. Produce embeddings with Qwen3-Embedding-8B
from transformers import AutoModel, AutoTokenizer
import torch
qwen_tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-Embedding-8B")
qwen_model = AutoModel.from_pretrained("Qwen/Qwen3-Embedding-8B", torch_dtype=torch.float16).cuda()
text = "The quick brown fox jumps over the lazy dog."
inputs = qwen_tokenizer(text, return_tensors="pt", padding=True, truncation=True).to("cuda")
with torch.no_grad():
embedding = qwen_model(**inputs).last_hidden_state.mean(dim=1) # [1, 4096]
# 2. Load the inverter and decode
# Requires the vec2text library: https://github.com/jxmorris12/vec2text
from vec2text.models.inversion import InversionModel
inverter = InversionModel.from_pretrained("kennethge123/qwen3-8b-t5-inverter").cuda().eval()
# Pass the frozen embedding through the model's generate method
This model builds on the vec2text framework:
@article{morris2023text,
title={Text Embeddings Reveal (Almost) As Much As Text},
author={Morris, John X and Kuleshov, Volodymyr and Shmatikov, Vitaly and Rush, Alexander M},
journal={arXiv preprint arXiv:2310.06816},
year={2023}
}
Base model
google-t5/t5-base