]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
sampling : add XTC sampler (#9742)
authorMaggotHATE <redacted>
Tue, 15 Oct 2024 10:54:55 +0000 (15:54 +0500)
committerGitHub <redacted>
Tue, 15 Oct 2024 10:54:55 +0000 (12:54 +0200)
commitfbc98b748e7b075e327bcf13237057f647678049
treeb1dc1815c0fb24a0e9880b82309afaf5acfc7d5f
parentdcdd535302fc9702a4709be25f56540d65163a44
sampling : add XTC sampler (#9742)

* Initial XTC commit

Adds XTC sampler, not activated by default, but recommended settings by default.

* Cleanup

* Simplified chances calculation

To be more inline with the original implementation, chance is calculated once at the beginning.

* First fixes by comments

Still need to look into sorting

* Fixed trailing backspaces

* Fixed RNG to be reproduceable

Thanks to @slaren for directions

* Fixed forgotten header

* Moved `min_keep`

Moved from conditions to a simple check at the end.

* Fixed broken randomization

Thanks to @slaren for explanation

* Swapped sorting for a custom algorithm

Shifts tokens to remove the penalized ones, then puts the penalized at the back. Should make `min_keep` still viable.

* Algorithm rework

1. Scan token from top till the first non-penalizable
2. Remove the last captured token (the least probable above threshold)
3. Shift all tokens to override the remaining penalizable
4. Penalize and put them at the the bottom.

* Added XTC to `test-sampling`

* Simplified algorithm and more tests

* Updated info in common and args

* Merged back lost commits in common and arg

* Update dump info in common

* Fixed incorrect min_keep check

* Added XTC to README

* Renamed parameters, fixed info and defaults

* probability is at 0 by default, but XTC is included in sampling queue
* threshold higher than 0.5 switches XTC off

* Initial server support

* Added XTC to server UIs

* Fixed labels in old server UI

* Made algorithm safer and more readable

* Removed xtc_threshold_max

* Fixed arg after update

* Quick fixes by comments

* Simplified algorithm since threshold_max is removed

* Renamed random distribution

* Fixed tests and outdated README

* Small fixes
common/arg.cpp
common/common.cpp
common/common.h
common/sampling.cpp
examples/main/README.md
examples/server/public/index-new.html
examples/server/public/index.html
examples/server/server.cpp
include/llama.h
src/llama-sampling.cpp
tests/test-sampling.cpp