Specifications
Document Parsing
Extract fields from documents
Data Entry
Automate form filling
Schema Mapping
Complex nested structures
Prompting Recipe
System Prompt Format:Quick Start
- Transformers
- llama.cpp
Install:Run:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
🚀 New: LFM2-24B-A2B — our largest model is now available! Learn more →
1.2B parameter model for structured information extraction from documents
| Property | Value |
|---|---|
| Parameters | 1.2B |
| Context Length | 32K tokens |
| Task | Structured Extraction |
| Output Formats | JSON, XML, YAML |
temperature=0 (greedy decoding) for best results. This model is intended for single-turn conversations only.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"
pip install "transformers>=5.0.0" torch accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "LiquidAI/LFM2-1.2B-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:
- name: "Person's full name"
- email: "Email address"
- company: "Company name"
"""
user_input = "Contact John Smith at john.smith@acme.com. He works at Acme Corp."
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)
hf download LiquidAI/LFM2-1.2B-Extract-GGUF \
--local-dir ./LFM2-1.2B-Extract-GGUF
llama-cli -m ./LFM2-1.2B-Extract-GGUF/LFM2-1.2B-Extract-Q4_K_M.gguf \
-p "Extract name and email from: Contact John at john@example.com" \
--temp 0
Was this page helpful?