Model guide
LFM2.5 Encoder 350M
LFM2.5 Encoder 350M is the larger bidirectional backbone to compare with the 230M encoder for an adapted classification, tagging or retrieval task. Evaluate it after adding the appropriate task head or training procedure. It does not generate chat answers, and raw encoder outputs are not automatically a useful search index.
At a glance
- Parameters
- 0.35B
- 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
- 1.42 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
- Compare the 350M and 230M encoders after training on the same labels. Score both on held-out requests before accepting the larger model.
Choose something else when
- For ready-made semantic search without task training, choose the separate 350M Embedding checkpoint.
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-350M"
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.
