Post · 9 min read· pp. 31–35

One model to see and imagine: Unifying image understanding and generation

DREAM is a single AI model that learns to understand images and to generate images from text at the same time. Today these are usually separate systems: models like CLIP understand images but can’t create them, and text-to-image generators create images but learn a much weaker sense of what’s in them. Training one model to do both has been hard, because the two skills want opposite kinds of training.

We found a simple fix: a training schedule we call Masking Warmup, which lets the model learn to understand images first and then shifts it gradually toward generation, without ever dropping either skill. The result beats both specialists at their own jobs. It also unlocks something neither specialist can do: the model can judge its own rough drafts while it’s generating, and finish only the most promising one.

Background: Why this is hard

People learn to see and to imagine together. Recognizing what’s in a scene and picturing a scene from a description draw on the same understanding of the visual world. AI vision has mostly split them apart, and I wanted to know whether a single model could learn both, with each skill helping the other.

The obstacle is that the two skills train in opposite ways. A CLIP-style model learns by matching an image to its caption, and that works best when it sees nearly the whole image. If most of the image is hidden, there isn’t enough left to match against the text. A masked generator learns the other way around: we hide most of an image and ask the model to rebuild it. To learn to create images from nothing, it has to practice on images that are almost entirely hidden.

If you train one model on both objectives using the heavy masking that generators rely on, training collapses. The model loses nearly all of its ability to recognize images, and it never learns to generate either. Many recent unified models avoid the conflict rather than resolve it: they freeze one part of the network, borrow features from a separate pretrained model, or train the two skills in separate stages. We wanted one model, trained end to end in a single stage.

This project builds on earlier work from our lab. In 2023, MAGE, led by Tianhong Li with collaborators at Google, showed that one model could learn both image recognition and image generation by varying how much of each image is hidden during training. MAGE also found that adding a contrastive objective improved recognition, and it left a better way to combine contrastive learning with generative training as future work. DREAM picks up that thread in a harder setting: aligning images with text, and generating images from text prompts. Tianhong is a co-author on DREAM.

The key idea: Learn to see first, then to imagine

Since the conflict comes from how much of each image is hidden, we tried to fix it right there, rather than by changing the architecture. Masking Warmup is a schedule for how much of each training image the model sees.

At the start of training, the model mostly sees nearly complete images. That gives the understanding side time to build a stable, text-aligned sense of what images contain. Over roughly the first 200,000 training steps, the typical amount hidden rises steadily from none to all, which shifts the emphasis toward generation.

The important detail is that the mix stays wide throughout. Every training batch includes both lightly and heavily hidden images, so the model keeps practicing understanding even while most of its effort goes to generation.

The order turned out to matter a lot. When we ran the same schedule in reverse, heavy masking first and light masking last, the model still recognized images well, but its generated images got noticeably worse. When we trained understanding fully first and then switched to generation, training collapsed just like the naive version. The two skills need to overlap, with understanding getting a head start. In other words, the model learns what images contain before it learns to create them, and it keeps practicing understanding the whole time it’s learning to generate.

What we found: Generating makes it a better seer

The result that surprised me most is that learning to generate made the model better at understanding images, not worse.

To make the comparison fair, we built CLIP, the generation-only model FLUID, and DREAM from the same architecture and trained them all on the same data, so the only difference is the training objective. DREAM came out ahead of CLIP on every understanding test we ran:

The few-shot result is broad. DREAM matched or beat CLIP on 13 of the 14 datasets, from satellite imagery (EuroSAT, UC Merced) to textures (DTD), everyday scenes (PASCAL VOC), and dog breeds (Stanford Dogs). For comparison, FLUID, which only learns to generate, scores 48.1% on the ImageNet test.

The model also holds up when most of an image is missing. With 80% of an image hidden, DREAM identifies images zero-shot more than six times as accurately as CLIP, because it was trained on partially hidden images all along.

The generation objective is doing real work here. When we removed it and kept everything else the same, recognition fell to 70.8%, below CLIP. Our read is that generation forces the model to capture fine spatial detail, which is where the segmentation and depth gains come from, while the contrastive objective drives the classification gains.

A model that grades its own rough drafts

Once one model could both understand and generate, a new capability followed that I’m especially excited about: the model can judge its own work partway through creating it.

The standard way to get better images from a generator is to create several complete candidates and have a separate CLIP model pick the best one. That wastes effort, since most of the finished images are thrown away. And an outside judge that was only trained on finished images can’t reliably evaluate a half-finished one.

We call our approach Semantically Aligned Decoding. DREAM starts several candidate images at once. After 8 of its 64 generation steps, when only 12.5% of each image exists, DREAM’s own text encoder scores each rough draft against the prompt, and only the winner is finished. This works because DREAM’s understanding side saw partially hidden images throughout training, so rough drafts look familiar to it. In a test with 1,000 images that were only 12.5% complete, DREAM matched each draft to its correct caption 70.8% of the time, versus 22.2% for a standard CLIP model.

It’s like a painter who makes quick thumbnail sketches, picks the strongest, and paints only that canvas. At the same compute budget as the standard approach, finishing two images and reranking them with an external CLIP model, our method gave better image quality (about 5.6% better FID) and about 10% more images per second.

With draft grading, DREAM also beats FLUID on image quality for captions like the ones it was trained on, while matching FLUID on how well images follow the prompt. Without draft grading, the two are roughly even. On captions from a different dataset, MS-COCO, DREAM’s images followed the prompts best of all the models we tested, though FLUID’s FID was slightly better there at this data scale. That gap reversed when we trained on more data (below).

Does it hold up at scale?

The main experiments use about 11 million image-caption pairs, a controlled setting chosen to isolate the effect of the training recipe. We also tested DREAM on a much larger dataset, GPIC, with 100 million pairs, about nine times the data. We reused the same training settings without retuning them, and the gains still held. DREAM again beat CLIP at ImageNet recognition, 68.9% versus 67.6%. On MS-COCO captions, the small image-quality gap in FLUID’s favor flipped: DREAM’s FID was 10.24 versus FLUID’s 10.54. We think the earlier gap came from the narrower range of captions in the smaller dataset.

The approach also scales with model size. We trained versions from about 264 million to 2.4 billion parameters, and understanding and generation both improved as the model grew.

We also checked whether DREAM gets the details of a prompt right, using GenEval, a benchmark that tests objects, counts, colors, and positions. With draft grading, DREAM matched FLUID overall. Without it, DREAM was weaker at attaching the right color to the right object, and draft grading closed most of that gap.

Every headline comparison held across three independent training runs.

Why it matters, and what’s next

Getting both skills costs very little extra. Training DREAM takes about 4% more time and memory than training the generator alone, and the model has about 12% more parameters. In return, you get a strong image encoder and a competitive image generator from a single training run. I hope that makes unified models more practical for academic groups that can’t afford to train two large systems.

More broadly, I think the result suggests that understanding and generation don’t have to compete for a model’s capacity. Trained in the right order, they reinforce each other, which is a step toward vision models built on one shared representation of the visual world.

Team and resources

The paper is by me (Charlie (Chao) Li), Tianhong Li, and Dina Katabi at MIT CSAIL, and Sai Vidyaranya Nuthalapati, Hong-You Chen, Satya Narayan Shukla, Jianpeng Cheng, Yonghuan Yang, Jun Xiao, Xiangjun Fan, Aashu Singh, and Shlok Kumar Mishra at Meta AI. The project started during my summer internship at Meta AI, which I extended part time through the fall and spring while continuing my PhD at CSAIL with Dina. The main training ran on Meta’s compute, and I used MIT’s Engaging cluster, run by the Office of Research Computing and Data, for the efficiency and generalization analyses.

We’ll present DREAM at NeurIPS in December 2026, and the code is open source.

• Paper: Unifying Contrastive and Generative Objectives for Visual Understanding and Text-to-Image Generation

• Project page: More results and generated samples

• Code: github.com/chaoli-charlie/dream

Article written by Charlie (Chao) Li.