FLAT: Resampling Image and Text into 1D Flexible-Length Aligned Transmodal Tokens for Retrieval and Generation

Guangyu Sun, Shlok Kumar Mishra, Wentao Bao, Robert Zhenheng Yang, Xiao Wang, Xiyuan Wang, Yujunrong Ma, Chen Yuan, Max Xiangjun Fan, Jun Xiao, Jianpeng ChengarXiv 2026

TL;DR

FLAT introduces a unified multimodal pre-training framework that bridges the gap between contrastive representation learning (retrieval) and generative modeling (synthesis). By mapping images and text into a shared, continuous 1D sequence space and applying nested dropout, FLAT produces flexible-length embeddings that natively support both state-of-the-art cross-modal retrieval and high-quality generation while significantly reducing inference compute.

What Problem Does This Paper Address?

Traditionally, multimodal AI is split into two distinct stages: representation learning (like CLIP) and downstream generation (like Stable Diffusion or LLaVA). Generative models typically rely on frozen embeddings from these representation encoders. This decoupling creates a performance bottleneck because the frozen embeddings aren't optimized for generation, requiring complex, parameter-heavy adapters to re-align the modalities.

While some recent unified models try to solve this by training everything end-to-end using purely generative objectives, they often lose the explicit, linearly interpolatable embedding space that makes contrastive models so useful for tasks like retrieval and latent space arithmetic. FLAT aims to solve this by jointly optimizing a single, shared embedding space for both contrastive alignment and bidirectional generation (text-to-image and image-to-text).

Methods

FLAT architecture overview. A shared VLM encoder processes inputs through register tokens, applying nested dropout to truncate sequences to variable prefix lengths.

The FLAT (Flexible-Length Aligned Transmodal representations) framework consists of three main components:

  1. A Shared Representation Encoder: Built on a Qwen3.5-2B backbone with LoRA adapters, it appends $N$ learnable register tokens to the input (image or text) and projects the final hidden states into a unified 1D continuous sequence space ($z$).
  2. Representation Dropout (Nested Dropout): To achieve variable sequence lengths, FLAT randomly samples a "keep-length" $K$ from a geometric ladder ($K \in \{1, 4, 16, 64, 256\}$) during training. Only the prefix sequence $z_{:K}$ is passed to the decoders. This forces the network to pack the most critical semantic information into the very first tokens.
  3. Dual Transmodal Decoders:
  4. An Image-to-Text (I2T) decoder (an autoregressive language model) that generates captions conditioned on visual tokens.
  5. A Text-to-Image (T2I) decoder (a rectified flow transformer initialized from SANA-1.6B) that synthesizes images conditioned on textual tokens.

The entire system is trained end-to-end using a joint objective function combining a bidirectional contrastive loss and two cross-modal generation losses (autoregressive cross-entropy for text and rectified flow matching for images).

Datasets

  • Pre-training: A large-scale corpus of 65.7M image-text pairs, consisting of a mix of long-caption (30M), short-caption (33M), prompt-style (4M), and curated high-quality (0.1M) pairs.
  • Evaluation & Fine-tuning:
  • GenEval: For benchmarking compositional text-to-image synthesis.
  • MS-COCO (Karpathy split): Used for image captioning, image-to-text retrieval, and text-to-image retrieval.
  • Flickr30K: For cross-modal retrieval evaluation.
  • ImageNet-1K: For evaluating representation quality via linear probing.
  • MMEB CIRR: For zero-shot composed image retrieval.

Key Insights and Ideas

  • Hierarchical Information Packing: Because of nested dropout, FLAT exhibits a "coarse-to-fine" representation structure. A single token ($K=1$) is dense enough to capture global semantics and perform highly accurate cross-modal retrieval. As $K$ increases, finer details like spatial relationships, attribute bindings, and secondary objects are unlocked.
GenEval accuracy across keep-lengths broken down by evaluation category. Smaller K captures core entities, while larger K is required for complex spatial layouts and attribute bindings.
  • Closing the Modality Gap: Traditional dual-encoder models like CLIP suffer from a persistent "modality gap" where image and text embeddings cluster in completely separate regions of the latent space. By forcing the embeddings to serve as direct generative conditions for both text and image decoders, FLAT shrinks this gap dramatically, achieving a highly overlapping, unified transmodal space.
  • Prefix-Dependent Compute Scaling: Since the representation encoder is causal, processing a shorter prefix length $K$ at inference time means you only need to compute the first $K$ registers. Reducing $K$ from 256 to 1 slashes encoder and text decoder compute by 50.0% and 71.1% respectively, allowing users to dynamically trade compute for detail.

