Interview's MateAI Engineering
Interview's Mate

AI Engineering

LLMs, RAG, agents & evals

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
AI Engineering topics
Lesson 15/ 160
01. LLM Fundamentals

Multimodal Inputs

Images, audio, and documents as model inputs, plus tokenization and safety considerations.

IntermediateVision · Audio3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidHands-onQuiz (3)Practice

In plain words

The model can look at pictures and listen to sound as well as read words, by turning them into the same kind of tokens it uses for text.

Think of it like…

Hiring an assistant who can read, look and listen: you can hand them a photo of a whiteboard or a voicemail instead of typing it out. But they may squint at tiny print, charge by the size of the photo, and be fooled by a sticky note saying "ignore your boss".

Where you’ve seen it

An expense app lets employees photograph receipts. A multimodal model returns {vendor, date, total, currency} through a structured-output schema. On a 400-receipt set it reads 96 percent of totals correctly, but accuracy drops to 78 percent on crumpled, low-resolution photos. The team adds an upload check for resolution, cropping guidance, a confidence flag, and human review for low-confidence receipts.

Words you’ll hear

Vision encoder
Converts image patches into embeddings the language model can read.
Image tokens
Tokens an image costs, often depending on its size and detail setting.
Document understanding
Reading layout, tables and forms from PDFs and scans.
Speech-to-text / native audio
Transcribing audio first, or feeding audio directly to a model that understands it.

Visual diagram

Loading interactive diagram

Theory & deep dive

How images, audio and documents reach the model

A vision encoder splits an image into patches (for example 14 × 14 pixels), embeds them, and a projection layer maps those embeddings into the language model's token space. The cost grows with image size: providers resize or tile large images and charge a token count based on dimensions or a "detail" setting, so a high-resolution screenshot can cost thousands of tokens. For text-heavy images, resolution must be high enough for small characters to survive resizing.

Audio is handled in two ways. A pipeline transcribes speech with a speech-to-text model and sends the text, which is cheap and reliable for plain dictation but loses tone, speaker identity and non-speech sounds. Natively multimodal models take audio directly, enabling real-time voice conversations and richer understanding, at higher cost and with less transparency. PDFs can be sent as pages rendered to images (preserving layout, tables and charts) or as extracted text (cheaper, but loses structure); many providers do both.

Choosing page images vs extracted text

A scanned invoice has no text layer, so send page images. A born-digital contract PDF with clean text can be extracted cheaply and sent as text, adding page images only for pages with tables or signatures.

Key takeaway: Everything becomes tokens; image size and detail drive cost, and resolution drives accuracy.

Limitations, safety and evaluation

Models still misread small or low-contrast text, miscount objects, confuse similar-looking digits and struggle with precise spatial reasoning and complex multi-column tables. They can describe details that aren't there. Mitigate with higher resolution, cropping to the region of interest, asking for structured output with a confidence or "unreadable" option, cross-checking totals, and using classic OCR or specialised parsers for exact numerics where the stakes are high.

Safety concerns are different from text-only. Images can contain hidden or visible instructions (a form with tiny text saying "ignore previous instructions"), so treat image content as untrusted data. Photos and audio often contain personal information such as faces, ID numbers or voices, so apply the same privacy, retention and consent rules as for any PII, and be careful when sending data to third-party APIs. Evaluate on a labelled set that includes your worst inputs (blurry, rotated, multilingual), not just clean samples.

An escape hatch for unreadable input

Add a field such as "readable": boolean and make each extracted value nullable. If the model flags a receipt unreadable, route it to the user for a clearer photo instead of guessing a total.

Key takeaway: Expect misreads on hard inputs; give the model a way to say "unreadable" and test on bad data.

How it works, step by step

Step 1 of 4
Design

1. Choose the modality path

Decide between sending images or page renders, extracted text, or a speech-to-text pipeline, based on the content.

scans → images · clean PDFs → text · calls → transcript
Key numbers at this step
Cheapest
that preserves what you need

When to use it & trade-offs

What it is

Multimodal models accept more than text: images (photos, screenshots, charts), audio (speech) and documents (PDFs with layout), and some also produce images or audio. Non-text inputs are converted into tokens the model can attend to alongside text: an image is split into patches encoded by a vision encoder and counted against your context and bill, and audio is encoded into frames or transcribed first. Capabilities include reading charts, describing UI screenshots, extracting fields from scans and answering questions about spoken content.

Why it matters: Much real-world data is not clean text: invoices are scans, support tickets include screenshots, meetings are audio, dashboards are charts. Multimodal models let one pipeline handle them, replacing brittle OCR and layout code. They also bring new costs (image tokens), failure modes (misread small text, hallucinated details) and safety issues (images carrying hidden instructions or personal data).

When to reach for it

  • Extracting data from receipts, forms and scans
  • Describing screenshots and UI states for support or testing
  • Question answering over charts and slides

When to avoid or be careful

  • Sending huge unscaled images when a crop would do
  • Treating image text as trusted instructions
  • Skipping human review for high-stakes numeric extraction

Ways to process non-text data

Multimodal LLM directly
Best for: Varied layouts, screenshots, charts and flexible questions

Strengths: One flexible pipeline; understands context and layout.

Watch out: Image tokens cost; occasional misreads; harder to audit.

OCR / speech-to-text, then LLM
Best for: High-volume text-centric documents and calls

Strengths: Cheap and auditable; precise characters.

Watch out: Loses layout, charts and tone; OCR errors propagate.

Specialised parsers or classic CV
Best for: Fixed templates and exact numerics

Strengths: Deterministic and fast.

Watch out: Brittle when layouts change.

Interview signals & numbers to know

When this topic comes up

  • “Users upload screenshots”
  • “Extract fields from scanned invoices”
  • “Why did this image cost so many tokens?”
  • OCR vs vision models
  • Voice assistants

Benchmarks & rules of thumb

thousands -
of tokens for one high-resolution image
96% / 78% -
clean vs crumpled receipt accuracy in the example
2 paths -
transcribe-then-LLM or native audio

Common mistakes & follow-ups

Common interview mistakes

  • Downscaling screenshots until small text becomes unreadable, then blaming the model.
  • Sending an entire multi-page PDF as images when extracted text would be cheaper and more accurate.
  • Following instructions found inside an uploaded image as though they came from the user.

Likely interviewer follow-ups

  • How would you extract data from scanned invoices reliably?
  • How are images counted in cost and context?
  • What new security risks do multimodal inputs introduce?
Interview tip: Mention cost (image tokens), accuracy (resolution and a way to say unreadable) and safety (untrusted image text, PII). Those three show you've shipped multimodal features.
Loading hands-on exercise

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Multimodal Inputs with generative AI interview Q&A and hands-on practice.

Open Generative AI Q&A →Tech Learn Q&A
Previous topic
Hallucinations
Next topic
Fine-tuning with LoRA