avatarTony

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

6446

Abstract

ities.”</p></blockquote><h2 id="ac3d">Detailed Output Specifications</h2><p id="8a22">Provide a comprehensive description of the expected output, including all relevant components.</p><p id="a441">For example:</p><blockquote id="cdb6"><p>You will be acting as a renowned financial advisor, WealthGPT. I need you to customize a financial plan based on the information I provide. I am ‘#age’ years old and ‘#gender’. My annual income is ‘#annual_income’, and I have ‘#savings_amount’ in savings. I have some financial goals, specifically ‘#financial_goals’. I can commit to saving ‘#savings_per_month’ per month towards these goals. I have ‘#debts_amount’ in debts that need to be addressed. I am looking for a comprehensive financial plan that includes budgeting, investment strategies, and debt management. Please summarize this plan for me and provide detailed recommendations for budget allocation, investment options, and debt repayment strategies. Additionally, I need a detailed breakdown of expenses and income sources, along with a shopping list for any recommended financial tools or resources. Please keep the role setting consistent and refrain from unnecessary descriptive text. Finally, I would appreciate it if you could provide me with 30 financial wisdom quotes to keep me motivated on my journey towards financial freedom.</p></blockquote><h2 id="4c63">Clear and Specific Request</h2><p id="04c0">Clearly and precisely express your request, provide sufficient context to ensure the AI accurately understands our intent.</p><blockquote id="7fcc"><p>For example: You are a renowned landscape architect specializing in designing Japanese gardens. You possess deep knowledge of Japanese culture, including traditional gardening techniques and aesthetics. Your expertise lies in creating serene and harmonious landscapes that evoke the beauty of nature and capture the essence of Japanese philosophy.</p></blockquote><blockquote id="7469"><p>Please adhere to the following guidelines for garden design:</p></blockquote><blockquote id="39d9"><p>1. Emphasize the principles of simplicity, tranquility, and harmony, reflecting the minimalist elegance of Japanese gardens.</p></blockquote><blockquote id="af8b"><p>2. Incorporate elements such as rocks, water features, and carefully pruned plants to create focal points and evoke natural landscapes.</p></blockquote><blockquote id="7df6"><p>3. Utilize traditional Japanese garden design techniques, such as tsukiyama (hill gardens), karesansui (dry rock gardens), and tea gardens, to create diverse and engaging spaces.</p></blockquote><blockquote id="bbcc"><p>4. Consider the surrounding environment, including climate, topography, and existing vegetation, to ensure seamless integration with the surroundings.</p></blockquote><blockquote id="46ed"><p>5. Pay attention to details such as pathways, bridges, and lanterns to enhance the visitor experience and create a sense of journey and discovery.</p></blockquote><blockquote id="81e9"><p>6. Strive for authenticity and cultural sensitivity, respecting the historical and cultural significance of Japanese garden design.</p></blockquote><blockquote id="a154"><p>7. Aim for sustainability and ecological harmony, incorporating native plants and natural materials to minimize environmental impact.</p></blockquote><blockquote id="92c9"><p>8. Collaborate closely with clients to understand their preferences, needs, and vision for the garden, ensuring the final design reflects their desires and aspirations.</p></blockquote><h1 id="9ad7">Crafting Effective Prompts</h1><p id="b998">While you can find numerous excellent prompts online, the most suitable prompt for a given scenario is unlikely to be simply copied from the internet. The key lies in referencing outstanding prompts and continuously refining and fine-tuning your own.</p><h2 id="fa9e">Clear Objectives</h2><p id="1745">Identify the specific goal of the inquiry, such as text classification, entity labeling, information extraction, translation, generation, summarization, reading comprehension, inference, question answering, correction, keyword extraction, similarity calculation, and so on.</p><h2 id="496f">Focused Questions</h2><p id="50bf">Avoid overly broad or open-ended questions. If a question is difficult for humans to answer, then the AI’s response is unlikely to be good either.</p><div id="85cb"><pre>Original Question: <span class="hljs-string">"Tell me about the history of the universe."</span></pre></div><p id="5cf1">vs</p><div id="9a7f"><pre>Rewritten Focused Question: <span class="hljs-string">"What are the main stages of the Big Bang theory?"</span></pre></div><h2 id="6aea">Clear Articulation</h2><p id="f4bd">Use clear, precise, and detailed language to express the question, avoiding ambiguity, complexity, or vague descriptions. If there are specialized terms in the prompt, they should be clearly defined.</p><div id="48a4"><pre>Original Prompt: <span class="hljs-string">"Explain the impact of climate change on ecosystems."</span></pre></div><p id="4c04">vs</p><div id="b2f1"><pre>Rewritten Clear Articulation: <span class="hljs-string">"Describe how climate change affects biodiversity and ecosystem dynamics, including changes in species distribution, habitat loss, and disruptions to food webs."</span></pre></div><h2 id="7c39">Relevant Content</h2><p id="eb6d">Ensure that the description provided is directly related to the question at hand. Avoid introducing irrelevant information during the conversation that does not contribute to addressing the question.</p><div id="61bc"><pre>Original Prompt: <span class="hljs-string">"Discuss the impact of social media on mental health."</span></pre></div><p id="e7ac">vs</p><div id="4d03"><pre>Rewritten Relevant Content: <span class="hljs-string">"Explain how excessive use of social media platforms can lead to increased feelings of loneliness, anxiety, and depression, as users may compare themselves unfavorably to others and experience cyberbullying."</span></pre></div><h2 id="0cf0">Background Information</h2><p id="9ca2">Providing context in the prompt can assist AI in better understanding your requirements. To aid the model in comprehending the question or task, the prompt should include relevant background information and context wherever possible. This helps the model generate more accurate and relevant responses.</p><h1 id="f35d">Further Refining Prompts</h1><p id="f6cb">

