350M parameter extraction model for edge deployment
← Back to Liquid NanosLFM2-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.
Use temperature=0 (greedy decoding) for best results. This model is intended for single-turn conversations only.
System Prompt Format:
Copy
Ask AI
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"
from transformers import AutoTokenizer, AutoModelForCausalLMmodel_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)