How Prompt Keywords (Magic Words) Optimize Language Model Performance

Discover how carefully chosen prompt keywords enhance the effectiveness of language models. Learn how to craft precise prompts to improve the reliability and usefulness of AI responses.

How Prompt Keywords (Magic Words) Optimize Language Model Performance

Prompt keywords are carefully chosen words or phrases that you can give to an LLM to guide it to give you the answer you're looking for. Think of them as the power ups for prompts that nudge the model perform its best for your use case.

Why is This Important?

When you ask a language model a question or give it a task, the way you phrase your question/task and the choice of keywords, entities etc. can greatly affect the answer it gives. By finding the best way to phrase questions or prompts, we can make these models much more reliable and useful.

How Prompt Keywords Work

When explaining these concepts I find it useful to abstract away the technical layers and imagine the language model’s knowledge base as a vast knowledge graph.

This abstraction helps visualize how prompt engineering influences the model's behavior, making it more intuitive to understand how to craft effective prompts for specific use cases.

In this graph:

  • Entities: Each word or concept is a node in the graph.
  • Relationships: The connections between these nodes represent how words or concepts are related, with probabilities indicating the strength or likelihood of these connections.

Basic Structure

  1. Nodes: Words or phrases (e.g., “Titanic,” “1912,” “sank”).
  2. Edges: Relationships between nodes, with probabilities indicating how likely one word leads to another in a given context (e.g., “Titanic” -> “sank” with high probability, “Titanic” -> “1912” with medium probability).

Standard Prompting

When you ask the model a question, it typically follows the most probable paths in this graph. Think of it as giving the average response of all the information you have given it and the information it can grasp that are closest to the central theme.

For example, asking "When did the Titanic sink?" follows the path:

  • Start at “Titanic” node.
  • Follow the high-probability edge to “sank.”
  • From “sank,” follow another edge to “1912.”

Prompt Keywords

Prompt Keywords are specific words, phrases or partials that can guide the language model to follow less obvious paths in the graph. This is akin to giving it directions to explore less likely but still valid connections.

How Prompt KeyWords Work:

  1. Highlighting Paths: Certain words/phrases in your prompt can act like beacons, highlighting paths in the graph that the model might not usually take.
    • Example: Prompting with “The famous ship Titanic, which sank in 1912,” can directly highlight the “1912” node.
  2. Skipping Steps: Keywords can instruct the model to jump directly to less likely nodes, bypassing intermediate steps.
    • Example: Using a prompt like “In 1912, what happened to the Titanic?” makes the model start from “1912” and directly link to “sank,” bypassing other possible nodes like “ship” or “voyage.”
  3. Contextual Cues: Adding contextual information in your prompt can set a starting point closer to the desired node.
    • Example: “Considering historical maritime disasters, when did the Titanic sink?” This prompt positions the model closer to the “sank” node associated with maritime disasters, making the path to “1912” more straightforward.

Probability Modifiers

  • Prompt Tokens as Modifiers: Each word in the prompt can modify the probabilities of certain paths.
    • For instance, the word “historical” might increase the likelihood of the model considering years or events.

Dynamic Re-Routing

  • Dynamic Path Adjustment: Just as GPS can recalculate routes based on traffic, certain prompts can dynamically adjust the model's path through the graph.
    • Example: A prompt like “Given the significant events of 1912, what happened to the Titanic?” causes the model to prioritize paths that consider the “significant events” of the year.

Another Example

Basic Structure

  • Nodes: Ideas or concepts (e.g., “space exploration,” “Mars,” “colonization”).
  • Edges: Relationships between nodes, with probabilities indicating how likely one idea leads to another in a given context (e.g., “space exploration” -> “Mars” with high probability, “Mars” -> “colonization” with medium probability).

Standard Prompting

For example, asking "What are some ideas for space exploration?" follows the path:

  • Start at the “space exploration” node.
  • Follow the high-probability edge to “Mars.”
  • From “Mars,” follow another edge to “colonization.”

