Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Implement XTC sampler (new) #1075

Closed
3dfactor opened this issue Aug 19, 2024 · 6 comments
Closed

Feature Request: Implement XTC sampler (new) #1075

3dfactor opened this issue Aug 19, 2024 · 6 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@3dfactor
Copy link

Exclude Top Choices (XTC) sampling algorithm is a novel sampler that turns truncation on its head: Instead of pruning the least likely tokens, under certain circumstances, it removes the most likely tokens from consideration.

More precisely, it removes all except the least likely token meeting a given threshold, with a given probability. This ensures that at least one "viable" choice remains, retaining coherence. Truncation samplers can be applied as usual, preventing garbage from being sampled. The result is coherent output (because truncation removes bad tokens) with unprecedented creativity (because XTC removes "boring" tokens).

The oobabooga implementation can be found here along with eloquent description: oobabooga/text-generation-webui#6335

@LostRuins
Copy link
Owner

Shouldn't be too hard, I have some comments for the creator of this sampler though, following up in your link

@LostRuins LostRuins added enhancement New feature or request question Further information is requested labels Aug 19, 2024
@LostRuins
Copy link
Owner

Will be added in 1.74

5bf527a

@p-e-w
Copy link

p-e-w commented Aug 22, 2024

@LostRuins

Please see my comments in that commit.

I would recommend to wait until the parameter discussion in the original PR has been resolved before releasing this in Kobold, to avoid potentially diverging implementations.

@LostRuins
Copy link
Owner

LostRuins commented Aug 22, 2024

Yeap sure @p-e-w , it's not live yet. I saw your comments on 5bf527a#r145630779 and will address them.

Particularly the part about keeping the tail, this line
image
gave me the impression that only one candidate should remain at the end. But now I think you're saying I should not touch any tokens below the xtc_threshold (ie. leave them as-is) correct?

So the final result is only a warping of the (n-1) out of n tokens above the threshold (if multiple exist) or nothing at all (if n<=1), no truncation exists in both cases.

@p-e-w
Copy link

p-e-w commented Aug 22, 2024

@LostRuins

But now I think you're saying I should not touch any tokens below the xtc_threshold (ie. leave them as-is) correct?

So the final result is only a warping of the (n-1) out of n tokens above the threshold (if multiple exist) or nothing at all (if n<=1), no truncation exists in both cases.

Yes, that's correct. The text from the image you cut out is intended to supplement the two bar charts, where you can see that the only tokens that are removed (faded out) are the ones above the threshold. A more unambiguous version of the last line would be

...remove all tokens above the threshold, except the least probable one, from sampling

@LostRuins
Copy link
Owner

Closing as added in latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants