Skip to main content
← Back to Liquid Nanos 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.

Specifications

PropertyValue
Parameters350M
Context Length32K tokens
TaskStructured Extraction
Output FormatsJSON, XML, YAML

Edge Deployment

Runs on mobile devices

Low Latency

Fastest extraction model

Batch Processing

High-volume extraction

Prompting Recipe

Use temperature=0 (greedy decoding) for best results. This model is intended for single-turn conversations only.
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

Install:
pip install transformers torch
Run:
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").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)