Skip to content

Commit 2be814a

Browse files
committed
Fixed tests and outdated README
1 parent 3613a6d commit 2be814a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

examples/main/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ Example usage: `--mirostat 2 --mirostat-lr 0.05 --mirostat-ent 3.0`
246246
- `--xtc-probability N`: Sets the chance for token removal (checked once on sampler start) (default: 0.0).
247247
- `--xtc-threshold N`: Sets a minimum probability threshold for tokens to be removed (default: 0.1).
248248

249-
Exclude Top Choices (XTC) is a unique sampler that is designed to remove top tokens from consideration and avoid more obvious and repetitive outputs. With a chance of `xtc-p` it searches for tokens with probabilities of `xtc-threshold` and above, then removes all such tokens except the least probable one.
249+
Exclude Top Choices (XTC) is a unique sampler that is designed to remove top tokens from consideration and avoid more obvious and repetitive outputs. With a chance of `xtc-probability` it searches for tokens with probabilities of `xtc-threshold` and above, then removes all such tokens except the least probable one.
250250

251251
By removing top tokens XTC can improve the variety of answers, break writing clichés and inhibit repition, since clichés and repeated phrases are usually more likely to appear. By keeping the last token above the threshold, XTC ensures that the answer is still coherent. XTC is meant to be used for creative tasks, but feel free to experiment with different settings for different models.
252252

253-
Being experimental and unique, XTC is disabled by default. The recommended combination of samplers is Min-P followed by XTC on its default settings: `--sampling-seq mx --min-p 0.02 -xtc-p 0.5`.
253+
Being experimental and unique, XTC is disabled by default. The recommended combination of samplers is Min-P followed by XTC on its default settings: `--sampling-seq mx --min-p 0.02 --xtc-probability 0.5`.
254254

255-
Example usage: `-xtc-p 0.5 -xtc-t 0.1
255+
Example usage: `--xtc-probability 0.5 --xtc-threshold 0.1
256256

257257
### Logit Bias
258258

src/llama-sampling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ static void llama_sample_xtc_apply(struct llama_sampler * smpl, llama_token_data
10951095
int pos_last = 0;
10961096

10971097
for (size_t i = 0; i < cur_p->size; ++i) {
1098-
if (cur_p->data[i].p - ctx->threshold >= -1e-5) {
1098+
if (cur_p->data[i].p >= ctx->threshold) {
10991099
pos_last = i;
11001100
} else break;
11011101
}

tests/test-sampling.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,12 @@ int main(void) {
333333
test_min_p({0.1f, 0.2f, 0.3f, 0.4f}, {0.4f/0.4f}, 1.00f);
334334

335335
printf("XTC should:\n");
336-
test_xtc({0.4f, 0.3f, 0.2f, 0.1f}, {0.1f}, 0.99f, 0.10f);
337-
test_xtc({0.4f, 0.3f, 0.2f, 0.1f}, {0.2f, 0.1f}, 0.99f, 0.20f);
338-
test_xtc({0.4f, 0.3f, 0.2f, 0.1f}, {0.3f, 0.2f, 0.1f}, 0.99f, 0.30f);
336+
test_xtc({0.4f, 0.3f, 0.2f, 0.1f}, {0.1f}, 0.99f, 0.09f);
337+
test_xtc({0.4f, 0.3f, 0.2f, 0.1f}, {0.2f, 0.1f}, 0.99f, 0.19f);
338+
test_xtc({0.4f, 0.3f, 0.2f, 0.1f}, {0.3f, 0.2f, 0.1f}, 0.99f, 0.29f);
339339

340340
printf("XTC should not:\n");
341-
test_xtc({0.4f, 0.3f, 0.2f, 0.1f}, {0.4f, 0.3f, 0.2f, 0.1f}, 0.99f, 0.40f);
341+
test_xtc({0.4f, 0.3f, 0.2f, 0.1f}, {0.4f, 0.3f, 0.2f, 0.1f}, 0.99f, 0.39f);
342342

343343
test_tfs({0.1f, 0.15f, 0.2f, 0.25f, 0.3f}, {0.3f}, 0.25f);
344344
test_tfs({0.1f, 0.15f, 0.2f, 0.25f, 0.3f}, {0.3f, 0.25f}, 0.75f);

0 commit comments

Comments
 (0)