← Questions

Design a multimodal neural network

0
AmazonAI/ML designLast asked Sep 2025

An AI/ML design interview question asked in Amazon's system design round, last asked Sep 2025. It tests deep learning, multimodal and architecture.

Design a neural network that takes text and images together and uses them for retrieval (find the images for a text query, or the text for an image) and for classification (for example, labelling a product from its photo and its description).

Requirements

  • Functional: an encoder per modality, a fusion design, training objectives for both retrieval and classification, robustness when one modality is missing or noisy, and evaluation.
  • Non-functional: retrieval over a large index in tens of milliseconds; classification fast enough to run at upload; adaptable to new domains with little labelled data.

Clarifying questions

  • How much paired text-image data is there, and how much of it is labelled for classification?
  • How often is one modality missing at prediction time?
  • What latency and compute budget does serving have?
  • Is the main task retrieval, classification, or both equally?

What a strong answer covers

  • Encoders: a vision transformer or CNN for images and a transformer for text, both pretrained, with projection heads into a shared space.
  • Fusion choices and their trade-offs: late fusion (separate embeddings, combined at the end; cheap, indexable, needed for retrieval), early fusion (tokens of both combined at the input), and cross-attention between modalities (strongest for classification, too slow to precompute for retrieval).
  • Objectives: a contrastive loss on matched pairs (in-batch negatives, hard negatives, temperature) for retrieval, plus a classification head on the fused representation, trained jointly or in stages.
  • Missing and noisy modalities: modality dropout during training, a learned "missing" embedding, filtering of mismatched pairs, and augmentation per modality.
  • Evaluation: recall@k and mean reciprocal rank for retrieval, accuracy and F1 per class for classification, and slices with one modality missing.
  • Serving: image and text embeddings precomputed into an approximate nearest-neighbour index; cross-attention used only for re-ranking a short list or for classification.
  • New domains: fine-tuning projection heads or adapters (LoRA) on a little labelled data, keeping the encoders mostly frozen.

Follow-ups

  • Add a third modality, such as audio or tabular attributes.
  • The model relies on the text and ignores the image. How do you detect and fix that?
  • How do you update the index when the image encoder is retrained?

Where it's asked

What it tests

deep learning · multimodal · architecture

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing