feat: Update vendored llama.cpp to include ModernBERT support
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Stale
- Domain
- ai-infra-agents, backend
Research direction
The issue requires updating the vendored llama.cpp submodule to a commit after Dec 22, 2025, and then updating the Python ctypes bindings in llama_cpp/llama_cpp.py to match the changed C API (e.g., llama_get_kv_self is gone). Also, CMakeLists.txt needs fixes, especially around LLAVA_BUILD. Start by examining the current vendor/llama.cpp submodule and the binding code, then check the llama.cpp C API changes in the target commit. Building with -DLLAVA_BUILD=OFF is a workaround, but the bindings must be fully compatible. Done looks like the library can load ModernBERT GGUF models without errors.
Written by the indexing model from the issue text.
Description
Context
The current release (v0.3.16, Aug 15 2025) vendors llama.cpp at commit 4227c9b (Aug 14, 2025). ModernBERT architecture support was added to llama.cpp on Dec 22, 2025 in PR ggml-org/llama.cpp#15641 (src/models/modern-bert.cpp). The vendor submodule hasn't been updated in ~7 months.
Problem
Loading a ModernBERT GGUF model fails with:
llama_model_load: error loading model: error loading model architecture: unknown model architecture: 'modernbert'
The binary only knows: bert, falcon, gemma, gpt2, llama, mamba, qwen, rwkv, stablelm — no modernbert.
Attempted fix
We tried updating the vendor submodule to llama.cpp b8373 (Mar 16, 2026) and building from source. Results:
- CMake fails with
LLAVA_BUILD=ON(default) —vendor/llama.cpp/tools/mtmd/CMakeLists.txt:37has aset_target_propertieserror incompatible with the binding's CMakeLists.txt - CMake succeeds with
-DLLAVA_BUILD=OFF— builds and installs fine - Runtime ABI mismatch — the Python bindings call
llama_get_kv_selfwhich no longer exists in b8373 (symbol not found). The C API has diverged significantly in 7 months.
So it's not just a submodule bump — the Python ctypes bindings need updates to match the current llama.cpp C API.
Why it matters
Several recent high-quality embedding models use ModernBERT architecture:
- granite-embedding-small-english-r2 (IBM, 47M params, 384d, BEIR NDCG@10 50.9, Apache 2.0)
- modernbert-embed-base (Nomic, 149M params, Apache 2.0)
- gte-modernbert-base (Alibaba, 149M params)
These models can't be used with llama-cpp-python until the binding is updated.
Request
Update the Python ctypes bindings and CMakeLists.txt to be compatible with a recent llama.cpp build that includes ModernBERT support (post Dec 22, 2025).
- Dominant language
- Python
- Stars
- 10.7k
- Forks
- 1.5k
- Avg merge
- 1h 40m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from abetlen/llama-cpp-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
abetlen/llama-cpp-python#2424 ·
Maintainers usually reply within 1 day
-
Seven llama_sampler_init_* bindings admit keyword arguments that the ctypes function object silently dropsPossibly taken @Belal0066 claimed this 59 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
abetlen/llama-cpp-python#2371 ·
Maintainers usually reply within 1 day
-
uv add llama-cpp-python wheels fails for versions above 0.3.30Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
abetlen/llama-cpp-python#2352 · 1 comment · 3 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
abetlen/llama-cpp-python#2314 ·
Maintainers usually reply within 1 day
-
Llama.embed() calls LlamaBatch.add_sequence with old 3-arg signature; missing logits_arrayMay be free again @lxcxjxhx claimed this 136 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
abetlen/llama-cpp-python#2211 · 2 comments ·
Maintainers usually reply within 1 day
All issues in abetlen/llama-cpp-python
Similar issues
-
Bug IronPython Python 3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pyrevitlabs/pyRevit#4184 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 74/100
jqueryscript/awesome-claude-code#1009 ·
-
tests
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[Plugin] 群聊记忆 · 人格养成Open
Difficulty 1/5 1-3 hours Newbie friendliness 74/100