llama.cpp/common
MaggotHATE fbc98b748e
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
2024-10-15 12:54:55 +02:00
..
cmake llama : reorganize source code + improve CMake (#8006) 2024-06-26 18:33:02 +03:00
arg.cpp sampling : add XTC sampler (#9742) 2024-10-15 12:54:55 +02:00
arg.h common : use common_ prefix for common library functions (#9805) 2024-10-10 22:57:42 +02:00
base64.hpp llava : expose as a shared library for downstream projects (#3613) 2023-11-07 00:36:23 +03:00
build-info.cpp.in build : link against build info instead of compiling against it (#3879) 2023-11-02 08:50:16 +02:00
CMakeLists.txt common : reimplement logging (#9418) 2024-09-15 20:46:12 +03:00
common.cpp sampling : add XTC sampler (#9742) 2024-10-15 12:54:55 +02:00
common.h sampling : add XTC sampler (#9742) 2024-10-15 12:54:55 +02:00
console.cpp console : utf-8 fix for windows stdin (#9690) 2024-09-30 11:23:42 +03:00
console.h gguf : new file format with flexible meta data (beta) (#2398) 2023-08-21 23:07:43 +03:00
json-schema-to-grammar.cpp json: restore default additionalProperties to false, fix some pattern escapes (#8180) 2024-06-28 09:26:45 +01:00
json-schema-to-grammar.h JSON: [key] -> .at(key), assert() -> GGML_ASSERT (#7143) 2024-05-08 21:53:08 +02:00
json.hpp json-schema-to-grammar improvements (+ added to server) (#5978) 2024-03-21 11:50:43 +00:00
log.cpp common : use common_ prefix for common library functions (#9805) 2024-10-10 22:57:42 +02:00
log.h common : use common_ prefix for common library functions (#9805) 2024-10-10 22:57:42 +02:00
ngram-cache.cpp common : use common_ prefix for common library functions (#9805) 2024-10-10 22:57:42 +02:00
ngram-cache.h common : use common_ prefix for common library functions (#9805) 2024-10-10 22:57:42 +02:00
sampling.cpp sampling : add XTC sampler (#9742) 2024-10-15 12:54:55 +02:00
sampling.h common : use common_ prefix for common library functions (#9805) 2024-10-10 22:57:42 +02:00
stb_image.h common : Update stb_image.h to latest version (#9161) 2024-08-27 08:58:50 +03:00
train.cpp common : reimplement logging (#9418) 2024-09-15 20:46:12 +03:00
train.h sync : ggml (backend v2) (#3912) 2023-11-13 14:16:23 +02:00