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

Feature Request: WebUI ban tokens/strings

Open MerijnHendriks opened this issue 5 months ago • 3 comments

Prerequisites

  • [x] I am running the latest code. Mention the version if possible as well.
  • [x] I carefully followed the README.md.
  • [x] I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • [x] I reviewed the Discussions, and have a new and useful enhancement to share.

Feature Description

The ability to ban certain strings/tokens inside the settings.

Motivation

As proven in SillyTavern, it's effective at combating GPT-isms such as "shivers down my spine". It's especially useful for prohibiting explicit phrases that a less technical user might not be able to do otherwise, and improving prose quality when roleplaying/storywriting.

Possible Implementation

Akin to what SilyTavern is doing in their Text Completion settings, having a global preset is enough.

Image

MerijnHendriks avatar Nov 12 '25 14:11 MerijnHendriks

I'm not quite sure how this can be useful. SilyTavern's implementation simply delete the banned string: https://github.com/SillyTavern/SillyTavern/blob/e9cd32a123f49c1f5d2f42f4320021007c1e9a50/public/scripts/macros.js#L330C10-L341

So it's not actually ban, but just hide them. Actual ban is much more complicated to do, as we also need to somehow rollback the generation and re-sample the sequence

ngxson avatar Nov 12 '25 23:11 ngxson

Then simply deleting them is good enough 👍

MerijnHendriks avatar Nov 13 '25 08:11 MerijnHendriks

I think maybe a "string replace" feature can be more useful. For example, replace em dash with normal dash.

To hide a string, simply replace them with an empty one.

ngxson avatar Nov 13 '25 09:11 ngxson