In a nutshell
The model only gives you odds for the next token; a decoding strategy decides which one to actually output. Greedy always takes the single most likely token — safe but repetitive. Temperature is a dial that sharpens the odds below 1 (more focused) or flattens them above 1 (more creative). Top-k keeps only the k most likely tokens, and top-p (nucleus) keeps the smallest set whose odds add up to p; both throw away the unlikely tail, then rescale and randomly pick from what's left. Lower settings stay safe and on-topic; higher ones get more diverse and surprising.