You need to enable JavaScript to run this app.
Lake AI Service

Lake AI Service

Copy page
Download PDF
Multimodal deep thinking
Multimodal deep reasoning (Doubao-1.5-thinking-vision-pro)
Copy page
Download PDF
Multimodal deep reasoning (Doubao-1.5-thinking-vision-pro)

Operator introduction

Description

Provides deep reasoning capabilities of large models in multimodal scenarios
Uses models with deep reasoning capabilities to analyze and understand images, videos, or text, and returns structured text output. The operator automatically constructs a message structure compliant with multimodal model specifications. Users only need to provide image, video, or text data as specified to complete inference.

Key features

  • Deep reasoning mechanism: The model automatically decomposes questions and performs logical reasoning before answering, generating a reasoning chain (reasoning_content)
  • Multimodal scenario support: Supports simultaneous input of images, videos, and text, and automatically assembles multimodal messages
  • Input simplification mechanism: Supports multiple data sources including local files, HTTP/HTTPS URLs, TOS/S3 object storage, and more. Visual understanding capabilities can be enabled through simple configuration.
  • Flexible reasoning mode: Supports controlling the deep reasoning mode via the thinking_type parameter (enabled / disabled / auto), allowing flexible trade-offs between answer quality and performance

Input and output specifications

  • Input format:
    • Images (images): Supports string or list formats
      • Supported data source types:
        • url: Network resource address, supports http/https/tos/s3. TOS/S3 will automatically generate a pre-signed URL
        • base64: Base64 encoded data
        • binary: Binary data (internally converted to Base64 encoding)
    • Videos (videos): Supports string or list formats. Data source types are consistent with images
    • Text (texts): Supports string or list formats, used as user prompt input

(Mixing string and list types in the same field is not allowed)

  • Output format:
    • Default mode: Returns struct type, including the following fields:
      • llm_result: The model's final answer content
      • reasoning_content: The model's reasoning chain / reasoning process
    • When the environment variable LAS_LLM_FINISH_REASON_CHECK=true is set, the struct will additionally include:
      • finish_reason: The reason for the model result ending. Possible values include:
        • stop: Normal termination
        • length: Exceeds token limit
        • content_filter: Matches content filtering policy
    • When the environment variable LAS_LLM_BOTS_REFERENCES=true is set, the struct will additionally include:
      • references: Retrieval results or external knowledge information referenced by the model, facilitating downstream transmission and parsing

Model capability enhancement

  • Chain-of-thought visualization: The reasoning process of the model is output via the reasoning_content field, making it easier to observe and review.
  • Result reliability control: The finish_reason field is used to identify abnormal termination cases, such as length truncation or content filtering.
  • Multimodal understanding: Supports mixed input parsing of images, videos, and text, suitable for complex multimodal scenarios.

Version compatibility note

This operator (ArkLLMThinkingVision) is used differently in Daft 0.6.5 (and earlier versions) compared to Daft 0.6.14 (and later versions).

  • In Daft 0.6.14 and later versions, you can specify the images, texts, and videos fields as input, corresponding to the model's image, text, and video inputs, and simultaneous input is supported. Here is an example:

    df = df.with_column(
    
            "llm_result",
    
            las_udf(
    
                ArkLLMThinkingVision,
    
                construct_args={
    
                    "model": "doubao-seed-1.6",
    
                    "system_text": "",
    
                    "inference_type": "online",
    
                },
    
            )(videos=col("videos"), texts=""),
    
        )
    
  • In Daft 0.6.5 and earlier versions, only video or image can be provided as input, and simultaneous input of video and image is not supported. The input type is specified via multimodal_type, which accepts "video", "image", and "text". It also supports providing text information by specifying the prompt parameter. Here is an example:

    df = df.with_column(
    
            "llm_result",
    
            las_udf(
    
                ArkLLMThinkingVision,
    
                construct_args={
    
                    "model": "doubao-seed-1.6",
    
                    "multimodal_type": "video",
    
                    "system_text": "",
    
                    "prompt": "",
    
                    "inference_type": "online",
    
                },
    
            )(col("videos")),
    
        )
    

Daft invocation

Operator parameters

Input

Input column name

Description

images

Provide the image data to be processed. Supports input of a single image (string) or multiple images (list). The data source is controlled by the source_type parameter: in url mode, http/https/tos/s3 and other protocol addresses are supported, where tos/s3 will be automatically converted to a pre-signed URL; in base64 mode, the image's Base64 encoding is used; in binary mode, binary data will be automatically converted to Base64 encoding.

videos

Provide the video data to be processed. Supports input of a single video (string) or multiple videos (list). The data source is controlled by the source_type parameter: in url mode, http/https/tos/s3 and other protocol addresses are supported, where tos/s3 will be automatically converted to a pre-signed URL; in base64 mode, the video's Base64 encoding is used; in binary mode, binary data will be automatically converted to Base64 encoding.

