LFM3-style 125M
A compact language model for architecture study
2 min readupdated
LFM3-style 125M is a 125-million parameter base language model built to compare the architectural features of LFM3 and LFM2. Trained from scratch on two billion tokens of English web text, it operates on a next-token prediction basis. It does not follow instructions and is not designed for chat dialogues. This development will interest researchers and developers studying hybrid convolution and attention layers.
Key features
- A hybrid architecture combining convolutional layers and global attention layers with separate windows.
- A compact size of 125 million parameters, allowing the model to run on a regular CPU or GPU.
- Uses the tokenizer from the LFM2 architecture with a vocabulary size of 65,536 tokens.
- Includes a ready-to-use quantized ONNX version for running in the browser or via onnxruntime.
What you can do
- Run the model locally using a pure PyTorch script for English text generation.
- Test the model directly in the browser through the official developer web sandbox.
- Use the
modeling_lfm3_style.pyarchitecture file for experiments with hybrid layers and attention parameters. - Integrate the ONNX version of the model into lightweight applications with limited resources.
Example
Running the model for text generation using Python:
import sys
sys.path.insert(0, "lfm3-style-125m")
from modeling_lfm3_style import LFM3Style
model, tok = LFM3Style.from_pretrained("lfm3-style-125m")
print(model.complete(tok, "The best way to learn a new language is", max_new_tokens=40, temperature=0.7))Read more
DetailsBenchmarks: validation loss 3.148 (compared to 3.211 for the LFM2-style twin).
Hardware requirements: lightweight model, runs on a CPU or a single GPU.
Limitations: trained only on English, outputs incorrect facts, and is prone to repetition.
Training details: 2B Ultra-FineWeb tokens, AdamW, bf16, about 50 minutes on a single B200 accelerator.










Comments