Runoob Tutorial ArchiveEnglish

Large Model Multimodality

Large Model Multimodality

Multimodal large models allow AI to process multiple information formats such as text, images, audio, and video simultaneously, which is one of the most core development directions for large models currently.

This article explains the concept, development process, internal principles, and typical capabilities of multimodality from scratch, and provides a runnable example of building the first multimodal application in the end.


I. What is Multimodality?

Traditional large models can usually only process one type of information—text; if you give a traditional AI an image and ask it "How many cats are in the picture?", it cannot do so if it does not support multimodality.

But the real world is not composed of text, but of various sensory information:

Senses Corresponding information
Eyes Images
Ears Sounds
Mouth Language
Hand Action
Video Image + Time
Webpage Text + Image + Structure

Therefore, the concept of Multimodal emerged.

Understand in one sentence:

Multimodal = a model that can simultaneously understand and generate multiple types of information.

Look at two typical examples:

This ability to describe images and summarize audio is the most direct manifestation of multimodal capabilities.


II. What is a Modality?

Modality is the form in which information is presented.

Different modalities correspond to different inputs and outputs; the table below lists common modalities and their typical applications:

Modality Input Example Output examples Typical applications
Text Novels, chat logs Answers, articles Q&A, writing, translation
Image Photos, screenshots Image understanding, image generation OCR, visual question answering
Audio Speech, music Transcription, speech synthesis Meeting summarization, voice assistant
Video Video stream Video analysis, timeline Tutorial summary, content retrieval
Sensor GPS, temperature Control signal Robot, autonomous driving
Action Mouse click, keyboard input Execute actions GUI Agent, automation

The more modalities a model supports, the closer its capabilities are to human-like, which is why all top labs are upgrading text models to multimodal models.

7 9d673 75b7 489d a3 e bcaca789bf8


III. The Development Process of Multimodal Large Models

Multimodal large models have gone through three distinct stages, from only being able to process text to being able to see, hear, and output video.

Three stages of multimodal LLM development From single-modality text to native multimodality, each step brings the model closer to a human-like way of understanding. 1 Stage 1: LLM (language model) Input: text Output: text Capabilities: Write code / write articles Translation / reasoning / QA Limitation: cannot see the world Representative: GPT, Claude, Gemini 2 Stage 2: VLM (vision-language model) Input: image + text Output: text New capabilities: Image viewing / OCR Chart understanding / screenshot QA Limitation: only "sees" the image Representative: GPT-4V, Gemini 1.5, Qwen-VL 3 Stage 3: native multimodality (unified model) Input: any modality combination Output: any modality Complete capabilities: See / hear / speak / reason Video / real-time interaction / Agent Status: mainstream direction Representative: GPT-5, Gemini 2.5, Claude 4.6

Stage One: Language Models (LLM)

In this stage, both the input and output of the model are text, and representative products include OpenAI GPT series, Anthropic Claude, and Google Gemini.

They can write code, write articles, translate, and answer questions, and their capabilities are very strong, but there is a fundamental limitation: they cannot see.

Phase Two: Vision-Language Models (VLM)

VLM adds "image viewing" capability on top of LLMs; a typical use case is uploading a screenshot of a webpage and asking "why is the layout wrong," with the model answering "CSS conflict."

In this phase, the model begins to possess capabilities such as image understanding, OCR, and chart understanding.

Phase Three: Native Multimodal Models

Native multimodal models no longer treat "images" and "text" as two spliced modules, but unify the processing of images, audio, video, and text from the start of training.

It possesses complete capabilities: seeing, hearing, speaking, reasoning, and executing, which is also the mainstream direction in the industry today.


Four, how do multimodal models work internally?

The internal workings of multimodal models can be summarized in one sentence: converting all data into a unified vector space.

For example:

Three expressions, "a cat", "cat", and cat.png, although from different modalities, will fall into close regions in the vector space after encoding.

The overall process is shown in the figure below:

