Use AIUnderstand AIBuild with AI
Build with AI·Model deep dive·· 5 min read

LFM3-1.7B: A 1.7B Agent Model That Fits in About 1 GB at 4-bit

Liquid AI's LFM3-1.7B is a text model for local agents and tool calling with a 256K-token context. Run it with Transformers and wire up a tool call.

The code in this post comes from the model's docs and hasn't been run in our CI yet. If something breaks, let us know.

LFM3-1.7B is a 1.73B-parameter text model from Liquid AI, built for local agents, tool calling, structured outputs and domain-specific fine-tuning. It uses a “tri-hybrid” architecture and has a 256K-token context window. Per the card, at 4-bit precision it takes about 1 GB of memory, so it fits on a phone or laptop.

Key specs

Parameters 1.73B
Architecture 24 layers: 13 gated short convolutions, 5 sliding-window attention, 6 global attention
Context length 256K tokens (input + output)
Vocabulary 128,000 tokens
Languages English, Arabic, Chinese, French, German, Italian, Japanese, Korean, Portuguese, Spanish, Vietnamese, Thai, Indonesian, Hindi, Russian, Polish
Checkpoint Post-trained, text-only
License LFM Open License v1.0 (license: other; read the LICENSE file in the repo)

The card lists checkpoints for different runtimes: BF16 (vLLM, SGLang, Transformers), FP8 and NVFP4 (SGLang), GGUF (llama.cpp, Ollama, LM Studio), MLX 4-bit for Apple Silicon, and ONNX. This post uses the BF16 repo with Transformers.

What the card reports

Liquid AI’s own benchmark table compares LFM3-1.7B with LFM2.5 2.6B, MiniCPM5 2B, Gemma 4 E4B, Qwen3.5 4B and Qwen3.5 9B. A few rows relevant to agent work:

Benchmark LFM3-1.7B Qwen3.5 9B MiniCPM5 2B
BFCL V4 (tool use) 71.39 62.83 62.65
WebArena-Verified 38.42 28.94 9.11
IFEval 96.66 92.08 87.83
SWE-bench Verified (OpenCode) 43.40 51.20 34.80
GPQA Diamond 63.37 80.40 65.15

The card says the model “can power agentic applications that used to need 9B parameters.” The table shows that is not uniform: Qwen3.5 9B scores higher on SWE-bench Verified and GPQA Diamond. These are vendor-reported numbers, so check them on your own tasks.

Install and run

The card’s quick start uses the transformers pipeline with trust_remote_code=True. It doesn’t give an install command, so set up transformers and a backend your own way.

chat.py
from transformers import pipeline
generator = pipeline(
"text-generation",
model="LiquidAI/LFM3-1.7B",
trust_remote_code=True,
)
messages = [{"role": "user", "content": "What is C. elegans?"}]
output = generator(
messages,
do_sample=True,
temperature=0.1,
top_k=50,
repetition_penalty=1.1,
max_new_tokens=2048,
)
print(output[0]["generated_text"][-1]["content"])

The card gives two sampling presets. For chat, tool use, agents and coding: temperature=0.1, top_k=50, repetition_penalty=1.1. For math and STEM: temperature=1.0, top_p=0.95, top_k=20.

Tool calling

Per the card, you pass function schemas through tools=... to apply_chat_template(), and the template formats the definitions and results for you. The model writes calls in an XML format:

<tool_call>
<function=get_weather>
<parameter=city>
Paris
</parameter>
</function>
</tool_call>

Your application runs the call. You then add the parsed assistant call to the history as a tool_calls entry and append the result as a tool message. Keep passing the tool schemas on later requests. function.arguments must be a Python mapping, so decode JSON strings with json.loads() first.

The card says to pass function schemas through tools=... to apply_chat_template(). This snippet reuses the pipeline’s tokenizer to render the prompt text so you can see what the model receives. The {"type": "function", "function": ...} wrapper matches the card’s tool-search snippet; the weather schema inside is my own example, and the card doesn’t show a complete one. The card doesn’t show a full generate-and-parse loop either, so this post stops at the prompt.

tool_prompt.py
from transformers import pipeline
generator = pipeline(
"text-generation",
model="LiquidAI/LFM3-1.7B",
trust_remote_code=True,
)
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city.",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
}
]
messages = [{"role": "user", "content": "What's the weather in Paris?"}]
prompt = generator.tokenizer.apply_chat_template(
messages,
tools=tools,
add_generation_prompt=True,
tokenize=False,
)
print(prompt)

The printed prompt should contain your tool definition. Generating from it, parsing the <tool_call> block and sending the result back as a tool message is up to your code.

LFM3 supports deferred tools. Set defer_loading=True on a tool to keep its definition out of the prompt until your harness’s search tool returns its name as a tool_reference part; the chat template then inserts the definition. Your harness implements and runs the search, and you must keep the full tools list, including deferred tools, on every request. The card suggests telling the model in the system prompt when to call the search tool. This works with vLLM, SGLang and LFM3-compatible llama.cpp builds.

Fine-tuning

The card points to TRL notebooks for four cases: SFT to extract structured JSON from messy documents, DPO to answer from retrieved documents or decline, GRPO to call the right tools in a 108-tool phone app, and continued pre-training to learn a new language (Turkish) from raw text. It describes single-GPU fine-tuning as quick.

Gotchas

  • trust_remote_code=True is required in the card’s example, and the repo is tagged custom_code.
  • Reasoning is on by default. The chat template ends the generation prompt with <think>. You can pass enable_thinking=False, but the card says this can be inconsistent, especially for reasoning-heavy tasks. Thinking from turns before the latest user message is dropped unless preserve_thinking=True.
  • Tool arguments must be a mapping, not a JSON string.
  • Not for everything. The card says it is not recommended for agentic coding or complex multi-step reasoning because of its small size, and to use retrieval or search for knowledge-heavy tasks. Its own AA-Omniscience accuracy score is 7.07.
  • llama.cpp needs LFM3 support. For llama.cpp, use a GGUF with the current chat template or load it with --chat-template-file.
  • License. The license is “LFM Open License v1.0,” not a standard open-source license. Read it before shipping.

When to pick it

Pick LFM3-1.7B if you need a small model on a laptop, phone or modest GPU for tool calling, structured output or a specialist you plan to fine-tune, and you have retrieval for facts. The card reports strong tool-use and instruction-following scores for its size.

Skip it if your main task is coding agents, hard reasoning or answering from memory. The card says as much, and its own table shows a 9B model ahead on SWE-bench Verified and GPQA Diamond.

Related