AIF-C01 notes
Essentials of prompt engineering

Modifying Prompts

Inference parameters

Which parameters are available depends on the model.

Randomness and diversity

ParameterWhat it doesLower valueHigher value
TemperatureReshapes the probability distribution of the next tokenMore deterministic, focused, repeatableMore diverse, creative, random
Top PSamples only from the smallest set of tokens whose probabilities add up to POnly the most likely tokensA wider range of tokens
Top KSamples only from the K most probable tokensFocused, coherent (for example K = 10)More varied (for example K = 500)

Length

  • Maximum length: caps the number of generated tokens to avoid runaway output.
  • Stop sequences: tokens that end generation as soon as they appear, whatever the maximum length.

Prompting best practices

  • Be clear and concise, in natural language.
  • Include context, such as what the output is for.
  • Use directives for the response type: summary, full sentence, list, length.
  • Put the requested output at the end of the prompt.
  • Start with a question: who, what, where, when, why, how.
  • Give an example response in brackets.
  • Break up complex tasks into subtasks or separate prompts, or ask the model to think step by step.
  • Experiment with different prompts.
  • Use prompt templates for consistent, reliable inputs.

Scenario update

Temperature 0.9 and top p 0.999 for more creative output, maximum length 5,000, the finance industry and SMB audience as context, and a list of report sections as the directive.

On this page