How Prompt Keywords Work

  1. Highlighting Paths:
    • Example: Prompting with “Innovative methods for space travel, beyond Mars colonization,” can directly highlight the “innovative methods” node.
  2. Skipping Steps:
    • Example: Using a prompt like “What are some unconventional ideas for interstellar travel?” makes the model start from “interstellar travel” and directly link to “unconventional ideas,” bypassing other possible nodes like “Mars” or “technology.”
  3. Contextual Cues:
    • Example: “Considering the latest advancements in quantum physics, what are some futuristic concepts for space travel?” This prompt positions the model closer to the “quantum physics” node, making the path to “futuristic concepts” more straightforward.
  4. Probability Modifiers
    1. Prompt Tokens as Modifiers:
    • Example: The word “futuristic” might increase the likelihood of the model considering advanced technologies or speculative ideas.

Dynamic Re-Routing

  • Dynamic Path Adjustment:
    • Example: A prompt like “Given the recent breakthroughs in space-time manipulation, what are some potential applications for space exploration?” causes the model to prioritize paths that consider “space-time manipulation” and its applications.

Practical Illustration

Let's apply this to a practical scenario of customer service:

Scenario: Customer Inquiry on Product Delivery

  1. Standard Inquiry: “Where is my order?”
    • Nodes: Start at “order.”
    • Edges: Likely paths include “tracking,” “shipping,” “delivery date.”
  2. Magic Words Inquiry: “Can you update me on the exact delivery status of my recent purchase?”
    • Highlighting Paths: The words “exact delivery status” make the model prioritize the path to “delivery date” and potentially skip over intermediate nodes like “shipping.”
    • Contextual Cues: The phrase “recent purchase” provides additional context, refining the search within recent time frames and relevant transactions.

Summary

  • The knowledge graph represents all possible connections and probabilities within the language model's knowledge base.
  • Magic words in prompts act like special instructions or modifiers that highlight, skip, or prioritize certain paths in the graph, enabling the model to reach less likely but relevant nodes more efficiently.
  • By using this approach, you can guide the model to produce more accurate, relevant, and contextually appropriate responses even when the direct path isn't the most probable one.

Two Main Categories of Prompt Keywords

Prompt Keywords

Prompt Keywords are specific words or phrases used to enhance and direct the performance of language models. They can be categorized into two major types: general/generic prompt keywords and specific prompt keywords.

1. General/Generic Prompt Keywords

These are versatile keywords that can be applied across a wide range of use cases. They help to construct and refine prompts, making them more targeted and purposeful.

Examples and Uses

  • Summarize: Used to condense information into a brief overview.
    • Example: "Summarize the key points of this article."
  • Explain: Requests a detailed explanation of a concept or process.
    • Example: "Explain the theory of relativity."
  • Describe the process of: Asks for a step-by-step description of a particular process.
    • Example: "Describe the process of photosynthesis."
  • Compare and contrast: Used to highlight similarities and differences between two or more items.
    • Example: "Compare and contrast the features of Python and JavaScript."
  • Define: Requests a precise definition of a term or concept.
    • Example: "Define artificial intelligence."
  • Analyze: Asks for a detailed examination of a topic.
    • Example: "Analyze the impact of climate change on global agriculture."
  • Discuss: Invites a comprehensive discussion on a subject.
    • Example: "Discuss the implications of blockchain technology on financial systems."

2. Specific Prompt Keywords

These keywords are tailored to particular domains or use cases. They are designed to trigger more precise and relevant responses within specialized contexts.

Examples and Uses

Medical Domain

  • Diagnose: Used to ask for a diagnosis based on symptoms.
    • Example: "Diagnose the condition given the following symptoms: fever, cough, shortness of breath."
  • Treatment options: Requests information on possible treatments for a condition.
    • Example: "What are the treatment options for type 2 diabetes?"

Technical/Engineering Domain

  • Algorithm: Asks for an explanation or implementation of a specific algorithm.
    • Example: "Explain the QuickSort algorithm."
  • Architecture: Requests details on the structure of a system or software.
    • Example: "Describe the architecture of a neural network."

Business/Finance Domain

  • Market analysis: Requests an examination of market trends.
    • Example: "Provide a market analysis for the electric vehicle industry."
  • Investment strategy: Asks for strategies related to investing.
    • Example: "What are some effective investment strategies for a volatile market?"

