# qwenlm/qwen2-vl architecture

> Architecture diagram of the GitHub repository qwenlm/qwen2-vl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/qwenlm/qwen2-vl
- Repository: https://github.com/qwenlm/qwen2-vl

## Overview

Qwen3-VL is a vision-language model release repository with supporting inference utilities, a chat demo, fine-tuning code, task cookbooks, and benchmark evaluation programs. The user-facing workflow is to submit text and image/video content to the demo, which prepares a model request and presents generated output. Fine-tuning and evaluation are separate workflows: training prepares multimodal examples and runs a trainer; benchmark programs prepare datasets, run inference, and score results. Connections reflect the README and indexed imports; unsampled implementation details are not inferred.

Main entry points: [`evaluation/mmmu/dataset_utils.py`](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/dataset_utils.py) (MMMU dataset), [`evaluation/mmmu/eval_utils.py`](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/eval_utils.py) (MMMU scoring), [`evaluation/mmmu/common_utils.py`](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/common_utils.py) (MMMU helpers), [`qwen-vl-finetune/qwenvl/train/train_qwen.py`](https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/train/train_qwen.py) (Training entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_demo["Inference demo"]
  node_web_demo["Chat demo<br/>[web_demo_mm.py]"]
end

subgraph group_vision["Vision utilities"]
  node_vision_process["Vision processing<br/>[vision_process.py]"]
end

subgraph group_training["Fine-tuning"]
  node_train_entry["Training entry<br/>[train_qwen.py]"]
  node_data_processor["Data processing<br/>[data_processor.py]"]
  node_rope2d["2D position encoding<br/>[rope2d.py]"]
  node_train_args["Training arguments<br/>[argument.py]"]
  node_trainer["Trainer<br/>[trainer.py]"]
end

subgraph group_evaluation["Benchmark evaluation"]
  node_mmmu_run["MMMU inference<br/>[run_mmmu.py]"]
  node_mmmu_data["MMMU dataset<br/>[dataset_utils.py]"]
  node_mmmu_common["MMMU helpers<br/>[common_utils.py]"]
  node_mmmu_eval["MMMU scoring<br/>[eval_utils.py]"]
  node_mathvision_run["MathVision inference<br/>[run_mathv.py]"]
  node_mathvision_eval["MathVision scoring<br/>[eval_utils.py]"]
  node_odinw_run["ODinW evaluation<br/>[run_odinw.py]"]
  node_realworld_run["RealWorldQA inference<br/>[run_realworldqa.py]"]
  node_realworld_eval["RealWorldQA scoring<br/>[eval_utils.py]"]
  node_videomme_run["VideoMME inference<br/>[run_videomme.py]"]
end

node_user(("Demo user"))
node_cookbooks["Task cookbooks"]

node_user -->|"submits content"| node_web_demo
node_web_demo -->|"uses vision utilities"| node_vision_process
node_train_entry -->|"uses"| node_data_processor
node_train_entry -->|"uses"| node_trainer
node_train_entry -->|"uses"| node_train_args
node_data_processor -->|"uses"| node_rope2d
node_mmmu_run -->|"loads dataset"| node_mmmu_data
node_mmmu_run -->|"uses scoring"| node_mmmu_eval
node_mmmu_data -->|"uses helpers"| node_mmmu_common
node_mmmu_eval -->|"uses helpers"| node_mmmu_common
node_mathvision_run -->|"uses dataset helpers"| node_mmmu_data
node_mathvision_run -->|"uses scoring helpers"| node_mmmu_eval
node_mathvision_eval -->|"uses helpers"| node_mmmu_common
node_odinw_run -->|"uses dataset helpers"| node_mmmu_data
node_odinw_run -->|"uses scoring helpers"| node_mmmu_eval
node_realworld_run -->|"uses dataset helpers"| node_mmmu_data
node_realworld_run -->|"uses scoring helpers"| node_mmmu_eval
node_realworld_eval -->|"uses helpers"| node_mmmu_common
node_videomme_run -->|"uses dataset helpers"| node_mmmu_data
node_videomme_run -->|"uses scoring helpers"| node_mmmu_eval
node_cookbooks -.->|"demonstrates tasks"| node_user

click node_web_demo "https://github.com/qwenlm/qwen2-vl/blob/main/web_demo_mm.py"
click node_vision_process "https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-utils/src/qwen_vl_utils/vision_process.py"
click node_cookbooks "https://github.com/qwenlm/qwen2-vl/tree/main/cookbooks"
click node_train_entry "https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/train/train_qwen.py"
click node_data_processor "https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/data/data_processor.py"
click node_rope2d "https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/data/rope2d.py"
click node_train_args "https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/train/argument.py"
click node_trainer "https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/train/trainer.py"
click node_mmmu_run "https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/run_mmmu.py"
click node_mmmu_data "https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/dataset_utils.py"
click node_mmmu_common "https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/common_utils.py"
click node_mmmu_eval "https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/eval_utils.py"
click node_mathvision_run "https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/MathVision/run_mathv.py"
click node_mathvision_eval "https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/MathVision/eval_utils.py"
click node_odinw_run "https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/ODinW-13/run_odinw.py"
click node_realworld_run "https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/RealWorldQA/run_realworldqa.py"
click node_realworld_eval "https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/RealWorldQA/eval_utils.py"
click node_videomme_run "https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/VideoMME/run_videomme.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_demo,node_user toneBlue
class node_vision_process toneAmber
class node_train_entry,node_data_processor,node_rope2d,node_train_args,node_trainer toneMint
class node_mmmu_run,node_mmmu_data,node_mmmu_common,node_mmmu_eval,node_mathvision_run,node_mathvision_eval,node_odinw_run,node_realworld_run,node_realworld_eval,node_videomme_run,node_cookbooks toneRose
```

## Components

### Inference demo

- [Chat demo](https://github.com/qwenlm/qwen2-vl/blob/main/web_demo_mm.py): `web_demo_mm.py`

### Vision utilities

- [Vision processing](https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-utils/src/qwen_vl_utils/vision_process.py): `qwen-vl-utils/src/qwen_vl_utils/vision_process.py`

### Fine-tuning

- [Training entry](https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/train/train_qwen.py): `qwen-vl-finetune/qwenvl/train/train_qwen.py`
- [Data processing](https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/data/data_processor.py): `qwen-vl-finetune/qwenvl/data/data_processor.py`
- [2D position encoding](https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/data/rope2d.py): `qwen-vl-finetune/qwenvl/data/rope2d.py`
- [Training arguments](https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/train/argument.py): `qwen-vl-finetune/qwenvl/train/argument.py`
- [Trainer](https://github.com/qwenlm/qwen2-vl/blob/main/qwen-vl-finetune/qwenvl/train/trainer.py): `qwen-vl-finetune/qwenvl/train/trainer.py`

### Benchmark evaluation

- [MMMU inference](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/run_mmmu.py): `evaluation/mmmu/run_mmmu.py`
- [MMMU dataset](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/dataset_utils.py): `evaluation/mmmu/dataset_utils.py`
- [MMMU helpers](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/common_utils.py): `evaluation/mmmu/common_utils.py`
- [MMMU scoring](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/mmmu/eval_utils.py): `evaluation/mmmu/eval_utils.py`
- [MathVision inference](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/MathVision/run_mathv.py): `evaluation/MathVision/run_mathv.py`
- [MathVision scoring](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/MathVision/eval_utils.py): `evaluation/MathVision/eval_utils.py`
- [ODinW evaluation](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/ODinW-13/run_odinw.py): `evaluation/ODinW-13/run_odinw.py`
- [RealWorldQA inference](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/RealWorldQA/run_realworldqa.py): `evaluation/RealWorldQA/run_realworldqa.py`
- [RealWorldQA scoring](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/RealWorldQA/eval_utils.py): `evaluation/RealWorldQA/eval_utils.py`
- [VideoMME inference](https://github.com/qwenlm/qwen2-vl/blob/main/evaluation/VideoMME/run_videomme.py): `evaluation/VideoMME/run_videomme.py`

### Other components

- **Demo user**
- [Task cookbooks](https://github.com/qwenlm/qwen2-vl/tree/main/cookbooks): `cookbooks`

## Connections

- Demo user → Chat demo: submits content (evidence: `README.md`)
- Chat demo → Vision processing: uses vision utilities (evidence: `web_demo_mm.py`)
- Training entry → Data processing: uses (evidence: `qwen-vl-finetune/qwenvl/train/train_qwen.py`)
- Training entry → Trainer: uses (evidence: `qwen-vl-finetune/qwenvl/train/train_qwen.py`)
- Training entry → Training arguments: uses (evidence: `qwen-vl-finetune/qwenvl/train/train_qwen.py`)
- Data processing → 2D position encoding: uses (evidence: `qwen-vl-finetune/qwenvl/data/data_processor.py`)
- MMMU inference → MMMU dataset: loads dataset (evidence: `evaluation/mmmu/run_mmmu.py`)
- MMMU inference → MMMU scoring: uses scoring (evidence: `evaluation/mmmu/run_mmmu.py`)
- MMMU dataset → MMMU helpers: uses helpers (evidence: `evaluation/mmmu/dataset_utils.py`)
- MMMU scoring → MMMU helpers: uses helpers (evidence: `evaluation/mmmu/eval_utils.py`)
- MathVision inference → MMMU dataset: uses dataset helpers (evidence: `evaluation/MathVision/run_mathv.py`)
- MathVision inference → MMMU scoring: uses scoring helpers (evidence: `evaluation/MathVision/run_mathv.py`)
- MathVision scoring → MMMU helpers: uses helpers (evidence: `evaluation/MathVision/eval_utils.py`)
- ODinW evaluation → MMMU dataset: uses dataset helpers (evidence: `evaluation/ODinW-13/run_odinw.py`)
- ODinW evaluation → MMMU scoring: uses scoring helpers (evidence: `evaluation/ODinW-13/run_odinw.py`)
- RealWorldQA inference → MMMU dataset: uses dataset helpers (evidence: `evaluation/RealWorldQA/run_realworldqa.py`)
- RealWorldQA inference → MMMU scoring: uses scoring helpers (evidence: `evaluation/RealWorldQA/run_realworldqa.py`)
- RealWorldQA scoring → MMMU helpers: uses helpers (evidence: `evaluation/RealWorldQA/eval_utils.py`)
- VideoMME inference → MMMU dataset: uses dataset helpers (evidence: `evaluation/VideoMME/run_videomme.py`)
- VideoMME inference → MMMU scoring: uses scoring helpers (evidence: `evaluation/VideoMME/run_videomme.py`)
- Task cookbooks → Demo user: demonstrates tasks (evidence: `README.md`)
