Model mapping
Pick the LFM in the same deployment class as your current model. Compare within class; benchmarking a 1.2B LFM against a 32B Qwen does not tell you whether it fits your deployment.| If you run | Evaluate | Notes |
|---|---|---|
| Qwen3-0.6B, Llama-3.2-1B, Gemma-3-270M/1B | LFM2.5-350M | Classification, extraction, routing. Also consider LFM2.5-230M. |
| Qwen3-1.7B, Llama-3.2-3B, Gemma-3-4B | LFM2.5-1.2B-Instruct | The default dense workhorse. |
| Qwen3-4B/8B, Llama-3.1-8B, Gemma-3-12B | LFM2.5-8B-A1B | MoE with 8B total and 1.5B active parameters. |
| Qwen3-14B/32B and larger dense models | LFM2-24B-A2B | 24B total and roughly 2.3B active parameters. |
| Qwen3 thinking mode or DeepSeek distills | LFM2.5-1.2B-Thinking | Reasoning traces at 1.2B. |
| Qwen2.5-VL-3B/7B, Llama-3.2-Vision, Gemma-3 vision | LFM2.5-VL-450M or LFM2.5-VL-1.6B | Use -Extract variants for image to strict JSON. |
| Whisper plus separate TTS | LFM2.5-Audio-1.5B | ASR, TTS, and speech-to-speech in one model. |
Runtime-by-runtime migration
Minimum versions:transformers >= 5.2.0- vLLM
>= 0.23.0
- Transformers
- vLLM
- SGLang
- llama.cpp
- Ollama / LM Studio
- MLX / ONNX
- LEAP SDK
Change the model ID and use the model’s chat template:Do not reuse literal Llama-style or Gemma-style prompt strings. They will usually run, but quality will degrade.See Transformers.
Chat template and sampling
LFMs use a ChatML-style format:system, user, assistant, and tool. Vision-language models use an <image> sentinel. See Chat template.
Migration notes:
- From Qwen: ChatML is familiar, but token details differ. Use
apply_chat_template; do not reuse literal Qwen strings. - From Llama: replace
<|begin_of_text|>and<|start_header_id|>prompt builders. - From Gemma: replace
<start_of_turn>builders. LFMs support a realsystemrole.
| Param | LFM2.5 recommendation | Common carry-over mistake |
|---|---|---|
temperature | 0.1 | 0.6 to 0.7, which can cause drift |
top_k | 50 | disabled |
repetition_penalty | 1.05 | 1.0 |
Tool calling
LFMs natively emit a Pythonic tool-call list, not OpenAI-style JSON:- Pass tools through
tokenizer.apply_chat_template(messages, tools=[...])or the serving runtime’s supported tool mechanism. - Parse the Pythonic call list between
<|tool_call_start|>and<|tool_call_end|>. - On vLLM or SGLang, configure the LFM tool-call parser instead of a generic JSON parser.
- Return results as
toolrole messages, with JSON content if useful. - For strict schemas, use constrained decoding. See Constrained Generation.
- If you fine-tune for tool calling, train on the native Pythonic format and convert to any internal DSL after parsing.
Migrating your fine-tuning pipeline
LFMs are standard Hugging Face causal LMs, so TRL and Unsloth-style pipelines carry over with two LFM-specific corrections. First, update LoRAtarget_modules. LFM2 and LFM2.5 use a conv-attention hybrid with different module names than Llama-family models:
model.print_trainable_parameters(). You should see millions of trainable parameters, and the LoRA module count should be in the expected range for your model size. If it is near zero, the module names are wrong.
Second, format training examples with the LFM chat template. Training data formatted with your previous model’s template creates a silent distribution mismatch.
Everything else transfers directly:
- LEAP Finetune for SFT, LoRA, DPO, GRPO, text, VLM, MoE, local, SLURM, Kubernetes, Modal, and GGUF export workflows
- Existing TRL or Unsloth setups
- Starting LoRA recipe:
r=16,alpha=32, learning rate around2e-4to3e-4, 3 to 5 epochs, bf16
Migration checklist
Serving swap
- Runtime meets minimum version requirements
- Model ID swapped
- Chat template comes from the model
- Sampling updated for LFM defaults
- Tool parser configured if tool calling is in scope
- Context length validated against production p95
Evaluation
- Comparison stays within the same deployment class
- Latency and throughput measured at production prompt lengths and concurrency
- Quantized artifact evaluated if you plan to ship quantized
Fine-tuning
- LoRA
target_modulesupdated to LFM names - Trainable-parameter count sanity-checked
- Training data reformatted with the LFM chat template
- Tool-call training data uses the native Pythonic format
- Held-out eval set frozen before training