LFM2.5 Encoders Speed Up Long-Context NLP on CPUs
Liquid AI has introduced LFM2.5-Encoders, a pair of compact, general-purpose language encoders designed for production workloads that need to process long documents quickly and inexpensively. The family includes 230-million- and 350-million-parameter models, both supporting contexts of up to 8,192 tokens. They target tasks such as document classification, intent routing, information extraction, safety filtering, policy checking, personal-data detection, and search. Unlike generative large language models, which produce text one token at a time, encoders are optimized to understand and score an entire input, making them a more efficient choice for repetitive language-processing jobs.
The models belong to the same family as the previously released LFM2.5-Retrievers, which were created specifically for multilingual search. However, the new encoders have a broader role. They are pretrained through masked language modeling, where parts of a text are hidden and the model learns to reconstruct them from the surrounding context. This training method allows developers to fine-tune the same base model for document-level classification, token-level labeling, extraction, or retrieval. The central proposition is that search represents only one application of an encoder, so a general-purpose foundation is more useful than simply repackaging a specialized retriever.
Liquid AI created the encoders from the LFM2.5-230M and LFM2.5-350M decoder backbones. The original causal decoders were converted into bidirectional models, allowing every token to consider words appearing both before and after it. Their short convolutional layers were also changed from causal to symmetrically padded operations, so local features can combine information from neighboring tokens on either side. During training, 30% of input tokens were masked. The initial stage used a large web corpus and a 1,024-token context to establish broad language competence, followed by long-context adaptation at 8,192 tokens using a wider data mixture intended to reinforce factual, legal, and multilingual capabilities.
The evaluation covered 14 models and 17 tasks drawn from GLUE, SuperGLUE, and multilingual classification benchmarks. Each model was fully fine-tuned separately for every task, and the reported result was averaged across five held-out random seeds to reduce run-to-run variation. Liquid AI says it has open-sourced both the evaluation framework and the raw results. LFM2.5-Encoder-350M placed fourth among all 14 models; the three systems above it were larger, including one with 3.5 billion parameters, nearly ten times its size. The 230M model outperformed ModernBERT-base and every tested EuroBERT model despite being smaller than most of them. Both new encoders also substantially exceeded the company’s specialized LFM2.5-Retrievers on this broader evaluation.
The most pronounced advantage appears in long-context CPU inference. Because both LFM2.5-Encoders and ModernBERT support 8,192-token inputs, Liquid AI compared their performance across the entire supported range. The 230M encoder was the fastest CPU model at every tested sequence length, including short inputs where it surpassed the smaller ModernBERT-base. As documents became longer, ModernBERT’s throughput deteriorated sharply, while the LFM2.5 models moved into the middle of the performance range before gradually tapering. At 8,192 tokens, ModernBERT-base reportedly required more than 90 seconds for one forward pass, compared with roughly 28 seconds for LFM2.5-Encoder-230M, producing an approximately 3.7-fold speed advantage.
That result means a developer could scan or classify a full contract, transcript, or lengthy customer-support conversation in under 30 seconds using a laptop CPU, according to the announcement. The GPU results followed a similar pattern but with a narrower difference. ModernBERT-base led below approximately 1,000 tokens on an Apple GPU, while LFM2.5-Encoders moved ahead from around 2,000 tokens. The comparison therefore positions the new models primarily as efficient long-input systems, with an especially large benefit when dedicated GPU hardware is unavailable.
Liquid AI demonstrated the models through several fine-tuned applications running in CPU-only Hugging Face Spaces. A zero-shot prompt router lets users describe routing destinations in natural language and scores an entire prompt against every destination in one pass. A policy-linting demo compares text with company rules expressed as free-form instructions and evaluates every token against every rule simultaneously. Other demonstrations include token-by-token spelling correction and detection or removal of 40 categories of personally identifiable information across 16 languages. An experimental masked-diffusion chatbot also generates text by repeatedly revealing masked tokens rather than producing a conventional left-to-right sequence.
For high-volume understanding tasks, the company argues that a specialized encoder can be smaller, faster, and considerably cheaper than a generative LLM while running on existing CPUs. The 350M version is presented as the option for workloads where accuracy has priority, while the 230M model is intended for constrained hardware and higher throughput. Developers can load either model through the Transformers library, use it directly for masked-token prediction, or attach a task-specific output layer and fine-tune the full encoder for classification, routing, extraction, scoring, or another downstream application.
Why it matters
- —Compact encoders can handle continuous classification, routing, extraction, and safety workloads without the cost of a generative LLM.
- —The 230M model reportedly processes an 8,192-token input about 3.7 times faster than ModernBERT-base on a CPU.
- —Strong benchmark results suggest that carefully designed small models can compete with substantially larger encoders.
Key facts
- The family includes 230M and 350M bidirectional encoders with an 8,192-token context window.
- Evaluation covered 14 models and 17 GLUE, SuperGLUE, and multilingual classification tasks, with results averaged across five seeds.
- LFM2.5-Encoder-350M ranked fourth overall, behind three larger models.
- At 8,192 tokens, the 230M model took about 28 seconds per CPU forward pass, versus more than 90 seconds for ModernBERT-base.
- CPU-only demos cover prompt routing, policy linting, spell checking, multilingual PII detection, and masked-diffusion generation.
The full text is in the original source. Here we provide a brief summary and key facts.