Model guide
LFM2.5 Encoder 230M
LFM2.5 Encoder 230M is a bidirectional masked-language model for adaptation to tasks such as tagging or classification. It is not the generative 230M assistant and is not already a finished retrieval system. Choose it when you intend to train or adapt a task-specific component and can review the required model code.
At a glance
- Parameters
- 0.23B
- Accepts
- Text
- Returns
- Token representations for a task you train
- Published context limit
- 8,192 tokens
- Model format
- safetensors
- Software and download hosts
- Transformers. Follow the exact setup below; this list does not establish support for every format, input type or software version.
- Model-weight download
- 0.92 GB of F32 weights · native workflow
- Languages
- English · German · Spanish · French · Italian · Dutch · Polish · Portuguese · Arabic · Hindi · Japanese · Russian · Turkish · Vietnamese · Chinese
- License
- LFM Open License v1.0 (commercial use is subject to the US$10 million annual-revenue threshold in section 5)
Measure peak memory while running the masked-token example. Budget training for your classifier or retriever separately.
Best for
- Fine-tune a compact classifier for labelled requests. Keep a held-out set to check whether the 230M model routes unfamiliar requests correctly.
Choose something else when
- The masked-token example checks loading. You still need a task head and training data for request classification.
Adapting an encoder
This encoder is built for tasks such as classification or retrieval after adaptation. Follow its model card; a chat app or an embedding app cannot use it unchanged.
First setup
This is a masked-language encoder for adaptation to classification or retrieval. It does not generate chat answers. Install python -m pip install -U transformers torch. The publisher requires custom Python code; review it before allowing trust_remote_code=True to execute it.
import torch
from transformers import AutoModelForMaskedLM, AutoTokenizer
repo = "LiquidAI/LFM2.5-Encoder-230M"
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForMaskedLM.from_pretrained(repo, trust_remote_code=True)
inputs = tokenizer(f"The capital of France is {tokenizer.mask_token}.", return_tensors="pt")
model.eval()
with torch.no_grad():
logits = model(**inputs).logits
position = (inputs["input_ids"][0] == tokenizer.mask_token_id).nonzero()[0].item()
print([tokenizer.decode([i]).strip() for i in logits[0, position].topk(5).indices.tolist()])
Expect five candidate tokens for the masked position, not a conversation. Inspect whether they make sense in the sentence. A useful classifier or retrieval system still needs the appropriate task head, training and evaluation; this load check does not provide them.
Save the Python example as example.py, then run python example.py in the environment where you installed its packages. The first run downloads model files; later local execution still needs the cached files. Start with these short inputs and batch size 1. If loading runs out of memory, close other model processes or use a smaller model; do not interpret missing output as an empty search result. See the publisher model card for the full workflow.
Measure encoding time for fixed-length inputs at batch size 1, then at the intended batch size. Fine-tuning adds training memory and compute; chat generation speed is not a useful measure for this encoder.
