> ## Documentation Index
> Fetch the complete documentation index at: https://docs.liquid.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LFM2.5-VL-1.6B-Extract

> Vision extraction Nano for structured JSON extraction from images

<a href="/lfm/models/liquid-nanos" className="back-button">← Back to Liquid Nanos</a>

LFM2.5-VL-1.6B-Extract extracts user-defined fields from images and returns structured JSON. It extends the Extract family to vision workflows, using a YAML field list in the system prompt to define exactly what to extract.

<div style={{display: 'flex', gap: '0.5rem', margin: '0.5rem 0 1.5rem 0'}}>
  <a href="https://huggingface.co/LiquidAI/LFM2.5-VL-1.6B-Extract" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#fbbf24'}}><span style={{color: '#000'}}>HF</span></a>
  <a href="https://huggingface.co/LiquidAI/LFM2.5-VL-1.6B-Extract-GGUF" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#60a5fa'}}><span style={{color: '#000'}}>GGUF</span></a>
</div>

## Specifications

| Property       | Value                                        |
| -------------- | -------------------------------------------- |
| Parameters     | 1.6B total (1.2B LM + \~400M vision encoder) |
| Context Length | 128K tokens                                  |
| Image Input    | Single image, dynamic resolution             |
| Task           | Vision structured extraction                 |
| Output Format  | JSON                                         |

<div className="use-cases">
  <CardGroup cols={3}>
    <Card title="Image Inspection" icon="eye">
      Extract visual attributes into JSON.
    </Card>

    <Card title="Retail Tagging" icon="tags">
      Auto-tag product images with structured fields.
    </Card>

    <Card title="Safety Signals" icon="shield-alert">
      Detect visual events for automated workflows.
    </Card>
  </CardGroup>
</div>

## Prompting Recipe

<Warning>
  Use greedy decoding for best results. This model is intended for single-image, single-turn extraction.
</Warning>

Describe the fields to extract as YAML in the system prompt, then provide the image as the user message.

```yaml theme={"theme":{"light":"github-light","dark":"github-dark"}}
wood_color: The overall coloration of the wood surface
wood_texture: The tactile quality of the wood surface
wood_pattern: The pattern types visible on the wood surface
```

## Quick Start

<Tabs>
  <Tab title="Transformers">
    **Install:**

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    pip install "transformers>=5.1.0" pillow torch accelerate
    ```

    **Run:**

    ```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    from transformers import AutoModelForImageTextToText, AutoProcessor
    from transformers.image_utils import load_image

    model_id = "LiquidAI/LFM2.5-VL-1.6B-Extract"
    model = AutoModelForImageTextToText.from_pretrained(
        model_id,
        device_map="auto",
        dtype="bfloat16",
        trust_remote_code=True,
    )
    processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)

    image = load_image("https://huggingface.co/LiquidAI/LFM2.5-VL-1.6B-Extract/resolve/main/sample_image.png")
    fields_yaml = """wood_color: The overall coloration of the wood surface
    wood_texture: The tactile quality of the wood surface
    wood_pattern: The pattern types visible on the wood surface"""

    system_prompt = f"""Extract the following from the image:

    {fields_yaml}

    Respond with only a JSON object. Do not include any text outside the JSON."""

    conversation = [
        {"role": "system", "content": system_prompt},
        {"role": "user", "content": [{"type": "image", "image": image}]},
    ]

    inputs = processor.apply_chat_template(
        conversation,
        add_generation_prompt=True,
        return_tensors="pt",
        return_dict=True,
        tokenize=True,
    ).to(model.device)

    outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False)
    response = processor.batch_decode(
        outputs[:, inputs["input_ids"].shape[1]:],
        skip_special_tokens=True,
    )[0]
    print(response)
    ```
  </Tab>

  <Tab title="llama.cpp">
    **Run GGUF:**

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    llama-server -hf LiquidAI/LFM2.5-VL-1.6B-Extract-GGUF:Q4_K_M

    llama-cli -hf LiquidAI/LFM2.5-VL-1.6B-Extract-GGUF:F16 \
      -p "wood_color: The overall coloration of the wood surface" \
      --image ./image.jpg
    ```
  </Tab>
</Tabs>