texts

Provide user text prompts. Supports input of a single text (string) or multiple texts (list).

Output

By default, the returned field type is struct and includes the following fields:

  • llm_result: Model output result
  • reasoning_content: Chain-of-thought content output by the model (reasoning process)

When the environment variable LAS_LLM_FINISH_REASON_CHECK=true is set, the struct will additionally include the following field:

  • finish_reason: The reason for model output termination. Common values include:
  • stop: Normal termination
  • length: Generated length has reached the upper limit
  • content_filter: Content safety/filtering policy triggered

When the environment variable LAS_LLM_BOTS_REFERENCES=true is set, the struct will additionally include the following field:

  • references: Reference information in JSON string format, used to carry external knowledge or citation results retrieved by the model, facilitating downstream parsing and display.

Both environment variables can be enabled simultaneously, in which case the struct will include all of the above fields.

Parameters

If a parameter does not have a default value, it is required.

Parameter name

Type

Default value

Description

model

str

Model name. Supported models include: Doubao model and DeepSeek model. For example: doubao-seed-1.6.

version

str or None

Model version. Enter the version information corresponding to the model. For example: 250115.

inference_type

str

batch

Inference type. Supports online inference and batch inference. The default value is batch, which uses batch inference. - online: Uses the online inference module provided by the ModelArk platform for inference. - batch: Uses the batch inference module provided by the ModelArk platform for inference.

system_text

str or None

System prompt content. The system prompt content is used as input to the model with the system role to uniformly constrain model behavior.

system_image_url

str or None

System image URL. In scenarios with mixed text and images, input the system image URL to guide the model's behavior.

system_video_url

str or None

System video URL. In scenarios with mixed text and videos, input the system video URL to guide the model's behavior.

image_format

str

jpeg

Image encoding format. The default is jpeg. Supported formats: JPEG, PNG, WEBP, GIF, BMP, TIFF, and other common formats.

image_url_detail

str or None

Image quality. Supports manual setting of image quality. Available values are high, low, and auto. - high: High detail mode, suitable for scenarios requiring understanding of image details, such as multiple local information/feature extraction, complex/rich detail image understanding, and more comprehensive understanding. - low: Low detail mode, suitable for simple image classification/recognition, overall content understanding/description, and similar scenarios, with faster understanding. - auto: Default mode. The selected mode may vary slightly depending on the model. For details, refer to the official documentation.

video_format

str

mp4

Video encoding format. Configure the video format. The default is mp4. Supported video formats: MP4, AVI, MOV. Each video file must be within 50 MB.

video_fps

float or None

Video frame rate. Value range: [0.2, 5]. Default value: 1. Extract a specified number of images from the video per second. The higher the value, the more detailed the understanding of changes in the video frames. The lower the value, the less sensitive to changes, but fewer tokens are used and speed is faster.

source_type

str

url

Data source type. Specifies the source format of the media data. The default is url. Optional values: - binary: raw binary data - base64: Base64-encoded data - url: network resource address (supports http/https/tos/s3), where tos/s3 will be automatically converted to a pre-signed URL

max_tokens

int or None

Maximum length of the model response (in tokens). The total length of input and output is limited by the model context.

max_completion_tokens

int or None

Maximum number of tokens generated by the model, including reasoning_content and content, but excluding the input messages. When exceeded, the model stops outputting reasoning_content and the response, and returns the finish_reason field as "length".

stop

list or None

Stop word list. When the model encounters a string specified in the stop field, it will stop generating further output. The string itself will not be included in the output. Up to 4 strings are supported. For example, ["你好", "天气"].

frequency_penalty

float

0

Frequency penalty coefficient. Frequency penalty coefficient. If the value is positive, new tokens will be penalized based on their frequency in the text, reducing the likelihood of the model repeating tokens verbatim. Value range: [-2.0, 2.0], default is 0.

presence_penalty

float

0

Presence penalty coefficient. Presence penalty coefficient. If the value is positive, new tokens will be penalized if they have already appeared in the text so far, increasing the likelihood that the model discusses new topics. Value range: [-2.0, 2.0]. Default value: 0.

temperature

float

1

Sampling temperature. The sampling temperature controls the degree of smoothing applied to the probability distribution of candidate words when generating text. - When set to 0, the model only considers the token with the highest log probability. - Higher values (such as 0.8) make the output more random, while lower values (such as 0.2) make the output more focused and deterministic. It is generally recommended to adjust only one of temperature or top_p, rather than both. The value range is [0, 2], with a default value of 1.

top_p

float

0.7

