Instructions to use aruntemme/LFM2.5-350M-M3-Distill with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aruntemme/LFM2.5-350M-M3-Distill with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aruntemme/LFM2.5-350M-M3-Distill") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("aruntemme/LFM2.5-350M-M3-Distill") model = AutoModelForCausalLM.from_pretrained("aruntemme/LFM2.5-350M-M3-Distill", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use aruntemme/LFM2.5-350M-M3-Distill 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 aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M # Run inference directly in the terminal: llama cli -hf aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M # Run inference directly in the terminal: llama cli -hf aruntemme/LFM2.5-350M-M3-Distill: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 aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf aruntemme/LFM2.5-350M-M3-Distill: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 aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M
Use Docker
docker model run hf.co/aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use aruntemme/LFM2.5-350M-M3-Distill with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aruntemme/LFM2.5-350M-M3-Distill" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aruntemme/LFM2.5-350M-M3-Distill", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M
- SGLang
How to use aruntemme/LFM2.5-350M-M3-Distill 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 "aruntemme/LFM2.5-350M-M3-Distill" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aruntemme/LFM2.5-350M-M3-Distill", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "aruntemme/LFM2.5-350M-M3-Distill" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aruntemme/LFM2.5-350M-M3-Distill", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use aruntemme/LFM2.5-350M-M3-Distill with Ollama:
ollama run hf.co/aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M
- Unsloth Studio
How to use aruntemme/LFM2.5-350M-M3-Distill 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 aruntemme/LFM2.5-350M-M3-Distill 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 aruntemme/LFM2.5-350M-M3-Distill to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for aruntemme/LFM2.5-350M-M3-Distill to start chatting
- Pi
How to use aruntemme/LFM2.5-350M-M3-Distill with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use aruntemme/LFM2.5-350M-M3-Distill with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf aruntemme/LFM2.5-350M-M3-Distill: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 "aruntemme/LFM2.5-350M-M3-Distill: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"
- Docker Model Runner
How to use aruntemme/LFM2.5-350M-M3-Distill with Docker Model Runner:
docker model run hf.co/aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M
- Lemonade
How to use aruntemme/LFM2.5-350M-M3-Distill with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M
Run and chat with the model
lemonade run user.LFM2.5-350M-M3-Distill-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use aruntemme/LFM2.5-350M-M3-Distill with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf aruntemme/LFM2.5-350M-M3-Distill: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 aruntemme/LFM2.5-350M-M3-Distill:Q4_K_M
Run Hermes
hermes
- Atomic Chat
LFM2.5-350M-M3-Distill
A 350M-parameter assistant fine-tuned from LiquidAI/LFM2.5-350M on a synthetic instruction dataset distilled from MiniMax-M3 (a frontier teacher model). It targets fast, capable on-device / Raspberry Pi use for everyday assistant tasks — general chat, Q&A, summarization, text rewriting, classification/extraction, and JSON / structured output.
v2 (current). Same recipe as v1 but trained on a verbosity-curated dataset — terse tasks (rewrite, "make concise", tone changes) now give a single clean answer instead of multi-option essays, with no regression on chat / Q&A / summarization / JSON / tool-calling. Read Limitations before using.
What it's good at
Versus the stock LFM2.5-350M base (observed on a fixed 35-prompt eval set), the fine-tune produces:
- More structured, complete answers for open-ended chat and explanations.
- Better short-text classification (e.g. spam / sentiment) — fixed cases the base got wrong.
- Cleaner summarization and JSON output for its size.
- Tool / function calling is preserved from the base (native
<|tool_call_start|>format) — and on math it correctly defers to acalculatetool instead of hallucinating arithmetic.
Intended use
- General chat & advice
- Factual Q&A
- Summarization
- Text rewriting (tone, formality, paraphrase, simple translation)
- Classification & extraction (sentiment, spam, fields → JSON)
- Structured / JSON output
- Tool / function calling (native LFM2.5 format)
Limitations (please read)
- Not for code or math. The LFM2.5 base is explicitly not recommended for code, math, or creative writing, and this model was deliberately not trained on the code/reasoning data. Use a code-capable model (e.g. Qwen3-0.6B) for those.
- Weak at precise token-level editing. Grammar/spelling-correction tasks are unreliable — a genuine capacity limit at 350M (unchanged in v2).
- Shallow synthesis. When summarizing long/multi-source material it tends to list findings rather than deeply synthesize — expected at this size.
- Small model: it can hallucinate and should not be relied on for factual accuracy without verification.
Recommended generation settings
Use sampling (not greedy) — greedy decoding causes repetition loops at this size:
generation_config = dict(
do_sample=True,
temperature=0.7,
top_p=0.9,
repetition_penalty=1.1,
max_new_tokens=512,
)
Usage (Transformers)
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tok = AutoTokenizer.from_pretrained("aruntemme/LFM2.5-350M-M3-Distill")
model = AutoModelForCausalLM.from_pretrained("aruntemme/LFM2.5-350M-M3-Distill",
dtype=torch.bfloat16).to("cuda")
msgs = [{"role": "user", "content": "Summarize the benefits of regular exercise in 3 bullet points."}]
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt",
return_dict=True).to("cuda")
out = model.generate(**inputs, do_sample=True, temperature=0.7, top_p=0.9,
repetition_penalty=1.1, max_new_tokens=512)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Tool / function calling
Pass tools via the chat template; the model emits calls in LFM2.5's native format
(<|tool_call_start|>[func(arg="val")]<|tool_call_end|>):
tools = [{"type": "function", "function": {
"name": "get_weather", "description": "Get current weather for a city",
"parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}}]
msgs = [{"role": "user", "content": "What's the weather in Paris?"}]
inputs = tok.apply_chat_template(msgs, tools=tools, add_generation_prompt=True,
return_tensors="pt", return_dict=True).to("cuda")
out = model.generate(**inputs, max_new_tokens=100)
# -> <|tool_call_start|>[get_weather(city="Paris")]<|tool_call_end|>
Usage (GGUF / llama.cpp / Raspberry Pi)
Quantized GGUF files are included for CPU / edge inference:
| file | quant | approx size |
|---|---|---|
lfm2.5-350m-m3distill-Q4_K_M.gguf |
Q4_K_M | ~230 MB |
lfm2.5-350m-m3distill-f16.gguf |
f16 | ~709 MB |
./llama-cli -m lfm2.5-350m-m3distill-Q4_K_M.gguf \
-p "Explain photosynthesis in 40 words." \
--temp 0.7 --top-p 0.9 --repeat-penalty 1.1
Training
- Base: LiquidAI/LFM2.5-350M
- Teacher: MiniMax-M3 (synthetic data generated via the teacher, then quality-filtered/judged)
- Method: full supervised fine-tuning (no LoRA), bf16, gradient checkpointing
- Data (v2): ~30,400 instruction→response examples (chat, Q&A, summarization, rewriting, explanation, classification/extraction, JSON) — code & reasoning excluded to match the base's strengths; v2 additionally drops the multi-option / over-long responses on terse tasks to cut needless verbosity (v1 used ~32,100 uncurated examples)
- Hyperparameters: 2 epochs, effective batch 32 (bs 4 × grad-accum 8), lr 1.5e-5 (cosine, 3% warmup), max sequence length 1024, weight decay 0.01
- Hardware: single NVIDIA RTX 3060 (12 GB), ~2.7 h
- Final eval: loss 1.87, token accuracy 0.60
- Frameworks: TRL 1.6.0, Transformers 5.12.1, PyTorch 2.12.1
License & attribution
This is a derivative of LiquidAI/LFM2.5-350M, distributed under the LFM Open License v1.0 (commercial use permitted under a $10M annual-revenue threshold). This derivative is provided under the same license; a copy is included. The base model and its license notices are retained per the license terms.
Acknowledgements
- Base model: Liquid AI (LFM2.5-350M)
- Distillation teacher: MiniMax-M3
- Downloads last month
- 35