Temperature rescales logits before softmax (0 picks greedy argmax; higher values flatten probabilities). Top-p (nucleus sampling) restricts sampling to the smallest token set whose cumulative probability >= p. For guaranteed JSON, use provider Structured Outputs (constrained decoding against a JSON schema) + Pydantic validation rather than begging in the prompt—and note temperature=0 isn’t 100% deterministic across MoE batches.
Follow-up Interview Question · Why should you change temperature OR top-p rather than tuning both aggressively at once?