llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

Feature Request: Add Support for ModernBert

Open sukkritsharmaofficial opened this issue 1 year ago • 1 comments

Prerequisites

  • [x] I am running the latest code. Mention the version if possible as well.
  • [x] I carefully followed the README.md.
  • [x] I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • [x] I reviewed the Discussions, and have a new and useful enhancement to share.

Feature Description

  • Add Support for ModernBert https://huggingface.co/nomic-ai/modernbert-embed-base

Motivation

Use the more enhanced version of embedding models for accurate retrieval.

Possible Implementation

No response

sukkritsharmaofficial avatar Jan 17 '25 18:01 sukkritsharmaofficial

https://huggingface.co/blog/modernbert

cheungxiongwei avatar Feb 21 '25 09:02 cheungxiongwei

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Apr 07 '25 01:04 github-actions[bot]

https://github.com/NoahBPeterson/llama.cpp/tree/modernbert

I did some work on this, and got to the point where I could produce some non-zero output, but I couldn't get it all of the way there.

If I started over, I would have copied one of the Gemma models' implementations instead of Bert, since ModernBERT uses Gemma's attention, which is global every n layers, local for all the others. That's what I get for not deep reading the ModernBERT paper until well into my efforts of trying to recreate the attention mechanism myself ;)

NoahBPeterson avatar May 06 '25 13:05 NoahBPeterson

since ModernBERT uses Gemma's attention

Gemma's attention is causal, while if I remember correctly, ModernBERT uses non-causal. So it would need a slight modification when creating the KQ mask.

ggerganov avatar May 07 '25 08:05 ggerganov

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 22 '25 01:06 github-actions[bot]