Foundations to Frontier
Tests
F. NLP and Large Language Models › F13 Multimodal Models

Unified multimodal architectures

A multimodal model must combine evidence from images, audio and text. Late fusion runs separate models and combines their outputs. Cross-attention fusion (Flamingo) lets text tokens attend to image features. Early fusion puts all modalities into one token sequence for one transformer. Natively multimodal models such as GPT-4o, Gemini and Chameleon train on interleaved sequences from the start and can also output images or speech. This page compares the fusion strategies, token budgets, resamplers that compress visual tokens, discrete image and audio tokenizers, and training with missing modalities. In the exercises you build an interleaved sequence, late fusion and cross-attention. You then train fusion models on a miniature visual question answering task where the answer depends on both the object and the question. Text alone reached 0.71 and image alone 0.59. Late fusion reached 0.79 because it cannot model the interaction. Early fusion reached 0.996. With the image missing, early fusion fell back to the text-only guess. Modality dropout gave no extra robustness, a null result.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

One model for pictures, sound and words

To answer ‘is the light on the left wing green?’ you need both the picture and the question: neither alone tells you the answer. Early multimodal systems glued separate models together at the end. Newer models turn images, sound and text into one long stream of tokens and let a single transformer read it all, so every word can look at every patch of the image. The demo shows how much of such a stream is image, audio and text.

Multimodal lab
2 images (576 tokens each, green), 30 s of audio (1500 tokens, yellow) and a 200-token question (red): 2852 tokens, of which text is only 7%.
Why engineers care

A robot that hears a command, sees the scene and reads a label needs all three at once; unified models make that possible in one network.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Late fusion combines…
  2. 2. Early fusion uses…
  3. 3. Answering a question about an image needs…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Late fusion: combine predictions or scores of separate models; simple, robust to a missing input, but cannot model interactions.
  • Cross-attention fusion: a language model with inserted cross-attention layers reading visual features (Flamingo), often through a resampler that compresses them to 64 latents.
  • Projector fusion: LLaVA-style; visual tokens projected into the LLM’s input sequence (early fusion of continuous embeddings).
  • Native early fusion: images and audio quantised to discrete tokens and trained jointly with text from scratch (Chameleon, Gemini, GPT-4o); can generate any modality; Transfusion mixes next-token and diffusion losses.
  • Token budgets: images (hundreds to thousands of tokens) and audio (25–50 per second) dominate sequence length; attention cost grows with its square. Resamplers (Q-Former, Perceiver) and token merging cut it.
  • Missing modalities: modality dropout during training; masks in attention.
  • Any-to-any: speech-to-speech assistants stream audio tokens in and out with low latency.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Flamingo fuses vision through…
  2. 2. Natively multimodal models represent images as…
  3. 3. BLIP-2's Q-Former reduces…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Building with multimodal models

Exercise 1.

  • An interleaved image-text sequence.
  • Late fusion of probabilities.
  • Cross-attention from text to image features.

Practice.

  • Use hosted natively multimodal models (GPT-4o, Gemini, Claude) for mixed inputs; open models: Qwen2.5-Omni, Llama 3.2 Vision, Pixtral, Chameleon.
  • Pass images at the lowest resolution that keeps the needed detail; crop to the region of interest.
  • For speech-to-speech, use realtime APIs that stream audio tokens; measure end-to-end latency.
  • For sensor fusion in robotics, start with late fusion as a baseline; move to joint models when interactions matter.
  • Test each modality missing or corrupted.
from transformers import AutoProcessor, AutoModelForImageTextToText
proc = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct")
model = AutoModelForImageTextToText.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct", device_map="auto")
msgs = [dict(role="user", content=[dict(type="image", image=img), dict(type="text", text="Is the left wing light green?")])]
inputs = proc.apply_chat_template(msgs, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt")
print(proc.decode(model.generate(**inputs, max_new_tokens=50)[0]))
🐍 Exercise 1: sequences and fusion
Build an interleaved sequence, fuse two models' probabilities and implement cross-attention.
📝 Quick check (Level 2)
0/3 answered
  1. 1. A sensible first baseline for sensor fusion:
  2. 2. To cut image tokens…
  3. 3. Always test…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Interactions. Late fusion with logits f(x) + g(q) is additive: it can raise or lower the answer by image and by question but cannot express ‘yes for this object and this question, no otherwise’. Any table T[object, question] that is not a sum of a row and a column effect is beyond it. A joint network on the concatenated inputs can represent any such table.

Attention cost. For n text and m visual tokens, self-attention costs O((n + m)²); cross-attention costs O(n m) and keeps the language model’s own sequence short, which is why Flamingo-style designs were attractive for many images.

Discrete tokens. Vector-quantised tokenizers map an image patch grid to codebook indices; generation becomes next-token prediction, at the cost of reconstruction detail and long sequences.

Missing inputs. A joint model trained on complete pairs sees out-of-distribution inputs when a modality is absent; modality dropout trains for that case. Whether it helps depends on how the absent input is represented.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Late fusion with summed logits is…
  2. 2. Cross-attention cost scales with…
  3. 3. VQ tokenizers map patches to…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

When does joint (early) fusion beat late fusion, and does modality dropout make a joint model robust to a missing image?

History.

  • J.-B. Alayrac et al., “Flamingo” (2022).
  • J. Li et al., “BLIP-2” (2023).
  • Chameleon Team, “Chameleon: mixed-modal early-fusion foundation models” (2024).

Exercise 2. Miniature visual question answering.

  • Task: an ‘image’ vector (16 dimensions) shows one of 8 objects; a ‘question’ vector (8 dimensions) asks one of 4 yes/no questions; the answer is a fixed random table with question base rates 0.85, 0.7, 0.5 and 0.3; noise 0.5 on both inputs.
  • Models (Adam, 1500 steps of 128): text-only MLP; image-only MLP; late fusion (sum of an image MLP and a text MLP logit); early fusion (one MLP on both); early fusion with the image zeroed for 30% of training examples (modality dropout).
  • Missing image: test with the image vector set to zero. 4000 test examples.
model accuracy image missing
text only 0.715 0.715
image only 0.591 0.469
late fusion 0.787 0.716
early fusion 0.996 0.715
early fusion + modality dropout 0.993 0.694
  • Neither modality alone answers: text gets the base rates, image the object’s average answer.
  • Late fusion adds the two but cannot express the object × question table.
  • Early fusion learned the table almost perfectly.
  • Missing image: early fusion fell back to the text-only guess even without dropout; modality dropout gave no gain (seed 0 slightly worse; seeds 1 and 2 equal). A zero vector is close to the average image here, so the model was not out of distribution; with other encodings of absence the result may differ.
  • Seeds 1 and 2: late fusion 0.756 and 0.737, early fusion 0.989 and 0.994, text only 0.623 and 0.681.
🐍 Exercise 2 (research): when does joint (early) fusion beat late fusion, and does modality dropout make a joint model robust to a missing image?
Train text-only, image-only, late-fusion and early-fusion models on a task needing both inputs; test with the image missing and with modality dropout.

Unified multimodal models in AI, robotics and aerospace

  • Vision-language-action models: RT-2 and OpenVLA put camera images, instructions and robot actions in one token sequence.
  • Sensor fusion: aircraft and spacecraft combine cameras, radar and lidar; learned joint fusion is studied alongside classical filters, which remain the certified baseline.
  • Mission assistants: speech-in, speech-out assistants that also read displays and documents.

References

  1. J.-B. Alayrac et al. (2022). “Flamingo: a visual language model for few-shot learning.” NeurIPS.
  2. J. Li, D. Li, S. Savarese and S. Hoi (2023). “BLIP-2.” ICML.
  3. Chameleon Team (2024). “Chameleon: mixed-modal early-fusion foundation models.” arXiv.
  4. C. Zhou et al. (2024). “Transfusion: predict the next token and diffuse images with one multi-modal model.” arXiv.