I compared my relative-probability cutoff approach with Tail Free sampling, shared that I had blogged about my LLM sampling experiments, and later shared an MLX implementation of First Token Cutoff. These notes extend my work on nucleus sampling limitations.
I compared that derivative-based cluster identification to “like you do to identify bars in barcode reading!”
My approach identifies the cluster as maximum ration with the LLM top pick.
I said, “Sampling is user tunable so to be understandable is a big plus.”
I said, “It's also faster.”
I blogged about my LLM sampling experiments.
I shared my LLM sampling experiments blog post at https://t.co/qvWmsiYQQe.
I shared an implementation of the First Token Cutoff algorithm.
I said the First Token Cutoff implementation is based on MLX.
I invited readers to try the First Token Cutoff implementation “in case you want to play with it in the practice” and shared https://t.co/AykqXS1Tg9.
I explored a relative-probability cutoff sampler that compares candidate tokens with the best-scoring token, then makes a weighted random pick among eligible tokens. I also described how the cutoff bounds the worst pick and shared a visualization of sampled tokens.
I described the method this way: consider all the tokens that are worse than a max percentage compared to the first choice. Then do a weighted random pick.
I said the variation is bounded: it's bounded to be no worse than X% than the first choice. In the first case, the bound comes from beta.
I explained that the squares are the top 32 output tokens after softmax. The color scale is white at 0% and blue at 100%.
I said that to the right are the choosen token string, and the chosen token order.
I defined the reference and filter this way: T0 is the best token. We consider only tokens that no worse than a given percentage from T0.
p = 1 - (t[j] / t0)
I set the sampler’s example cutoff to 0.5; at this setting, considered tokens cannot have less than half the probability of the best token.
Among tokens that meet the cutoff, I make a weighted random pick.
I describe the sampler’s invariant for the worst token picked as a percentage difference compared with the best pick; it is more versatile than the binary sampler, while still providing an hard guarantee about output token quality.
I pointed to the implementation in MLX at https://t.co/zOAbPwkbyR.
I noted that the best token will always be picked when its difference from lower-quality tokens is large enough, expressed as p > cutoff.
1-(0.01/0.3) = 0.97
1-(0.01/0.1) = 0.90
I said the sampler’s only parameter is the cutoff co, and that p must be < co.
In my Mistral example about Umberto Eco, the choosen token is “january”.
I called the sampler extremely opinionated about the dates.