[GH-ISSUE #9376] List of words to penalize during generation #31881

Closed
opened 2026-04-22 12:39:36 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @binarynoise on GitHub (Feb 26, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/9376

I'd like to be able to provide the API with a list of tokens, words or short phrases that should be penalized during generation.
Penalizing stop tokens could encourage longer texts or prevent the LLM from abruptly stopping (yes, I've increased numPredict already, no, it's far away from that limit), remove buzzwords or just prevent them from thinking of the pink elephant.

Originally created by @binarynoise on GitHub (Feb 26, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/9376 I'd like to be able to provide the API with a list of tokens, words or short phrases that should be penalized during generation. Penalizing stop tokens could encourage longer texts or prevent the LLM from abruptly stopping (yes, I've increased `numPredict` already, no, it's far away from that limit), remove buzzwords or just prevent them from thinking of the pink elephant.
GiteaMirror added the feature request label 2026-04-22 12:39:36 -05:00
Author
Owner

@rick-github commented on GitHub (Feb 26, 2025):

Other than tuning the prompts, there's no mechanism for that at the moment.

Potentially relevant: https://github.com/ollama/ollama/issues/2415, https://github.com/ollama/ollama/issues/8110

<!-- gh-comment-id:2686264423 --> @rick-github commented on GitHub (Feb 26, 2025): Other than tuning the prompts, there's no mechanism for that at the moment. Potentially relevant: https://github.com/ollama/ollama/issues/2415, https://github.com/ollama/ollama/issues/8110
Author
Owner

@codelion commented on GitHub (Mar 5, 2025):

You can try using optillm - https://github.com/codelion/optillm in fact we recently implemented something similar for reasoning LLMs like deepseek r1 here - https://github.com/codelion/optillm/blob/main/optillm/thinkdeeper.py

<!-- gh-comment-id:2699686349 --> @codelion commented on GitHub (Mar 5, 2025): You can try using optillm - https://github.com/codelion/optillm in fact we recently implemented something similar for reasoning LLMs like deepseek r1 here - https://github.com/codelion/optillm/blob/main/optillm/thinkdeeper.py
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#31881