Visual Understanding and Tool Calling in Multimodal Agents: Architecture and Parallel Orchestration

    This article examines how multimodal agents should co-design visual understanding and tool use. It covers unified multimodal architectures, native-resolution visual encoding, shared image-video representations, decoupled training, and parallel multi-agent orchestration with critical-path latency analysis.

    1. Background: Why Visual and Tool Capabilities Need to Be Designed Together

    Early multimodal systems often followed a “train the language model first, then attach a vision module” route. The vision encoder and the language model were pretrained separately and then connected through a relatively small adapter layer. This approach has low development cost, but it tends to produce two problems. First, visual features are not sufficiently aligned with the language space: the model may recognize image content but struggle to describe details accurately. Second, when the model is further fine-tuned to strengthen visual ability, language ability may degrade because the two modalities compete for limited parameter capacity.

    In real applications, user requests often contain images, tables, screenshots, documents, and tool calls at the same time. For example, a model may need to locate a problem from an interface screenshot, call an API to query logs, and then generate a repair suggestion. This requires the model to understand visual content in the same semantic space and turn that understanding into an executable action sequence. Therefore, visual understanding and tool use need to be considered together at the architecture level.

    2. Basic Components of a Unified Multimodal Architecture

    A typical unified multimodal model usually contains three parts:

    1. Vision encoder: converts images or video frames into a sequence of visual features.
    2. Projection layer: maps visual features into the embedding space of the language model through a lightweight network.
    3. Language backbone: receives a mixed sequence of visual tokens and text tokens and performs end-to-end modeling.

    The data flow can be summarized as: visual feature extraction, cross-modal projection, and unified modeling by the language backbone.

    1. # Illustration: concatenate visual tokens and text tokens for unified modeling
    2. visual_tokens = projector(vision_encoder(image_or_video)) # [N_v, d]
    3. text_tokens = embedding(prompt_ids) # [N_t, d]
    4. sequence = concat([visual_tokens, text_tokens], dim=0) # [N_v + N_t, d]
    5. output = language_backbone(sequence)

    The key point of this structure is that visual tokens and text tokens are placed in the same sequence. The attention mechanism can directly establish dependencies between them without additional result concatenation outside the model.

    3. Design Considerations for the Vision Encoder

    3.1 Preserve Native Resolution

    Traditional approaches often resize or crop images to a fixed size, which loses detail and distorts aspect ratios. A more reasonable approach is to split an image into patches, flatten each patch, and concatenate them into a one-dimensional sequence. Different images can have different sequence lengths, distinguished through masks or positional encoding. In this way, screenshots with extreme aspect ratios and high-resolution charts can be fed in close to their original form.

    1. def patchify(image, patch_size):
    2. # image: [H, W, C]; H and W must be multiples of patch_size, otherwise pad the borders first
    3. h, w, c = image.shape
    4. patches = image.reshape(h // patch_size, patch_size, w // patch_size, patch_size, c)
    5. patches = patches.transpose(0, 2, 1, 3, 4).reshape(-1, patch_size * patch_size * c)
    6. return patches # [num_patches, patch_dim]

    Native resolution makes sequence length grow with image size. In engineering practice, it is usually necessary to set a maximum number of patches, reasonably downsample the excess, and control GPU memory usage.

    3.2 Unified Representation for Images and Video

    Video is essentially a sequence of images with a temporal dimension. An efficient approach is to organize adjacent frames into spatiotemporal blocks: split patches in the spatial dimension, pack patches at corresponding positions across multiple frames in the temporal dimension, and process them with the same encoder. An image can be regarded as a special case with a temporal length of 1.

    This design brings two benefits. First, images and video share parameters, so there is no need to design a separate branch for video. Second, spatial representations learned from images can naturally transfer to video understanding, reducing training pressure caused by insufficient video data.

    3.3 Decoupled Training

    The vision encoder and the language backbone have different sensitivities to data and optimization objectives. During direct end-to-end joint training, their gradients may interfere with each other. Common decoupled training practices include: pretraining the vision encoder independently first, then aligning it with the language backbone using a lower learning rate or freezing; or using different ratios of image-text data at different training stages. The core goal is to let each component converge at an appropriate pace while ensuring that the final joint representation remains stable.

    4. Tool Calling and Parallel Multi-Agent Orchestration

    4.1 Bottlenecks of Sequential Execution

    An agent usually goes through multiple steps to complete a complex task, such as planning, retrieval, tool calling, and result validation. If all steps are strictly serial, the total time equals the sum of the time required by each step. When subtasks have no dependencies—for example, retrieving multiple sources or checking multiple files at the same time—serial execution causes substantial waiting.

    4.2 Task Decomposition and Dependency Graphs

    The first step in parallel multi-agent orchestration is to represent the task as a directed acyclic graph. Nodes represent subtasks, and edges represent data dependencies. Nodes without dependencies can be executed concurrently. The scheduler is responsible for dispatching tasks, collecting results, handling failures, and aggregating outputs.

    1. import asyncio
    2. async def run_subtask(name, delay):
    3. await asyncio.sleep(delay) # Simulate tool call or model inference time
    4. return f"{name} completed"
    5. async def orchestrate():
    6. # Three independent subtasks run concurrently
    7. results = await asyncio.gather(
    8. run_subtask("Retrieve materials", 1.2),
    9. run_subtask("Parse table", 0.8),
    10. run_subtask("Check files", 1.0),
    11. )
    12. # A subtask that depends on previous results runs after concurrent results return
    13. summary = await run_subtask("Summarize findings", 0.5)
    14. return results, summary

    4.3 Latency Analysis

    The benefit of parallelization depends on the length of the critical path, not on total workload. Let T_critical be the duration of the longest dependency chain in the task graph; the parallelization benefit is determined by the critical path length rather than by total workload.