Skip to main content
LFM vision models’ capabilities enable the model to analyze and understand images and, with LFM3-VL, videos. These models support common vision-language tasks such as describing images, answering questions about visual content, comparing multiple images, reading text, and localizing objects. They also support tool calling, including examples where an image helps determine the tool arguments. LFM3-VL is the latest generation: it reasons step by step before answering, takes video as input, and points at objects natively. The examples below show how to send images and videos to LFM3-VL models.
Using LFM2.5-VL? See LFM2.5-VL for its examples, including document layout annotations.
Install PyTorch, Transformers, and the image and video packages used by the examples. torchvision and Pillow are required by the LFM3-VL image processor, and torchcodec decodes videos. torchcodec needs FFmpeg.
Load the model with AutoProcessor and AutoModelForImageTextToText. LFM3-VL ships its model code in the checkpoint, so pass trust_remote_code=True.
LFM3-VL thinks in a <think> block before it answers, and reasoning can be long. The helper below generates with the recommended sampling parameters (temperature=0.1, top_k=50, repetition_penalty=1.1), then splits the reasoning from the answer.

Single-image prompt

Provide one image and a text question in the same user message. This pattern is useful for captioning, visual question answering, and scene understanding.
Output Input image

Answer without reasoning

For simple questions, set enable_thinking=False to skip the reasoning and get a direct answer with lower latency.
Output

Multi-image prompt

You can include multiple images in a single prompt. Label each image in the prompt, such as Media-1 and Media-2, to make cross-image references clearer.

OCR

LFM3-VL can read text in document images and screenshots.
Output (truncated) Input image

Pointing

Pointing asks the model to locate visible objects with a single point each. LFM3-VL points natively as {"point_2d": [x, y]}, with x and y as integers normalized to [0, 1000]. This example asks for a point on each cat and each remote control, then draws the points.
Output
Points drawn on the cats and remote controls

Object detection and grounding

Grounding asks the model to localize visible objects with bounding boxes. This example uses the same image, asks for boxes in [xmin, ymin, xmax, ymax] format normalized to [0, 1000], then draws the returned boxes.
Coordinate format: Convert normalized coordinates back to pixels with x / 1000 * width and y / 1000 * height. Points and boxes are approximate, so visually inspect the result before using coordinates in downstream workflows.
Output
Bounding boxes drawn around the cats and remote controls

Video understanding

LFM3-VL takes video as input. Videos are processed at their native resolution: they are sampled at 2 frames per second, consecutive frames are paired, and each frame is prefixed with its timestamp. Pass a local video path with {"type": "video", "video": ...}. This example uses a short clip from the Hugging Face test videos.
Output
To also use a video’s soundtrack, use LFM3-Omni-2B. See Omni Capabilities.

Tool calling

In this example, the model sees an image and can route the request to the most relevant tool. Pass the tool schemas to apply_chat_template() with tools=.... LFM3-VL writes each call between <tool_call> and </tool_call>, with the function name in a <function=...> tag and each argument in a <parameter=...> tag.
Output
Execute the call in your application, add the parsed call to the conversation as a tool_calls entry, and return the result as a tool message. See Tool Use for the full workflow.

LFM2.5-VL

LFM2.5-VL models answer directly without a reasoning trace and use the LFM2.5 tool call format. LFM2.5-VL-3B also returns document layout annotations. Install PyTorch, Transformers, and the image-processing packages used by the examples. torchvision and Pillow are required by the LFM2.5-VL image processor, and opencv-python is used to draw grounding and layout boxes.
Load the model with AutoProcessor and AutoModelForImageTextToText, matching the standard LFM2.5-VL documentation examples. Start with LiquidAI/LFM2.5-VL-450M or LiquidAI/LFM2.5-VL-1.6B for fast iteration. Use LFM2.5-VL-3B for the strongest grounding, layout parsing, and tool-calling examples.

LFM2.5-VL single-image prompt

Provide one image and a text question in the same user message. This pattern is useful for captioning, visual question answering, and scene understanding.
Output Cell 7 output

LFM2.5-VL multi-image prompt

Model support: This capability is best supported by LFM2.5-VL-3B.
You can include multiple images in a single prompt. Label each image in the prompt, such as Media-1 and Media-2, to make cross-image references clearer.
Output
Media-1 inputMedia-2 input

LFM2.5-VL OCR

Model support: This capability is best supported by LFM2.5-VL-3B.
LFM2.5-VL can read text in document images and, with LFM2.5-VL-3B, return structured layout annotations, which can be used to visualize the parsed layout regions.
Image quality: OCR and layout parsing work best when text is legible and the image is not blurry, rotated, or heavily compressed. For dense documents, crop to the relevant page or region when possible.
Output Cell 11 output

Document layout annotations

For document understanding tasks, LFM2.5-VL-3B can return OCR with layout annotations. Each region contains a label, normalized bounding box, and content:
Coordinates are normalized integers in [0, 1000], matching the grounding format. If you want to visualize these boxes, scale the coordinates back to pixels with the same x / 1000 * width and y / 1000 * height pattern used in the grounding example.
Output
Cell 13 output

LFM2.5-VL object detection and grounding

Model support: This capability is best supported by LFM2.5-VL-3B.
Grounding asks the model to localize visible objects and return normalized coordinates. This example uses a COCO sample image with cats and remote controls, then draws the returned boxes with OpenCV.
Coordinate format: The grounding examples use normalized [0, 1000] coordinates. Convert them back to pixels with x / 1000 * width and y / 1000 * height. Boxes are approximate, so visually inspect the result before using coordinates in downstream workflows.
Output
Cell 15 output

LFM2.5-VL tool calling

Model support: This capability is best supported by LFM2.5-VL-3B.
In this example, the model sees an image and can route the request to the most relevant tool. The tool schemas are generic enough to adapt to real catalog, search, or workflow APIs.
Output Cell 17 output

FAQ

Which LFM vision model should I use? Use LFM3-VL-2B for most use cases, including video understanding, harder visual questions that benefit from reasoning, pointing, and grounding. Among LFM2.5-VL models, use LFM2.5-VL-450M or LFM2.5-VL-1.6B for fast image captioning and visual question answering, and LFM2.5-VL-3B for document layout parsing. Can I turn off reasoning? Yes, for LFM3-VL. Pass enable_thinking=False to apply_chat_template() for direct answers with lower latency. LFM2.5-VL models always answer directly. What image and video formats are supported? LFM vision models work with common image formats such as JPEG and PNG. In the examples above, images are loaded from Hugging Face URLs with transformers.image_utils.load_image. LFM3-VL also takes video files that torchcodec can decode, such as MP4. Can the models point at or localize objects? Yes. Prompt LFM3-VL to return points as {"point_2d": [x, y]} or bounding boxes as bbox_2d: [xmin, ymin, xmax, ymax], with coordinates normalized to [0, 1000]. LFM2.5-VL returns bounding boxes in the same format. Boxes and points are approximate and can vary with prompt wording, image resolution, and generation settings. For workflows that require precise localization, inspect the returned coordinates and validate them against the original image. Can the models parse documents? Yes. LFM3-VL reads visible text in documents and screenshots. LFM2.5-VL-3B can also return document layout annotations, including region labels, bounding boxes, and extracted content. Can the models call tools based on an image? Yes. You can provide tool schemas through the chat template and ask the model to choose the relevant tool based on the visual content. LFM3-VL uses the LFM3 <tool_call> format, and LFM2.5-VL uses the LFM2.5 format. See Tool Use. Can the models generate or edit images? No. LFM vision models are image and video understanding models. They can analyze images and videos, answer questions, read text, localize objects, parse layouts, and route tool calls, but they do not generate or edit images.