Feature Request: mmproj GPU processing while offloading weights
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 20/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Calme
- Stack technique
- cpp
- Domaine
- machine-learning, performance
Piste de recherche
Start from the README and the linked llama.cpp discussion #20246, then trace how the existing --mmproj-offload and --no-mmproj-offload options are wired through the CLI and multimodal projector loading. The issue names no source files, so the first task is to locate the mmproj load/encode path and the model-specific projector implementations such as Qwen and Gemma before proposing a design. Done means a documented, working third mode that keeps image encoding on GPU without permanent full projector residency.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Prerequisites
- I am running the latest code. Mention the version if possible as well.
- I carefully followed the README.md.
- 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).
- I reviewed the Discussions, and have a new and useful enhancement to share.
Feature Description
I would like to request an option to use GPU-accelerated vision processing without keeping the complete multimodal projector permanently resident in VRAM.
Currently there are essentially two choices:
--mmproj-offload: fast GPU image encoding, but the projector permanently consumes a significant amount of VRAM.
--no-mmproj-offload: saves the VRAM, but image encoding runs on the CPU and can be considerably slower.
What I would like is a third option: keep the VRAM available for the LLM / KV cache most of the time, while still performing image encoding on the GPU.
There already seem to be several approaches demonstrating that this is possible:
https://github.com/ggml-org/llama.cpp/discussions/20246
https://github.com/Anbeeld/beellama.cpp/issues/140
https://github.com/valujin/beellama-kvarn
I also encountered a similar low-VRAM GPU vision approach while testing HyperQwen / vLLM.
Motivation
Currently, loading mmproj typically consumes around 1 GB of VRAM.
On VRAM-constrained GPUs, this is quite significant, especially when running large models with long context windows. That VRAM could otherwise be used for additional context, larger KV cache, draft models, or other features.
CPU-based image processing is an alternative, but in my experience it creates substantial overhead and is much slower.
For this reason, I currently often disable mmproj completely for Qwen and Gemma models: keeping it on the GPU costs too much VRAM, while processing images on the CPU is too expensive.
A low-memory GPU implementation would provide a useful middle ground:
-
fast GPU-based image processing
-
very low additional VRAM usage
-
more VRAM available for context and KV cache
-
no need to choose between fast vision processing and large context sizes
For users running modern multimodal models on GPUs with limited VRAM, this could make a substantial difference.
Possible Implementation
HyperQwen may provide a useful reference implementation. Its vLLM-based implementation seems to use a sliding-window approach for image processing, allowing the processing to remain GPU-accelerated while using only a very small amount of VRAM.
The related llama.cpp discussion also appears to cover approaches in this direction:
https://github.com/ggml-org/llama.cpp/discussions/20246
I assume that a fully model-independent implementation may not be straightforward, since projector architectures differ between model families.
Still, even an implementation initially targeting a few common architectures such as Qwen and Gemma could already be very useful, and might provide a basis for a more generic solution later.
- Langage dominant
- C++
- Étoiles
- 1.2k
- Forks
- 80
- Merge moyen
- 4 j 20 h
- PR mergées (30 j)
- 2
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de Anbeeld/beellama.cpp
-
[BUG] KVarN assertion failure in build_inp_mem_hybrid_iswa() due to uninitialized self_kvarn_rotOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Anbeeld/beellama.cpp#205 ·
-
Difficulté 3/5 Une demi-journée Accessibilité débutants 58/100
Anbeeld/beellama.cpp#206 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 57/100
Anbeeld/beellama.cpp#204 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
Anbeeld/beellama.cpp#203 · 2 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
Anbeeld/beellama.cpp#202 · 1 commentaire ·
Toutes les issues de Anbeeld/beellama.cpp
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
CachyOS/packageinstaller#144 ·
Les mainteneurs répondent en général sous 1 jour
-
documentation
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
TomerAberbach/profiler-md#951 ·
Les mainteneurs répondent en général sous 1 jour
-
[Bug] Default key routing (JavaStringHash) picks a different partition than the Java client for about half of keysPeut-être pris @0z5a l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
apache/pulsar-client-go#1575 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
pocoproject/poco#5764 ·
Les mainteneurs répondent en général sous 2 jours
-
bug cpp-core-guidelines low-priority
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
NatronGitHub/openfx-supportext#164 ·
Les mainteneurs répondent en général sous 1 jour