Instructions to use LiquidAI/LFM2-24B-A2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM2-24B-A2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LiquidAI/LFM2-24B-A2B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LiquidAI/LFM2-24B-A2B") model = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM2-24B-A2B", 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-24B-A2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/LFM2-24B-A2B" # 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-24B-A2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LiquidAI/LFM2-24B-A2B
- SGLang
How to use LiquidAI/LFM2-24B-A2B 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-24B-A2B" \ --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-24B-A2B", "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-24B-A2B" \ --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-24B-A2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LiquidAI/LFM2-24B-A2B with Docker Model Runner:
docker model run hf.co/LiquidAI/LFM2-24B-A2B
Fix chat template: render assistant tool_calls history
Thanks for LFM2. The 24B's tool discipline measured impressively in our runs.
Defect: the shipped message loop renders content but never renders a past assistant turn's tool_calls. OpenAI-compatible clients replay history in that standard form, so the template emits an empty assistant turn and removes the model's action history.
The 24B is more robust than the 1.2B when history is missing. Its 4-step chains survive, but the tested 6-step chains lose steps 5 and 6. On the official Q4_K_M GGUF with temperature 0.1, top_k 50, and llama.cpp, the shipped template scored ordered 0/3 and exact 0/3 on those 6-step runs.
With this fix, the like-for-like 6-step runs scored ordered 3/3 and exact 3/3: six requested calls in order, nothing extra, with grounded and correct final answers. The combined seeded suite of three 4-step and three 6-step runs scored ordered 6/6 and exact 6/6 with no middleware. The route doctor's verdict also changed from a template-history failure to healthy.
Fix: port the LFM2.5-8B-A1B tool-call macros into this template's message loop while preserving the 24B template's multimodal handling. Everything outside the tool-call path remains byte-identical. The standalone regression test covers the defect, fixed rendering, tool-free byte equality, list-form multimodal content, null content, hostile values, and malformed call shapes.
The patch deliberately follows the current 8B-family argument formatting. Any family-wide string-escaping policy belongs in a separate discussion rather than a hidden 24B-only change.
GGUF users receive the fix through a re-converted GGUF or llama-server --jinja --chat-template-file <this file>, which is how we verified it live.
Happy to adjust anything to your conventions.
Evidence, wire excerpts, regression tests, and reproductions:
https://github.com/graphometer/droplet/tree/main/public/evidence
Disclosure: prepared with heavy AI assistance; every claim above comes from recorded runs that can be inspected. Not affiliated with, endorsed by, or connected to Liquid AI.