Liquid AI’s Tiny Encoders Run Long-Context Inference 3.7× Faster on CPU Than ModernBERT

Encoder models, the workhorses behind search, classification, and safety filtering, have a problem. As input lengths grow to thousands of tokens, inference latency on CPU climbs into minutes. Liquid AI’s latest release aims to solve that with a pair of small encoder models designed specifically for efficient long-context inference on CPU hardware.

The LFM2.5-Encoder series, released in 230-million and 350-million parameter variants, processes 8,192 tokens about 3.7 times faster than the equivalent ModernBERT-base model on CPU. At that length, ModernBERT-base takes over 90 seconds per forward pass. The LFM2.5-Encoder-230M does it in approximately 28 seconds.

The performance gain comes from the underlying architecture. Both models are initialized from Liquid AI’s LFM2.5 decoder backbones and converted to bidirectional encoders through three modifications: a bidirectional attention mask that lets tokens see both sides, non-causal short convolutions with symmetric padding, and masked language modeling training with 30 percent token masking. A two-stage training process first builds general language competence at short context lengths, then extends to 8,192 tokens on a mixed corpus of factual, legal, and multilingual data.

The benchmarks tell a clear story for the model’s size class. The 350M variant ranks fourth out of 14 encoder models tested across GLUE, SuperGLUE, and multilingual classification tasks, beaten only by larger models, including a 3.5-billion-parameter entry. The 230M variant beats ModernBERT-base and every EuroBERT model while being smaller than most of them.

Our mission is simple: reliable news backed by careful research. Help us continue that mission.

Contribute today

For developers deploying in production, the speed advantage on CPU is the headline. Many encoder workloads (intent routing, policy linting, PII detection, spell checking) run continuously on server CPUs rather than GPUs, where latency at long input lengths directly affects throughput. Liquid AI has released live demos on Hugging Face Spaces showing zero-shot prompt routing, policy linting, and multilingual PII detection running entirely on CPU.

The models are available under permissive open-source licenses and integrate through the standard Hugging Face Transformers pipeline. Flash Attention 2 is optional for GPU acceleration, but the design ethos is clear: encoders should not require a GPU to be practical, even when processing thousands of tokens per request.

Sources: Hugging Face Blog (Jul 28, 2026); Liquid AI models

Scroll to Top