In instruction tuning the model is shown a prompt and a response. It should learn to produce the response, not to imitate the prompt. The loss therefore skips the prompt positions and the padding, but keeps the response and the end-of-turn token.
You will see why, build the shifted labels with the ignore value −100, and write the masked mean loss.