mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
feat: Implement logit_bias parameter for token-level generation bias #3553
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Fluorite8 on GitHub (Feb 3, 2025).
Originally assigned to: @dannyl1u on GitHub.
Is your feature request related to a problem? Please describe.
I would like to request the addition of logit_bias parameter support for per-token bias adjustment. This feature is already implemented in major APIs like llama.cpp and OpenAI. For example, llama.cpp supports passing a logit_bias parameter as a dictionary of {token1: bias1, token2: bias2, ...}.
Reference implementation in llama.cpp:
21c84b5d2d/examples/server/server.cpp (L169C61-L169C69)This feature would enable important use cases such as:
Describe the solution you'd like
Implement logit_bias support through modifications to these core components:
src/lib/components/chat/Settings/Advanced/AdvancedParams.sveltesrc/lib/components/chat/Settings/General.sveltebackend/open_webui/utils/misc.pybackend/open_webui/utils/payload.pyProposed implementation details:
Describe alternatives you've considered
An alternative approach could allow raw JSON input for advanced users, but this would require:
However, the proposed dictionary-based implementation balances flexibility with safety, following established patterns in the codebase.
@dannyl1u commented on GitHub (Mar 4, 2025):
Completed in #10373