Options

For complex tasks that require exploration or strategic anticipation, traditional or simplistic prompting techniques are inadequate. Writing prompts is akin to writing code — it requires continuous testing and optimization.</p><p id="0786">Depending on the specific application scenario and requirements, constant experimentation with prompt writing methods and strategies is necessary to enhance the accuracy and efficiency of model inference.</p><h2 id="f307">Underlying Structure</h2><p id="b5ec">ChatGPT not only support direct questioning but also offer more detailed prompt structure configurations, primarily for supporting multi-turn conversations. This includes providing various roles (system, user, assistant) settings.</p><p id="216f">ChatGPT supports sending a list as a prompt, where each message in the list has two attributes: role and content.</p><ul><li><b>System</b>: Background information</li><li><b>User</b>: User’s query</li><li><b>Assistant</b>: Model’s response</li><li><b>Content</b>: The actual content of the message.</li></ul><p id="4ea1">For example:</p><div id="a299"><pre>[ { <span class="hljs-string">"role"</span>: <span class="hljs-string">"system"</span>, <span class="hljs-string">"content"</span>: <span class="hljs-string">"You are a memory master."</span> }, { <span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, <span class="hljs-string">"content"</span>: <span class="hljs-string">"Who am I?"</span> }, { <span class="hljs-string">"role"</span>: <span class="hljs-string">"assistant"</span>, <span class="hljs-string">"content"</span>: <span class="hljs-string">"Naisi"</span> }, { <span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, <span class="hljs-string">"content"</span>: <span class="hljs-string">"##Math problem: Find the pattern: 4, 7, 9, 15, 16, 31, 25, x. What is x? <span class="hljs-subst">\n</span>##Knowledge point: Pattern <span class="hljs-subst">\n</span>##Grade range: Chinese elementary school grades 1-6"</span> }, { <span class="hljs-string">"role"</span>: <span class="hljs-string">"assistant"</span>, <span class="hljs-string">"content"</span>: <span class="hljs-string">"2"</span> }, { <span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, <span class="hljs-string">"content"</span>: <span class="hljs-string">"Who am I?"</span> } ]</pre></div><h2 id="cfaf">Prompt Chaining</h2><p id="2055">Prompt Chaining, also known as sequential prompting, is a technique used to address complex problems that cannot be solved with a single inference task. Prompt engineering breaks down a task into multiple sub-tasks and creates a series of prompts based on these sub-tasks.</p><p id="ffc3">Once the sub-tasks are determined, the prompts for each sub-task are provided to the language model. The results obtained from one prompt are then used as part of the input for the next prompt, forming a chain of prompts. The diagram below illustrates a chain of prompts for a story generation task, where prompts are used step by step to generate summaries, titles, characters, locations, dialogues, and so on.</p><p id="a341">For example:</p><figure id="0043"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*c3873UgXWtJOYLVIXLyrdw.png"><figcaption></figcaption></figure><h2 id="fbd0">TOT</h2><p id="af1e">Tree Of Thought, abbreviated as TOT, represents a structured approach to problem-solving known as the “thought tree.” TOT maintains a tree-like structure of thoughts, encompassing a series of intermediate steps in the process of answering questions. With TOT, AI can evaluate and validate the intermediate steps of reasoning.</p><p id="fdfb">Imagine three chefs tasked with creating a new recipe. Each chef begins by brainstorming the key ingredients they’d use and shares their ideas with the group. Then, they move on to detailing the cooking methods and techniques they’d employ, sharing their plans step by step. This process continues until each chef has outlined their entire recipe. However, if any chef suggests an incorrect or impractical cooking method during the discussion, they are asked to step aside. The question is, …</p><h2 id="ef87">RAG</h2><p id="df6f">Retrieval Augmented Generation, or RAG, represents a breakthrough in addressing the limitations of language models. Even with proficient prompt engineering, sometimes a model’s inability to provide accurate answers isn’t due to poor prompts but rather a lack of knowledge. It’s akin to expecting a top-ranking elementary school student to excel in a college entrance exam; their poor performance is due to the absence of exposure to that level of knowledge.</p><p id="2aad">RAG enables large models to rapidly acquire specific knowledge. It integrates artificial intelligence techniques from information retrieval and text generation. RAG begins by scouring vast amounts of data for relevant information (e.g., using search engines like Google or Baidu). It then utilizes reasoning to generate coherent and accurate responses. RAG is particularly useful for addressing the issue of hallucinations in large models and is also effective for learning new knowledge that the current model hasn’t mastered.</p><p id="7751">By enabling language models to access the latest information without the need for retraining, RAG produces reliable outputs based on search-generated content.</p><h1 id="ea88">Conclusion</h1><p id="4cb9">Prompting engineering represents a pivotal advancement in harnessing the capabilities of language models for problem-solving and information retrieval. By crafting clear, concise, and contextually relevant prompts, we can guide these models to generate accurate and insightful responses. Through techniques like prompt chaining, TOT, and RAG, we can refine the problem-solving process, address model limitations, and empower these AI systems to tackle increasingly complex tasks.</p><p id="ee51">As we continue to innovate and refine our approaches to prompting engineering, we unlock new possibilities for AI-driven solutions across various domains, from natural language understanding to knowledge acquisition and beyond. Ultimately, prompting engineering stands at the forefront of AI research, offering a pathway towards more intelligent, adaptive, and effective artificial intelligence systems.</p></article></body>