Internal workflow of multimodal models Map different modalities into a unified vector space, then let the Transformer reason over them uniformly. Input layer Text Image Audio Video Encoder layer Text Encoder Vision Encoder Audio Encoder Video Encoder Unified semantic space Embedding Vector Space "cat" / "cat" / image are close to each other here. Transformer Self-Attention + Feed Forward Unified reasoning Cross-modal association Attention(Q, K, V) Decoder Decoder Generate on demand Any modality Output layer Text Image Audio Video Core idea: map any modality into the same high-dimensional vector space, letting the Transformer understand them in a unified way.

The figure above shows the complete link from input to output, and the following breaks down each step.

Step 1: Encoding

Different modalities must first be converted into numbers for the model to process.

Modality Raw data Encoded
Text "Hello" [2034, 789] A set of token ids
Image Pixel matrix Visual feature vector
Audio Waveform Spectral feature vector

Step 2: Unifying semantic space

The key step in encoding is to make "cat", "cat", and cat.png close to each other in the vector space.

This is the essence of "cross-modal understanding": projecting features from different modalities into the same space.

Step 3: Generating output

After inference in the unified space, the model "reconstructs" the results into different modalities as needed.

The output can be: text, image, audio, or video.

For example: upload an image → describe → then generate an introductory video, this is a complete multimodal generation chain.


V. Why can Transformer unify multiple modalities?

There is only one core reason: the Attention mechanism.

The core formula of Transformer is Attention(Q, K, V), which means "the model decides what to focus on itself."

For example: when the user asks "Who is playing basketball in the picture?", the model will:

  1. First look at the image and identify all people in the picture.
  2. Identify the basketball in the picture.
  3. Determine the relationship between "who" and "basketball".
  4. Generate answers with comprehensive context

This "self-determined focus" capability makes the Transformer naturally suitable for processing multimodal inputs:

Input What the model is focusing on
Pure text Semantic relationships between sentences
Image + text Correspondence between image regions and text descriptions
Video + Text Association between timeline segments and questions

This is also why Attention has almost become a "standard feature" of all modern large models—it is inherently designed for cross-modal tasks.


VI. Typical Multimodal Capabilities

Multimodal models possess five typical capabilities, and the figure below shows the relationship between them.

Five typical capabilities of multimodal LLMs A single unified model covers the complete chain of "see, hear, speak, act". Multimodal Large model Unified Model Image understanding OCR / charts / screenshot QA Typical applications: · Error screenshot → AI locates the problem · Automatic interpretation of paper charts Image generation Text-to-image / image-to-image Typical applications: · Posters / covers / illustrations · Game assets / UI sketches Voice interaction ASR + TTS + dialogue Typical applications: · Real-time voice assistant · Meeting transcription and summarization Video understanding Long video / timeline / QA Typical applications: · Automatic teaching video summarization · Monitor and retrieve key events Agent Search / generate / execute / feedback · Complete a PPT / poster / research with a single sentence · Chain multiple tools into an "action chain" Five capabilities freely combinable

1. Image Understanding

Input a screenshot, and the model outputs page questions, UI analysis, or OCR results.

The most common scenario for programmers is: screenshot an error and have the AI locate the problem.

2. Image Generation

Input a text description such as "generate a futuristic city," and the model returns an AI image.

Typical applications: posters, covers, game assets, product sketches.

3. Voice Interaction

Speak to input, the model responds in real-time, with capabilities covering ASR (Automatic Speech Recognition), TTS (Text-to-Speech), and dialogue.

4. Video Understanding

Upload a tutorial video, and the model outputs a summary, timeline, and key answerable segments.

5. Agent

When you input "Help me make a PPT", the model begins executing a complete action chain: search for materials → generate outline → create slides → revise → export.

An Agent is the final form that combines "seeing, hearing, speaking" and "hands-on execution".


VII. Five Terms Beginners Must Understand

The terms in the table below will appear repeatedly when reading multimodal-related documentation; memorize them first:

Term Meaning Example
Token The smallest unit processed by the model, text is split by words "Hello world" → [you][good][world]
Embedding The process of converting information into numerical coordinates "Cat" → [0.12, 0.78, 0.33, ...]
Context The history and background information of the current conversation When the user says "apple" + "context: phone" = iPhone, not fruit
Attention Deciding which part of the input the model should focus on When looking at an image, the model first looks at the "person" and then the "basketball"
Inference The process of the model generating output based on the input After the user inputs a question, the model "thinks and answers"

