Multimodal LLM Deployment Guide: Visual Understanding and Function Calling

    This guide explains how to evaluate multimodal LLMs for production use, focusing on visual understanding and native function calling. It covers a JSON Schema tool-call workflow, long-context capacity estimation, MCP integration considerations, and a troubleshooting checklist for images that render as placeholders in mixed text-image output.

    1. How Should You Evaluate a Multimodal Model’s Visual Understanding and Function-Calling Capabilities?

    Multimodal LLMs have expanded from pure text processing to images, charts, video, and automation tasks. Many vendors offer two versions: a flagship version for high-performance cloud clusters and a lightweight version for local deployment and low-latency scenarios, often with names that include Flash. These versions differ significantly in capabilities, price, and hardware requirements. Before choosing one, check the specification sheet for each version.

    1. Visual Understanding: Clear Gains, but Check Specific Benchmarks

    Early vision models mainly performed image classification and object detection. Newer models have made clear progress in visual feature extraction and image-text alignment. They can understand spatial relationships between objects in an image and explain chart meanings in context.

    Vendors often say a model “leads” in performance. Such claims are useful only when they include the benchmark name, model version, and evaluation settings. When selecting a model, run a small-scale test with your own business images. For example, take 100 financial report charts, measure key-field extraction accuracy, and compare the candidates.

    2. Native Function Calling: The Model Decides, the Code Executes

    The traditional approach is to prompt the model to output fixed-format text, then use regular expressions or a parser in code to extract parameters. A model with native function calling can select tools directly based on user intent and generate arguments according to a JSON Schema.

    The key boundary is this: the model only generates the call request. Actual function execution, permission checks, and database writes are still handled by the developer’s code.

    The following request example analyzes a financial chart and saves the result. The model is a placeholder; replace it with the model name provided by your platform.

    1. {
    2. "model": "your-multimodal-model",
    3. "messages": [
    4. {
    5. "role": "user",
    6. "content": [
    7. {"type": "text", "text": "Analyze the core data trends in this financial report chart and call the data ingestion interface to save the results."},
    8. {"type": "image_url", "image_url": {"url": "https://example.com/charts/q3-revenue.png"}}
    9. ]
    10. }
    11. ],
    12. "tools": [
    13. {
    14. "type": "function",
    15. "function": {
    16. "name": "save_to_database",
    17. "description": "Save the parsed structured data to the specified database table",
    18. "parameters": {
    19. "type": "object",
    20. "properties": {
    21. "table": {"type": "string"},
    22. "dataset": {
    23. "type": "array",
    24. "minItems": 1,
    25. "items": {
    26. "type": "object",
    27. "properties": {
    28. "period": {"type": "string"},
    29. "metric": {"type": "string"},
    30. "value": {"type": "number"}
    31. },
    32. "required": ["period", "metric", "value"]
    33. }
    34. }
    35. },
    36. "required": ["table", "dataset"]
    37. }
    38. }
    39. }
    40. ]
    41. }

    If the model determines that a tool call is needed, it returns an assistant message containing tool_calls. The following data is illustrative:

    1. {
    2. "role": "assistant",
    3. "tool_calls": [
    4. {
    5. "id": "call_001",
    6. "type": "function",
    7. "function": {
    8. "name": "save_to_database",
    9. "arguments": "{\"table\": \"revenue_trend\", \"dataset\": [{\"period\": \"2026-Q3\", \"metric\": \"revenue\", \"value\": 12.5}]}"
    10. }
    11. }
    12. ]
    13. }

    After the code executes the function, return the result to the conversation as a tool message so the model can produce the final response:

    1. {
    2. "role": "tool",
    3. "tool_call_id": "call_001",
    4. "content": "{\"status\": \"ok\", \"inserted\": 1}"
    5. }

    In actual development, handle tool calls with these steps:

    1. Validate arguments against the JSON Schema. If fields are missing, types are wrong, or dataset is empty, do not write to the database. Return the error information to the model so it can regenerate the call.
    2. Retry the same request at most twice. If it still fails, hand it off to a human.
    3. Include an idempotency key when writing to the database, for example a hash computed from the concatenation of table, period, and metric. This prevents retries after a network timeout from creating duplicate records.
    4. Add secondary confirmation for tools that delete or overwrite data. Model-generated parameters cannot be treated as trusted input directly.

    3. Long Context: Window Size Is Not Usable Capacity

    Many models claim to support a 128k-token context window. The actual usable input must deduct the following: system prompt, tool definitions, conversation history, and output reserve. Images also consume tokens, and vendors calculate them differently.

    Use the following formulas for estimation:

    1. Available input limit ≈ context window − output reserve − system prompt and tool definitions − conversation history
    2. Document portion ≈ pages × average tokens per page + number of images × tokens per image

    Measure the average tokens per page and tokens per image with the vendor’s token-counting API. Do not rely on rules of thumb.

    Assume about 1,000 tokens per page. Three reports totaling 120 pages are about 120k tokens. With output reserve added, this is close to the upper limit of a 128k window. In this case, a single full-input pass leaves little margin.

    For whether to enable retrieval-augmented generation (RAG), start with a baseline: when the estimated input exceeds about 60% of the window, or the number of documents exceeds the range that can be processed reliably, use vector retrieval to filter relevant passages first. Adjust this ratio on your own data based on accuracy and cost.

    2. What Can MCP Do in Toolchain Integration?

    MCP (Model Context Protocol) connects external tools and data sources through a unified protocol. Common tool categories include data analysis, document processing, web retrieval, and code execution. The model selects an appropriate interface from the registered tool list, and developers only need to implement and register tools according to the protocol to extend model capabilities.

    When integrating tools, follow three recommendations: tool descriptions should clearly state inputs, outputs, and side effects; each tool should have timeouts and permissions; call logs should record parameters and mask sensitive fields.

    3. How Can Mixed Text and Images Avoid Placeholders Without Displaying Images?

    Model-generated Markdown or HTML may already contain correct image tags, but the page still shows only a placeholder box. The problem is usually in the rendering layer, not in the model output. Troubleshoot in this order:

    1. Image URL: Check whether it is a relative path without a base URL, or whether a signed URL has expired.
    2. Hotlink protection: If the image host checks the Referer, the browser request will be rejected.
    3. Mixed content: An HTTPS page loading an HTTP image will be blocked by the browser.
    4. Content Security Policy (CSP): If the page’s img-src does not include the image domain, the image will be blocked.
    5. Cross-Origin Resource Sharing (CORS): If the image is read through fetch or canvas, the server must return CORS response headers. This is usually not required when the image is displayed only with an img tag.
    6. Rich text sanitization: The sanitizer may remove the img tag or the src attribute.
    7. Markdown parsing: Confirm that the parser you use supports image syntax.

    A more robust approach is for the backend to proxy-download the image, validate Content-Type and file size, save it to your own storage or cache, and replace URLs in the model output with your own addresses. Also configure reasonable caching.