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.
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.
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.

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.

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.

Tool calling
Model support: This capability is best supported by LFM2.5-VL-3B.
FAQ
Which LFM2.5-VL model should I use? UseLFM2.5-VL-450M or LFM2.5-VL-1.6B for fast image captioning and visual question answering. Use LFM2.5-VL-3B for the strongest support for multi-image prompts, grounding, document layout parsing, and tool calling.
What image formats are supported?
LFM2.5-VL works with common image formats supported by the image loading path you use, such as JPEG and PNG. In the examples above, images are loaded from Hugging Face URLs with transformers.image_utils.load_image.
Can LFM2.5-VL return bounding boxes?
Yes. For grounding tasks, prompt the model to return bounding boxes in a structured format such as JSON. Coordinates in these examples are normalized to [0, 1000], so you can scale them back to the displayed image size.
Note that bounding boxes are approximate and can vary with prompt wording, image resolution, and generation settings. For workflows that require precise localization, inspect the returned boxes and validate them against the original image.
Can LFM2.5-VL parse documents?
Yes. LFM2.5-VL-3B can read visible text and return document layout annotations, including region labels, bounding boxes, and extracted content. This is useful for tables, forms, screenshots, reports, and other structured document images.
Can LFM2.5-VL 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. For example, an image can help determine the right tool arguments.
Can LFM2.5-VL generate or edit images?
No. LFM2.5-VL models are image understanding models. They can analyze images, answer questions, read text, localize objects, parse layouts, and route tool calls, but they do not generate or edit images.