These five terms run through all large model documentation; first build intuition, and refer back for details.


VIII. Hands-on Experience: Build Your First Multimodal Application in 5 Minutes

Goal of this section: Upload an image and have the AI output a text description.

The entire process does not require any deep learning foundation, only knowledge of Python.

8.1 Prepare the project

First, create a project named multimodal-demo and test it using the openai library:

Example

Create project

mkdir

multimodal-demo

Enter the project directory

cd

multimodal-demo

Install the official OpenAI SDK (compatible with multiple multimodal models)

pip

install

openai

Upload an image cat-cartoon.webp to the multimodal-demo directory, as shown below (you can right-click and save it to test):

cat cartoon

8.2 Write the calling code

This example uses Ark's Coding Plan, whose doubao-seed-2.0-pro model supports multimodality.

Save the following code as test.py:

Instance

import

base64

import

os

from

io

import

BytesIO

from

openai

import

OpenAI

from

PIL

import

Image

==================== Ark Configuration ====================

ARK_API_KEY

=

"ark-xxxx"

           

Enter your Key here

ARK_BASE_URL

=

"https://ark.cn-beijing.volces.com/api/coding/v3"

 

It is recommended to use the general v3 interface

MODEL_ENDPOINT

=

"doubao-seed-2.0-pro"

 

Supports multimodal models

Initialize client

client

=

OpenAI

(

api_key

=

ARK_API_KEY

,

base_url

=

ARK_BASE_URL

,

timeout

=

60

)

def

prepare_image_base64

(

image_path:

str

,

max_size:

int

=

1024

)

str

:

   

"""
Read local image, process alpha channel, resize, and convert to base64 string
"""

   

if

not

os

.

path

.

exists

(

image_path

)

:

       

raise

FileNotFoundError

(

f

"Test image not found: {image_path}"

)

       

   

with

Image.

open

(

image_path

)

as

img:

       

1. Process RGBA transparent background

       

if

img.

mode

==

"RGBA"

:

background

=

Image.

new

(

"RGB"

,

img.

size

,

(

255

,

255

,

255

)

)

background.

paste

(

img

,

mask

=

img.

split

(

)

[

1

]

)

img

=

background

       

elif

img.

mode

!=

"RGB"

:

            img

=

img.

convert

(

"RGB"

)

           

       

2. Proportional scaling (to prevent large images from overflowing Payload/Token)

img.

thumbnail

(

(

max_size

,

max_size

)

)

       

       

3. Convert to Base64

buf

=

BytesIO

(

)

img.

save

(

buf

,

format

=

"JPEG"

,

quality

=

85

)

 

Appropriate compression quality

b64

=

base64

.

b64encode

(

buf.

getvalue

(

)

)

.

decode

(

"utf-8"

)

       

   

return

f

"data:image/jpeg;base64,{b64}"

def

multimodal_chat

(

img_path:

str

,

prompt:

str

)

:

   

"""Multimodal conversation test"""

   

try

:

       

print

(

f

"Processing image: {img_path} ..."

)

img_b64

=

prepare_image_base64

(

img_path

)

       

       

print

(

"Sending request to Volcengine Ark platform..."

)

res

=

client.

chat

.

completions

.

create

(

model

=

MODEL_ENDPOINT

,

            messages

=

[

               

{

                   

"role"

:

"user"

,

                   

"content"

:

[

                       

{

"type"

:

"text"

,

"text"

: prompt

}

,

                       

{

"type"

:

"image_url"

,

"image_url"

:

{

"url"

: img_b64

}

}

                   

]

               

}

           

]

,

temperature

=

0.7

,

max_tokens

=

1024

       

)

       

       

print

(

"\n"

"="

10

" Recognition result "

"="

10

)

       

print

(

res.

choices

[

0

]

.

message

.

content

)

       

print

(

"="

30

)

       

return

res

   

except

FileNotFoundError

as

e:

       

print

(

f

"【Error】{e}"

)

   

except

Exception

as

e:

       

print

(

f

"【API Request Failed】Please check the network or if the Endpoint/Key is correct. Error message:\n{e}"

)

       

return

None

if

name

==

"main"

:

   

Test configuration

image_file

=

"./cat-cartoon.webp"

question

=

