Instructions to use LiquidAI/LFM3-1.7B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use LiquidAI/LFM3-1.7B-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf LiquidAI/LFM3-1.7B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf LiquidAI/LFM3-1.7B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf LiquidAI/LFM3-1.7B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use LiquidAI/LFM3-1.7B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/LFM3-1.7B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LiquidAI/LFM3-1.7B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
- Ollama
How to use LiquidAI/LFM3-1.7B-GGUF with Ollama:
ollama run hf.co/LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
- Unsloth Desktop
- Pi
How to use LiquidAI/LFM3-1.7B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "LiquidAI/LFM3-1.7B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use LiquidAI/LFM3-1.7B-GGUF with Docker Model Runner:
docker model run hf.co/LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
- Lemonade
How to use LiquidAI/LFM3-1.7B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.LFM3-1.7B-GGUF-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use LiquidAI/LFM3-1.7B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use LiquidAI/LFM3-1.7B-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf LiquidAI/LFM3-1.7B-GGUF:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "LiquidAI/LFM3-1.7B-GGUF:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
LFM3-1.7B BF16: WikiText perplexity sensitivity to BOS insertion.
hey hey hey, ran into this while testing lfm3-1.7b in llama.cpp. the gguf files in LiquidAI/LFM3-1.7B-GGUF have tokenizer.ggml.add_bos_token = false, so when you score raw text (llama-perplexity, plain completion, eval harnesses) the model never gets <|startoftext|> (id 124894) at the start. chat is fine since the template puts it in.
on wikitext-2 that makes a pretty big difference. ppl goes up ~42% at ctx 512 and ~16% at ctx 4096. once i force bos on, llama.cpp lands right on the transformers number, so the conversion itself looks fine, it's just the missing bos.
the hf tokenizer doesn't add it by default either (tok("Hello").input_ids gives [35808], no 124894), so raw text evals through transformers probably hit the same thing unless the harness adds bos itself.
numbers (bf16, wikitext-2 test):
ctx 512, 40 chunks
- llama.cpp as shipped (no bos): 20.9585 +/- 0.65926
- llama.cpp with bos forced on: 14.7372 +/- 0.43107
- transformers, bos in front, same scoring: 14.7322
ctx 4096, 5 chunks
- llama.cpp as shipped (no bos): 14.5160 +/- 0.42331
- llama.cpp with bos forced on: 12.5438 +/- 0.35262
- transformers, bos in front, same scoring: 12.5046
tokenization matches between the two btw, i checked 4,501 of 4,501 tokens on the first 20k characters and the ids are identical.
setup:
- gguf: LiquidAI/LFM3-1.7B-GGUF, LFM3-1.7B-BF16.gguf, repo revision 4b423c332fd97961416f2e8b69467758fd27370d, sha256 39158a79f56edb85e0c4252ce6447b8d7883ef82ffedd02f0cda7c84da5e9f68
- metadata: tokenizer.ggml.add_bos_token = false, tokenizer.ggml.bos_token_id = 124894
- original: LiquidAI/LFM3-1.7B in bfloat16, trust_remote_code=True
- llama.cpp: version 0.8.0-dev (build 1, commit 604cc43), master from 2026-10-28, appleclang 21 on apple silicon (metal)
- data: wikitext-2 raw test, wiki.test.raw (1,290,590 bytes, sha256 173c87a53759e0201f33e0ccf978e510c2042d7f2cb78229d9a50d79b9e7dd08). no preprocessing, the raw file goes straight into -f. on the transformers side i read the whole file as one string and tokenize with add_special_tokens=False
commands, as shipped:
llama-perplexity -m LFM3-1.7B-BF16.gguf -f wiki.test.raw -c 512 --chunks 40 -ngl 99 -t 4
llama-perplexity -m LFM3-1.7B-BF16.gguf -f wiki.test.raw -c 4096 --chunks 5 -ngl 99 -t 4
with bos forced on:
llama-perplexity -m LFM3-1.7B-BF16.gguf -f wiki.test.raw -c 512 --chunks 40 -ngl 99 -t 4 --override-kv tokenizer.ggml.add_bos_token=bool:true
llama-perplexity -m LFM3-1.7B-BF16.gguf -f wiki.test.raw -c 4096 --chunks 5 -ngl 99 -t 4 --override-kv tokenizer.ggml.add_bos_token=bool:true
for the transformers number i scored it the same way llama-perplexity does: tokenize the whole text once with bos in front, cut into ctx sized chunks, swap each chunk's first token for bos, only score the second half of each chunk.
import math, torch
from transformers import AutoModelForCausalLM, AutoTokenizer
C, N = 512, 40 # and 4096, 5
tok = AutoTokenizer.from_pretrained("LiquidAI/LFM3-1.7B", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM3-1.7B", dtype=torch.bfloat16,
trust_remote_code=True).to("mps").eval()
ids = [tok.bos_token_id] + tok(open("wiki.test.raw").read(), add_special_tokens=False).input_ids
first, nll, n = C // 2, 0.0, 0
with torch.no_grad():
for i in range(N):
chunk = ids[i * C:(i + 1) * C]
chunk[0] = tok.bos_token_id
x = torch.tensor([chunk], device="mps")
lg = model(input_ids=x).logits[0, first:C - 1].float()
nll += torch.nn.functional.cross_entropy(lg, x[0, first + 1:], reduction="sum").item()
n += C - 1 - first
print(f"PPL = {math.exp(nll / n):.4f}")
probably the fix is just add_bos_token = true in the gguf metadata (and tokenizer_config.json if raw text is supposed to match training). since the chat template already writes the token, might be worth checking chat prompts don't end up with two of them after that, i didn't test that part. might also be worth a note on the model card in the meantime, third party raw text benchmarks of lfm3 (perplexity, lm-eval loglikelihood stuff) could be underselling it.
Find me on x if you have more questions : iimmyNWJS