Creative Domain

  • Plot outline: Requests an outline for a story or screenplay.
    • Example: "Give a plot outline for a mystery novel."
  • Character development: Asks for ideas on developing characters in a story.
    • Example: "Describe the character development process for a protagonist in a coming-of-age story."

Educational Domain

  • Learning objectives: Requests specific goals for a lesson or course.
    • Example: "What are the learning objectives for an introductory course on machine learning?"
  • Teaching methods: Asks for effective ways to teach a particular subject.
    • Example: "Discuss the best teaching methods for explaining complex math concepts to high school students."

SkillsGraphs, Personality Matrices and so on

Specific prompt keywords can include predefined matrices like personality or knowledge matrices, which help in categorizing and refining the prompts based on specific areas of expertise or interest. These matrices provide a structured way to tailor the responses according to distinct knowledge domains or personality traits.

Example: Knowledge Matrix

This matrix categorizes knowledge areas and can be used to guide the language model to respond from a specific knowledge domain.

[WISE]: 1. [WidenPerspective]: 1a. DiverseViewpoints→1b,2a 1b. ContextualLens→1c,2c 2. [Interpret]: 2a. PatternRecognition→2b,2c,3a 2b. MeaningMaking→2c,3b 2c. InsightExtraction→3a,3b 3. [Synthesize]: 3a. KnowledgeIntegration→3b,4a 3b. HolisticUnderstanding→3c,4b 4. [Embody]: 4a. WisdomInternalization→4b,5a 4b. PrincipleApplication→4c,5c 5. [Evolve]: 5a. ContinuousLearning→5b,1a 5b. AdaptiveGrowth→5c,1b 5c. TransformativeDevelopment→1c,2c

Application in Prompt Reformulation

When using these keywords in prompt reformulation, they help structure the prompt more effectively, guiding the language model to provide more accurate and relevant responses.

Example: General Prompt Reformulation

Original Prompt: "Tell me about photosynthesis."

Reformulated Prompt with General Keywords: "Explain the process of photosynthesis, including the roles of sunlight, water, and carbon dioxide."

Example: Specific Prompt Reformulation

Original Prompt: "What should I do for my knee pain?"

Reformulated Prompt with Specific Keywords (Medical Domain): "Diagnose the possible causes of knee pain and suggest treatment options for inflammation and injury."

By categorizing prompt keywords into general/generic and specific types, we can more effectively guide language models to produce targeted and contextually appropriate responses. General keywords provide a broad framework applicable across multiple domains, while specific keywords cater to particular fields, ensuring precision and relevance in the generated outputs. This approach enhances the model's ability to understand and respond to complex queries, making it a powerful tool for various applications.


Types of Prompt Keywords or "Magic Words"

Prompt Keywords or Magic words can take various forms depending on the task and the specific needs of the interaction with the LLM. Here are some types of magic words identified, each serving a unique purpose in enhancing the performance and output quality of the model:

Contextual Enhancers

Contextual enhancers provide additional context to the model, helping it generate more accurate and relevant responses. These words or phrases add background information or specify the nature of the task.

Example:

  • Basic Prompt: "Translate to French: 'I love programming.'"
  • Enhanced with Context: "In a formal context, translate to French: 'I love programming.'"

Task-Specific Cues

These magic words specify the type of task the model needs to perform, such as translation, summarization, sentiment analysis, or question answering. By explicitly stating the task, the prompt helps the model focus on the correct output type.

Example:

  • Basic Prompt: "The capital of France is [MASK]."
  • Task-Specific Cue: "Answer the following question: The capital of France is [MASK]."

Polarity Indicators

Polarity indicators guide the model towards identifying positive or negative sentiments. They are particularly useful in sentiment analysis tasks.

Example:

  • Basic Prompt: "I am feeling [MASK] today."
  • Polarity Indicator: "Given that the speaker is happy, complete the sentence: I am feeling [MASK] today."

Disambiguators

Disambiguators clarify potential ambiguities in the input, helping the model distinguish between multiple possible meanings or interpretations.

