common: add system-level config file - #26118
Merged
Merged
Conversation
ngxson
requested changes
Jul 25, 2026
ngxson
left a comment
Collaborator
There was a problem hiding this comment.
also missing docs about this feature
jcmdln
force-pushed
the
config-precedence
branch
from
July 29, 2026 19:44
05ab3c1 to
e18f92b
Compare
1. CLI flags have the highest precedence
2. ENV vars have the second-highest precedence
3. System and User configs have the lowest precedence
- Linux/BSD/Mac
- /etc/llama.cpp/config.ini < ${XDG_CONFIG_HOME:-~/.config}/llama.cpp/config.ini
- Windows
- %PROGRAMDATA%\llama.cpp\config.ini < %APPDATA%\llama.cpp\config.ini
jcmdln
force-pushed
the
config-precedence
branch
from
August 2, 2026 19:45
e18f92b to
3fa1bff
Compare
Contributor
Author
|
I believe I have completed the requested changes. Anything else to improve or is this looking better? |
Collaborator
|
sorry for the delay, I'll push my changes directly to this PR |
jcmdln
force-pushed
the
config-precedence
branch
from
August 12, 2026 20:35
3fa1bff to
a537279
Compare
Collaborator
|
@jcmdln I'm taking over this PR and please do not push any further commits here are quite many correctness issues that it would be better if I resolve it myself |
ngxson
force-pushed
the
config-precedence
branch
from
August 12, 2026 20:44
a537279 to
1b4b677
Compare
ngxson
approved these changes
Aug 12, 2026
ngxson
left a comment
Collaborator
There was a problem hiding this comment.
all UBs are fixed and behaviors are well-documented in docs/preset.md
1 task
brittlewis12
pushed a commit
to brittlewis12/llama.cpp
that referenced
this pull request
Aug 17, 2026
* common: Add CLI > ENV > models-presets > INI precedence
1. CLI flags have the highest precedence
2. ENV vars have the second-highest precedence
3. System and User configs have the lowest precedence
- Linux/BSD/Mac
- /etc/llama.cpp/config.ini < ${XDG_CONFIG_HOME:-~/.config}/llama.cpp/config.ini
- Windows
- %PROGRAMDATA%\llama.cpp\config.ini < %APPDATA%\llama.cpp\config.ini
* fix UB
* use common_get_env
* ignore_unknown_keys
* nits
* add docs
---------
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
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.
Overview
Currently running llama-cpp tools (llama-cli, llama-bench, llama-embedding, etc) require passing many CLI flags. In some cases, these commands require the same config options, such as defining multi-gpu scenarios, threads, parallel, api-key, etc.
The existing mechanism is
models-presetbut this only works forllama-serverand is a portable, shareable config format. Administrators of multiple machines are missing the ability to define per-node configs independent ofmodels-preset, instead needing to include this in init system configs, shell aliases or some other mechanism.Instead of duplicating these values or smuggling them into other systems, let's add config precedence re-using the same ini config libraries that
models-presetuses so that:CLI flags have the highest precedence
ENV vars have the second-highest precedence
System and User configs have the lowest precedence
Here is an example of what flags an operator might want to set for a particular node:
Requirements