[PR #2670] [MERGED] fix(llm): wire minP sampling through to providers (#2668) #5713

Closed
opened 2026-10-22 04:18:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2670
Author: @kolacheee
Created: 6/20/2026
Status: ✅ Merged
Merged: 6/21/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/wire-minp-parameter


📝 Commits (2)

  • ef24e3e fix(llm): wire minP sampling through to providers (#2668)
  • 9739222 Merge remote-tracking branch 'origin/staging' into codex-pr-2670

📊 Changes

3 files changed (+30 additions, -0 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+7 -0)
📝 packages/server/src/services/llm/base-provider.ts (+1 -0)
📝 packages/server/src/services/llm/providers/openai.provider.ts (+22 -0)

📄 Description

Linked issue

Closes #2668

Why this change

minP (Min-P sampling) is presented as a first-class generation parameter — it's in the schema, the default preset ships with it, the editor exposes a slider, and it's parsed/salvaged from stored params — but it was never attached to the outgoing request, so setting it did nothing on any provider. A user dialing in Min-P (common for local models, where it's a popular alternative to top-p/top-k) saw zero effect, with no indication their setting was ignored.

What changed

  • Added minP?: number to ChatOptions.
  • Threaded minP through the generate route exactly like topK: preset baseline → connection/chat overrides → game-mode reset → all three ChatOptions construction sites.
  • Mapped it in the OpenAI provider as min_p, gated by the same shouldSendTopK() check as top_k — i.e. sent only where the backend is known to accept the non-standard sampler (the bundled local model). Other backends keep the existing customParameters escape hatch. minP = 0 means "disabled" and is omitted.

Anthropic and Google have no min_p concept, so they ignore it (no change there).

3 files, +30 / −0.

Validation

ℹ️ Boxes are intentionally left unchecked — per CONTRIBUTING.md / CLAUDE.md, these are a human to-do list, not proof of work by an agent.

Automated (done by the agent): pnpm check passed locally — full TypeScript + ESLint + build (exit 0).

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Set minP (e.g. 0.05) in a preset or Chat → Advanced Parameters, run a generation against the bundled local model, and confirm min_p appears in the outgoing request body (logPromptSentToModel) and influences sampling.
  • Confirm minP = 0 (default) omits min_p entirely.
  • Confirm game mode forces minP off (like the other sampler resets) unless a connection/chat override sets it.
  • Confirm cloud providers (OpenAI / Anthropic / Google) are unaffected (no min_p sent — matches existing top_k behavior).

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

No docs/version changes are included. docs/GENERATION_PARAMETERS.md already lists minP ("Disabled" by default); a follow-up could note it is wired only to local-model backends, but it isn't required here.

UI evidence (if applicable)

N/A — server-only change.

Summary by CodeRabbit

  • New Features
    • Added minimum probability (minP) sampling parameter support for text generation. This parameter is now configurable and supported across the generation pipeline, including OpenAI provider integration.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2670 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 6/20/2026 **Status:** ✅ Merged **Merged:** 6/21/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/wire-minp-parameter` --- ### 📝 Commits (2) - [`ef24e3e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ef24e3e60df19d800d69541ff5fbbc538a3569c1) fix(llm): wire minP sampling through to providers (#2668) - [`9739222`](https://github.com/Pasta-Devs/Marinara-Engine/commit/97392224dbfae211b3211eb5302311ec235e63d8) Merge remote-tracking branch 'origin/staging' into codex-pr-2670 ### 📊 Changes **3 files changed** (+30 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+7 -0) 📝 `packages/server/src/services/llm/base-provider.ts` (+1 -0) 📝 `packages/server/src/services/llm/providers/openai.provider.ts` (+22 -0) </details> ### 📄 Description <!-- Target branch: `staging` --> ## Linked issue Closes #2668 ## Why this change `minP` (Min-P sampling) is presented as a first-class generation parameter — it's in the schema, the default preset ships with it, the editor exposes a slider, and it's parsed/salvaged from stored params — but it was **never attached to the outgoing request**, so setting it did nothing on any provider. A user dialing in Min-P (common for local models, where it's a popular alternative to top-p/top-k) saw zero effect, with no indication their setting was ignored. ## What changed - Added `minP?: number` to `ChatOptions`. - Threaded `minP` through the generate route exactly like `topK`: preset baseline → connection/chat overrides → game-mode reset → all three `ChatOptions` construction sites. - Mapped it in the OpenAI provider as `min_p`, gated by the **same** `shouldSendTopK()` check as `top_k` — i.e. sent only where the backend is known to accept the non-standard sampler (the bundled local model). Other backends keep the existing `customParameters` escape hatch. `minP = 0` means "disabled" and is omitted. Anthropic and Google have no `min_p` concept, so they ignore it (no change there). 3 files, +30 / −0. ## Validation > ℹ️ Boxes are intentionally left unchecked — per `CONTRIBUTING.md` / `CLAUDE.md`, these are a human to-do list, not proof of work by an agent. **Automated (done by the agent):** `pnpm check` passed locally — full TypeScript + ESLint + build (exit `0`). - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Set `minP` (e.g. `0.05`) in a preset or Chat → Advanced Parameters, run a generation against the **bundled local model**, and confirm `min_p` appears in the outgoing request body (`logPromptSentToModel`) and influences sampling. - Confirm `minP = 0` (default) omits `min_p` entirely. - Confirm game mode forces `minP` off (like the other sampler resets) unless a connection/chat override sets it. - Confirm cloud providers (OpenAI / Anthropic / Google) are unaffected (no `min_p` sent — matches existing `top_k` behavior). ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) No docs/version changes are included. `docs/GENERATION_PARAMETERS.md` already lists `minP` ("Disabled" by default); a follow-up could note it is wired only to local-model backends, but it isn't required here. ## UI evidence (if applicable) N/A — server-only change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added minimum probability (minP) sampling parameter support for text generation. This parameter is now configurable and supported across the generation pipeline, including OpenAI provider integration. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:18:46 +07:00
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#5713
No description provided.