You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Significantly higher gpu memory consumption in koboldcpp 1.98.1 compared to 1.95.1 when using both embedding model and text model #1734
Describe the Issue
After updating to 1.98.1 from 1.95.1, attempting to run the same model configuration (text model + embedding) results in a crash because of not having enough gpu memory.
Having attempted to reduce the number of offloaded GPU layers I have noticed that even with 0 gpu layers offloaded it still uses 5 gb of gpu memory, against 700 mb with version 1.95.1
The 4gb+ difference disappears if I remove either the embedding model or the text model.
Hmm... the context length of loaded embedding models now defaults to the same context length of loaded text models. You can override this with --embeddingsmaxctx, does it help?
Hmm... the context length of loaded embedding models now defaults to the same context length of loaded text models. You can override this with --embeddingsmaxctx, does it help?
Adding embeddingsmaxctx: 8192 to the configuration file made no difference. still ~4.5 gb more gpu memory allocated for 1.98.1 compared to 1.95.1 (with gpulayers: 1 I get 918 mb vs 5478 mb from nvidia-smi, and with all layers it still crashes)
Note that the embedding model has a default context of 8192 tokens, same as the configured contextsize for the text model.
If i use embeddingsmaxctx: 1024 instead the difference (between the two versions) becomes much smaller: 1022 mb vs 918 mb.
Should it make any difference though if we use embeddingsgpu: false?
I have restricted a bit more the reproduction surface. Apparently this only happens if flashAttention is disabled.
I must correct myself here. With flashAttention enabled there is still some difference in gpu memory usage, although it is significantly lower (1428 mb vs 898 mb with full 8k context and gpulayers: 1, difference of about 500 mb), this may suggest the extra memory usage is related to the logits or kv cache (which is quantized differently with flash attention)
Thank you for looking into this. Pacman currently botched my grub installation, I'll test it as soon as I can find an usb stick to boot my linux machine again -.-
@LostRuins tested with 1.99.4 GPU memory usage is down to 900mb with flash attention and 934mb without it, the same as 1.95.1 (it too has a slightly higher memory usage footprint now, possibly different than before because I have updated CUDA and gpu drivers in the meanwhile). Issue seems solved for me.
Activity
LostRuins commentedon Sep 11, 2025
Hmm... the context length of loaded embedding models now defaults to the same context length of loaded text models. You can override this with
--embeddingsmaxctx, does it help?pqnet commentedon Sep 14, 2025
I have restricted a bit more the reproduction surface. Apparently this only happens if
flashAttentionis disabled.pqnet commentedon Sep 14, 2025
Adding
embeddingsmaxctx: 8192to the configuration file made no difference. still ~4.5 gb more gpu memory allocated for 1.98.1 compared to 1.95.1 (withgpulayers: 1I get 918 mb vs 5478 mb fromnvidia-smi, and with all layers it still crashes)Note that the embedding model has a default context of 8192 tokens, same as the configured
contextsizefor the text model.If i use
embeddingsmaxctx: 1024instead the difference (between the two versions) becomes much smaller: 1022 mb vs 918 mb.Should it make any difference though if we use
embeddingsgpu: false?pqnet commentedon Sep 14, 2025
I must correct myself here. With
flashAttentionenabled there is still some difference in gpu memory usage, although it is significantly lower (1428 mb vs 898 mb with full 8k context andgpulayers: 1, difference of about 500 mb), this may suggest the extra memory usage is related to the logits or kv cache (which is quantized differently with flash attention)LostRuins commentedon Sep 14, 2025
Alright i'll look into it
LostRuins commentedon Sep 21, 2025
Hi, can you try 1.99, should be fixed.
pqnet commentedon Sep 23, 2025
Thank you for looking into this. Pacman currently botched my grub installation, I'll test it as soon as I can find an usb stick to boot my linux machine again -.-
pqnet commentedon Sep 28, 2025
@LostRuins tested with 1.99.4 GPU memory usage is down to 900mb with flash attention and 934mb without it, the same as 1.95.1 (it too has a slightly higher memory usage footprint now, possibly different than before because I have updated CUDA and gpu drivers in the meanwhile). Issue seems solved for me.
LostRuins commentedon Jan 18, 2026
for tracking, original issue ggml-org#15586
attempted fix: 7b4517c#diff-9c76f92045438deae73cc18c608142fddd561d05228fcff1e51e4212061b0e86