context: ignore zero scale LoRAs when checking sameness#20166
Merged
ggerganov merged 1 commit intoggml-org:masterfrom Mar 6, 2026
Merged
context: ignore zero scale LoRAs when checking sameness#20166ggerganov merged 1 commit intoggml-org:masterfrom
ggerganov merged 1 commit intoggml-org:masterfrom
Conversation
ggerganov
approved these changes
Mar 6, 2026
bartowski1182
pushed a commit
to bartowski1182/llama.cpp
that referenced
this pull request
Mar 10, 2026
Ethan-a2
pushed a commit
to Ethan-a2/llama.cpp
that referenced
this pull request
Mar 20, 2026
Seunghhon
pushed a commit
to Seunghhon/llama.cpp
that referenced
this pull request
Apr 26, 2026
rsenthilkumar6
pushed a commit
to rsenthilkumar6/llama.cpp
that referenced
this pull request
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When passed a set of input LoRAs,
set_adapters_loranever stores zero scale LoRAs in thelorasfield, butadapters_lora_are_sameexpects the number of inputs to be equal to the number of stored LoRAs. So there will always be a mismatch if zero scale adapters are passed repeatedly.This causes a server started with
--lora-init-without-applyto re-reserve the graph for every token when handling requests with"lora": [{"id": 0, "scale": 0.0}].Tested:
llama-server --model tmp/ggml-org_stories15M_MOE_stories15M_MOE-F16.gguf --lora tmp/moe_shakespeare15M.gguf --lora-init-without-apply"lora": [{"id": 0, "scale": 0.0}]via the Web UIsched_reserve: reserving ...for every tokensched_reserve: reserving ...just once (or not at all)The server unit tests still pass, but I don't know how to add a test specifically for this bug (unless I want to rely on inference performance, which seems suboptimal).
Alternative fixes considered:
set_adapters_lorabefore callingadapters_lora_are_same. However, that would require allocating even for the not-modified case, which it seemed better to avoid.llama_set_adapters_loraAPI, so it seemed better to fix this for everyone.AI Disclaimer: Claude Code was used to identify the problem after describing the symptoms. The patch was authored by a human (me).