Multimodal LLM Visual Understanding and Tool Calling: A Practical Guide

    This article examines the shift from text-only dialogue to multimodal understanding and task execution. It covers parameter-tiered open models, how MoE architecture affects deployment, cloud versus local deployment, visual understanding evaluation methods, and native function calling. It also includes a Python example for sending images to an OpenAI-compatible Chat Completions endpoint and a JSON tool definition for invoice lookup. The goal is to help teams build a practical model selection and integration framework instead of relying on leaderboard scores alone.

    1. Why Multimodal Capabilities Matter

    The competitive focus of large language models is shifting from pure text dialogue to multimodal understanding and task execution. Multimodal models can process text, images, and video frames in the same semantic space and reason over them. Recently released open models often share the following characteristics:

    1. Parameter scale tiering: A model family usually includes both a large cloud version and a billion-level lightweight version. The former is suitable for cluster inference, while the latter is suitable for on-device or offline deployment.
    2. Improved visual understanding: New models generally perform better than the previous generation on tasks such as image recognition, chart parsing, and layout understanding. Specific results should be based on each model’s published evaluation reports.
    3. Native tool calling: Some models add Function Call capability during training and can decide when to call external tools.
    4. Expanded context windows: Many models support context lengths of around 128K tokens, enabling long-document and long-video analysis.
    5. Changes in API pricing: Pricing varies widely across vendors and changes with version iterations. For model selection, use the current billing rules on official websites rather than relying on relayed price figures.

    Understanding these trends helps establish a model selection framework. A single leaderboard score is not enough to determine whether a model fits a specific business scenario.

    2. Architecture: Mixture of Experts and Parameter Tiers

    2.1 How MoE Architecture Affects Deployment

    A Mixture of Experts (MoE) architecture places multiple expert subnetworks inside the model and activates only a subset of them during each forward pass. The total parameter count can be large, while the compute required for a single inference can remain relatively low.

    This has several engineering implications:

    • Compute cost is mainly determined by activated parameters. When evaluating inference compute, focus on the number of activated parameters rather than only the total parameter count.
    • VRAM still needs to be provisioned based on total parameters. The weights of all experts usually need to be loaded into VRAM or memory. Fewer activated parameters does not mean lower VRAM requirements.
    • Throughput and latency require trade-offs. Expert routing adds scheduling and communication overhead. High-concurrency scenarios need empirical testing.
    • Quantization can further reduce footprint. INT8 or FP8 quantization can lower VRAM requirements, but it introduces some accuracy loss and should be validated on your own evaluation set.

    2.2 Division of Labor Between Cloud and Local Versions

    Specification Typical Parameters Suitable Scenarios
    Cloud large model Tens of billions or more (MoE) Complex visual reasoning, multi-document analysis, content creation pipelines
    Local lightweight version Billion-level On-device real-time interaction, privacy-sensitive scenarios, offline environments

    A common approach is hybrid deployment: assign complex tasks to the cloud large model and high-frequency simple tasks to the local lightweight model. This balances quality and cost.

    3. Visual Understanding: Accuracy and Evaluation Methods

    Visual understanding capability is mainly reflected in three areas.

    1. Fine-grained recognition: The ability to identify small text, dense tables, and the meaning of chart axes. This has direct value for scenarios such as receipt processing and financial report parsing.
    2. Layout structure understanding: The ability to distinguish headings, body text, captions, headers, and footers, and to output structured results with clear hierarchy.
    3. Image-text alignment: The ability to associate paragraphs with corresponding illustrations in mixed image-text input, reducing cases where the model misinterprets the image.

    Public leaderboards provide only a reference. A more reliable approach is to build your own business evaluation set with a fixed set of images and questions, and run regression tests after each model upgrade. The following example sends an image through an OpenAI-compatible Chat Completions interface. Before running, install requests with pip install requests, and adjust the endpoint and model name for your service:

    1. import base64
    2. import os
    3. import requests
    4. API_URL = os.environ["VLM_API_URL"] # Example: https://your-host/v1/chat/completions
    5. API_KEY = os.environ["VLM_API_KEY"]
    6. MODEL_NAME = os.environ.get("VLM_MODEL", "your-model-name")
    7. def ask_vlm(image_path: str, question: str, timeout: int = 60) -> str:
    8. with open(image_path, "rb") as f:
    9. img_b64 = base64.b64encode(f.read()).decode("utf-8")
    10. payload = {
    11. "model": MODEL_NAME,
    12. "messages": [{
    13. "role": "user",
    14. "content": [
    15. {"type": "image_url",
    16. "image_url": {"url": f"data:image/png;base64,{img_b64}"}},
    17. {"type": "text", "text": question},
    18. ],
    19. }],
    20. }
    21. headers = {"Authorization": f"Bearer {API_KEY}"}
    22. resp = requests.post(API_URL, json=payload, headers=headers, timeout=timeout)
    23. resp.raise_for_status()
    24. data = resp.json()
    25. try:
    26. return data["choices"][0]["message"]["content"]
    27. except (KeyError, IndexError, TypeError) as exc:
    28. raise RuntimeError(f"Unexpected response format: {data}") from exc
    29. if __name__ == "__main__":
    30. print(ask_vlm("sample.png", "List all column names in the table in the image."))

    The example assumes PNG input by default. If the input is JPEG, change image/png in the data URL to image/jpeg.

    4. Native Function Calling and Task Closure

    Models with native Function Call capability can understand visual input and then call tools to complete tasks. For example:

    • After recognizing a webpage screenshot, call a code generation tool to output a front-end page;
    • After reading multiple PDFs, call retrieval and summarization interfaces to generate a comparison report;
    • After understanding a data chart, call calculation tools to complete numerical verification.

    The following points require attention during engineering integration.

    1. Tool descriptions should be precise. The model relies on the function name, parameter descriptions, and return constraints to decide whether to call a tool. Below is an example tool definition for querying an invoice amount:
    1. {
    2. "type": "function",
    3. "function": {
    4. "name": "query_invoice_total",
    5. "description": "Query the invoice total amount (in CNY) by invoice number. Call only when the user explicitly provides an invoice number.",
    6. "parameters": {
    7. "type": "object",
    8. "properties": {
    9. "invoice_no": {"type": "string", "description": "Invoice number, 12 digits"}
    10. },
    11. "required": ["invoice_no"]
    12. }
    13. }
    14. }
    1. Set allowlists, timeouts, and retry limits. Restrict callable tools, set a timeout for each call, and limit the maximum number of call rounds per task to prevent the model from entering loops or repeatedly calling costly interfaces.
    2. Result injection and validation. Tool results should be passed back to the model in structured form and checked with rules before final output, for example whether the amount is positive and whether the number format is correct.