Everyone Can Become an AI Master Through the Art of Prompt Engineering

In this era where technology reinvents itself with each passing day, understanding and mastering artificial intelligence is becoming as fundamental as learning to read and write. Yet for most, AI remains a shrouded enigma, an arcane field seemingly reserved for the few.

When AI was budding in early 2023, there was an intense focus on the pretrain-finetune paradigm. Innovators labored over models, feeding them high-quality data, honing their inferential prowess with myriad training techniques. Yet, this presented a conundrum — the costs of training and deployment were astronomical, and there lingered a risk of diminished reasoning post-training. Some lamented the Sisyphean ordeal of training a model, only to find it eclipsed by an official update that was more adept and capable.

As we evolved, so did AI. With the advent of large language models like ChatGPT, the pioneers of AI began to pivot their gaze towards the art of prompt engineering.

AI’s prowess in comprehending and generating language is known to all, but the question remains: How do we make machines understand our needs and deliver the right answers? Enter the prompt — a nudge, a directive that allows us to draw out AI’s response through simple instructions or queries, much like typing keywords into a search engine.

The beauty of prompt engineering lies in its simplicity. There’s no need for intricate coding skills, just plain human language questions. With just a spark of creativity, prompts can empower you to craft an automated Q&A for your website, a virtual customer service for your business, or even a personal assistant for your daily life. A little innovation unleashes AI to not just participate in our world, but to change it, profoundly and perpetually.

