[GH-ISSUE #3042] [Issue]: Local-sidecar provider ignores per-request temperature/topP/topK (uses the runtime config instead, contradicting its own comment) #1612

Closed
opened 2026-10-21 05:40:41 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @kolacheee on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3042

Originally assigned to: @SpicyMarinara on GitHub.

What's wrong

The local (sidecar) model provider's applyRuntimeSettings is documented to let chat/preset Advanced Parameters win over the local runtime fallback — and it does so for maxTokens and minP. But for temperature, topP, and topK (in the normal non-structured-output case) it uses the sidecar's runtime config.* value and ignores the per-request options.*. So a user who sets temperature / top_p / top_k in their chat or preset Advanced Parameters has those silently ignored on the bundled local model — every request uses the sidecar's configured values instead.

How to reproduce (try it yourself)

  1. Use the local (sidecar) model connection.
  2. In a chat or preset's Advanced Parameters, set a distinctive temperature (e.g. 0.2) different from the sidecar's configured temperature.
  3. Generate a normal (non-tool, non-structured-output) turn.

You'll see: the request goes out with the sidecar config's temperature, not 0.2; same for top_p and top_k. Only maxTokens and minP reflect the per-request values.
Expected: the per-request temperature / top_p / top_k win (falling back to the sidecar config only when unset), exactly as maxTokens and minP already do.

Where it is

packages/server/src/services/llm/providers/local-sidecar.provider.ts:58-75 (applyRuntimeSettings). The returned ChatOptions sets maxTokens: requestedMaxTokens ?? config.maxTokens (line 69, per-request wins) and minP: structuredOutput ? 0 : options.minP (line 73, per-request), but temperature: structuredOutput ? 0 : config.temperature (line 70), topP: structuredOutput ? 1 : config.topP (line 71), and topK: structuredOutput ? 0 : config.topK (line 72) read config.* instead of options.*. The line-68 comment explicitly states: "Chat/preset Advanced Parameters are per-request and should win over the local runtime fallback."

What's happening

The non-structured-output branch for temperature/topP/topK reads the sidecar runtime config, not the per-request options, so the user's chat/preset values for those three fields are dropped on this provider — inconsistent with maxTokens/minP and with the stated intent.

Suggested fix

Make temperature/topP/topK respect the per-request value with the sidecar config as fallback, mirroring maxTokens/minP and honoring the line-68 comment:

temperature: structuredOutput ? 0 : (options.temperature ?? config.temperature),
topP: structuredOutput ? 1 : (options.topP ?? config.topP),
topK: structuredOutput ? 0 : (options.topK ?? config.topK),

The structuredOutput branch (deterministic 0/1/0 for response-format/tool requests) is intentional and unchanged; only the non-structured branch now uses the per-request value when present, falling back to the sidecar config when not — identical in shape to the existing maxTokens handling. No regression: when the chat/preset doesn't set these (options.* undefined), the sidecar config is still used exactly as today; only a user-supplied per-request value newly takes effect.


AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.

Originally created by @kolacheee on GitHub (Jun 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3042 Originally assigned to: @SpicyMarinara on GitHub. **What's wrong** The local (sidecar) model provider's `applyRuntimeSettings` is documented to let chat/preset Advanced Parameters win over the local runtime fallback — and it does so for `maxTokens` and `minP`. But for `temperature`, `topP`, and `topK` (in the normal non-structured-output case) it uses the sidecar's runtime `config.*` value and ignores the per-request `options.*`. So a user who sets temperature / top_p / top_k in their chat or preset Advanced Parameters has those silently ignored on the bundled local model — every request uses the sidecar's configured values instead. **How to reproduce (try it yourself)** 1. Use the local (sidecar) model connection. 2. In a chat or preset's Advanced Parameters, set a distinctive temperature (e.g. `0.2`) different from the sidecar's configured temperature. 3. Generate a normal (non-tool, non-structured-output) turn. You'll see: the request goes out with the sidecar config's temperature, not `0.2`; same for `top_p` and `top_k`. Only `maxTokens` and `minP` reflect the per-request values. Expected: the per-request `temperature` / `top_p` / `top_k` win (falling back to the sidecar config only when unset), exactly as `maxTokens` and `minP` already do. **Where it is** `packages/server/src/services/llm/providers/local-sidecar.provider.ts:58-75` (`applyRuntimeSettings`). The returned `ChatOptions` sets `maxTokens: requestedMaxTokens ?? config.maxTokens` (line 69, per-request wins) and `minP: structuredOutput ? 0 : options.minP` (line 73, per-request), but `temperature: structuredOutput ? 0 : config.temperature` (line 70), `topP: structuredOutput ? 1 : config.topP` (line 71), and `topK: structuredOutput ? 0 : config.topK` (line 72) read `config.*` instead of `options.*`. The line-68 comment explicitly states: "Chat/preset Advanced Parameters are per-request and should win over the local runtime fallback." **What's happening** The non-structured-output branch for `temperature`/`topP`/`topK` reads the sidecar runtime `config`, not the per-request `options`, so the user's chat/preset values for those three fields are dropped on this provider — inconsistent with `maxTokens`/`minP` and with the stated intent. **Suggested fix** Make `temperature`/`topP`/`topK` respect the per-request value with the sidecar config as fallback, mirroring `maxTokens`/`minP` and honoring the line-68 comment: ```ts temperature: structuredOutput ? 0 : (options.temperature ?? config.temperature), topP: structuredOutput ? 1 : (options.topP ?? config.topP), topK: structuredOutput ? 0 : (options.topK ?? config.topK), ``` The `structuredOutput` branch (deterministic `0`/`1`/`0` for response-format/tool requests) is intentional and unchanged; only the non-structured branch now uses the per-request value when present, falling back to the sidecar config when not — identical in shape to the existing `maxTokens` handling. No regression: when the chat/preset doesn't set these (`options.*` undefined), the sidecar config is still used exactly as today; only a user-supplied per-request value newly takes effect. --- *AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.*
Author
Owner

@SpicyMarinara commented on GitHub (Jun 29, 2026):

Claiming this for the current staging sweep in draft PR #3053 (branch codex/issue-sweep-3033-3052).

<!-- gh-comment-id:4834988626 --> @SpicyMarinara commented on GitHub (Jun 29, 2026): Claiming this for the current staging sweep in draft PR #3053 (branch `codex/issue-sweep-3033-3052`).
Author
Owner

@SpicyMarinara commented on GitHub (Jun 29, 2026):

Fixed in PR #3053 on branch codex/issue-sweep-3033-3052 (commit bfb1bc76). Closing this issue as addressed; the PR remains open for staging review/merge.

<!-- gh-comment-id:4835088564 --> @SpicyMarinara commented on GitHub (Jun 29, 2026): Fixed in PR #3053 on branch `codex/issue-sweep-3033-3052` (commit bfb1bc76). Closing this issue as addressed; the PR remains open for staging review/merge.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1612
No description provided.