Instructions to use QuantFactory/LFM2-350M-Extract-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/LFM2-350M-Extract-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantFactory/LFM2-350M-Extract-GGUF")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/LFM2-350M-Extract-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/LFM2-350M-Extract-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/LFM2-350M-Extract-GGUF", filename="LFM2-350M-Extract.Q2_K.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/LFM2-350M-Extract-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/LFM2-350M-Extract-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/LFM2-350M-Extract-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/LFM2-350M-Extract-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M
- SGLang
How to use QuantFactory/LFM2-350M-Extract-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "QuantFactory/LFM2-350M-Extract-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/LFM2-350M-Extract-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "QuantFactory/LFM2-350M-Extract-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/LFM2-350M-Extract-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use QuantFactory/LFM2-350M-Extract-GGUF with Ollama:
ollama run hf.co/QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/LFM2-350M-Extract-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/LFM2-350M-Extract-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/LFM2-350M-Extract-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/LFM2-350M-Extract-GGUF to start chatting
- Docker Model Runner
How to use QuantFactory/LFM2-350M-Extract-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/LFM2-350M-Extract-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/LFM2-350M-Extract-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.LFM2-350M-Extract-GGUF-Q4_K_M
List all available models
lemonade list
aashish1904/LFM2-350M-Extract-GGUF
This is quantized version of LiquidAI/LFM2-350M-Extract created using llama.cpp
Original Model Card
LFM2-350M-Extract
Based on LFM2-350M, LFM2-350M-Extract is designed to extract important information from a wide variety of unstructured documents (such as articles, transcripts, or reports) into structured outputs like JSON, XML, or YAML.
Use cases:
- Extracting invoice details from emails into structured JSON.
- Converting regulatory filings into XML for compliance systems.
- Transforming customer support tickets into YAML for analytics pipelines.
- Populating knowledge graphs with entities and attributes from unstructured reports.
You can find more information about other task-specific models in this blog post.
π Model details
Generation parameters: We strongly recommend using greedy decoding with a temperature=0.
System prompt: If no system prompt is provided, the model will default to JSON outputs. We recommend providing a system prompt with a specific format (JSON, XML, or YAML) and a given schema to improve accuracy (see the following example).
Supported languages: English, Arabic, Chinese, French, German, Japanese, Korean, Portuguese, and Spanish.
Chat template: LFM2 uses a ChatML-like chat template as follows:
<|startoftext|><|im_start|>system
Return data as a JSON object with the following schema:\n[...]<|im_end|>
<|im_start|>user
Caenorhabditis elegans is a free-living transparent nematode about 1 mm in length that lives in temperate soil environments.<|im_end|>
<|im_start|>assistant
{
"species": "C. elegans",
"genus": "Caenorhabditis",
"description": "A free-living transparent nematode about 1 mm in length that lives in temperate soil environments.",
[...]{<|im_end|>
You can automatically apply it using the dedicated .apply_chat_template() function from Hugging Face transformers.
β οΈ The model is intended for single-turn conversations.
The data used for training these models was primarily synthetic, which allowed us to ensure a diverse data mix. We used a range of document types, domains, styles, lengths, and languages. We also varied the density and distribution of relevant text in the documents. In some cases, the extracted information was clustered in one part of the document; in others, itβs spread throughout. We applied the same approach of ensuring diversity when creating synthetic user requests and designing the structure of the model outputs. The data generation process underwent many iterations, incorporating ideas and feedback from across the Liquid AI team.
π Performance
We evaluated LFM2-Extract on a dataset of 5,000 documents, covering over 100 topics with a mix of writing styles, ambiguities, and formats. We used a combination of five metrics to capture a balanced view on syntax, accuracy, and faithfulness:
- Syntax score: Checks whether outputs parse cleanly as valid JSON, XML, or YAML.
- Format accuracy: Verifies that outputs match the requested format (e.g., JSON when JSON is requested).
- Keyword faithfulness: Measures whether values in the structured output actually appear in the input text.
- Absolute scoring: A judge LLM scores quality on a 1-5 scale, assessing completeness and correctness of extractions.
- Relative scoring: We ask a judge LLM to choose the best answer between the extraction modelβs output and the ground-truth answer.
LFM2-350M-Extract outperforms Gemma 3 4B at this task, a model more than 11x its size.
π How to run
- Hugging Face: LFM2-350M
- llama.cpp: LFM2-350M-Extract-GGUF
- LEAP: LEAP model library
π¬ Contact
If you are interested in custom solutions with edge deployment, please contact our sales team.
- Downloads last month
- 200
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
Model tree for QuantFactory/LFM2-350M-Extract-GGUF
Base model
LiquidAI/LFM2-350M
