AI-ENGINEERING
    beginner

    Multimodal LLMs (Vision)

    AI Engineer path · lesson 63 of 124
    The idea
    An image enters the model the way a mosaic enters a description: broken into tiles, each tile summarized as a 'visual word', and the words read in order alongside your question. Big tiles read fast but blur the details; small tiles keep detail but take far more words.
    How to use
    Switch the patch grid size and watch token count vs detail trade off — then check what a full screenshot actually costs in tokens.
    patch grid:256 image tokens
    →… ×256each patch → one embedding ("visual word")fed into the LLM exactly like text tokens
    64 tok, detail lost
    coarse grid (8×8)
    576 tok, detail kept
    fine grid (24×24)
    14–16 px
    patch size in real ViTs

    Key insight

    The vision encoder turns an image into a few hundred patch embeddings — nothing more magical than "visual words." Anything smaller than a patch (a 6-pixel-tall word, a hairline chart tick) is blurred into its tile, which is the root of most small-text failures.

    How an image reaches the LLM

    Schematic

    Fill in the missing stages of the vision path.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    Input image

    fixed-size squares
    encodes patches
    aligns the spaces

    LLM, alongside text tokens

    3 pieces left to place

    Test your knowledge

    20 questions
    Question 1 of 20
    Score: 0

    How does an image enter a vision-language model?

    The short version

    An image enters the model the way a mosaic enters a description: broken into tiles, each tile summarized as a "visual word", and the words read in order alongside your question. Big tiles read fast but blur the details; small tiles keep detail but take far more words.

    In more depth

    Multimodal LLMs (Vision)

    A language model only understands tokens, so multimodal models make every modality look like tokens.

    The pipeline

    1.Patchify — a vision encoder (ViT) slices the image into fixed patches (~14-16 px) and embeds each as a vector: "visual words."
    2.Project — a small trained adapter maps patch embeddings into the LLM's text-embedding space.
    3.Attend — image tokens sit in the same sequence as text; attention flows across modalities, so a question about the image is answered directly.

    Engineering consequences

    Images are token-hungry: a phone photo ≈ 700-1 600 tokens; a 30-page PDF as images can eat ~50k tokens before you ask anything. Resolution is a cost dial.
    Detail floor: anything smaller than a patch is blurred away at encode time — the root of small-text failures. Crop/zoom second passes fix what prompts cannot.
    Failure modes: hallucinated detail (fluent guesses about invisible things), weak counting and pixel-precision, and image prompt injection — instructions rendered in an image are read like any other content.
    What it replaced: OCR → layout parser → rules → NLP pipelines collapse into one call for long-tail documents; classical OCR still wins on high-volume uniform forms (see IDP).

    Interview Questions

    OpenAI
    Anthropic
    Google
    Meta
    Anthropic
    Google
    OpenAI
    Google
    Meta
    Anthropic
    Microsoft
    Google
    Google
    Amazon
    Scale AI

    Love this visualization?

    Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.

    100% free • No credit card required