Using LFM2.5-VL? See LFM2.5-VL for its examples, including document layout annotations.
torchvision and Pillow are required by the LFM3-VL image processor, and torchcodec decodes videos. torchcodec needs FFmpeg.
AutoProcessor and AutoModelForImageTextToText. LFM3-VL ships its model code in the checkpoint, so pass trust_remote_code=True.
<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.
Answer without reasoning
For simple questions, setenable_thinking=False to skip the reasoning and get a direct answer with lower latency.
Multi-image prompt
You can include multiple images in a single prompt. Label each image in the prompt, such asMedia-1 and Media-2, to make cross-image references clearer.
OCR
LFM3-VL can read text in document images and screenshots.
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.

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 withx / 1000 * widthandy / 1000 * height. Points and boxes are approximate, so visually inspect the result before using coordinates in downstream workflows.

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.
Tool calling
In this example, the model sees an image and can route the request to the most relevant tool. Pass the tool schemas toapply_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.
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.
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.
LFM2.5-VL multi-image prompt
Model support: This capability is best supported by LFM2.5-VL-3B.
Media-1 and Media-2, to make cross-image references clearer.

LFM2.5-VL OCR
Model support: This capability is best supported by LFM2.5-VL-3B.
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.
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:[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.

LFM2.5-VL object detection and grounding
Model support: This capability is best supported by LFM2.5-VL-3B.
Coordinate format: The grounding examples use normalized[0, 1000]coordinates. Convert them back to pixels withx / 1000 * widthandy / 1000 * height. Boxes are approximate, so visually inspect the result before using coordinates in downstream workflows.

LFM2.5-VL tool calling
Model support: This capability is best supported by LFM2.5-VL-3B.
FAQ
Which LFM vision model should I use? UseLFM3-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.