KPMG Interview Question

How does llm stop generating tokens, based on what?