What is Prompt Engineering

Prompt engineering is a technique in AI engineering that refines large language models (LLMs) using specific prompts and desired outputs. The art of prompt engineering is akin to drawing out the magic from a digital genie. At its core, it’s a dance between the realms of AI engineering and creative orchestration, guiding large language models like ChatGPT to generate responses, craft narratives, or even spawn images from a mere handful of words.

Think of it as a creative collaboration, where the prompt is your offering and the AI’s output is the unpredictable yet often awe-inspiring creation. It blends logical structuring, a touch of programming, and a dash of artistic insight. Whether it’s a line of text, a visual cue, or a different kind of digital input, these prompts are the keys to unlocking a myriad of virtual possibilities.

Consider ChatGPT as a maestro of words, poised to compose texts on virtually any topic you propose. However, like a seasoned artist awaiting inspiration, it requires clear, cogent prompts to unleash its potential fully. This is where the finesse of prompt engineering truly shines — it’s not about commanding an AI but engaging in a dialogue with it, where the clarity of your requests shapes the quality of the AI’s performance.

What is Prompt

A prompt is the query we pose to large-scale models. For instance, when someone interacts with AI for the first time, they might ask, ‘Who are you?’ This inquiry constitutes a prompt.

When first encountered AI, you may thought prompts were merely the content of the questions asked, and clarity in expression was all that mattered. However, that’s not the case. Prompts are closely tied to the results of model inference, and using different prompts for the same question may yield different answers.

For example,

vs

As you can see, the second prompt is evidently superior, leading to the emergence of Prompt Engineering. This practice involves crafting prompts tailored to different scenarios to maximize the capabilities of large-scale models. To utilize AI fully and efficiently, Prompt Engineering is indispensable.

In today’s market, a plethora of AI products abound, from AI novelists to AI fortune tellers, and AI analysts, among others. In fact, most of these products employ Prompt Engineering to function.

Assigning a Role to AI

Firstly, we have AI assume a specific role and respond to questions related to that role.

For example: “You are a meteorologist providing weather updates. Please give a forecast for the next three days in the following cities: New York, London, and Tokyo. Include information on temperature, precipitation, and wind speed. Remember to present the data clearly and concisely. Begin with the current weather conditions and then predict the changes over the next three days”.

Provide Some Examples

Offer some sample texts to the model, allowing it to generate text similar to the examples provided. The model will recognize any patterns or formats present in the samples.

Here are few motivational statements for your reference:

“No matter what you did yesterday, every morning is a new starting point for your life.”

“Your potential is limitless; you can achieve anything you set your mind to.”

“Everyone has the opportunity for success; the key is whether you seize it.”

“Only through enduring storms can we witness the beauty of a rainbow.”

“Always look forward; your future is filled with endless possibilities.”

Detailed Output Specifications

Provide a comprehensive description of the expected output, including all relevant components.

For example:

