> ## Documentation Index
> Fetch the complete documentation index at: https://liquidai-codex-model-library-starting-point.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# LFM2-350M-Extract

> 350M parameter extraction model (deprecated - use LFM2.5-350M instead)

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

<Warning>
  This model is deprecated. Use [LFM2.5-350M](/lfm/models/lfm25-350m) for compact structured extraction with the latest 350M checkpoint.
</Warning>

LFM2-350M-Extract is the fastest extraction model, optimized for edge deployment with strict memory and compute constraints. It delivers structured data extraction with minimal latency.

<div style={{display: 'flex', gap: '0.5rem', margin: '0.5rem 0 1.5rem 0'}}>
  <a href="https://huggingface.co/LiquidAI/LFM2-350M-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-350M-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>
  <a href="https://huggingface.co/onnx-community/LFM2-350M-Extract-ONNX" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#86efac'}}><span style={{color: '#000'}}>ONNX</span></a>
</div>

## Specifications

| Property       | Value                 |
| -------------- | --------------------- |
| Parameters     | 350M                  |
| Context Length | 32K tokens            |
| Task           | Structured Extraction |
| Output Formats | JSON, XML, YAML       |

<div className="use-cases">
  <CardGroup cols={3}>
    <Card title="Edge Deployment" icon="microchip">
      Runs on mobile devices
    </Card>

    <Card title="Low Latency" icon="bolt">
      Fastest extraction model
    </Card>

    <Card title="Batch Processing" icon="layer-group">
      High-volume extraction
    </Card>
  </CardGroup>
</div>

## Prompting Recipe

<Warning>
  Use `temperature=0` (greedy decoding) for best results. This model is intended for single-turn conversations only.
</Warning>

**System Prompt Format:**

```
Identify and extract information matching the following schema.
Return data as a JSON object. Missing data should be omitted.

Schema:
- field_name: "Description of what to extract"
- nested_object:
  - nested_field: "Description"
```

## Quick Start

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

    ```bash theme={null}
    pip install "transformers>=5.2.0" torch accelerate
    ```

    **Run:**

    ```python theme={null}
    from transformers import AutoTokenizer, AutoModelForCausalLM

    model_id = "LiquidAI/LFM2-350M-Extract"
    tokenizer = AutoTokenizer.from_pretrained(model_id)
    model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")

    system_prompt = """Identify and extract information matching the following schema.
    Return data as a JSON object. Missing data should be omitted.

    Schema:
    - product: "Product name"
    - price: "Price in dollars"
    - quantity: "Number of items"
    """

    user_input = "Order: 5 units of Widget Pro at $29.99 each"

    messages = [
        {"role": "system", "content": system_prompt},
        {"role": "user", "content": user_input}
    ]

    inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True).to(model.device)
    outputs = model.generate(**inputs, max_new_tokens=256, temperature=0, do_sample=False)
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    print(response)
    ```
  </Tab>

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

    ```bash theme={null}
    hf download LiquidAI/LFM2-350M-Extract-GGUF \
      --local-dir ./LFM2-350M-Extract-GGUF
    ```

    **Run:**

    ```bash theme={null}
    llama-cli -m ./LFM2-350M-Extract-GGUF/LFM2-350M-Extract-Q4_K_M.gguf \
      -p "Extract product info from: 3 laptops at $999 each" \
      --temp 0
    ```
  </Tab>
</Tabs>
