# Multimodal

> How vision and language are aligned, and how images are generated: from CLIP, LLaVA and the token cost of an image to how diffusion and flow matching build images, robot actions and text from noise, the core structures and limits of multimodal models.

- URL: https://dmxsf.com/en/wiki/multimodal/
- [DMXSF](https://dmxsf.com/en/about/)
- Updated: 2026-11-17

## After this chapter you will be able to

- Explain how a vision encoder, a projector and a language model turn an image into tokens and align it with text.
- Estimate how many visual tokens an image takes and what that does to the KV cache and the latency.
- Explain why resolution decides whether the model can read small text, and choose image preprocessing accordingly.
- Write the training objective and sampling procedure of diffusion models and flow matching, and explain the trade-offs between step count, guidance strength and sample quality.
- Tell vision-language models that read images from diffusion and flow-matching models that draw them, and name the components they share (ViT, Transformers, text encoders).

The basic idea of a multimodal LLM is to use a vision encoder to turn an image into vectors, and a projector to "translate" them into tokens the language model can read. After that, everything the earlier chapters say about attention, the KV cache and serving applies to images unchanged; the sequence just contains a batch of visual tokens.

This chapter has two pages, one for reading images and one for drawing them. The first focuses on vision-language models that describe and answer questions about images, and works through the engineering questions: how an image becomes tokens, what it costs, and whether small text can be read. The second covers diffusion models and flow matching: it implements them from scratch on 2-D data, measures how steps and guidance strength trade off against sample quality, and then extends to latent diffusion, DiT, and the generation of robot actions and text. Audio and video will be added later.

Related paper explainers: [CLIP](https://dmxsf.com/en/blog/clip-learning-transferable-visual-models/), [LLaVA](https://dmxsf.com/en/blog/llava-visual-instruction-tuning/), [DDPM](https://dmxsf.com/en/blog/ddpm-denoising-diffusion-probabilistic-models/) and [Flow Matching](https://dmxsf.com/en/blog/flow-matching-for-generative-modeling/).

[World models and planning](https://dmxsf.com/en/wiki/multimodal/world-models/) connects visual representations to control through predictive dynamics, planning, and feedback.

[Chapter labs on GitHub](https://github.com/dmxsf/dmxsf/tree/main/labs/multimodal)