Example:

  • Basic Prompt: "The bank is [MASK]."
  • Disambiguator: "The financial institution is [MASK]."

Emphasizers

Emphasizers stress particular aspects of the input, drawing the model's attention to specific details that are crucial for generating the desired output.

Example:

  • Basic Prompt: "The year Titanic sank is [MASK]."
  • Emphasizer: "The exact year the RMS Titanic sank is [MASK]."

Domain-Specific Terminology

Using domain-specific terminology helps tailor the model's responses to a particular field or subject matter, ensuring the output is relevant and accurate within that context.

Example:

  • Basic Prompt: "Explain quantum mechanics."
  • Domain-Specific Terminology: "In layman's terms, explain the basic principles of quantum mechanics."

Instructional Phrases

Instructional phrases provide clear instructions on how the model should process the input or format the output. They are particularly useful for code generation or structured output tasks.

Example:

  • Basic Prompt: "Create a Python function."
  • Instructional Phrase: "Write a Python function named 'factorial' that calculates the factorial of a number using recursion."

Prompt Length and Structure

The structure and length of the prompt can also act as magic words. Shorter prompts might be effective for some tasks, while longer, more detailed prompts might be better for others. The structure can include bullet points, numbered lists, or formatted text to guide the model.

Example:

  • Basic Prompt: "List benefits of exercise."
  • Structured Prompt: "List five key benefits of regular exercise, including physical and mental health aspects."

Formality Modifiers

Formality modifiers adjust the tone and formality level of the response, which can be crucial for tasks involving different social or professional contexts.

Example:

  • Basic Prompt: "Send an email to my boss."
  • Formality Modifier: "Write a formal email to my boss, requesting a meeting."

Repetition and Reinforcement

Repetition of key terms or phrases within the prompt can reinforce the importance of certain aspects of the task, guiding the model to focus on those elements.

Example:

  • Basic Prompt: "Describe the Eiffel Tower."
  • Repetition: "Describe the Eiffel Tower, emphasizing its height, structure, and cultural significance."

By identifying and employing these types of magic words, users can significantly improve the effectiveness of LLM prompts, ensuring more accurate, relevant, and contextually appropriate outputs.

Sequence Modifiers

Sequence modifiers influence the order or flow of information, helping the model to follow a logical progression in its responses.

Example:

  • Basic Prompt: "Describe the process of photosynthesis."
  • Sequence Modifier: "Step-by-step, describe the process of photosynthesis."

Temporal Context

Temporal context words provide time-related information that can guide the model to produce outputs relevant to a specific period.

Example:

  • Basic Prompt: "Discuss the impact of technology."
  • Temporal Context: "In the last decade, discuss the impact of technology on education."

Contrasts and Comparisons

These prompts explicitly ask the model to compare or contrast information, which can be useful for analytical tasks.

Example:

  • Basic Prompt: "Compare apples and oranges."
  • Contrasts and Comparisons: "Compare the nutritional benefits of apples and oranges."

Hypothetical Scenarios

Hypothetical scenarios can help the model generate creative or speculative responses based on imagined situations.

Example:

  • Basic Prompt: "What if [MASK]?"
  • Hypothetical Scenario: "Imagine a world where [MASK]. Describe the possible societal changes."

Example-Driven Prompts

Providing examples within the prompt can help the model understand the expected format or type of response.

Example:

  • Basic Prompt: "Explain Newton's laws."
  • Example-Driven Prompt: "Explain Newton's laws of motion, similar to how you would explain gravity to a child."

Clarifiers

Clarifiers help remove ambiguity by specifying particular details or constraints within the prompt.

Example:

  • Basic Prompt: "Describe a star."
  • Clarifier: "Describe a star in the context of astronomy, not celebrity."

Cultural or Regional Context

These prompts incorporate cultural or regional specifics to ensure the response is relevant to a particular audience.

Example:

  • Basic Prompt: "What is Thanksgiving?"
  • Cultural Context: "In the United States, what is Thanksgiving and how is it celebrated?"

Personification and Perspective

Using a specific perspective or personification can guide the model to generate responses from a particular viewpoint.

