Skip to Main Content
Libraries
askus Ask us
 

Prompt Design For Beginners

Make the robot work for you.

PRO TIPS: Set The Temperature Parameter

Temperature logo

Key Points Of The Pro Tip

  • This module introduces you to the concept of manipulating ChatGPT's temperature parameter

  • The temperature parameter provides a way to set the context for the model's responses - a high temperature (eg. 1) emphasizes randomness and creativity while a low temperature (eg. 0) acts to constrain the degree of randomness to generate a conservative output.

  • For ChatGPT-3.5, the scale for the temperature parameter ranges from 0.0 to 1.0, in 0.1 increments. The default setting is 0.7.

The Temperature Parameter's Scale For ChatGPT-3.5

 

Scale for ChatGPT's temperature parameter.

 

Image Caption: A diagram showing the scale for ChatGPT-3.5's temperature parameter.

ChatGPT-3.5's temperature parameter ranges from 0.0 to 1.0, in 0.1 increments. The default setting for ChatGPT is 0.7.

  • Low Temperature
    • Range: 0.0 to 0.4
    • The model's response to a prompt is conservative and predictable. 
    • Use for research and explanations.
       
  • Medium Temperature
    • Range: 0.5 to 0.7
    • The model's response to a prompt is balanced between creativity and accuracy. 
    • Setting used most often. 
       
  • High Temperature
    • Range: 0.8 to 1.0
    • The model's response to a prompt is highly creative and unpredictable but may be nonsensical. 
    • Use for brainstorming and storytelling. 

References

Do you know ChatGPT has a temperature mode? (2023, June 2). Medium.
https://medium.com/aimonks/do-you-know-chatgpt-has-a-temperature-mode-d0fae25d7357

Leung, K. (2023, November 7). Guide to ChatGPT’s advanced settings: Top P, frequency penalties, temperature, and more. Towards Data Science. 
https://towardsdatascience.com/guide-to-chatgpts-advanced-settings-top-p-frequency-penalties-temperature-and-more-b70bae848069#289d

Step 1: Low Temperature Setting

Let's explore how changing the temperature parameter impacts how ChatGPT completes a simple sentence about a cat sitting on a mat; this example is derived from Leung's 2023 Medium article referenced above. 

  • At the lowest temperature setting of 0, the model will finish the sentence in a predictable manner - selecting an activity that cats tend to do such as sleep, groom, purr, etc. 

Prompt Design

  • The prompt is specifically phrased to help ChatGPT-3.5 understand that temperature refers to a parameter that controls the degree of randomness for the model and not to use temperature as a measurement of heat (eg. O°C). 
  • The sentence to be completed by the model is enclosed in quotation marks to help ChatGPT understand where the sentence begins and ends. 

Prompt In ChatGPT-3.5: 

Laura:

Continue the sentence with the lowest degree of randomness (temperature=0):

"The cat sat on the mat and started to...'"

ChatGPT:

"The cat sat on the mat and started to groom itself."

Step 2: Medium Temperature Setting

  • With a medium temperature of 0.5, there's a moderate level of randomness introduced to the model's response. Playing with a string is a slightly less expected activity for a cat relative to sleeping but it's a reasonable activity. 

Prompt In ChatGPT-3.5: 

Laura:

Continue the sentence with a medium degree of randomness (temperature=0.5):

"The cat sat on the mat and started to...'"

ChatGPT:

"The cat sat on the mat and started to play with a dangling string, swatting it with playful enthusiasm."

Step 3: High Temperature Setting

  • With a high temperature of 1, the model's response becomes much more creative and unexpected. While I owned a Siamese cat for over a decade, he never once recited sonnets in a musical voice. 

Prompt In ChatGPT-3.5: 

Laura:

Continue the sentence with the highest degree of randomness (temperature=1):

"The cat sat on the mat and started to...'"

ChatGPT:

"The cat sat on the mat and started to spontaneously recite Shakespearean sonnets in a whimsical, melodious voice, leaving an air of poetic eccentricity lingering in the room."

ACTIVITY: Your Turn!

Creative Commons License
This work by The University of Victoria Libraries is licensed under a Creative Commons Attribution 4.0 International License unless otherwise indicated when material has been used from other sources.