Instructions to use LiquidAI/LFM2.5-8B-A1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM2.5-8B-A1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LiquidAI/LFM2.5-8B-A1B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LiquidAI/LFM2.5-8B-A1B") model = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM2.5-8B-A1B", 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
- vLLM
How to use LiquidAI/LFM2.5-8B-A1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/LFM2.5-8B-A1B" # 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/LFM2.5-8B-A1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LiquidAI/LFM2.5-8B-A1B
- SGLang
How to use LiquidAI/LFM2.5-8B-A1B 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 "LiquidAI/LFM2.5-8B-A1B" \ --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": "LiquidAI/LFM2.5-8B-A1B", "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 "LiquidAI/LFM2.5-8B-A1B" \ --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": "LiquidAI/LFM2.5-8B-A1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LiquidAI/LFM2.5-8B-A1B with Docker Model Runner:
docker model run hf.co/LiquidAI/LFM2.5-8B-A1B
Congratulations and Feedback
You are hereby greeted.
I would like to congratulate your publication and release of LFM2.5's 8B A1B version. I am genuinely impressed by the architecture's efficiency. Using llama.cpp's server example (commit b9414, Vulkan backend) and this model's Q4_K_M quantization (therefore, with stricter sampling: top-k of 40 and top-p of 0.5), I was able to yield:
- roughly 1,200 T/s encoding and 120 T/s decoding when under a context length of 32,768.
- roughly 800 T/s encoding and 40 T/s decoding when over a context length of 65,536.
I am running Fedora 44 Workstation with a six-core @4.5GHz CPU and a RTX4060 with only 8GB. I was able to fluently engage with the model in both English and German, which are languages I natively understand. The model is (mostly, see below) able to use a websearch tool to answer German questions about essays correctly, and it also surprised me with its quick and correct answers about STEM-related subjects like mathematics and physics.
Despite the model's positive aspects, I desire to gently state a few underdeveloped areas of the model.
As notified here, I also noticed that the model quite frequently finishes the reasoning, but then does not generate a response beyond the </think> tag. Sometimes, especially when communicating with the model in German, the model would generate the actual response inside the reasoning section, but this did not happen frequently.
Also, it seems the model often struggles to use the correct tools given. For example, when integrating Hugging Face's official MCP server and instructing the model to search about LFM2.5-8B-A1B on Hugging Face, the model would still use the websearch tool. In my tests, the model did not attempt to call any Hugging Face-specific tool at all, even when it was explicitly stated that the model is on Hugging Face.
Additionally, as hinted here, the model is not able to fluently speak Arabic. Even though I am not able to fully communicate in that language, I was able to determine that the model's response is incoherent. I also found this being the case on the official playground, and I frequently checked if I was wrong about the model's performance by translating its output to English using Google Translate.
Ultimately, I appreciate the model a lot despite its weaknesses. I am used to interacting with language models using English, and the model performs beyond expectations in STEM using that language. I also prefer the model's rather formatting-free style, specifically the avoidance of unnecessary emojis and excessive Markdown usage. I hope you continue your fantastic work on efficient and performative conversational, autoregressive language models, and I would wish to point out that I strongly believe in your ability to fix the small annoyances I stated.
You are hereby bidden farewell.