Article summary — original

Liquid AI Releases LFM2.5-Encoders for Efficient Long-Context CPU and GPU Inference Liquid AI has launched LFM2.5-Encoder-230M and LFM2.5-Encoder-350M, two open-weight bidirectional encoder models designed for efficient long-context processing up to 8,192 tokens on commodity hardware and CPUs. Models are built from LFM2 decoder backbones converted to bidirectional encoders using non-causal convolutions, bidirectional attention, and masked language pre-training. LFM2.5-Encoder-230M runs about 3.7 times faster than ModernBERT-base at an 8,192-token context on CPU, requiring roughly 28 seconds per pass compared to over 90 seconds. Benchmark evaluations on 17 tasks from GLUE, SuperGLUE, and multilingual classification place LFM2.5-Encoder-350M fourth among 14 evaluated models, trailing only substantially larger architectures. The models are hosted on Hugging Face alongside CPU-only demo spaces covering zero-shot routing, policy linting, spell checking, PII detection, and masked-diffusion generation. Architecture and Training Methodology The encoders are adapted from the causal LFM2-230M and LFM2-350M decoder backbones. To convert them into general-purpose encoders, Liquid AI introduced bidirectional attention masks, symmetrically padded non-causal short convolutions, and masked language modeling with a 30% masking rate. Training proceeded in two phases: an initial general language competence stage using a 1,024-token context on a web corpus, followed by a long-context adaptation phase extending sequences to 8,192 tokens to bolster legal, factual, and multilingual performance. Benchmark Accuracy and Inference Performance Across 14 models tested on 17 tasks from GLUE, SuperGLUE, and multilingual suites across five seeds, LFM2.5-Encoder-350M achieved fourth place, outscored only by larger models including a 3.5B-parameter baseline. LFM2.5-Encoder-230M outperformed ModernBERT-base and all tested EuroBERT models. In runtime tests, the 230M model showed a significant CPU latency advantage, completing an 8,192-token forward pass in roughly 28 seconds compared to over 90 seconds for ModernBERT-base. On GPUs, ModernBERT-base led at contexts below 1,000 tokens, while the LFM2.5 models took the lead above approximately 2,000 tokens. Applications and Usage Targeted at high-volume classification, routing, and scoring workloads, the encoders can run continuously on standard CPUs as lower-cost alternatives to generative LLMs. Liquid AI demonstrated tasks including zero-shot prompt routing, zero-shot policy linting, spell checking, and multilingual PII identification spanning 40 data categories across 16 languages. Developers can load the weights using Hugging Face Transformers for masked language modeling or attach task-specific heads for fine-tuning.

Article summary — zh

Liquid AI 发布通用编码器模型 LFM2.5-Encoders,主打 CPU 平台长上下文快速推理 Liquid AI 在 Hugging Face 上发布了 LFM2.5-Encoder-230M 和 LFM2.5-Encoder-350M 两款开源权重通用编码器。该系列支持 8,192 token 上下文,专门针对长文本处理和 CPU 部署进行优化,在长序列推理速度上显著超越现有基线模型。 发布 230M 与 350M 两款编码器模型,支持 8,192 token 上下文长度并开源权重。 基于 LFM2 解码器骨干网络改造,通过双向注意力、非因果卷积和掩码语言建模(30%掩码率)分两阶段训练而成。 在 GLUE、SuperGLUE 等 17 项基准测试中,表现比肩或超越包括 ModernBERT-base、EuroBERT 及更大规模的模型。 CPU 推理优势突出,8,192 token 下推理耗时约 28 秒,较 ModernBERT-base 快约 3.7 倍。 架构改造与训练流程 LFM2.5-Encoders 从 LFM2.5-230M 和 350M 自回归解码器骨干初始化,转变为双向编码器时引入了双向注意力掩码、对称填充的非因果短卷积,并在训练中应用 30% 掩码率的掩码语言建模任务。训练分为两个阶段:先在 1,024 长度上下文的大规模网络语料上建立通用语言能力,再扩展至 8,192 上下文进行全量数据长文本适配,强化事实、法律与多语言能力。 基准评估与推理性能 在 GLUE、SuperGLUE 及多语言分类等 17 项任务的微调评测中,LFM2.5-Encoder-350M 在 14 个对比模型中名列第四,仅落后于体量更大的模型(包括接近其 10 倍体积的 3.5B 模型);230M 版本则击败了 ModernBERT-base 及所有 EuroBERT 模型。在推理速度方面,CPU 环境优势尤为显著:在 8,192 token 序列下,ModernBERT-base 单次前向传播需逾 90 秒,而 230M 模型仅需约 28 秒(提速约 3.7 倍)。在 GPU 环境下,从约 2,000 token 开始该系列同样保持速度领先。 生产部署与应用场景 该系列模型适用于文本分类、提示词路由、合规检查、拼写纠错和多语言 PII 识别等高吞吐生产任务,也支持掩码扩散文本生成。相较于生成式大语言模型,微调编码器运行成本显著更低,且可直接借助 Hugging Face Transformers 库在现有 CPU 硬件上部署运行。

