Why does tokenizer.apply_chat_template() add multiple eos tokens?

The models have been trained with the EOS token positioned in this way to create the illusion of a multi-turn conversation. Therefore, sticking to the prompt template used during the instruction finetune will cause the model to also stick to its expected behaviour.

The EOS token then effectively helps the model to understand that whomever was speaking is now done.

In some examples I have found that omitting the EOS token in my query caused the model to attempt to complete my query. Whereas adding the EOS token caused the model to reply to my query.

As with all things, experiment an see what happens.