Key Results

Generative Performance

  • Text-to-Image (T2I): After task-specific fine-tuning, FLAT achieves a GenEval score of 83.1, outperforming specialized baselines like Janus-Pro-7B (80.0) and MetaQuery-XL (80.0), despite using a smaller 2B backbone and no prompt-rewriting mechanisms.
  • Image-to-Text (I2T): On MS-COCO image captioning, FLAT achieves 40.5 BLEU-4 and 138.6 CIDEr, matching or exceeding competitive baselines while utilizing significantly fewer latent features.

Discriminative & Geometric Properties

  • Cross-Modal Retrieval: FLAT's retrieval performance is remarkably stable across sequence lengths. On MS-COCO, a single token ($K=1$) achieves a Recall@5 of 86.44 (I2T), which is within one percentage point of the full $K=256$ width (86.82).
  • Linear Probing: A linear classifier trained on top of frozen FLAT representations achieves 81.8% top-1 accuracy on ImageNet-1K, surpassing purely generative latent spaces.
  • Emergent Latent Operations: Due to its tightly aligned geometry, FLAT natively supports zero-shot continuous feature interpolation and latent space arithmetic (e.g., modifying an image concept by adding/subtracting text embeddings) across both decoders simultaneously.

Limitations and Future Work

While FLAT demonstrates impressive versatility, the authors note a few limitations:

  1. Fine-Grained Imperfections: In text-to-image generation, minor imperfections still occur in highly complex layouts or rendering precise typography.
  2. Omission of Secondary Details: In zero-shot captioning setups, the model occasionally omits secondary objects or minor background actions in favor of the primary scene.
  3. Complex Counting Edits: In zero-shot composed retrieval, simultaneously preserving a reference category while successfully executing complex counting edits (e.g., "show multiple ostriches") remains a challenging frontier.

Summary updated

Abstract

Traditional multimodal representation learning and generation are two stages: a contrastive or self-supervised visual encoder is trained first, followed by a separate downstream generative model. This setup bottlenecks generative performance behind frozen embeddings. To bridge this gap, we revisit joint multimodal representation learning and generation to produce linearly interpolatable embeddings that are directly consumable by generative decoders. We present FLAT (Flexible-Length Aligned Transmodal representations), a representation pre-training framework that jointly optimizes a shared multimodal encoder alongside downstream text-to-image (T2I) and image-to-text (I2T) decoders. By combining contrastive alignment with bidirectional cross-modal generative objectives, FLAT ensures its representations function as both discriminative semantic descriptors and generative conditions. Architecturally, FLAT maps visual and textual inputs into a unified continuous 1D sequence space, applying nested dropout over prefix-K tokens to enable dynamic output lengths. A single pre-training stage allows FLAT to perform cross-modal retrieval and generation across variable prefix K, achieving a T2I GenEval score of 71.1. Task-specific fine-tuning aligns model performance with state-of-the-art baselines: 83.1 GenEval on T2I generation; 40.5 BLEU-4 and 138.6 CIDEr on MS-COCO image captioning; and Recall@5 scores of 86.8 (I2T) / 75.8 (T2I) on MS-COCO alongside 98.3 (I2T) / 93.6 (T2I) on Flickr30K. Finally, qualitative evaluations demonstrate that FLAT representations natively support linear interpolation, latent space arithmetic, and zero-shot composed retrieval.
BibTeX
@misc{sun2026flat,
  author = {Guangyu Sun and Shlok Kumar Mishra and Wentao Bao and Robert Zhenheng Yang and Xiao Wang and Xiyuan Wang and Yujunrong Ma and Chen Yuan and Max Xiangjun Fan and Jun Xiao and Jianpeng Cheng},
  title = {{FLAT: Resampling Image and Text into 1D Flexible-Length Aligned Transmodal Tokens for Retrieval and Generation}},
  year = {2026},
  eprint = {2609.16591},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.16591},
}
Figure