Essentials of Prompt Engineering Flashcards
Elements of a prompt Instructions:
This is a task for the large language model to do. It provides a task description or instruction for how the model should perform.
Elements of a prompt Context:
This is external information to guide the model.
Elements of a prompt - Input data:
This is the input for which you want a response.
Elements of a prompt Output indicator
This is the output type or format.
Negative prompting
is used to guide the model away from producing certain types of content or exhibiting specific behaviors. It involves providing the model with examples or instructions about what it should not generate or do.
Good prompt broken down
Instructions: Given a list of customer orders and available inventory, determine which orders can be fulfilled and which items have to be restocked.
*
Context: This task is essential for inventory management and order fulfillment processes in ecommerce or retail businesses.
*
Input data:
Orders:
Order 1: Product A (5 units), Product B (3 units)
Order 2: Product C (2 units), Product B (2 units)
Inventory:
Product A: 8 units
Product B: 4 units
Product C: 1 unit
*
Output indicator: Fulfillment status:
Randomness and diversity
This is the most common category of inference parameter. Randomness and diversity parameters influence the variation in generated responses by limiting the outputs to more likely outcomes or by changing the shape of the probability distribution of outputs.
Three most common Randomness and Diversity parameters
Temperature, Top P, Top K
When interacting with FMs, you can often configure these to limit or influence the model response.
inference parameters
Two most common categories of inference parameters
Randomness and diversity
length
Temperature
This parameter controls the randomness or creativity of the model’s output. A higher temperature makes the output more diverse and unpredictable, and a lower temperature makes it more focused and predictable. Temperature is set between 0 and 1
Top p
is a setting that controls the diversity of the text by limiting the number of words that the model can choose from based on their probabilities. Top p is also set on a scale from 0 to 1.
Top K
Top k limits the number of words to the top k most probable words, regardless of their percent probabilities.
Low top K setting
With a low setting, like 10, the model will only consider the 10 most probable words for the next word in the sequence. This can help the output be more focused and coherent
High top K setting
This can lead to more diverse and creative output, because the model has a larger pool of potential words to choose from