File size: 4,454 Bytes
fea8752
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44b2d84
 
 
 
fea8752
44b2d84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
dataset_info:
  features:
  - name: text_trg
    dtype: string
  splits:
  - name: train
    num_bytes: 16486231249
    num_examples: 36074196
  - name: test
    num_bytes: 22761845
    num_examples: 50000
  download_size: 11310715074
  dataset_size: 16508993094
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
  - split: test
    path: data/test-*
task_categories:
- text-generation
language:
- en
---

This dataset is associated with the paper [Compressed and Smooth Latent Space for Text Diffusion Modeling](https://huggingface.co/papers/2506.21170), which introduces COSMOS, a novel approach to text generation that operates entirely in a compressed, smooth latent space tailored specifically for diffusion models. This space is learned using an autoencoder trained simultaneously for token-level reconstruction and alignment with frozen activations from a pretrained language encoder, providing robust semantic grounding.

The dataset, featuring `text_trg` (target text), is used to train and evaluate models within the COSMOS framework across diverse generative tasks, including story generation, question generation, summarization, and detoxification. The paper demonstrates that text representations can be compressed by $8\times$ while maintaining generation quality comparable to token-level diffusion models, and can surpass both diffusion-based and autoregressive baselines.

- Paper: [Compressed and Smooth Latent Space for Text Diffusion Modeling](https://huggingface.co/papers/2506.21170)
- Code: [https://github.com/MeshchaninovViacheslav/cosmos](https://github.com/MeshchaninovViacheslav/cosmos)

## Paper Abstract

Autoregressive language models dominate modern text generation, yet their sequential nature introduces fundamental limitations: decoding is slow, and maintaining global coherence remains challenging. Diffusion models offer a promising alternative by enabling parallel generation and flexible control; however, their application to text generation is hindered by the high dimensionality of token-level representations. We introduce Cosmos, a novel approach to text generation that operates entirely in a compressed, smooth latent space tailored specifically for diffusion. This space is learned using an autoencoder trained simultaneously for token-level reconstruction and alignment with frozen activations from a pretrained language encoder, providing robust semantic grounding and enabling effective perturbation-based augmentations. Empirically, we demonstrate that text representations can be compressed by $8\times$ while maintaining generation quality comparable to token-level diffusion models. Furthermore, increasing the latent sequence length allows Cosmos to surpass both diffusion-based and autoregressive baselines. We evaluate Cosmos on four diverse generative tasks including story generation, question generation, summarization, and detoxification and compare it with various generative paradigms. Cosmos achieves comparable or superior generation quality while offering more than $2\times$ faster inference. Code is released at \href{ this https URL }{GitHub}

## Sample Usage

After training the diffusion model, you can generate new text samples using the following command, as described in the project's GitHub repository:

```bash
CUDA_LAUNCH_BLOCKING=1 \
HYDRA_FULL_ERROR=1 \
uv run \
torchrun --nproc_per_node=4 --master_port=12345 \
generate.py \
dataset=rocstories \
diffusion.dynamic.N=200 \
diffusion.dynamic.d=5 \
diffusion.training.batch_size=512 \
encoder.latent.num_latents=16 \
encoder.embedding.max_position_embeddings=128 \
decoder.latent.num_latents=16 \
decoder.embedding.max_position_embeddings=128 \
autoencoder.model.load_checkpoint='"autoencoder-num_latents=16-wikipedia-final-128/100000.pth"' \
diffusion.model.load_checkpoint='"diffusion-rocstories-16-d=5-final/180000.pth"' \
diffusion.generation.num_gen_texts=2000 \
training=""
```

## Citation

If you use this work or the associated dataset, please cite the paper:

```bibtex
@misc{meshchaninov2025compressed,
      title={Compressed and Smooth Latent Space for Text Diffusion Modeling},
      author={Viacheslav Meshchaninov and Egor Chimbulatov and Alexander Shabalin and Aleksandr Abramov and Dmitry Vetrov},
      year={2025},
          eprint={2506.21170},
          archivePrefix={arXiv},
          primaryClass={cs.CL},
          url={https://arxiv.org/abs/2506.21170},
}
```