Live data from Hacker News

Gemini last models: temperature, top_p, and top_k are deprecated and ignored

ai.google.dev

31–40 of 53 posts

Re: Gemini last models: temperature, top_p, and top_k are deprecated and ignored

#31
post #24

Earlier quoted context omitted.

where can one learn what top_k and top_p mean?

The posted answers are either behind a paywall or very obtuse so I'll just explain. I'll assume you know what tokens are. A models output is not a single token, but a list with the probability for all the tokens that it knows, so we need to use a sampler to select the token that it's going to be the next token in the sentence. For example a simple greedy sampler will choose the token with the highest probability, but…

Thank you. So they are essentially a protection against spurious errors, cool

I don't quite understand the point about order of operations - does it do normalization after every such filter pass? why not leave it to the end?

also: what is top_a? I saw it being mentioned in the GP link

Re: Gemini last models: temperature, top_p, and top_k are deprecated and ignored

#33
post #24

Earlier quoted context omitted.

The posted answers are either behind a paywall or very obtuse so I'll just explain. I'll assume you know what tokens are. A models output is not a single token, but a list with the probability for all the tokens that it knows, so we need to use a sampler to select the token that it's going to be the next token in the sentence. For example a simple greedy sampler will choose the token with the highest probability, but…

Thank you. So they are essentially a protection against spurious errors, cool I don't quite understand the point about order of operations - does it do normalization after every such filter pass? why not leave it to the end? also: what is top_a? I saw it being mentioned in the GP link

Yes, the whole list will always sum to 1 (100%) because there's lots of more sampling parameters. top_p, top_k and temperature are just the ones that affect output the most. Most parameters do math around assuming the list sums to 1 and order is not always the same, some software even lets you change the order around.

top_a is not very common and is better explained if I explain how the much more common min_p works. min_p filters out tokens below a certain threshold. The formula is = * . So if the top token has 0.5 probability, min_p = 0.1 would cut out tokens below 0.05. This is a tunable that lets you filter out other tokens depending on how confident the model is.

top_a is almost the same formula but you just square the . So = * ^ 2. This makes the filtering ramp up faster (cut out more tokens) if the model has a much more confident top choice, but keep more choices if the model is not so confident.

Re: Gemini last models: temperature, top_p, and top_k are deprecated and ignored

#34
post #24

Earlier quoted context omitted.

The posted answers are either behind a paywall or very obtuse so I'll just explain. I'll assume you know what tokens are. A models output is not a single token, but a list with the probability for all the tokens that it knows, so we need to use a sampler to select the token that it's going to be the next token in the sentence. For example a simple greedy sampler will choose the token with the highest probability, but…

Thank you. So they are essentially a protection against spurious errors, cool I don't quite understand the point about order of operations - does it do normalization after every such filter pass? why not leave it to the end? also: what is top_a? I saw it being mentioned in the GP link

> So they are essentially a protection against spurious errors

Only coincidentally. Sampling nonsense tokens will certainly degrade its performance and/or brick it, but it's also there to encourage diversity.

For example, imagine we have the following sentence:

> The color of this ball is ____

Now, what should the model predict for "____"? There isn't really a "correct" answer here. It can be "red", it can be "blue", it can be "green", or any other color. But it's definitely not going to be "ব্যথাя". LLMs output a probability distribution for the next token, so imagine this is the probability distribution that it outputs:

    red -> 60%
    green -> 19%
    blue -> 19%
    ব্যথাя -> 2%
So how do we decide which token to pick? Simplest way is to always pick the most probable one (in this case: "red"). In this case we'd ideally want it to be able to output "red", "green" or "blue" (since all of those are reasonable), but never "ব্যথাя" (whose 2% is most certainly noise). So a sampler is essentially an algorithm which lets the inference engine pick the exact token to output from this list.

> I don't quite understand the point about order of operations - does it do normalization after every such filter pass? why not leave it to the end?

Because you can technically compose multiple samplers at the same time in a pipeline, and in some cases their order can matter and give you a different result (or take less/more time to execute). To give you a generic example: imagine you have a list with numbers in random order. You can execute one of two operations on it: (1) sort it, (2) take the leading 10 numbers. If you first sort it and then take 10 leading numbers you'll get a different result than if you'd first took 10 leading numbers and then sorted them.

Re: Gemini last models: temperature, top_p, and top_k are deprecated and ignored

#35

> To improve determinism, define a system instruction with explicit rules for your specific use case. "Please be deterministic".

In all seriousness, this seems like it could be fine if done well. You can just have a model do a pass over the system prompt and set reasonable parameters based on that. That's probably not what they're doing, but it could be.

Re: Gemini last models: temperature, top_p, and top_k are deprecated and ignored

#36
post #18

Possible reasons: - They might be dynamically adjusting these at inference time [1]. For example, start with a low temperature and generate samples with increasingly high temperatures until one of them passes some quality gate. - They don't want you to fine-tune on high temperature completions (rejection fine-tuning). You could call this "rejection fine-tuning rejection". [1] https://rlhfbook.com/c/09-rejection-sampl…

Couple of other more businessy reasons:

- SynthID hides the watermark in the sampling RNG. No randomness -> no watermark.

- If you want to distil on the model outputs, you want temp=0 outputs. No temp=0 -> worse distillation.

Re: Gemini last models: temperature, top_p, and top_k are deprecated and ignored

#39
post #18

Possible reasons: - They might be dynamically adjusting these at inference time [1]. For example, start with a low temperature and generate samples with increasingly high temperatures until one of them passes some quality gate. - They don't want you to fine-tune on high temperature completions (rejection fine-tuning). You could call this "rejection fine-tuning rejection". [1] https://rlhfbook.com/c/09-rejection-sampl…

Couple of other more businessy reasons: - SynthID hides the watermark in the sampling RNG. No randomness -> no watermark. - If you want to distil on the model outputs, you want temp=0 outputs. No temp=0 -> worse distillation.

You probably don't want temp 0, especially with Gemini which often fails in the greedy sampling mode in practice, often in ridiculous ways (e.g. multiple thousand token loops). As another comment says it's pretty brittle and this is even reflected in their docs somewhere IIRC. You want the "normal" temperature (whatever it is) and oversampling if necessary.

Certain open models have/had the temperature locked on the official APIs, I assume they just have sampling incompatible with static temperature or do some fancy speculative decoding. It's clearly not to hide anything, as the weights are open and there are always alternative providers.

Re: Gemini last models: temperature, top_p, and top_k are deprecated and ignored

#40

> To improve determinism, define a system instruction with explicit rules for your specific use case. "Please be deterministic".

> improve determinism

Oh well. I might be to picky here, but how I see things, determinism cannot be improved or worsened, but achieved or not achieved. Or Partially archieved, when analyzing a system that has both components that are deterministic or non deterministic.

There are times to think in absolutes, and when talking about deterministic behavior of technical systems, this is one of them. Join the sith side, we have cookies, and when we say we have cookies, we do.

Post reply on HN