Instructions to use Petrouil/LFM2.5-Mosaic-900M-A500M-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Petrouil/LFM2.5-Mosaic-900M-A500M-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Petrouil/LFM2.5-Mosaic-900M-A500M-Base", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Petrouil/LFM2.5-Mosaic-900M-A500M-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Petrouil/LFM2.5-Mosaic-900M-A500M-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Petrouil/LFM2.5-Mosaic-900M-A500M-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Petrouil/LFM2.5-Mosaic-900M-A500M-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Petrouil/LFM2.5-Mosaic-900M-A500M-Base
- SGLang
How to use Petrouil/LFM2.5-Mosaic-900M-A500M-Base 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 "Petrouil/LFM2.5-Mosaic-900M-A500M-Base" \ --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": "Petrouil/LFM2.5-Mosaic-900M-A500M-Base", "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 "Petrouil/LFM2.5-Mosaic-900M-A500M-Base" \ --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": "Petrouil/LFM2.5-Mosaic-900M-A500M-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Petrouil/LFM2.5-Mosaic-900M-A500M-Base with Docker Model Runner:
docker model run hf.co/Petrouil/LFM2.5-Mosaic-900M-A500M-Base
LFM2.5-Mosaic-900M-A500M-Base
Model Summary
LFM2.5-Mosaic-900M-A500M-Base is a Mixture-of-Experts (MoE) agentic assistant built on top of the frozen LFM2.5-350M-Base trunk. Ten MoE layers are inserted after the trunk's GQA attention blocks and late convolution blocks, giving the model a large learnable capacity while keeping the base trunk's pre-trained representations untouched.
| Property | Value |
|---|---|
| Parameters (total) | 921M |
| Parameters (active per token) | ~543M |
| Parameters (trainable) | 566M |
| MoE layers | 10, inserted at blocks [2, 5, 8, 9, 10, 11, 12, 13, 14, 15] |
| Experts per layer | 8 routed (top-2) + 1 shared, always-on |
| Expert shape | SwiGLU 1024 → 2048 → 1024 (~6.3M params each) |
| Context length | 32,768 |
| Vocabulary | 65,536 |
| Precision | bf16 |
| Base trunk | frozen LFM2.5-350M-Base |
The model is designed for agentic / tool-use workloads: it plans multi-turn tool-calling loops, emits structured tool calls, and follows instructions. It is not a general-knowledge or long-horizon reasoning model — use external tools for information retrieval, which is exactly what this model is built to orchestrate.
Uses
Intended use
- Tool calling and function-calling in agentic workflows
- Multi-turn task completion with tools (web search, lookups, form filling, etc.)
- Plain chat and instruction-following in a tool-equipped assistant loop
Out of scope
- General-knowledge mastery or factual breadth (use tools)
- Heavy long-horizon reasoning
- Code-heavy or specialized-domain expertise
How to Use
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"petrouil/LFM2.5-Mosaic-900M-A500M-Base",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
).to("cuda")
tokenizer = AutoTokenizer.from_pretrained("petrouil/LFM2.5-Mosaic-900M-A500M-Base")
messages = [{"role": "user", "content": "Get the weather in Athens."}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
out = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False))
Tool-call format
Training renders tool calls as JSON content in the assistant turn, e.g.
[{"name": "get_weather", "arguments": {"city": "Athens"}}] with arguments as an object. The model may also emit the
LFM2.5-native Pythonic form (<|tool_call_start|>get_weather<|tool_call_sep|>{"city": "Athens"}<|tool_call_end|>);
both are accepted when the model is used with the LFM2.5 chat template.
Training Data
nvidia/Nemotron-SFT-Agentic-v2(CC BY 4.0) — ~992K synthetic, LLM-judged tool-use trajectories: tool calling (707K), multi-turn customer service across 838 domains (279K), and web-search graph walks (6K). Subsampled to ~200M tokens (mix 70/25/5), streamed with byte-accurate Range-resume retries.- Instruct mix (~193M tokens) from
HuggingFaceTB/smoltalk2(Apache-2.0 / odc-by) andHuggingFaceH4/ultrachat_200k(MIT): everyday conversations, tulu-3 instruction-following, system chats, Magpie-style chat, OpenHermes, UltraChat, and more. - Curated persona cache — hand-written identity/social Q&A plus fluency slices, taught during the final touch-up phases.
Training Procedure
- Frozen trunk: the entire LFM2.5-350M-Base backbone is frozen; only MoE routers, experts, and output scales are trained (the published checkpoint contains the full merged model).
- Phases: short router-only warm-up with gumbel exploration, then joint router + expert training; gumbel decays to 0 over ~1K steps. Followed by continuation phases (agentic-only → instruct mix → curated persona touch-ups).
- Optimizer: AdamW8bit; bf16 autocast; chunked CE over hidden states; grad clip 1.0; batch 98,304 tokens (micro-batch 1 × seq 2048 × 48 grad accum).
- Balancing: sequence-wise load-balance loss (annealed over phases) + DeepSeek-style aux-loss-free per-expert bias (±0.001/step), keeping all experts used.
- Hardware: single RTX 3070 (8 GB), ~6,300 tok/s steady state.
Limitations
- Small model: weak general knowledge, limited long-horizon reasoning — rely on tools.
- Routing: the router is domain-sensitive but soft (per-token entropy near its maximum); expect ensemble-flavored behavior rather than crisp per-domain expert switching.
- Fluency: long creative generations can repeat — a mild repetition penalty at inference (
repetition_penalty ≈ 1.1-1.2) is recommended. - License: custom license terms apply (see YAML metadata) — review before commercial redistribution.
Citation
@misc{mosaic2026,
author = {Petrouil},
title = {LFM2.5-Mosaic-900M-A500M-Base},
year = {2026},
url = {https://huggingface.co/petrouil/LFM2.5-Mosaic-900M-A500M-Base}
}
- Downloads last month
- 75
Model tree for Petrouil/LFM2.5-Mosaic-900M-A500M-Base
Base model
LiquidAI/LFM2.5-350M-Base