# Llama-2 generation\_config top\_p=0.6

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fllama-2-generation-config-top-p-0-6%2F49916%3E%5C
**Category:** Models\
**Created:** [August 8, 2023, 7:01am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fllama-2-generation-config-top-p-0-6%2F49916 "2023-08-08T07:01:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cygu](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@cygu](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcygu)%5C
**Post date:** [August 8, 2023, 7:01am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fllama-2-generation-config-top-p-0-6%2F49916%2F1 "2023-08-08T07:01:35Z")

</div>

The `generation_config.json` for the Llama-2-hf models explicitly set `temperature=0.9` and `top_p=0.6`, (e.g. [https://huggingface.co/meta-llama/Llama-2-7b-hf/blob/main/generation\_config.json](https://huggingface.co/meta-llama/Llama-2-7b-hf/blob/main/generation_config.json)). I am wondering why this is the case. In my experience, `top_p=0.6` easily leads to very repetitive text. Wouldn’t it be better to just not include these in the `generation_config.json`?

@ArthurZ @osanseviero

---

<div class="post-metadata">

**Author:** ![ArthurZ](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/arthurz/32/26972_2.png) [@ArthurZ](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FArthurZ)%5C
**Post date:** [August 8, 2023, 9:00am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fllama-2-generation-config-top-p-0-6%2F49916%2F2 "2023-08-08T09:00:32Z")

</div>

These parameter were specifically set by the Llama team, and probably come from their experiments with the model!

---

<div class="post-metadata">

**Author:** ![cygu](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@cygu](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcygu)%5C
**Post date:** [August 8, 2023, 9:45am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fllama-2-generation-config-top-p-0-6%2F49916%2F3 "2023-08-08T09:45:58Z")

</div>

Thanks for the response! I guess you probably won’t know the answer to this, but is it possible that the temperature and top\_p were somehow swapped on accident? In the official Llama repo, it seems that a temperature of 0.6 and top\_p of 0.9 are used, ([https://github.com/facebookresearch/llama/blob/main/example\_text\_completion.py](https://github.com/facebookresearch/llama/blob/main/example_text_completion.py), [https://github.com/facebookresearch/llama/blob/main/example\_chat\_completion.py](https://github.com/facebookresearch/llama/blob/main/example_chat_completion.py)). Whereas the `generation_config.json` has them swapped, temperature of 0.9 and top\_p of 0.6.

---

<div class="post-metadata">

**Author:** ![ArthurZ](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/arthurz/32/26972_2.png) [@ArthurZ](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FArthurZ)%5C
**Post date:** [August 8, 2023, 10:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fllama-2-generation-config-top-p-0-6%2F49916%2F4 "2023-08-08T10:21:34Z")

</div>

Ah in that case I would need to look at the commits, they might have been swapped ! Thanks for noticing!
