technovangelist / notes / mirostat

mirostat

An adaptive sampling algorithm that dynamically adjusts the randomness of token selection during text generation, aiming to maintain a target level of Perplexity or Surprise in the output.

The algorithm has a parameter, mu, that controls how surprised the model is with the next token. It’s continuously updated based on the difference between the target entropy (tau) and the actual entropy of generated tokens. Eta is the learning rate for adjusting mu.

There are two modes:

When mirostat is set to 1 or 2, top_p, top_k and min_p will be ignored.

#ollama/parameters