# The num\_return\_sequences parameter in model.generate does not return unique outputs

**URL:** <https://discuss.huggingface.co/t/the-num-return-sequences-parameter-in-model-generate-does-not-return-unique-outputs/61282>\
**Category:** 🤗Transformers\
**Created:** [November 6, 2023, 10:27pm UTC](https://discuss.huggingface.co/t/the-num-return-sequences-parameter-in-model-generate-does-not-return-unique-outputs/61282 "2023-11-06T22:27:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![josephgatto](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@josephgatto](https://discuss.huggingface.co/u/josephgatto)\
**Post date:** [November 6, 2023, 10:27pm UTC](https://discuss.huggingface.co/t/the-num-return-sequences-parameter-in-model-generate-does-not-return-unique-outputs/61282/1 "2023-11-06T22:27:21Z")

</div>

If I have a BART model, for example, and I run this:

`bart_output = BART.generate(input, temperature = 1.0, num_return_sequences = 3, num_beams=5, do_sample=True)`

I find that all 3 outputs are almost always exactly the same. However, if I were to call this function 3 independent times such as

`[BART.generate(input, temperature = 1.0, num_return_sequences = 1, num_beams=5, do_sample=True) for _ in range(3)]` I **will** often get unique outputs

Can anyone explain what’s going on here? This hacky solution is very inefficient!