Nucleus sampling probability threshold. Nucleus sampling probability threshold. The model considers token results whose probability mass falls within top_p. When the value is 0, the model considers only the token with the highest log probability. 0.1 means only the top 10% of tokens by probability mass are considered. The higher the value, the greater the randomness in generation; the lower the value, the greater the determinism. The default value is 0.7.

logit_bias

dict or None

Adjusts the probability of specified tokens appearing in the model output, making the generated content better match specific preferences. The logit_bias field accepts a map value, where each key is a token ID from the vocabulary (obtained using the tokenization interface), and each value is the bias value for that token, with a range of [-100, 100]. -1 decreases the likelihood of selection, 1 increases the likelihood; -100 completely prohibits selection of that token, 100 causes only that token to be selectable. The actual effect of this parameter may vary depending on the model.

tools

list or None

Tool invocation configuration. List of tools to be invoked, which can be included in the model's returned information. To have the model return tools to be invoked, this structure must be configured.

thinking_type

str or None

Thinking mode. Controls whether the model enables deep thinking mode. If not configured, deep thinking mode is used by default and can be manually disabled. Optional values: - enabled: Thinking mode is enabled, and the model will always think before answering. - disabled: Thinking mode is disabled, and the model answers questions directly without thinking. - auto: Automatic thinking mode, where the model autonomously determines whether thinking is needed based on the question; simple questions are answered directly.

llm_config

dict or None

Custom LLM configuration. In addition to the parameters above, other parameters will be passed through to the model. The parameters above will override values in llm_config.

request_timeout

int

1200

Timeout. The timeout duration for a single request (in seconds).

max_concurrency

int

100

Concurrency. Maximum concurrency per process.

Examples

The following code demonstrates how to use daft to access the ModelArk multimodal deep reasoning model (Doubao series) for batch inference. Note that the results of each large model inference may vary.

from __future__ import annotations

import os

import daft
from daft import col
from daft.las.functions.ark_llm.ark_llm_thinking_vision import ArkLLMThinkingVision
from daft.las.functions.udf import las_udf

if os.getenv("DAFT_RUNNER", "native") == "ray":
    import logging

    import ray

    def configure_logging():
        logging.basicConfig(
            level=logging.INFO,
            format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
            datefmt="%Y-%m-%d %H:%M:%S.%s".format(),
        )
        logging.getLogger("tracing.span").setLevel(logging.WARNING)
        logging.getLogger("daft_io.stats").setLevel(logging.WARNING)
        logging.getLogger("DaftStatisticsManager").setLevel(logging.WARNING)
        logging.getLogger("DaftFlotillaScheduler").setLevel(logging.WARNING)
        logging.getLogger("DaftFlotillaDispatcher").setLevel(logging.WARNING)

    ray.init(dashboard_host="0.0.0.0", runtime_env={"worker_process_setup_hook": configure_logging})
    daft.set_runner_ray()

daft.set_execution_config(min_cpu_per_task=0)

if __name__ == "__main__":
    # The environment variable LAS_API_KEY must be configured: LAS_API_KEY is obtained by creating it on the LAS service page
    tos_dir_url = os.getenv("TOS_DIR_URL", "las-cn-beijing-public-online.tos-cn-beijing.volces.com")
    samples = {
        "videos": [
            f"https://{tos_dir_url}/public/shared_video_dataset/eating_56.mp4",
        ]
    }

    df = daft.from_pydict(samples)
    df = df.with_column(
        "llm_result",
        las_udf(
            ArkLLMThinkingVision,
            construct_args={
                "model": "doubao-1.5-thinking-vision-pro",
                "system_text": "",
                "inference_type": "online",
            },
        )(videos=col("videos")),
    )

    df = df.with_column("reasoning_content", col("llm_result")["reasoning_content"])
    df = df.with_column("llm_result", col("llm_result")["llm_result"])
    df.show()

    #  Output (each time the result of large language model inference may differ)
    # ╭────────────────────────────────┬────────────────────────────────────────────┬────────────────────────────────────────────╮
    # │ videos                         ┆ llm_result                                 ┆ reasoning_content                          │
    # │ ---                            ┆ ---                                        ┆ ---                                        │
    # │ Utf8                           ┆ Utf8                                       ┆ Utf8                                       │
    # ╞════════════════════════════════╪════════════════════════════════════════════╪════════════════════════════════════════════╡
    # │ https://las-public-data-qa.to… ┆ The video presents an animated segment: initially, it shows a        ┆ The user now needs to describe the content in the video. First, let's examine the scene:        │
    # │                                ┆ a multi-layer cartoon style...                              ┆ the beginning features a multi-layer cake...                             │
    # ╰────────────────────────────────┴────────────────────────────────────────────┴────────────────────────────────────────────╯
Last updated: 2026.05.12 19:06:30