# Does OpenAI have a top\_k parameter?

**URL:** <https://community.openai.com/t/does-openai-have-a-top-k-parameter/612410>\
**Category:** API\
**Created:** [February 3, 2024, 8:12am UTC](https://community.openai.com/t/does-openai-have-a-top-k-parameter/612410 "2024-02-03T08:12:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dignity\_for\_all](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/dignity_for_all/32/300058_2.png) [@dignity\_for\_all](https://community.openai.com/u/dignity_for_all)\
**Post date:** [February 3, 2024, 8:38am UTC](https://community.openai.com/t/does-openai-have-a-top-k-parameter/612410/2 "2024-02-03T08:38:27Z")

</div>

As far as I understand, there seems to be no language model currently provided by OpenAI that allows you to specify the top\_k hyperparameter.

Top-K sampling considers the top k tokens, but you can use the Top-p (nucleus) sampling value as a hyperparameter.

In language models, top\_p and top\_k are not mutually exclusive concepts, but it seems that only top\_p is available as a hyperparameter through the API at the moment.

It seems that some past language models provided top\_k sampling as well.Please take this into consideration too.

> [@Top K? How can I set it?](https://community.openai.com/t/top-k-how-can-i-set-it/3712):
>
> I understand that the API allows us to specify for Top P, but how about Top K? Is there a default Top K that is already implemented? Or can we change Top K by deriving it from Top P?

---

_[View the full topic](https://community.openai.com/t/does-openai-have-a-top-k-parameter/612410)._
