Instructions to use QuantFactory/LFM2-1.2B-Tool-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/LFM2-1.2B-Tool-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantFactory/LFM2-1.2B-Tool-GGUF")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/LFM2-1.2B-Tool-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/LFM2-1.2B-Tool-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/LFM2-1.2B-Tool-GGUF", filename="LFM2-1.2B-Tool.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-1.2B-Tool-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-1.2B-Tool-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/LFM2-1.2B-Tool-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-1.2B-Tool-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/LFM2-1.2B-Tool-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-1.2B-Tool-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/LFM2-1.2B-Tool-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-1.2B-Tool-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/LFM2-1.2B-Tool-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/LFM2-1.2B-Tool-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/LFM2-1.2B-Tool-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/LFM2-1.2B-Tool-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-1.2B-Tool-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/QuantFactory/LFM2-1.2B-Tool-GGUF:Q4_K_M
- SGLang
How to use QuantFactory/LFM2-1.2B-Tool-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-1.2B-Tool-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-1.2B-Tool-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-1.2B-Tool-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-1.2B-Tool-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use QuantFactory/LFM2-1.2B-Tool-GGUF with Ollama:
ollama run hf.co/QuantFactory/LFM2-1.2B-Tool-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/LFM2-1.2B-Tool-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-1.2B-Tool-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-1.2B-Tool-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-1.2B-Tool-GGUF to start chatting
- Docker Model Runner
How to use QuantFactory/LFM2-1.2B-Tool-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/LFM2-1.2B-Tool-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/LFM2-1.2B-Tool-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/LFM2-1.2B-Tool-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.LFM2-1.2B-Tool-GGUF-Q4_K_M
List all available models
lemonade list
aashish1904/LFM2-1.2B-Tool-GGUF
This is quantized version of LiquidAI/LFM2-1.2B-Tool created using llama.cpp
Original Model Card
LFM2-1.2B-Tool
Based on LFM2-1.2B, LFM2-1.2B-Tool is designed for concise and precise tool calling. The key challenge was designing a non-thinking model that outperforms similarly sized thinking models for tool use.
Use cases:
- Mobile and edge devices requiring instant API calls, database queries, or system integrations without cloud dependency.
- Real-time assistants in cars, IoT devices, or customer support, where response latency is critical.
- Resource-constrained environments like embedded systems or battery-powered devices needing efficient tool execution.
You can find more information about other task-specific models in this blog post.
π Model details
Generation parameters: We recommend using greedy decoding with a temperature=0.
System prompt: The system prompt must provide all the available tools
Supported languages: English, Arabic, Chinese, French, German, Japanese, Korean, Portuguese, and Spanish.
Tool use: It consists of four main steps:
- Function definition: LFM2 takes JSON function definitions as input (JSON objects between
<|tool_list_start|>and<|tool_list_end|>special tokens), usually in the system prompt - Function call: LFM2 writes Pythonic function calls (a Python list between
<|tool_call_start|>and<|tool_call_end|>special tokens), as the assistant answer. - Function execution: The function call is executed and the result is returned (string between
<|tool_response_start|>and<|tool_response_end|>special tokens), as a "tool" role. - Final answer: LFM2 interprets the outcome of the function call to address the original user prompt in plain text.
Here is a simple example of a conversation using tool use:
<|startoftext|><|im_start|>system
List of tools: <|tool_list_start|>[{"name": "get_candidate_status", "description": "Retrieves the current status of a candidate in the recruitment process", "parameters": {"type": "object", "properties": {"candidate_id": {"type": "string", "description": "Unique identifier for the candidate"}}, "required": ["candidate_id"]}}]<|tool_list_end|><|im_end|>
<|im_start|>user
What is the current status of candidate ID 12345?<|im_end|>
<|im_start|>assistant
<|tool_call_start|>[get_candidate_status(candidate_id="12345")]<|tool_call_end|>Checking the current status of candidate ID 12345.<|im_end|>
<|im_start|>tool
<|tool_response_start|>{"candidate_id": "12345", "status": "Interview Scheduled", "position": "Clinical Research Associate", "date": "2023-11-20"}<|tool_response_end|><|im_end|>
<|im_start|>assistant
The candidate with ID 12345 is currently in the "Interview Scheduled" stage for the position of Clinical Research Associate, with an interview date set for 2023-11-20.<|im_end|>
β οΈ The model supports both single-turn and multi-turn conversations.
π Performance
For edge inference, latency is a crucial factor in delivering a seamless and satisfactory user experience. Consequently, while test-time-compute inherently provides more accuracy, it ultimately compromises the user experience due to increased waiting times for function calls.
Therefore, the goal was to develop a tool calling model that is competitive with thinking models, yet operates without any internal chain-of-thought process.
We evaluated each model on a proprietary benchmark that was specifically designed to prevent data contamination. The benchmark ensures that performance metrics reflect genuine tool-calling capabilities rather than memorized patterns from training data.
π 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
- 549
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
Model tree for QuantFactory/LFM2-1.2B-Tool-GGUF
Base model
LiquidAI/LFM2-1.2B
