llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

Misc. bug: llama-server webui overriding command line parameters

Open merc4derp opened this issue 7 months ago • 3 comments

Name and Version

llama-server --version version: 5269 (1d36b367) built with MSVC 19.43.34808.0 for x64

Operating systems

No response

Which llama.cpp modules do you know to be affected?

llama-server

Command line


Problem description & steps to reproduce

The server webui overrides the launch command parameters with its own saved settings. I can only see this as a bug.

Expected behavior would be to pass any explicitly given command line parameters to the webui and override its previously stored values instead.

The current behavior makes the webui needlessly hard to use when swapping models.

First Bad Commit

No response

Relevant log output


merc4derp avatar May 03 '25 00:05 merc4derp

If wanting to have it locally for now, you can skip sending those WebUI defaults:

Image
Show git diff for adding 'useServerDefaults' button to advanced settings
diff --git a/tools/server/webui/src/Config.ts b/tools/server/webui/src/Config.ts
index 5eef608c..1f564fef 100644
--- a/tools/server/webui/src/Config.ts
+++ b/tools/server/webui/src/Config.ts
@@ -37,6 +37,7 @@ export const CONFIG_DEFAULT = {
   dry_penalty_last_n: -1,
   max_tokens: -1,
   custom: '', // custom json-stringified object
+  useServerDefaults: false, // don't send defaults
   // experimental features
   pyIntepreterEnabled: false,
 };
@@ -79,6 +80,7 @@ export const CONFIG_INFO: Record<string, string> = {
     'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets DRY penalty for the last n tokens.',
   max_tokens: 'The maximum number of token per output.',
   custom: '', // custom json-stringified object
+  useServerDefaults: 'When enabled, skip sending WebUI defaults (e.g., temperature) and use the server\'s default values instead.',
 };
 // config keys having numeric value (i.e. temperature, top_k, top_p, etc)
 export const CONFIG_NUMERIC_KEYS = Object.entries(CONFIG_DEFAULT)
diff --git a/tools/server/webui/src/components/SettingDialog.tsx b/tools/server/webui/src/components/SettingDialog.tsx
index b0044d25..a4f1f886 100644
--- a/tools/server/webui/src/components/SettingDialog.tsx
+++ b/tools/server/webui/src/components/SettingDialog.tsx
@@ -191,6 +191,11 @@ const SETTING_SECTIONS: SettingSection[] = [
         label: 'Show tokens per second',
         key: 'showTokensPerSecond',
       },
+      {
+        type: SettingInputType.CHECKBOX,
+        label: 'Use server defaults for parameters (skip sending WebUI defaults)',
+        key: 'useServerDefaults',
+      },
       {
         type: SettingInputType.LONG_INPUT,
         label: (
diff --git a/tools/server/webui/src/utils/app.context.tsx b/tools/server/webui/src/utils/app.context.tsx
index 96cffd95..8142196d 100644
--- a/tools/server/webui/src/utils/app.context.tsx
+++ b/tools/server/webui/src/utils/app.context.tsx
@@ -209,25 +209,27 @@ export const AppContextProvider = ({
         messages,
         stream: true,
         cache_prompt: true,
-        samplers: config.samplers,
-        temperature: config.temperature,
-        dynatemp_range: config.dynatemp_range,
-        dynatemp_exponent: config.dynatemp_exponent,
-        top_k: config.top_k,
-        top_p: config.top_p,
-        min_p: config.min_p,
-        typical_p: config.typical_p,
-        xtc_probability: config.xtc_probability,
-        xtc_threshold: config.xtc_threshold,
-        repeat_last_n: config.repeat_last_n,
-        repeat_penalty: config.repeat_penalty,
-        presence_penalty: config.presence_penalty,
-        frequency_penalty: config.frequency_penalty,
-        dry_multiplier: config.dry_multiplier,
-        dry_base: config.dry_base,
-        dry_allowed_length: config.dry_allowed_length,
-        dry_penalty_last_n: config.dry_penalty_last_n,
-        max_tokens: config.max_tokens,
+        ...(config.useServerDefaults ? {} : {
+            samplers: config.samplers,
+            temperature: config.temperature,
+            dynatemp_range: config.dynatemp_range,
+            dynatemp_exponent: config.dynatemp_exponent,
+            top_k: config.top_k,
+            top_p: config.top_p,
+            min_p: config.min_p,
+            typical_p: config.typical_p,
+            xtc_probability: config.xtc_probability,
+            xtc_threshold: config.xtc_threshold,
+            repeat_last_n: config.repeat_last_n,
+            repeat_penalty: config.repeat_penalty,
+            presence_penalty: config.presence_penalty,
+            frequency_penalty: config.frequency_penalty,
+            dry_multiplier: config.dry_multiplier,
+            dry_base: config.dry_base,
+            dry_allowed_length: config.dry_allowed_length,
+            dry_penalty_last_n: config.dry_penalty_last_n,
+            max_tokens: config.max_tokens,
+        }),
         timings_per_token: !!config.showTokensPerSecond,
         ...(config.custom.length ? JSON.parse(config.custom) : {}),
       };

TeeAaTeeUu avatar May 09 '25 20:05 TeeAaTeeUu

If wanting to have it locally for now, you can skip sending those WebUI defaults: Image Show git diff for adding 'useServerDefaults' button to advanced settings

This is exactly what I was missing, I was waiting on this thread without saying anything, I wanted my webui used by friends to be on the default recommended settings (for Qwen3 MoE for example you have to lower the temperature and the top_k for thought mode and have a min_p at 0). I had to script the patch of index.html with sed lol Thanks a lot ! I do a git pull sometimes every hour to keep up with the developers and try new models long live to llama.cpp

ServeurpersoCom avatar May 09 '25 21:05 ServeurpersoCom

I make this : https://github.com/ggml-org/llama.cpp/compare/master...ServeurpersoCom:llama.cpp:webui-dynamic-config

Implemented dynamic config loading and reset behavior:
    - On startup, the app checks if localStorage.config exists and is non-empty. If not, it fetches defaults from the server.
    - The "Reset to default" button now properly:
        - fetches fresh config from the server,
        - updates localStorage,
        - calls saveConfig() to refresh the app state instantly.
    - Removed reliance on hardcoded CONFIG_DEFAULT. The server is now the single source of truth.

ServeurpersoCom avatar May 10 '25 15:05 ServeurpersoCom

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 24 '25 01:06 github-actions[bot]

Those not familiar with frontend can patch backend to ignore parameters from each request.

sed -i 's/data, "top_k",/data, "xxxx",/' tools/server/server.cpp
sed -i 's/data, "top_p",/data, "xxxx",/' tools/server/server.cpp
sed -i 's/data, "min_p",/data, "xxxx",/' tools/server/server.cpp
sed -i 's/data, "temperature",/data, "xxxx",/' tools/server/server.cpp
sed -i 's/data, "presence_penalty",/data, "xxxx",/' tools/server/server.cpp

See https://www.reddit.com/r/LocalLLaMA/comments/1jecdgi/any_solution_for_llamacpps_own_webui_overriding/

openingnow avatar Aug 21 '25 10:08 openingnow