GPT-2 Text Generation

Enter a prompt and experiment with decoding parameters to see how they affect output. Courses: 100 Deep Learning ch4, 200 Transformer ch4

10 200
0.1 2
0 100
0.1 1
1 2
Examples
Prompt Max New Tokens Temperature Top-k (0 = no limit) Top-p (nucleus) Repetition Penalty Show token probabilities

Temperature: Controls randomness. Low (0.1-0.3) = focused/repetitive. High (1.0-2.0) = creative/chaotic.

Top-k: Only consider the top-k most likely tokens. Lower = more focused. 0 = no limit.

Top-p (nucleus sampling): Only consider tokens whose cumulative probability exceeds p. Lower = more focused.

Repetition Penalty: Penalizes tokens that already appeared. >1.0 reduces repetition.

Try these experiments:

  1. Set temperature=0.1 → very deterministic, same output each time
  2. Set temperature=2.0 → chaotic, often incoherent
  3. Set top_k=5 → very restricted vocabulary
  4. Compare top_p=0.5 vs top_p=1.0