You will be acting as a renowned financial advisor, WealthGPT. I need you to customize a financial plan based on the information I provide. I am ‘#age’ years old and ‘#gender’. My annual income is ‘#annual_income’, and I have ‘#savings_amount’ in savings. I have some financial goals, specifically ‘#financial_goals’. I can commit to saving ‘#savings_per_month’ per month towards these goals. I have ‘#debts_amount’ in debts that need to be addressed. I am looking for a comprehensive financial plan that includes budgeting, investment strategies, and debt management. Please summarize this plan for me and provide detailed recommendations for budget allocation, investment options, and debt repayment strategies. Additionally, I need a detailed breakdown of expenses and income sources, along with a shopping list for any recommended financial tools or resources. Please keep the role setting consistent and refrain from unnecessary descriptive text. Finally, I would appreciate it if you could provide me with 30 financial wisdom quotes to keep me motivated on my journey towards financial freedom.

Clear and Specific Request

Clearly and precisely express your request, provide sufficient context to ensure the AI accurately understands our intent.

For example: You are a renowned landscape architect specializing in designing Japanese gardens. You possess deep knowledge of Japanese culture, including traditional gardening techniques and aesthetics. Your expertise lies in creating serene and harmonious landscapes that evoke the beauty of nature and capture the essence of Japanese philosophy.

Please adhere to the following guidelines for garden design:

1. Emphasize the principles of simplicity, tranquility, and harmony, reflecting the minimalist elegance of Japanese gardens.

2. Incorporate elements such as rocks, water features, and carefully pruned plants to create focal points and evoke natural landscapes.

3. Utilize traditional Japanese garden design techniques, such as tsukiyama (hill gardens), karesansui (dry rock gardens), and tea gardens, to create diverse and engaging spaces.

4. Consider the surrounding environment, including climate, topography, and existing vegetation, to ensure seamless integration with the surroundings.

5. Pay attention to details such as pathways, bridges, and lanterns to enhance the visitor experience and create a sense of journey and discovery.

6. Strive for authenticity and cultural sensitivity, respecting the historical and cultural significance of Japanese garden design.

7. Aim for sustainability and ecological harmony, incorporating native plants and natural materials to minimize environmental impact.

8. Collaborate closely with clients to understand their preferences, needs, and vision for the garden, ensuring the final design reflects their desires and aspirations.

Crafting Effective Prompts

While you can find numerous excellent prompts online, the most suitable prompt for a given scenario is unlikely to be simply copied from the internet. The key lies in referencing outstanding prompts and continuously refining and fine-tuning your own.

Clear Objectives

Identify the specific goal of the inquiry, such as text classification, entity labeling, information extraction, translation, generation, summarization, reading comprehension, inference, question answering, correction, keyword extraction, similarity calculation, and so on.

Focused Questions

Avoid overly broad or open-ended questions. If a question is difficult for humans to answer, then the AI’s response is unlikely to be good either.

Original Question: "Tell me about the history of the universe."

vs

Rewritten Focused Question: "What are the main stages of the Big Bang theory?"

Clear Articulation

Use clear, precise, and detailed language to express the question, avoiding ambiguity, complexity, or vague descriptions. If there are specialized terms in the prompt, they should be clearly defined.

Original Prompt: "Explain the impact of climate change on ecosystems."

vs

Rewritten Clear Articulation: "Describe how climate change 
affects biodiversity and ecosystem dynamics, including changes in species 
distribution, habitat loss, and disruptions to food webs."

Relevant Content

Ensure that the description provided is directly related to the question at hand. Avoid introducing irrelevant information during the conversation that does not contribute to addressing the question.

Original Prompt: "Discuss the impact of social media on mental health."

vs

Rewritten Relevant Content: "Explain how excessive use of social media 
platforms can lead to increased feelings of loneliness, anxiety, and 
depression, as users may compare themselves unfavorably to others and 
experience cyberbullying."

Background Information

Providing context in the prompt can assist AI in better understanding your requirements. To aid the model in comprehending the question or task, the prompt should include relevant background information and context wherever possible. This helps the model generate more accurate and relevant responses.

Further Refining Prompts

For complex tasks that require exploration or strategic anticipation, traditional or simplistic prompting techniques are inadequate. Writing prompts is akin to writing code — it requires continuous testing and optimization.

Depending on the specific application scenario and requirements, constant experimentation with prompt writing methods and strategies is necessary to enhance the accuracy and efficiency of model inference.

