# Using penalized sampling from CTRL

**URL:** <https://discuss.huggingface.co/t/using-penalized-sampling-from-ctrl/3500>\
**Category:** 🤗Transformers\
**Created:** [February 4, 2021, 4:22pm UTC](https://discuss.huggingface.co/t/using-penalized-sampling-from-ctrl/3500 "2021-02-04T16:22:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prajjwal1](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/prajjwal1/32/2246_2.png) [@prajjwal1](https://discuss.huggingface.co/u/prajjwal1)\
**Post date:** [February 4, 2021, 4:22pm UTC](https://discuss.huggingface.co/t/using-penalized-sampling-from-ctrl/3500/1 "2021-02-04T16:22:58Z")

</div>

So `CTRL` uses a new decoding mechanism called `Penalized sampling` which basically discounts the scores of previously generated tokens. I was wondering about the implementation with `model.generate`. Is `repetition_penalty=1.2` with `temperature=0` sufficient ?

---

<div class="post-metadata">

**Author:** ![prajjwal1](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/prajjwal1/32/2246_2.png) [@prajjwal1](https://discuss.huggingface.co/u/prajjwal1)\
**Post date:** [February 4, 2021, 4:34pm UTC](https://discuss.huggingface.co/t/using-penalized-sampling-from-ctrl/3500/2 "2021-02-04T16:34:04Z")

</div>

With `repetition_penalty` set, I’m not seeing as compelling generation as the ones mentioned in the paper. I’m trying out with other decoding strategies as well. If you’ve a suggestion about parameters which works best with `CTRL`, please let me know.