Saved original article

Today, we release two new encoder models on Hugging Face: LFM2.5-Encoder-230M and LFM2.5-Encoder-350M . They match the quality of larger models but stay fast as inputs get longer. This means you can run document-scale jobs on the hardware you already have, even on CPU. Here's what you get: Strong for their size: match or beat larger encoders on GLUE, SuperGLUE, and multilingual tasks. 8,192-token context with latency that grows slowly as inputs get longer. Fast on CPU : about 3.7× faster than ModernBERT-base at long context. With these, you can build intent routers, policy linters, PII detectors, and text classifiers that run cheaply, all day. See the live demos below. Why we built a general-purpose encoder Last month we released LFM2.5-Retrievers , built for multilingual search. LFM2.5-Encoders come from the same family but serve a broader purpose. They're pre-trained with a masked-language objective, so you can fine-tune them for classification, token-level tasks, and search alike. Search is just one thing an encoder enables. That's why we built a general-purpose model instead of reusing the retrievers. Encoders power many modern production NLP applications: classifiers, intent routers, safety filters. These jobs run all day, usually on CPU, on ever-longer inputs. BERT established this class of model, and recently ModernBERT pushed its accuracy, speed, and context further. LFM2.5-Encoders take the next step on the LFM2 architecture, where cost grows slowly as inputs grow. How the encoders are built We initialize the encoders from their respective LFM2 decoder backbones: LFM2.5-230M and LFM2.5-350M . Then we turn each causal decoder into a bidirectional encoder with a few changes: Bidirectional attention mask: each token now sees the tokens on both sides, not just the ones before it. Non-causal short convolutions: we pad them symmetrically so each token's convolution mixes in its neighbors on both sides. Masked language modeling: we mask 30% of the tokens during training. We train both models in two stages: General language competence : a short-context masked-language objective on a large web corpus at a 1,024-token context. Long-context adaptation : extending context to 8,192 tokens on the full data mix, strengthening factual, legal, and multilingual competence. Benchmark Results We fine-tune each model fully on every task and report the resulting score. Across the table, that's 14 models on 17 tasks pulled from GLUE, SuperGLUE, and multilingual classification. We report the mean across five held-out seeds, so the numbers are stable run to run. The full framework and raw results are open-sourced . LFM2.5-Encoder-350M ranks fourth of the 14 models. The three ahead of it are all larger, including a 3.5B model nearly 10 times its size. LFM2.5-Encoder-230M beats ModernBERT-base and every EuroBERT model, while being smaller than most of them. Both also score well above our own LFM2.5-Retrievers here. Inference speed on CPU and GPU Our encoders inherit the LFM2 backbone's fast inference. Since both our encoders and ModernBERT support an 8,192-token context, we measure speed across the full range. Our encoders show their biggest edge on CPU. Here, LFM2.5-Encoder-230M is the fastest at every sequence length (even faster than the smaller ModernBERT-base for short inputs). With increasing input length, throughput decreases sharply for ModernBERT, while our LFM2.5-Encoders rise into the mid-range before tapering. At 8,192 tokens, ModernBERT-base takes over a minute and a half per forward pass versus about 28s for LFM2.5-Encoder-230M. This is about 3.7x faster. For developers, that means you can scan or classify a full contract, transcript, or long support thread in under 30 seconds on a laptop CPU. On GPU, a similar pattern holds with a smaller margin: ModernBERT-base leads below ~1K tokens on the Apple GPU. Our encoders take the lead from about 2K tokens. This shows that for long inputs, LFM2.5-Encoders are the faster choice, and if you're running on CPU, dramatically so. LFM2.5-Encoder demos We built the demos below from fine-tuned LFM2.5-Encoders. Each one runs in a CPU-only Hugging Face space: Zero-shot prompt routing : define your own routing lanes as free text. The model scores the whole prompt against every lane in one pass. Zero-shot policy linting : check text against your company's rules, written as free text. It scores every token against every rule in one pass. Spell checking : correct misspellings token by token. PII detection : spot and remove 40 kinds of personal information across 16 languages. Masked-diffusion text generation (bonus): run the encoder as a chatbot that generates text by iteratively unmasking instead of left to right. How to use and fine-tune LFM2.5-Encoders Reach for an LFM2.5-Encoder when you have a high-volume understanding task, such as classification, routing, extraction, or scoring, that runs constantly and has to stay cheap and fast. For jobs like these, a fine-tuned encoder is smaller, faster, and far cheaper to run than a generative LLM, and it fits on the CPUs you already have. Between the two encoder sizes: LFM2.5-Encoder-350M : choose it when accuracy matters most. LFM2.5-Encoder-230M : choose it for tighter hardware or higher throughput. You can start in a few lines. Load a model with transformers . Then run it directly for masked-token prediction, or attach your own head and fine-tune it for your task. Load and run the model Install the latest version of transformers : pip install -U transformers Run masked-token prediction: from transformers import AutoModelForMaskedLM, AutoTokenizer import torch model_id = "LiquidAI/LFM2.5-Encoder-230M" # or "LiquidAI/LFM2.5-Encoder-350M" tok = AutoTokenizer.from_pretrained(model_id, trust_remote_code= True ) mlm = AutoModelForMaskedLM.from_pretrained(model_id, trust_remote_code= True ) text = f"The capital of France is {tok.mask_token} ." enc = tok(text, return_tensors= "pt" ) with torch.no_grad(): logits = mlm(**enc).logits pos = (enc[ "input_ids" ][ 0 ] == tok.mask_token_id).nonzero()[ 0 ].item() print ([tok.decode([t]).strip() for t in logits[ 0 , pos].topk( 5 ).indices.tolist()]) # -> ['Paris', 'Strasbourg', 'Paris', 'Lyon', 'Versailles'] For downstream tasks, load the encoder body and attach your own head (classification, token classification, regression, retrieval): from transformers import AutoModel body = AutoModel.from_pretrained(model_id, trust_remote_code= True ) If your GPU supports it, use Flash Attention 2 for the highest efficiency: pip install flash-attn Fine-tuning for your task A base encoder gives you general-purpose representations, not task outputs. So you fine-tune it for each task. Our fine-tuning tutorial walks through fine-tuning on long legal documents with an 8k context. Get started with LFM2.5-Encoders Both encoders are open-weight and available on Hugging Face today: Download: LFM2.5-Encoder-230M and LFM2.5-Encoder-350M on Hugging Face. Try: run the demos above in your browser, no setup needed. Fine-tune: adapt an encoder to your task with our fine-tuning tutorial . We can't wait to see what you build. Citation If you use this work, please cite the release blog: @article{liquidAI2026Encoders, author = {Liquid AI}, title = {LFM2.5-Encoders: Fast at Long Context, Even on CPU}, journal = {Liquid AI Blog}, year = {2026}, note = {www.liquid.ai/blog/lfm2-5-encoders}, }