Underlying Structure

ChatGPT not only support direct questioning but also offer more detailed prompt structure configurations, primarily for supporting multi-turn conversations. This includes providing various roles (system, user, assistant) settings.

ChatGPT supports sending a list as a prompt, where each message in the list has two attributes: role and content.

  • System: Background information
  • User: User’s query
  • Assistant: Model’s response
  • Content: The actual content of the message.

For example:

[
  {
    "role": "system",
    "content": "You are a memory master."
  },
  {
    "role": "user",
    "content": "Who am I?"
  },
  {
    "role": "assistant",
    "content": "Naisi"
  },
  {
    "role": "user",
    "content": "##Math problem: Find the pattern: 4, 7, 9, 15, 16, 31, 25, x. What is x? \n##Knowledge point: Pattern \n##Grade range: Chinese elementary school grades 1-6"
  },
  {
    "role": "assistant",
    "content": "2"
  },
  {
    "role": "user",
    "content": "Who am I?"
  }
]

Prompt Chaining

Prompt Chaining, also known as sequential prompting, is a technique used to address complex problems that cannot be solved with a single inference task. Prompt engineering breaks down a task into multiple sub-tasks and creates a series of prompts based on these sub-tasks.

Once the sub-tasks are determined, the prompts for each sub-task are provided to the language model. The results obtained from one prompt are then used as part of the input for the next prompt, forming a chain of prompts. The diagram below illustrates a chain of prompts for a story generation task, where prompts are used step by step to generate summaries, titles, characters, locations, dialogues, and so on.

For example:

TOT

Tree Of Thought, abbreviated as TOT, represents a structured approach to problem-solving known as the “thought tree.” TOT maintains a tree-like structure of thoughts, encompassing a series of intermediate steps in the process of answering questions. With TOT, AI can evaluate and validate the intermediate steps of reasoning.

Imagine three chefs tasked with creating a new recipe. Each chef begins by brainstorming the key ingredients they’d use and shares their ideas with the group. Then, they move on to detailing the cooking methods and techniques they’d employ, sharing their plans step by step. This process continues until each chef has outlined their entire recipe. However, if any chef suggests an incorrect or impractical cooking method during the discussion, they are asked to step aside. The question is, …

RAG

Retrieval Augmented Generation, or RAG, represents a breakthrough in addressing the limitations of language models. Even with proficient prompt engineering, sometimes a model’s inability to provide accurate answers isn’t due to poor prompts but rather a lack of knowledge. It’s akin to expecting a top-ranking elementary school student to excel in a college entrance exam; their poor performance is due to the absence of exposure to that level of knowledge.

RAG enables large models to rapidly acquire specific knowledge. It integrates artificial intelligence techniques from information retrieval and text generation. RAG begins by scouring vast amounts of data for relevant information (e.g., using search engines like Google or Baidu). It then utilizes reasoning to generate coherent and accurate responses. RAG is particularly useful for addressing the issue of hallucinations in large models and is also effective for learning new knowledge that the current model hasn’t mastered.

By enabling language models to access the latest information without the need for retraining, RAG produces reliable outputs based on search-generated content.

Conclusion

Prompting engineering represents a pivotal advancement in harnessing the capabilities of language models for problem-solving and information retrieval. By crafting clear, concise, and contextually relevant prompts, we can guide these models to generate accurate and insightful responses. Through techniques like prompt chaining, TOT, and RAG, we can refine the problem-solving process, address model limitations, and empower these AI systems to tackle increasingly complex tasks.

As we continue to innovate and refine our approaches to prompting engineering, we unlock new possibilities for AI-driven solutions across various domains, from natural language understanding to knowledge acquisition and beyond. Ultimately, prompting engineering stands at the forefront of AI research, offering a pathway towards more intelligent, adaptive, and effective artificial intelligence systems.

Artificial Intelligence
ChatGPT
Cloud Computing
Prompt Engineering
Software Development
Recommended from ReadMedium