LFM2.5-Encoders for Fast Long-Context Inference on CPU
Hugging Face releases LFM2.5-Encoder-230M and LFM2.5-Encoder-350M, optimized for fast long-context inference on CPU while maintaining high accuracy.
The useful question is what changes for users, developers or buyers, and whether the announcement stays industry context or becomes something people can actually use.
Hugging Face has introduced two new encoder models, LFM2.5-Encoder-230M and LFM2.5-Encoder-350M, designed to handle document-scale tasks efficiently on existing hardware, including CPUs. These models match the quality of larger alternatives while remaining fast as input lengths increase, enabling cost-effective deployment for tasks such as intent routing, policy linting, and text classification. The models are built on the LFM2 architecture, which scales inference costs more slowly than traditional approaches as input size grows.
The encoders are initialized from LFM2 decoder backbones and converted into bidirectional models through targeted modifications. They are pre-trained using a masked-language objective, allowing fine-tuning for classification, token-level tasks, and search applications. Benchmark results across 17 tasks from GLUE, SuperGLUE, and multilingual classification show LFM2.5-Encoder-350M ranking fourth among 14 models, outperforming smaller ModernBERT and EuroBERT variants while remaining significantly smaller than larger competitors.
Inference speed tests reveal the encoders' advantage, particularly on CPU. LFM2.5-Encoder-230M processes 8,192-token inputs in about 28 seconds, roughly 3.7 times faster than ModernBERT-base, which takes over 90 seconds. On GPU, the encoders lead for inputs longer than 2,000 tokens, demonstrating consistent performance gains for long-context tasks. These results highlight the models' suitability for high-volume, low-cost applications running on standard hardware.
Developers can implement the encoders using the Hugging Face Transformers library, either for direct masked-token prediction or fine-tuning with custom heads. The models are optimized for tasks requiring constant, fast inference, such as classification or extraction, where they offer a smaller, more efficient alternative to generative LLMs. A fine-tuning tutorial is available for adapting the models to long legal documents with an 8,192-token context.