theroyallab / tabbyAPI

An OAI compatible exllamav2 API that's both lightweight and fast
GNU Affero General Public License v3.0
585 stars 75 forks source link

[REQUEST] Modify strings probability, rather than outright banning with banned_strings #223

Closed atisharma closed 3 weeks ago

atisharma commented 3 weeks ago

Problem

banned_strings is fantastic, but a bit blunt when it comes to outright banning single words. A good list, for example, is antislop. Banning single over-represented words can be problematic, for example completely banning "punctuated" when discussing grammar.

Solution

What I propose is that it should be possible to adjust the probability of particular strings to non-zero level (instead of banning).

Alternatives

One possible naive implementation that need not change the sampling approach, would be to keep the current banning implementation but remove words from a dynamic banlist with certain probability.

For example, if you wish reduce the frequency of "concoctions" by half, you could specify ["concoctions", 0.7] in a avoided_words section of the sampler overrides yaml file, and then tabby would include "concoctions" in banned_strings 30% of time time.

A better implementation might be to apply the probability at the sampler backfilling stage.

Explanation

A more delicate banned_strings or avoided_strings would allow string-level adjustment of probabilities. This would permit statistical analysis of model output vs reference output at a (word or phrase) string level. Then it would be possible to automate adjustment of output to target a corpus style by adjusting those probabilities that are most mis-represented. Minimimising a slop-norm, as it were.

Examples

No response

Additional context

I think this is the approach that antislop uses.

Acknowledgements

bdashore3 commented 3 weeks ago

This is not in scope for TabbyAPI, but exl2. Please open this issue there.

atisharma commented 3 weeks ago

Apologies, I should have realised it's an exllamav2 issue. For future searchers, I filed it here.