Example:

  • Basic Prompt: "Explain climate change."
  • Perspective: "As a climate scientist, explain the causes of climate change."

Educational Level

Adjusting the complexity of the language to match a specific educational level can improve the model's response relevance.

Example:

  • Basic Prompt: "Explain X."
  • Educational Level: "Explain X to a group of elementary school students."

Emotional Tone

Setting an emotional tone helps the model generate responses with a specific sentiment, which is useful in creative writing or customer service applications.

Example:

  • Basic Prompt: "Write a response to a customer complaint."
  • Emotional Tone: "Write a compassionate and understanding response to a customer complaint."

Technical Jargon and Simplification

Using or avoiding technical jargon can tailor the response for a specialized or general audience, respectively.

Example:

  • Basic Prompt: "Explain blockchain."
  • Simplification: "Explain blockchain technology in simple terms for a beginner."

Metaphors and Analogies

Encouraging the use of metaphors or analogies can help in explaining complex concepts by relating them to familiar ideas.

Example:

  • Basic Prompt: "Describe the internet."
  • Metaphor: "Describe the internet as if it were a vast library."

Temporal Specificity

Including specific time frames or deadlines can help guide the model in generating timely or time-bound responses.

Example:

  • Basic Prompt: "Plan a project."
  • Temporal Specificity: "Plan a project to be completed in three months."

Directional Prompts

Directional prompts help structure the response by indicating the sequence of information:

  • First: Signals the start of a sequence, helping to initiate the response.
    • Example: "First, describe the initial steps of setting up a project."
  • Next: Indicates continuation in a sequence, maintaining logical flow.
    • Example: "Next, explain how to gather requirements for the project."
  • Finally: Marks the end of a sequence, summarizing or concluding the response.
    • Example: "Finally, summarize the key deliverables of the project."

Comparative Prompts

These prompts elicit comparisons and contrasts between concepts, ideas, or entities:

  • Compare and contrast: Highlights differences and similarities.
    • Example: "Compare and contrast the climates of tropical and temperate regions."
  • What is the difference between: Distinguishes between items or concepts.
    • Example: "What is the difference between renewable and non-renewable energy sources?"
  • How is [something] different from: Clarifies distinctions.
    • Example: "How is electric vehicle technology different from hybrid vehicle technology?"

Analytical Prompts

Analytical prompts encourage breaking down complex topics and evaluating components:

  • Analyze: Prompts the model to examine components.
    • Example: "Analyze the impact of social media on youth culture."
  • Evaluate: Requests an assessment of value or effectiveness.
    • Example: "Evaluate the effectiveness of online learning during the pandemic."
  • Critique: Requests a critical analysis.
    • Example: "Critique the main arguments presented in the article."
  • Examine: Prompts for detailed investigation.
    • Example: "Examine the factors leading to climate change."

Causal Prompts

These prompts explore causes, origins, or reasons behind events or phenomena:

  • What are the causes of: Explores origins or reasons.
    • Example: "What are the causes of the Great Depression?"
  • Explain why: Provides reasons or justifications.
    • Example: "Explain why the Roman Empire fell."
  • What led to: Discusses preceding events or causes.
    • Example: "What led to the signing of the Treaty of Versailles?"

Result-Oriented Prompts

Result-oriented prompts focus on outcomes, effects, or consequences:

  • What are the effects of: Discusses outcomes.
    • Example: "What are the effects of deforestation on biodiversity?"
  • What is the impact of: Assesses influence or consequences.
    • Example: "What is the impact of technology on education?"
  • Discuss the results of: Reviews outcomes or findings.
    • Example: "Discuss the results of the recent election."

Procedural Prompts

Procedural prompts elicit step-by-step instructions or processes:

  • List the steps: Outlines a process.
    • Example: "List the steps to perform a successful experiment."
  • How to: Provides instructions for a task.
    • Example: "How to bake a chocolate cake?"
  • Explain the process of: Details procedural steps.
    • Example: "Explain the process of photosynthesis."

Hypothetical Prompts