"Provide a detailed description of the content in this image, analyzing the main subject, colors, and scene."

   

   

Simulate creating a temporary test image (if the corresponding image is not locally available, for quick visual debugging)

   

if

not

os

.

path

.

exists

(

image_file

)

:

       

print

(

f

"No {image_file} detected, generating a temporary test image..."

)

Image.

new

(

'RGB'

,

(

200

,

200

)

,

color

=

(

73

,

109

,

137

)

)

.

save

(

image_file

)

       

multimodal_chat

(

image_file

,

question

)

Running Python, the output is as follows:

Original prompt (Chinese, left untranslated)

在发送请求至火山引擎方舟平台...



========== 识别结果 ==========

这是一张**Q版萌系卡通风格的数字角色插画**,整体背景为纯净的纯白色,没有任何环境元素,所有视觉重心都集中在中心的小猫主体上,是典型的独立角色立绘/吉祥物设计。

---

### I. Detailed description of the main subject

The main subject is a well-composed, sitting cartoon kitten, a domesticated orange and white tabby cat image designed to be cute, with an overall temperament that is gentle, innocent, and friendly:

1.  **比例与姿态**:采用萌系设计特有的大头短身比例,头部占整体高度的60%左右,

...

Opening the browser console will show the model's text description of the image. The entire process is:

User uploads image -> Browser sends image URL to OpenAI SDK -> Multimodal model understands the image -> Returns text description -> Prints to console.

8.3 Common Extensions

After completing the above minimal runnable code, you can continue to extend:

What you want to do How to modify
Change to upload local files After the user uploads the image, read it and convert it to base64, then assign it to image_file
Support continuous multi-turn conversations Append the history of questions and answers to the messages array
Switch to other vendor models Specify baseURL when constructing the OpenAI client, such as for Qwen, OpenAI, or Anthropic compatible endpoints
Handle speech Change type: "image_url" to type: "input_audio" and provide base64 audio

IX. Learning Roadmap (Recommended)

If you are new to large models, the figure below is a verified 6-week learning path.

Multimodal learning roadmap (6 weeks) From fundamentals to complete projects, building capability step by step. Start point W1 Basics Transformer Token W2 Get started Prompt engineering Call API W3 Data Embedding Vector database W4 Retrieval RAG principle Document QA W5 Action Agent orchestration Tool call W6 Integrate Complete multimodality Project practice Recommended practical projects 1. Image QA Upload image + question Model outputs a text answer Covers: image understanding 2. AI OCR Screenshot → text + structured Auto-organize into spreadsheets Covers: image understanding 3. Document assistant PDF upload → QA RAG retrieval augmentation Covers: RAG 4. Video summary Long video → timeline Key segment QA Covers: video understanding 5. AI coding assistant Screenshot error → fix Call tools to write code Covers: Agent

X. What's Next?

Reviewing the evolution of software forms, a clear trend can be seen:

Past: Software = Functionality.

Present: Software = Model.

Future: Software = Multimodal Agent.

This means that in the future, users only need to say a sentence, such as "make a website," and the model will automatically complete the entire process of design, coding, deployment, and operation.

Multimodality is not as simple as "giving the model an image viewing function."

What it truly changes is:

Allowing computers to directly understand the real world.

This is the most important paradigm shift in the current AI industry and a direction all developers are worth investing in.


Frequently Asked Questions

Which is better, multimodal models or regular LLMs?

It depends on the scenario: for pure text writing, code generation, or translation, regular LLMs offer better cost-effectiveness; when needing to view images, listen to audio, or understand videos, multimodal models are the only option.

Can multimodal models run locally?

Yes, but the cost is higher. Small parameter VLMs (like Qwen2-VL-7B) can run on consumer-grade GPUs with 16GB of VRAM; larger models usually require cloud GPUs or API calls.

Is the output of a multimodal model always text?

Not necessarily. Native multimodal models can output text, images, audio, or even video; pure VLM usually only outputs text.

How to choose a multimodal API?

If only doing image understanding: OpenAI gpt-4o, Gemini 2.5 Flash, and Qwen2-VL are all cost-effective choices; if you want "sight + hearing + real-time voice," it is recommended to use the OpenAI Realtime API or Gemini Live directly.