Skip to main content
How parameters work

A rundown of all the OpenAI parameters, so you can leverage them for better outputs

Dan Cleary avatar
Written by Dan Cleary
Updated over a week ago

Parameters are settings that you can adjust for any given model. The model itself and temperature are the most commonly used parameters.

Below are some quick definitions, if you want more info check out our article: Understanding OpenAI Parameters: Optimize your Prompts for Better Outputs

  1. Temperature - influences how deterministic the response from the model will be. The lower the temperature, the more determinisitic. The higher the Temperature, the more creative and random the response will be.

    If you're doing creative writing a temperature of .7 would be recommended. For more factual use cases like data analysis, temperature should be set to 0.

  2. Max Tokens - determines the maximum length (in tokens) of the response generated by the model.

    The token count of your prompt plus your Max Tokens value cannot exceed the model's context length. This is why we recommend using the gpt-3.5-turbo-16k model if you're dealing with larger prompts.


  3. Top P - An alternative to sampling with temperature, where the model considers the results of the tokens with top_p probability mass. A Top P of 0.1 means only the tokens comprising the top 10% probability mass are considered.

    If your eyes just rolled back reading that definition, don't worry, you can just use Temperature to influence the model's output.
    Leave Top P set to its default value of 1.

    It is recommended to alter Top P OR temperature but NOT both.


  4. Frequency Penalty - Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.

    The higher the frequency penalty, the less likely the model is to repeat the same words in its output

    Default value is 0.


  5. Presence Penalty - Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.


    Defaults to 0.

    Rarely do either of these penalties need to be used.

Our recommendation

Unless you have a specific need, don't adjust Max Tokens, Top P, Frequency Penalty, or Presence Penalty.

For temperature, try out a few different values and see what works best for you. What we like to do is run a prompt with a temperature of .7, commit the prompt, and then run the prompt again with a different temperature value (.3). Then you can view the outputs side-by-side to see which looks better.

If you want more info check out our article: Understanding OpenAI Parameters: Optimize your Prompts for Better Outputs. We go deeper into each parameter



Did this answer your question?