π§Ύ Components of a Prompt in Prompt Engineering
A prompt's form depends on the task you are giving to a model. When exploring prompt engineering, you will often see prompts that include some or all of the following elements:
πΉ Instructionsβ
- This is the task for the foundation model (FM) to perform.
- Provides a description or directive on how the model should behave.
πΉ Contextβ
- Offers external information to guide the model.
- Helps improve relevance and accuracy.
πΉ Input Dataβ
- The user-provided content that needs processing or response.
- For example: text to summarize, a question to answer, etc.
πΉ Output Indicatorβ
- Specifies the desired format or type of output.
- Helps the model understand how to structure the response.
π§ Model Latent Space
- Represents the βhiddenβ knowledge stored in a trained model
- It's a statistical database of patterns and relationships learned during training
- When you prompt an LLM, you're navigating this latent space to retrieve relevant knowledge
Example:β
- A scuba vacation recommendation model might encode:
- Destinations
- Dive depths
- Visibility
- Weather conditions
- Even if a user asks, "Where can I snorkel with manatees?", the model can infer an answer using its latent understanding of related concepts.
β Negative Prompting?
Negative prompting is a technique in prompt engineering where you explicitly instruct the model to avoid certain behaviors, topics, formats, or types of content in its response.
π§Ύ Why Use Negative Prompting?β
LLMs are flexible, but sometimes they:
- Drift off-topic
- Make assumptions
- Include unwanted content (e.g., code, hallucinations, opinions)
Negative prompting helps steer the model away from these undesired outputs.
β Examplesβ
Content Restrictionβ
Write a summary of this article, but do NOT include any opinions or assumptions.
Format Controlβ
Explain this concept in plain language. Do not use technical jargon.
Avoid Hallucinationβ
Answer only based on the context provided. Do not make up facts.
Prevent Repetition or Verbosityβ
Give a short response, and do not repeat any part of the input.
π§ Use Cases for Negative Promptingβ
Use Case | Negative Prompt Example |
---|---|
π± Chatbots | "Do not ask the user for personal data." |
βοΈ Legal Summarization | "Avoid giving legal advice." |
π Education | "Do not include the final answer, only explain the steps." |
π₯ Healthcare | "Do not make a diagnosis or suggest medication." |