Post

I'll get straight to the point. We trained 2 new models. Like BERT, but modern. ModernBERT. Not some hypey GenAI thing, but a proper workhorse model, for retrieval, classification, etc. Real practical stuff. It's much faster, more accurate, longer context, and more useful. 🧵

146 reposts620 likes

``` an entire enterprise codebase indexed with ModernBERT embeddings, providing fast long context retrieval of the relevant code across all repositories ``` ⬆️ is this for an out of the box ModernBERT model without any additional fine-tuning?

We haven't compared it directly, although generally OpenAI's embeddings seem to trail the better open models, so I expect it would be an improvement.

Great! Looking forward to trying this out sometime. Since we're an AWS shop we'll probably consolidate on Bedrock, and although it has an embedding service, I'd love to use that opportunity to pick something that's actually best for our needs.

That said, I really do have to hand it to OpenAI for making their models easy to use + comprehensive enough to the point where we could use them in production since Spring of last year, with there still being few replacements for their offerings

We created ModernBERT because encoder-only architectures are ideal for the kinds of real-world problems that come up every day, like retrieval (e.g. for RAG), classification (such as content moderation), & entity extraction. But they're under-appreciated, with little investment.

6 years after BERT, we have a replacement: ModernBERT! @answerdotai, @LightOnIO (et al) took dozens of advances from recent years of work on LLMs, and applied them to a BERT-style model, including updates to the architecture and the training process, eg alternating attention.

The more I think about it, fine-tuning this could be the ideal tool for replacing the “router” that picks the best next step for processing/responding with a workflow.

Ooh! This looks very promising. I’ve been thinking of replacing some classification steps in a workflow with local models. I’m curious how fast they can be on CPU only hardware(compared to slow sonnet api calls).

Yes, this was my thought exactly. There's tons of stuff you want a little bit language model smarts for but you don't need need a full chatbot. This could be great for that, especially if it can run in the web server directly.

Yeah, along those lines. Light enough to run as an async. task (say a 1-4 core server), and faster than an api call would be the ideal sweet spot.

This could be very useful for my team at our healthcare company. Thanks for your work! I see brief mention of the dataset in the paper. Can you provide more info on it? Is it proprietary? A conglomerate of a bunch of open source datasets?

I'd like to know how does it compare with T5? P.S.: I'm the author of Wikipedia BERT and T5 and basically all the Transformer-related pages. If you have comments about how the pages can be improved I can do it. (Yes ULMFit had already been on the BERT page)

T5 is an Encoder-Decoder model -- a different part of the family tree. It's primarily a generative model, whereas ModernBERT isn't, so it doesn't make that much sense to compare them.

Yi Tay etc disagree: www.yitay.net/blog/model-a... 2024-07-16 > BERT-style models pretty much deprecated at this point because there is a strictly better alternative... if the decoder was getting in the way... yanking out the encoder performed just as competitive as a BERT encoder.

yitay.netWhat happened to BERT & T5? On Transformer Encoders, PrefixLM and Denoising Objectives — Yi TayA Blogpost series about Model Architectures Part 1: What happened to BERT and T5? Thoughts on Transformer Encoders, PrefixLM and Denoising objectives

That's agreeing, actually -- rip out the decoder, as he says, and now you have an encoder-only model. Like ModernBERT. And if that's what you wanted, why not just train that directly? We don't all have infinite resources like Google, so cost matters.

Any chance your README could include a more detailed guide how to set up pretraining? I.e. being explicit about expected data format, data prep steps, launch commands for distributed training, etc. Would be very helpful and appreciated.