#nlp #llm #ai #llama #mistral #text-generation

kalosm-sample

A common interface for token sampling and helpers for structered llm sampling

7 unstable releases (3 breaking)

new 0.4.1 Mar 7, 2025
0.4.0 Feb 9, 2025
0.3.2 Aug 14, 2024
0.2.1 Feb 28, 2024
0.1.0 Dec 16, 2023

#663 in Machine learning

Download history 63/week @ 2024-11-17 85/week @ 2024-11-24 73/week @ 2024-12-01 145/week @ 2024-12-08 95/week @ 2024-12-15 41/week @ 2024-12-22 66/week @ 2024-12-29 170/week @ 2025-01-05 141/week @ 2025-01-12 112/week @ 2025-01-19 52/week @ 2025-01-26 93/week @ 2025-02-02 203/week @ 2025-02-09 105/week @ 2025-02-16 87/week @ 2025-02-23 194/week @ 2025-03-02

604 downloads per month
Used in 13 crates (5 directly)

MIT/Apache

170KB
4.5K SLoC

kalosm-sample

This is a sampling library for Kalosm.

It handles choosing a token from a probability distribution. Samplers can be used to constrain the generation of text for example you can use a sampler to prevent the model from generating the same word twice in a row. Or you could only allow the model to generate a list of single digit numbers.

Dependencies

~1.3–2.3MB
~33K SLoC