Hypothetical prompts explore imaginary scenarios or potential situations:

  • Imagine if: Explores hypothetical scenarios.
    • Example: "Imagine if humans could breathe underwater. How would society change?"
  • What if: Considers potential situations.
    • Example: "What if the internet was never invented?"
  • Suppose: Introduces hypothetical conditions.
    • Example: "Suppose you are a leader of a country. How would you address climate change?"

Implication Prompts

These prompts focus on potential implications or ripple effects:

  • What are the implications of: Discusses potential effects.
    • Example: "What are the implications of artificial intelligence on employment?"
  • What could result from: Explores possible outcomes.
    • Example: "What could result from the legalization of cannabis?"
  • Consider the consequences of: Reflects on potential impacts.
    • Example: "Consider the consequences of ignoring climate change warnings."

Advantage/Disadvantage Prompts

Advantage/disadvantage prompts provide a balanced perspective by considering pros and cons:

  • What are the benefits of: Discusses positive aspects.
    • Example: "What are the benefits of remote work?"
  • What are the drawbacks of: Highlights negative aspects.
    • Example: "What are the drawbacks of nuclear energy?"
  • List the advantages of: Focuses on benefits.
    • Example: "List the advantages of learning a second language."

Persona or Style Prompts

These prompts specify the tone or persona for the LLM to adopt:

  • Respond in a friendly tone: Controls the style.
    • Example: "Respond in a friendly tone to a customer inquiry about store hours."
  • Use formal language: Ensures formality.
    • Example: "Use formal language to write a business proposal."
  • Act as a teacher and explain: Adopts a specific persona.
    • Example: "Act as a teacher and explain the Pythagorean theorem."

Emotional Tone Prompts

Emotional tone prompts guide the LLM to generate responses with specific sentiments:

  • Respond with empathy: Generates supportive responses.
    • Example: "Respond with empathy to someone who has lost their job."
  • Provide a humorous take: Generates witty responses.
    • Example: "Provide a humorous take on daily commuting."
  • Offer a skeptical perspective: Generates critical responses.
    • Example: "Offer a skeptical perspective on the benefits of social media."

Domain-Specific Prompts

Domain-specific prompts tailor responses to specific fields or subjects:

  • From a medical perspective, explain: Generates health-related information.
    • Example: "From a medical perspective, explain the benefits of a balanced diet."
  • In terms of legal implications, analyze: Generates legal insights.
    • Example: "In terms of legal implications, analyze the impact of data privacy laws."
  • Using principles of psychology, describe: Generates psychological explanations.
    • Example: "Using principles of psychology, describe the effects of stress on performance."

Formatting or Structure Prompts

These prompts control the structure of the output:

  • Organize the response as a bulleted list: Generates itemized outputs.
    • Example: "Organize the response as a bulleted list of key points."
  • Present the information in a tabular format: Generates structured data.
    • Example: "Present the pros and cons of renewable energy in a tabular format."
  • Provide a step-by-step guide: Generates instructional content.
    • Example: "Provide a step-by-step guide to creating a budget."

Audience or Skill Level Prompts

Audience or skill level prompts tailor the response complexity:

  • Explain this concept to a 5-year-old: Generates simple explanations.
    • Example: "Explain gravity to a 5-year-old."
  • Discuss this topic at an advanced academic level: Generates complex content.
    • Example: "Discuss quantum mechanics at an advanced academic level."
  • Break this down for someone new to the field: Generates beginner-friendly explanations.
    • Example: "Break down blockchain technology for someone new to the field."

Viewpoint or Perspective Prompts

These prompts provide specific viewpoints or perspectives for the response:

  • From a historical viewpoint, analyze: Generates historical context.
    • Example: "From a historical viewpoint, analyze the causes of World War II."
  • Considering multiple cultural perspectives, discuss: Generates diverse viewpoints.
    • Example: "Considering multiple cultural perspectives, discuss the significance of festivals."
  • Through an ethical lens, examine: Generates moral or ethical considerations.
    • Example: "Through an ethical lens, examine the implications of genetic engineering."

Over 1200 Tried and Tested Magic Words for Your Prompt

Here's a table of prompts keywords, there are the closest things to magic words you can find. We are constantly testing and updating this table, so check back. The table is sorted by keyword length as I found this the most useful way to sort through the list.

Read next