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

Server system prompt parameter bug

Open An0nie opened this issue 2 years ago • 5 comments

It seems like the -spf / --system-prompt-file argument doesn't work in the server code.

The parameters are processed at the start of main() https://github.com/ggerganov/llama.cpp/blob/594fca3fefe27b8e95cfb1656eb0e160ad15a793/examples/server/server.cpp#L2486

While initialize() is called later. https://github.com/ggerganov/llama.cpp/blob/594fca3fefe27b8e95cfb1656eb0e160ad15a793/examples/server/server.cpp#L2621

It seems like the system prompt has a deferred loading controlled by the "system_need_update = true" flag. However, process_system_prompt_data() has the condition "slots.size() > 0", which results in that being skipped, because the slots are only added during initialize(). I'm not sure what the purpose of this condition is. https://github.com/ggerganov/llama.cpp/blob/594fca3fefe27b8e95cfb1656eb0e160ad15a793/examples/server/server.cpp#L810

Also, for some reason, initialize() empties the system prompt, so even if it's successfully set in server_params_parse(), it gets cleared. https://github.com/ggerganov/llama.cpp/blob/594fca3fefe27b8e95cfb1656eb0e160ad15a793/examples/server/server.cpp#L440

An0nie avatar Feb 14 '24 23:02 An0nie

Same as this issue? https://github.com/ggerganov/llama.cpp/issues/3997

chigkim avatar Feb 15 '24 22:02 chigkim

Yes, it's probably the same. It's easy to fix, but I'm not sure what slots.size() > 0 is there for and why initialize() clears the system prompt.

An0nie avatar Feb 15 '24 22:02 An0nie

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Mar 17 '24 06:03 github-actions[bot]

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

github-actions[bot] avatar Apr 01 '24 01:04 github-actions[bot]

this is still broken in llama-server.exe

getting "error: invalid argument: --system-prompt-file" tried --sysf as well, tried full path for the file as well without any luck

Well, the parameter --system-prompt-file is no longer listed in the help -h text.

However some reasoning models require the system prompt modified, this means the system prompt must be changed for each model in the webui settings.

batmanonline avatar Mar 29 '25 17:03 batmanonline