Instructions to use LiquidAI/LFM2-350M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM2-350M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LiquidAI/LFM2-350M") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LiquidAI/LFM2-350M") model = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM2-350M", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LiquidAI/LFM2-350M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/LFM2-350M" # 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-350M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LiquidAI/LFM2-350M
- SGLang
How to use LiquidAI/LFM2-350M 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-350M" \ --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-350M", "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-350M" \ --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-350M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LiquidAI/LFM2-350M with Docker Model Runner:
docker model run hf.co/LiquidAI/LFM2-350M
NNAI-Bench neural comparison: LFM2-350M measured on 900 questions
Hi Liquid AI team,
We evaluated LFM2-350M on the new neural comparison track: 222/900 (24.67%), 100% coverage, BF16, checkpoint revision f37d3f5c8c5484bc01dad379a595cf4c68c4e70e. Frozen predictions, per-item logits, hashes and runtime.
This is one disclosed letter-scoring configuration, not your model's best achievable reasoning performance. Random four-choice selection has expected accuracy 25%; please interpret the score within the protocol below. Checkpoint pretraining contamination is unknown. No fitting, test-label-based setting selection or prompt truncation was used.
I maintain NNAI-Bench under vynly, with coding-assistant help. We have added a separate neural comparison track: leaderboard and submission form, protocol. Neural models never enter the non-neural ranking. These notes and maintainer runs are not creator submissions or endorsements.
The frozen core has 900 four-choice synthetic test questions (150 each: arithmetic, logic, ordering, state tracking, strings and tables), plus 600 train / 300 validation questions. Templates and test labels are public; this is a small bounded diagnostic, not a hidden-test or general-intelligence claim. The initial readout uses bare A/B/C/D next-token logits after a fixed full question and choices, highest logit with A-first ties, no few-shot material, tools or chain of thought. Base models end in Answer:; LFM2 uses its released chat template. All runs reset state between questions and keep gold labels outside offline inference.
Would you be interested in checking the adapter/readout or contributing a run using your preferred documented native configuration? Choose any settings on validation, freeze before test, disclose prior test exposure, and submit all 900 predictions plus checkpoint/runtime revisions, precision, hardware and reproduction details through Neural comparison in the form. A different readout should be a separately named run. The latest CAEL rows are test-adapted and use authored helpers, so they are not clean held-out controls for these neural references.