大語言模型(Large Language Model)
大型語言模型(LLM)通過學習大量文本數據來掌握語言單元之間的模式和關係,本質上它解決的最核心的那個問題就是讓機器對人類語言的有了徹底的理解能力,讓人類可以使用自然語言去跟機器與軟體進行溝通,這個用來溝通的語言文本就是本系列的主題『提示詞』。
什麼是 Prompt Engineering(提示詞工程)?
在跟 LLM(大語言模型)如 ChatGPT 以及 Gemini 進行互動時,我們經常會聽到 #提示詞工程 這一個術語,用最直白的話來解釋:
這是一個創作出精確且具創意的提示文案去正確引導大語言模型產生符合期望回應的一個過程。
撰寫結構良好的提示(Prompt)對於獲得精確、高品質的回應至關重要。提示可以包含問題、指令、上下文資訊、範例,以及供模型完成或繼續的部分輸入。當模型接收到一個提示後,根據使用的模型類型,它可以生成文字、程式碼、圖片、影片、音樂等各種輸出。
一個好的提示應該像對人說話一樣明確,不留下多餘的解釋空間,這樣模型才能更精準地捕捉到我們的意圖並給出相應的回答。例如,如果我們要求模型提供一篇文章的摘要,明確指出「請提供一個200字的摘要」會比簡單地說「摘要這篇文章」更有效。
什麼是提示(Prompt)
提示就是一個用自然語言向大語言模型(LLM)提出的請求,目的是要從語言模型那裡得到回應。這個概念在實際應用中非常關鍵,因為它直接影響到模型生成的輸出的相關性和品質。無論是要模型回答一個問題、遵循一條指令、提供關於某個主題的資訊,還是完成一段未完的輸入,良好的提示設計都是實現目標的基礎。
提示詞的組成結構
在 Google 所撰寫的提示詞工程指引文件中,它將一段提示詞定義成以下幾個主要構件。
輸入
輸入是提示中的核心部分,直接決定了模型回應的方向和範圍。大致可分為 Question input、Task input、Entity input、Completion input 等等類型。由此可知我們能夠與 LLM 互動的方式是很多元的,這也代表在與 LLM 進行互動前我們必須先精確地定義好需求跟場景,然後使用不同的提示詞結構與策略才能從 LLM 中提取出高品質的回應。
Question input
#問題輸入 是指向模型提出的問題,模型需要根據其所學的知識和數據來提供答案,通常這指的是從模型預訓練權重(或加上網路、向量資料庫搜尋回來的資訊)中找尋解答。這是一種非常直接且常見的與語言模型互動方式,可以用於獲得特定信息、解釋概念或理解模型對特定領域知識的掌握程度。問題輸入的設計需要足夠明確和具體,以便模型能夠準確理解問題意圖並給出相應的回答。
我詢問 Gemini “對於高競爭關鍵字,有哪些有效的策略可以提升網站的搜尋引擎排名?”
"What are effective strategies for improving a website's search engine ranking for highly competitive keywords?"
Gemini 的回應:
Climbing the SERPs (Search Engine Results Pages) for highly competitive keywords is a constant challenge, but it's not impossible. Here are some effective strategies to consider:
**Content is King:**
* **High-Quality & Targeted:** Create informative, engaging, and well-written content that directly addresses the users' search intent for your targeted keywords. Aim for depth and comprehensiveness, going beyond what your competitors offer.
* **Keyword Optimization:** Strategically use your target keywords throughout your content, including titles, headings, meta descriptions, and body text. However, avoid keyword stuffing, which can backfire.
* **Fresh & Updated:** Regularly update your content with new information, insights, and data to keep it relevant and valuable to your audience. Consider publishing new content consistently to establish your website as a trusted source.
* **Diverse Formats:** Explore different content formats like infographics, videos, podcasts, and interactive elements to keep your audience engaged and cater to different learning styles.
**Technical SEO:**
* **Mobile-Friendliness:** This is non-negotiable. Ensure your website is optimized for mobile devices, offering a seamless experience across all platforms. Google prioritizes mobile-friendly websites in search results.
* **Website Speed:** Slow loading times hurt both user experience and rankings. Optimize your website speed through image compression, code minification, and caching mechanisms.
* **Structured Data:** Implement schema markup to provide search engines with richer information about your content, enhancing their understanding and potentially improving your search results.
**Off-Page Optimization:**
* **Backlinks:** Build high-quality backlinks from reputable websites in your niche. Focus on earning backlinks naturally through guest blogging, broken link building, and creating valuable content that others want to link to. Avoid buying backlinks, as it can harm your rankings.
* **Local SEO:** If your business has a local presence, optimize your website and online profiles for local searches. Claim your Google My Business listing, use relevant local keywords, and encourage positive customer reviews.
**Additional Strategies:**
* **User Experience:** Prioritize user experience (UX) by making your website easy to navigate, intuitive, and visually appealing. This can indirectly influence your rankings as satisfied users tend to spend more time on your site and engage more, which are positive signals for search engines.
* **Technical Expertise:** While you can handle basic SEO yourself, consider consulting with an SEO specialist for complex technical aspects or in-depth keyword research and strategy development.
**Remember:**
* SEO is a long-term game. Don't expect overnight results.
* Stay updated on the latest SEO trends and algorithm changes.
* Analyze your website performance regularly and adjust your strategies based on data and insights.
* Focus on providing value to your audience and building a strong online presence, and the ranking improvements will follow.
By implementing these strategies and tailoring them to your specific niche and target audience, you can increase your website's chances of ranking higher for competitive keywords and attract more organic traffic.
任務輸入
任務輸入不僅是告訴模型要做什麼,更是一種激發模型創造性和解決問題能力的方式。例如,要求模型提供創意點子或建議,這不僅考驗了模型的知識理解能力,也是對其生成創新內容能力的挑戰。
以下我用來測試 Task input 的範例是:列出幾個關鍵步驟來優化網頁的SEO以提高其在搜尋引擎中的可見度。
List several key steps to optimize a website's SEO to improve its visibility in search engines.
以下同樣是 Gemini 給的回應:
Here are several key steps to optimize a website's SEO to improve its visibility in search engines:
**On-page optimization:**
* **Keyword research and implementation:** Identify relevant keywords and phrases your target audience uses and naturally incorporate them into your content, title tags, meta descriptions, and image alt text.
* **High-quality, informative content:** Create valuable, well-written content that caters to your target audience's needs and search intent. Update content regularly to maintain freshness.
* **Technical SEO:** Ensure your website is mobile-friendly, has a fast loading speed, and a clear site structure with optimized URLs and internal linking.
* **Schema markup:** Implement structured data markup to help search engines better understand your content and display it richer search results.
**Off-page optimization:**
* **Link building:** Acquire backlinks from high-quality, relevant websites. Focus on earning links through creating valuable content, guest blogging, and outreach.
* **Local SEO (if applicable):** Optimize your website for local search if you have a brick-and-mortar location. Claim and manage your Google My Business listing, cite your business NAP (name, address, phone number) consistently across the web, and encourage customer reviews.
* **Social media promotion:** Share your content on social media platforms to increase visibility and engagement.
**Additional tips:**
* **Test and track:** Regularly monitor your website's SEO performance using analytics tools and adapt your strategies based on data and insights.
* **Stay updated:** Search engine algorithms constantly evolve, so stay informed about the latest SEO best practices and trends.
* **Focus on user experience:** Remember that SEO is ultimately about providing a valuable and engaging experience for users.
**Remember:** SEO is an ongoing process, and it takes time and effort to see results. However, by implementing these key steps and tailoring them to your specific website and target audience, you can significantly improve your website's visibility in search engines and attract more organic traffic.
I hope this helps!
不得不說 SEO 相關問題在 Google 上還是有主場優勢。
實體輸入
模型的應用不僅限於回答問題或完成任務,還可以進行更具體的操作,如分類或總結。這種輸入類型的有效性通常依賴於明確的指令,這也強調了 Prompt 在提高模型性能中的重要性。
以下我設計了一個「Entity Input」的範例,這範例要求模型對一系列網站元素進行分類,確定它們是對搜尋引擎最佳化(SEO)有利還是無益。具體來說,模型需要根據 #SEO 的最佳實務,將每個元素劃分為「對SEO有利」或「對SEO無益」兩大類。這種類型的輸入通常包含指令,以指導模型如何執行特定的動作(在這個情況下是分類)。這裡提到的10個網站元素包括:
- 高質量的外部連結:通常被認為對SEO有利,因為它們可以增加網站的權威性和信譽。
- 隱藏的文字:通常被認為對SEO無益,可能會被搜尋引擎視為欺騙行為。
- 網站地圖:對SEO有利,有助於搜尋引擎更好地瞭解網站結構。
- 快速載入的頁面速度:對SEO有利,因為加載速度是搜尋引擎排名的一個因素。
- 關鍵字堆砌:對SEO無益,這是一種過度優化的策略,可能會受到搜尋引擎的懲罰。
- 手機友好設計:對SEO有利,因為移動適應性是搜尋引擎評估的關鍵因素之一。
- 重複內容:對SEO無益,可能會導致搜尋引擎對網站的排名下降。
- 社交媒體整合:對SEO有利,可以增加網站的曝光度和用戶參與。
- 圖片的ALT標籤:對SEO有利,有助於搜尋引擎理解圖像內容。
- HTTPS:對SEO有利,因為安全性是搜尋引擎評價網站質量的因素之一。
"Categorize the following website elements as [beneficial for SEO, not beneficial for SEO].
High-quality backlinks
Hidden text
Sitemap
Fast page loading speed
Keyword stuffing
Mobile-friendly design
Duplicate content
Social media integration
ALT tags for images
HTTPS security
"
在沒有優化輸出格式的狀態下 Gemini 會回傳以下的內容,基本上分類都是正確的,只是輸出格式過於 verbose,這我們會在之後控制模型輸出格式的章節來進行優化。
Beneficial for SEO:
High-quality backlinks
Sitemap
Fast page loading speed
Mobile-friendly design
ALT tags for images
HTTPS security
Not beneficial for SEO:
Hidden text
Keyword stuffing
Duplicate content
完成輸入(Completion input)
Completion input 則是對模型創造性和連貫性的挑戰,要求模型基於給定的文本進行擴展或完善。這不僅可以用於生成文章、故事等,也是理解模型如何處理和延續既有信息的一種方式。
模型預期將基於一段開放式問題作為提示詞來完成或繼續後續的內容。在這個實驗下,我提出了一個 SEO 相關的問題或挑戰「如何降低網站的跳出率並提升使用者參與度」。模型被期望提供一或多個策略或建議,以回應這個開放式的請求。
這種類型的輸入鼓勵模型生成具體的行動指南或解決方案,這些解決方案應該是針對問題的直接回應。例如,模型可能會提出改善網頁設計、優化內容質量、提供互動元素或改進使用者體驗等建議。透過這種方式,完成輸入不僅促使模型展示其知識庫和生成能力,也為使用者提供了針對特定問題的實用建議。
To reduce bounce rate and boost engagement, consider...
Gemini 會嘗試針對我這個開放式的問題提供合理的解答如下:
1. **Optimize Page Loading Speed:** Ensure that your website loads quickly, as visitors are more likely to leave if they have to wait too long. Aim for a loading time of under 3 seconds.
2. **Write Clear and Concise Content:** Make sure your content is easy to read, informative, and engaging. Use subheadings and bullet points to break up text, highlight key points, and create a visually appealing layout.
3. **Include Relevant Visuals:** Use images, videos, infographics, or other visuals to illustrate your content and make it more visually appealing. This can help keep visitors engaged and reduce the chances of them bouncing.
4. **Use Attention-Grabbing Headlines:** Your headlines are the first thing visitors will see, so make sure they're attention-grabbing and accurately reflect the content of your page. Use strong keywords and clear calls to action to encourage visitors to click and stay on your page.
5. **Create an Intuitive Navigation Menu:** Make it easy for visitors to find what they're looking for by providing a clear and intuitive navigation menu. Avoid using complex or confusing terminology, and keep your menu structure simple and straightforward.
6. **Use Internal Links:** Link to other relevant pages on your website to keep visitors engaged and encourage them to explore your site further. This can help reduce bounce rate and increase the chances of visitors converting into customers.
7. **Optimize for Mobile Devices:** Ensure your website is mobile-friendly and responsive, as more and more users are accessing the internet from mobile devices. Make sure your content is easy to read and navigate on smaller screens, and consider using a mobile-specific template or design.
8. **Address User Intent:** Make sure your content is aligned with what users are searching for when they land on your page. If your content doesn't address their needs or expectations, they're more likely to leave quickly.
9. **Use Clear Calls to Action:** Tell visitors what you want them to do next, whether it's reading more content, subscribing to your newsletter, or making a purchase. Use clear and concise calls to action throughout your website to guide visitors and encourage them to take the desired action.
10. **Eliminate Distractions:** Remove any unnecessary elements or distractions from your pages, such as excessive advertising or pop-ups. A clean and clutter-free design can help keep visitors focused on your content and reduce the likelihood of them bouncing.
Context(上下文)
上下文(Context)的重要性在於它不僅提供了模型生成回應時所需的背景資訊,還可以指導模型的行為,確保生成的內容與提示的範圍保持一致。
以下的範例中我設計了一段針對「寵物電子商務網站」SEO分析的「上下文」提示,希望 LLM 能奠基在這些脈絡上去回答我以下的開放式的問題:
- 根據所提供的詳細上下文,評估網站在關鍵字「有機狗糧」的當前排名位置。
- 頁面載入時間若超過理想目標3秒,可能會對網站的整體SEO表現和用戶參與率產生什麼影響?
- 此外,考慮社交媒體整合在補償直接搜尋挑戰中的作用。
我設計的範例中關於 context 的解釋及其意義陳述如下:
- 網站焦點解釋:該網站專注於提供寵物產品,特別強調有機和自然選項,這表明了針對特定市場的營銷策略,這對SEO策略有重要影響。
- 主要和次要關鍵字解釋:確定「有機狗糧」為主要關鍵字焦點,並提供相關的次要關鍵字。這有助於了解針對各種相關搜尋查詢的更廣泛SEO策略。
- 每月搜尋量和關鍵字難度解釋:顯示主要關鍵字的受歡迎程度和競爭環境。高每月搜尋量配合高關鍵字難度表明存在重大機會,但提高排名也是一個挑戰。
- 當前排名位置解釋:展示了網站在搜尋引擎結果中對於主要關鍵字的當前能見度,為衡量SEO進展和效果提供了基準。
- 反向連結解釋:指向針對主要關鍵字頁面的反向連結數量,暗示了頁面的權威性以及外部網站對其SEO強度的貢獻。
- 當前頁面載入時間解釋:一個關鍵的可用性和SEO因素,因為較長的加載時間可能會負面影響跳出率和用戶滿意度,從而影響搜尋排名。
- 手機友好設計解釋:強調了網站對移動用戶的適應性,這是SEO表現的一個重要因素,因為行動搜尋查詢的比例日益增加。
- SEO優化內容覆蓋率解釋:使用最佳化 meta tags 的頁面百分比,表明網站如何利用 meta tags 來提高從搜尋結果的可見度和點擊率。
- 社交媒體整合解釋:積極的社交媒體參與可以直接推動流量和品牌能見度,間接通過增加內容分發和使用者參與來有益於SEO。
Comprehensive SEO Analysis for a Leading Pet E-commerce Website:
Website Focus: A wide range of pet products with a special emphasis on organic and natural options for dogs and cats.
Primary Keyword for Analysis: "organic dog food"
Related Secondary Keywords: ["grain-free dog treats", "eco-friendly pet toys", "natural pet supplements"]
Monthly Search Volume for Primary Keyword: 8,500
Keyword Difficulty for Primary Keyword: High, indicating a competitive market
Current Ranking Position for Primary Keyword on Google: 12, showing room for improvement
Number of Backlinks to the Page Targeting Primary Keyword: 40, suggesting moderate authority
Page Load Time: 3.5 seconds, which is above the ideal target, potentially affecting bounce rates and user experience
Mobile-Friendly Design: Implemented, ensuring a positive experience for mobile users
SEO Optimized Content Coverage: 85% of the site's pages have optimized meta descriptions, enhancing search visibility
Social Media Integration: Active profiles on Facebook, Instagram, and Twitter, driving engagement and direct traffic
Given the detailed context provided, evaluate the current ranking position for the keyword "organic dog food". How might the page load time, exceeding the ideal target of under 3 seconds, impact the website's overall SEO performance and user engagement rates? Additionally, consider the role of social media integration in compensating for direct search challenges.
以下是 Gemini 奠基在我所提供的 context 上所推論出的綜合建議:
**Evaluation of the Current Ranking Position for the Keyword "organic dog food":**
- The current ranking position of 12 for the primary keyword "organic dog food" indicates that while the website has some visibility on the search engine results pages (SERPs), there is significant room for improvement.
**Impact of Page Load Time on SEO Performance and User Engagement:**
- The page load time of 3.5 seconds, exceeding the ideal target, can negatively impact the website's overall SEO performance and user engagement rates in several ways:
- Increased Bounce Rate: Slow-loading pages tend to have higher bounce rates as users may get impatient and leave the website before it fully loads.
- Lower Search Rankings: Google's algorithms consider page load speed as a ranking factor, so a slower website may rank lower in search results.
- Reduced Conversion Rates: Visitors who experience longer load times are less likely to make purchases or take other desired actions on the website.
**The Role of Social Media Integration in Compensating for Direct Search Challenges:**
- Social media integration can play a crucial role in compensating for direct search challenges by:
- Driving Referral Traffic: Active social media profiles can drive targeted traffic to the website through social media posts, links, and advertisements.
- Building Brand Awareness: Social media platforms allow businesses to connect with their target audience, build a brand community, and increase awareness of their products and services.
- Generating Backlinks: Engaging social media content can attract backlinks from reputable websites, which can improve the website's authority and search rankings.
**To improve the website's overall SEO performance and user engagement rates, the following recommendations are suggested:**
- **Optimize Page Load Time:** Conduct a detailed analysis to identify the factors contributing to the slow page load time and implement optimizations such as minifying code, optimizing images, enabling browser caching, reducing redirects, and utilizing a content delivery network (CDN).
- **Enhance Content Quality:** Review and improve the website's content to ensure it is high-quality, relevant, and engaging. This can include optimizing product descriptions, creating informative blog posts, and adding customer testimonials and product reviews.
- **Build Backlinks:** Implement a strategic link-building campaign to acquire backlinks from high-quality and relevant websites. This can involve guest posting, directory submissions, and outreach to industry influencers and bloggers.
- **Increase Social Media Engagement:** Develop a comprehensive social media strategy that includes creating engaging content, running targeted social media ads, and interacting with followers to drive traffic to the website.
Examples in prompt text
在提示詞中內涵的「Examples」指的是在提示中納入成對的「輸入 – 輸出」示範,給模型展示一個理想的內容回應 pattern。這種方法論的關鍵在於利用模型的少樣本(Few-shot)學習能力去引導 LLM 理解如何針對特定的輸入生成所期望的輸出形式。
這種方法常見的使用場景在於想要模型生成特定格式(ex. CSV、YAML、XML…)的列表或報告(制式的 Invoice或是票卷…),通過提供一個或多個具體的「輸入 – 輸出」範例,模型可以學習到這種格式的結構和元素,從而在未來的輸入中重複這種模式。
以下我設計了一個 Examples 的 Prompt text 範例,在 Prompt text 中:
- 展示期望輸出:每個「輸入 – 輸出」清晰展示了什麼樣的反向連結會被視為「高品質反向連結」與「低品質反向連結」,有效地教導模型基於每個例子提供的上下文判斷分類標準。
- 定制回應格式:這種結構(陳述後跟著「答案是:」)鼓勵模型在未來的回應中復制此格式,不僅指導模型回應的內容,也指導其格式。
- 通過 Context 引導:每個範例提供的特定上下文幫助模型理解為何一個項目被特定分類,這對於訓練模型識別不同類型反向連結的細微差別至關重要。
- 提高模型的預測準確性:通過包含涵蓋不同情境的範例,模型可以學習更廣泛的模式,幫助提高對新未見輸入的預測或分類準確性。
Classify the following.
Options:
- High-quality backlink
- Low-quality backlink
Text: A link from a well-respected industry magazine
The answer is: High-quality backlink
Text: A link from a new blog with very little traffic
The answer is: Low-quality backlink
Text: A link from a top-rated educational institution
The answer is: High-quality backlink
Text: A link from an unrelated site with spammy content
The answer is: Low-quality backlink
Text: A link from a highly trafficked health and wellness forum relevant to your site's niche
The answer is: High-quality backlink
Text: A link from a large directory of businesses with no editorial standards
The answer is: Low-quality backlink
Text: A link from a government website about environmental regulations relevant to your site's content
The answer is: High-quality backlink
Text: A link from an over-optimized web page filled with keywords and little valuable content
The answer is:
我們會得到 Gemini 給出以下的答案:
Low-quality backlink
通用的提示詞工程
Gemini 用來進行推論角色扮演的設置
- 明確定義角色和專業領域:透過明確指定「AI與大型語言模型的專家」角色,增強了 Gemini 在特定領域內的回答質量和準確度。這種設定鼓勵 Gemini 在回答問題時,更加依賴於其訓練過程中學習到的相關知識和技能。
- 專注於特定的地區和文化背景:要求以台灣的用語、成語和習慣來回答問題,有助於提高 Gemini 在地化的溝通能力。這種地區性的指定不僅增加了回答的相關性和個人化,也讓 Gemini 能夠展現對特定文化背景的理解和尊重。
- 促進多樣化的語言表達:藉由指定使用台灣而非中國大陸的用語和表達方式,促使 Gemini 必須調整其語言生成策略,以適應不同的語言環境和文化要求。這不僅有助於提升 Gemini 的語言多樣性和彈性,也有助於增進 Gemini 對於地區性語言差異的識別能力。
- 提高 Gemini 推論的效率:透過具體而明確的角色扮演提示,可以更有效地引導 Gemini 產生高質量和高相關性的回答。這種方法有助於減少 Gemini 生成不相關或離題回答的風險,從而提升整體的推理效能和準確度。
From now on, you will be an expert in AI and large language models. You are also an expert in prompt engineering of llm and generative AI. You are Taiwanese. You will answer all my questions in zh-TW and use wordings, phrases, and idioms in Taiwan instead of Mainland China.
Give clear and specific instructions
我們來看看一段進行文章內容摘要的範例:
以下的提示詞我要求 Gemini 對『Principled Instructions Are All You Need for Questioning LLaMA-1/2, GPT-3.5/4』這篇論文的 Introduction 做摘要。
Summarize this text.
Text:
Large language models (LLMs) like ChatGPT [13] have shown impressive abilities in various domains and tasks, such as answering questions [7], mathematical reason- ing [5], code generating [11, 9], etc. However, their application and usage, especially on designing the optimal instructions or prompts, can sometimes be unclear to the common users. In this work, we aim to reveal these mysteries for developers or general users when inquiring and interacting with LLMs, and further enhance the quality of the responses from the pretrained LLMs by simply curating better prompts.
Given that directly fine-tuning LLMs for particular tasks tends to be impractical or unattainable for the majority of users and developers due to inefficiency, the research community has turned its attention to the optimization of prompts. The technique of prompt engineering, which entails the crafting of precise, task-specific instructions in natural language, either manually or through automated means, and the careful selection of representative examples for inclusion in the prompt, has become a central area of investigation for LLMs. Despite these dedicated efforts, the task of reliably guiding LLMs to produce specific responses and making full use of the capability of pretrained LLMs continues to pose a considerable challenge.
In this work, we present comprehensive principled instructions to improve the quality of prompts for LLMs. Specifically, we investigate a wide range of behaviors when feeding into different types and formulations of prompts, such as integrating the intended audience in the prompt, e.g., add “the audience is an expert in the field”, or “the audience is the 5-year-old child”, as well as other multiple aspects of the characteristics of LLMs. Our findings indicate that larger models possess a considerable capacity for simulation. The more precise the task or directive provided, the more effectively the model performs, aligning its responses more closely with our expectations. This suggests that LLMs do not merely memorize training data but are capable of adapting this information to suit varying prompts, even when the core inquiries remain constant. Therefore, it proves beneficial to assign a specific role to LLMs as a means to elicit outputs that better match our intended results.
We elaborate the principled instructions for LLM prompting, provide further mo- tivation, and detail several specific designing principles in Section 3. In Section 4 we show experimentally that the proposed principles can produce higher quality, more concise, factual and less complicated or intricate responses than standard prompts for LLMs. Specifically, with the manually-designed ATLAS benchmark, which includes multiple questions for each principle, the specialized prompts we introduced have en- hanced both the quality and accuracy of the LLM responses by an average of 57.7% and 67.3%, respectively, when applied to GPT-4. Furthermore, the improvements are more pronounced with the increase in model size, for example, the performance gains when moving from LLaMA-2-7B to GPT-4 exceed 40%.
在沒有提供他特定的指引的狀態下,他會輸出以下沒有分段落的內
Large language models (LLMs) like ChatGPT have shown impressive abilities across various domains and tasks. However, crafting optimal instructions or prompts for LLMs can be challenging for common users. The research community has focused on prompt engineering, which involves creating precise, task-specific instructions and selecting representative examples to guide LLMs effectively.
This study provides comprehensive instructions to improve LLM prompts. It explores the effects of different prompt types and formulations, demonstrating that LLMs can adapt training data to varying prompts. The findings suggest that assigning specific roles to LLMs helps elicit outputs aligned with intended results.
The study proposes several principles for LLM prompting, including considering the intended audience, formulating precise and unambiguous instructions, providing relevant examples, and fine-tuning prompts for specific models. Experimental results using the ATLAS benchmark show that the specialized prompts enhance the quality and accuracy of LLM responses, especially with larger models like GPT-4.
在以下微調後的提示詞中,我要求 LLM 將原本的長文摘要成兩句句子:
Summarize this text in two sentences.
Text:
Large language models (LLMs) like ChatGPT [13] have shown impressive abilities in various domains and tasks, such as answering questions [7], mathematical reason- ing [5], code generating [11, 9], etc. However, their application and usage, especially on designing the optimal instructions or prompts, can sometimes be unclear to the common users. In this work, we aim to reveal these mysteries for developers or general users when inquiring and interacting with LLMs, and further enhance the quality of the responses from the pretrained LLMs by simply curating better prompts.
Given that directly fine-tuning LLMs for particular tasks tends to be impractical or unattainable for the majority of users and developers due to inefficiency, the research community has turned its attention to the optimization of prompts. The technique of prompt engineering, which entails the crafting of precise, task-specific instructions in natural language, either manually or through automated means, and the careful selection of representative examples for inclusion in the prompt, has become a central area of investigation for LLMs. Despite these dedicated efforts, the task of reliably guiding LLMs to produce specific responses and making full use of the capability of pretrained LLMs continues to pose a considerable challenge.
In this work, we present comprehensive principled instructions to improve the quality of prompts for LLMs. Specifically, we investigate a wide range of behaviors when feeding into different types and formulations of prompts, such as integrating the intended audience in the prompt, e.g., add “the audience is an expert in the field”, or “the audience is the 5-year-old child”, as well as other multiple aspects of the characteristics of LLMs. Our findings indicate that larger models possess a considerable capacity for simulation. The more precise the task or directive provided, the more effectively the model performs, aligning its responses more closely with our expectations. This suggests that LLMs do not merely memorize training data but are capable of adapting this information to suit varying prompts, even when the core inquiries remain constant. Therefore, it proves beneficial to assign a specific role to LLMs as a means to elicit outputs that better match our intended results.
We elaborate the principled instructions for LLM prompting, provide further mo- tivation, and detail several specific designing principles in Section 3. In Section 4 we show experimentally that the proposed principles can produce higher quality, more concise, factual and less complicated or intricate responses than standard prompts for LLMs. Specifically, with the manually-designed ATLAS benchmark, which includes multiple questions for each principle, the specialized prompts we introduced have en- hanced both the quality and accuracy of the LLM responses by an average of 57.7% and 67.3%, respectively, when applied to GPT-4. Furthermore, the improvements are more pronounced with the increase in model size, for example, the performance gains when moving from LLaMA-2-7B to GPT-4 exceed 40%.
我們可以看到 Gemini 將按照我的指示,將長文精簡的摘要成兩句句子。
LLMs, like ChatGPT, excel in various tasks but require carefully crafted prompts to deliver optimal results.
Detailed principles and examples are provided to help users create effective prompts and enhance the quality of LLM responses.
我們也能夠透過 Prompt 去要求 Gemini 在進行摘要時以條列的方式進行摘要結果的輸出。
Summarize this text as bullets points of key information.
Text:
Large language models (LLMs) like ChatGPT [13] have shown impressive abilities in various domains and tasks, such as answering questions [7], mathematical reason- ing [5], code generating [11, 9], etc. However, their application and usage, especially on designing the optimal instructions or prompts, can sometimes be unclear to the common users. In this work, we aim to reveal these mysteries for developers or general users when inquiring and interacting with LLMs, and further enhance the quality of the responses from the pretrained LLMs by simply curating better prompts.
Given that directly fine-tuning LLMs for particular tasks tends to be impractical or unattainable for the majority of users and developers due to inefficiency, the research community has turned its attention to the optimization of prompts. The technique of prompt engineering, which entails the crafting of precise, task-specific instructions in natural language, either manually or through automated means, and the careful selection of representative examples for inclusion in the prompt, has become a central area of investigation for LLMs. Despite these dedicated efforts, the task of reliably guiding LLMs to produce specific responses and making full use of the capability of pretrained LLMs continues to pose a considerable challenge.
In this work, we present comprehensive principled instructions to improve the quality of prompts for LLMs. Specifically, we investigate a wide range of behaviors when feeding into different types and formulations of prompts, such as integrating the intended audience in the prompt, e.g., add “the audience is an expert in the field”, or “the audience is the 5-year-old child”, as well as other multiple aspects of the characteristics of LLMs. Our findings indicate that larger models possess a considerable capacity for simulation. The more precise the task or directive provided, the more effectively the model performs, aligning its responses more closely with our expectations. This suggests that LLMs do not merely memorize training data but are capable of adapting this information to suit varying prompts, even when the core inquiries remain constant. Therefore, it proves beneficial to assign a specific role to LLMs as a means to elicit outputs that better match our intended results.
We elaborate the principled instructions for LLM prompting, provide further mo- tivation, and detail several specific designing principles in Section 3. In Section 4 we show experimentally that the proposed principles can produce higher quality, more concise, factual and less complicated or intricate responses than standard prompts for LLMs. Specifically, with the manually-designed ATLAS benchmark, which includes multiple questions for each principle, the specialized prompts we introduced have en- hanced both the quality and accuracy of the LLM responses by an average of 57.7% and 67.3%, respectively, when applied to GPT-4. Furthermore, the improvements are more pronounced with the increase in model size, for example, the performance gains when moving from LLaMA-2-7B to GPT-4 exceed 40%.
我們可以看到 Gemini 將會以下方的 bullet 格式輸出摘要的結果。
- Large language models (LLMs) like ChatGPT have shown impressive abilities in various domains and tasks.
- The application and usage of LLMs, especially on designing optimal instructions or prompts, can be unclear to common users.
- Prompt engineering, which entails crafting precise, task-specific instructions in natural language and selecting representative examples, has become a central area of investigation for LLMs.
- Guiding LLMs to produce specific responses and making full use of their capability remains a challenge.
- The study provides principled instructions to improve the quality of prompts for LLMs.
- Larger models have a considerable capacity for simulation and perform more effectively with precise tasks or directives.
- LLMs do not merely memorize training data but adapt it to suit varying prompts, even with constant core inquiries.
- Assigning a specific role to LLMs can elicit outputs that better match intended results.
- Manually-designed ATLAS benchmarks show that specialized prompts enhance LLM response quality and accuracy by 57.7% and 67.3%, respectively, on GPT-4.
- Improvements are more pronounced with increasing model size, exceeding 40% when moving from LLaMA-2-7B to GPT-4.
Include examples
透過在提示中詞中納入範例向 Gemini 展示正確回應的樣子,Gemini 會試圖從這些範例中識別出模式和關係,並應用這些學習到的模式來形成回應。這類提示詞的 pattern 稱為少數樣本學習(few-shot prompts),而不提供範例的提示則稱為零樣本學習(zero-shot prompts)。Few-shot learning 常用於調節 Gemini 回應的格式、措辭、範疇或一般模式。
以下文字是一段 zero-shot learning 的提示詞,它沒有在提示詞中事先提供任何範例或背景資訊來直接指導模型如何選擇答案。在 zero-shot learning 的情境下,Gemini 需要依賴其已有的知識和理解,來判斷提出的選項中哪一個是對問題的最佳解釋。
Please choose the best explanation to the question:
Question: What is the role of keywords in SEO?
Explanation1: In SEO, keywords play a pivotal role by acting as the bridge between user queries and the content a website offers. By integrating relevant keywords into website content, titles, and meta descriptions, websites can improve their visibility in search engine results pages (SERPs), attracting more targeted traffic and enhancing their relevance to specific search queries.
Explanation2: Keywords are just words you add to your website to get more visits.
Answer:
Gemini 會選擇 Explanation1 作為他認為較好的陳述當作回應。
Explanation1: In SEO, keywords play a pivotal role by acting as the bridge between user queries and the content a website offers. By integrating relevant keywords into website content, titles, and meta descriptions, websites can improve their visibility in search engine results pages (SERPs), attracting more targeted traffic and enhancing their relevance to specific search queries.
以下這段優化後的版本則是一段採用了 few-shot learning 的提示瓷設計,它通過提供一系列問題和對應的解釋選項來明確展示 Gemini 該如何進行選擇。在每個問題後,都給出了兩種解釋,並指出了哪一個是最佳解釋。這樣,Gemini 不僅能夠理解每個特定問題的背景和上下文,還學習到如何從提供的選項中選擇最合適的答案。
Few-shot learning 依靠這些 Examples 來「教導」Gemini 特定任務的預期輸出模式。在這種情況下,Gemini 利用這些問題和解釋的結構來學習判斷何種類型的解釋更符合SEO相關問題的最佳回答標準。透過這種方法,Gemini 不只是獨立於先前知識作出反應,而是利用提供的範例來調整和優化其回應策略,從而更準確地針對類似問題給出合理的解釋。
Please choose the best explanations to the following questions:
Question 1: What is SEO (Search Engine Optimization)?
Explanation1: SEO is a collection of strategies and techniques aimed at enhancing a website's ranking in search engine results pages. This involves optimizing content with relevant keywords, improving website structure and user experience, among other methods, to increase organic traffic, brand visibility, and user engagement.
Explanation2: SEO is simply the process of making your website appear in Google search results.
Answer: Explanation1
Question 2: How does backlinking affect SEO?
Explanation1: Backlinking significantly impacts SEO as it acts as a vote of confidence from one site to another, indicating to search engines that the content is valuable, credible, and useful, thereby improving a site's ranking.
Explanation2: Backlinks are links from other websites. Having many links automatically makes your site rank higher.
Answer: Explanation1
Question 3: Why is mobile optimization important for SEO?
Explanation1: Mobile optimization is crucial for SEO because it ensures a site is accessible and offers a positive experience on mobile devices. With the majority of searches now performed on mobile, search engines favor mobile-friendly sites in their rankings.
Explanation2: Mobile optimization is making sure your website can be viewed on a phone.
Answer:
以下是針對 prompt text 中每一個作為 sample 的『問題和答案配對』的解釋,以及它們如何幫助模型正確推理:
- Question 1:什麼是SEO(Search Engine Optimization)?
- Explanation1:提供了一個全面而詳細的SEO定義,涵蓋了策略、技術、內容優化、網站結構改善以及 UX 等多個方面,這幫助模型學習到SEO是一個多層面的過程,並非單一動作或簡單任務。
- Explanation2:給出了一個簡化的SEO定義,雖然不完整,但也不完全錯誤。透過比較兩個解釋,模型學習到更全面、詳細的解釋更能準確反映問題的答案,從而在類似情境下優先選擇更加詳盡的解釋。
- Question 2:反向連結如何影響SEO?
- Explanation1:說明了反向連結對SEO的重要性,並解釋了其作為信任投票的概念以及如何影響網站排名的機制。這提供了一個清晰的因果關係和SEO策略背後的理論基礎。
- Explanation2:描述了反向連結的基本概念,但沒有涉及其對SEO的具體影響或背後的原理。透過這個對比,模型學習到在回答複雜問題時,詳細且有深度的解釋更受青睞。
- Question 3:為什麼手機優化對SEO很重要?
- Explanation1:強調了手機優化對於SEO的關鍵性,並詳細說明了原因,包括移動搜尋的普及和搜尋引擎對手機友好網站的偏好。這幫助模型理解手機優化對於提升搜索排名的具體益處。
- Explanation2:雖然提到了手機優化的目的,但缺乏對SEO影響的說明。比較兩個解釋,模型學習到包含原因和後果關係的解釋能更好地回答“為什麼”類型的問題。
經過這樣的拆解,相信讀者應該就能 get 到為何上述 Few-shot learning 版本的提示詞能夠因為 prompt 中給予的 pattern 而讓 Gemini 正確的推論出關於問題:
Question 3: Why is mobile optimization important for SEO?
Explanation1: Mobile optimization is crucial for SEO because it ensures a site is accessible and offers a positive experience on mobile devices. With the majority of searches now performed on mobile, search engines favor mobile-friendly sites in their rankings.
Explanation2: Mobile optimization is making sure your website can be viewed on a phone.
合理的推論結果是:
Explanation1
Find the optimal number of examples
當我們使用 LLM model 像是 #PaLM 或 #Gemini 來處理問題時,我們可以透過給它們一些範例來幫助它們理解我們想要的答案應該是什麼樣子(Few-shot learning)。就像是給學生一些範例題目來幫助他們學習一樣,這些 LLM 通常只需要幾個範例就能抓住要點。
不過,要找到讓 LLM 產生我們想要結果的最佳範例數量會是一個 trial-and-error 的過程。如果我們用的是比較簡單的模型,像是 #BERT,可能就需要更多的 examples 來幫助模型學習。但也要注意,如果我們給的 examples 太多,就有可能導致 LLM 太過專注於這些 examples,而不是去理解整體的問題,這就像是學生只會做練習題,但在面對真正的考題時卻束手無策(model overfitting)。
Use examples to show patterns instead of anti-patterns
在 Few-shot learning 的使用上,使用 Examples 來向 LLM 展示應該遵循模式的『正面表列』比使用 Examples 來向 LLM 展示應該避免的『負面表列』更為有效。
原因如下:
- 正向學習:大型語言模型(如 #GPT 系列、#BERT 等)通過學習大量的文本數據來理解語言的模式和結構。當我們提供正面的範例時,模型能夠直接從這些範例學習到正確的行為或答案的模式。這種正向學習使模型更容易復現和推廣這些模式到新的情境中,從而提高模型的準確性和效率。
- 避免混淆:使用反模式的範例可能會引入混淆,尤其是當模型試圖從這些範例中抽象出應避免的行為時。相比之下,正面的範例直接向模型展示了期望的行為,減少了模型解讀和推理的複雜性。
- 強化學習效果:正面的範例能夠明確地強化模型應該如何回應特定的提示或問題,這有助於模型在類似的未來任務中重複這種成功的行為。這種學習效果通常比試圖從反面範例中學習哪些行為是不被期望的要強。
- 提高學習效率:從正面範例學習允許模型更直接和高效地理解和掌握所需的知識或技能。這種方法減少了模型在學習過程中可能遇到的歧義和不確定性,從而加快了學習進程。
以下我們分別針對『負面表列』與『正面表列』的 few-shot learning 提示詞給出範例。
⛔ Negative pattern:使用多項『負面表列』當作條件去引導 LLM『不要怎麼做』
這段 prompt text 的主要任務是要求 LLM 幫我起草一篇名為「網站SEO的前十大錯誤…」的 Blog,並特別要求 LLM 在推論時盡全力聚焦在 SEO-friendly 內容寫作的複雜性上。
You're embarking on drafting a pivotal blog post titled "The Top 10 Mistakes in Website SEO...", aimed specifically at unraveling the intricacies of SEO-friendly content writing. This guide is intended to enlighten content creators and SEO strategists about the pitfalls that can compromise the effectiveness of their SEO efforts and how these can be adeptly circumvented to bolster a website's standing in search results. To craft a draft that is both comprehensive and instructive, we'll adopt a structured methodology, integrating few-shot learning examples that spotlight key anti-patterns in SEO-friendly content creation. Each "Do not..." prefixed example is designed to clarify practices that undermine SEO success, setting the stage for the large language model to generate an in-depth analysis tailored to enhancing SEO-friendly content writing.
**Do Not Overlook Keyword Intent**
Creating content without aligning it with the intent behind target keywords can lead to misaligned content that fails to satisfy user queries or engage the intended audience effectively.
**Do Not Disregard Article Structure**
Ignoring the structure of your articles, such as headings, subheadings, and logical flow, can make your content less accessible to readers and search engines, diminishing its SEO value.
**Do Not Skimp on Meta Descriptions and Title Tags**
Failing to craft compelling meta descriptions and title tags that resonate with your content's core message can result in lower click-through rates from search engine results pages.
**Do Not Underestimate the Value of Originality**
Publishing content that lacks originality or fails to offer unique perspectives can reduce your content's appeal to both users and search engines, impacting its ranking potential.
**Do Not Neglect Content Freshness**
Allowing your content to become outdated without regular updates or new insights can lead to a decline in relevance and engagement, affecting its search engine performance.
By focusing on these anti-patterns, your objective is to outline a blog post that not only highlights critical mistakes in SEO-friendly content writing but also paves the way for crafting content that ranks well and resonates with readers. This approach aims to equip readers with actionable guidance on creating content that is both engaging for users and optimized for search engines, without concentrating exclusively on one aspect of SEO.
✅ Positive pattern:使用多項『正面表列』作為條件去引導 LLM『應該怎麼做』
You are tasked with creating a blog post focused on the best practices of SEO, specifically within the realm of content writing. To ensure the post is both informative and actionable, include a series of positive-pattern examples that illustrate effective SEO content writing strategies. These examples are intended to guide the large language model (LLM) in generating insights on optimizing content for search engines and readers alike.
Positive-Pattern 1: Use Keywords Strategically
"Integrate primary and related keywords naturally within the content, ensuring readability remains high."
Positive-Pattern 2: Optimize Meta Descriptions and Title Tags
"Craft compelling meta descriptions and title tags that accurately reflect the content, enticing users to click through from search results."
Positive-Pattern 3: Structure Content for Readability
"Employ headers and subheaders to organize content clearly, making it easier for readers and search engines to understand the main points."
Positive-Pattern 4: Produce High-Quality, Original Content
"Focus on creating original content that provides real value to your audience, establishing your site as an authoritative source."
Positive-Pattern 5: Keep Content Updated
"Regularly update content to reflect the latest information and trends, maintaining its relevance and value to readers."
Based on these positive patterns, the blog post should outline and delve into the strategies that make content not only SEO-friendly but also engaging and valuable to readers.
Let the model complete partial input
LLM 非常的擅長根據提供的部分輸入內容去自動生成或補全剩下的內容。這類 model 類似於一個高級的自動完成工具,當你輸入一段不完整的內容時,它可以基於當前的輸入推斷並生成接下來的內容,無論是繼續一個句子、一段文字,還是補全一個想法。
以下這段 prompt text 的目標是要求生成一個 JSON物件,用來捕捉和組織一個 20人聚會中,每位參與者的飲料偏好。這個JSON物件應該包含 10種不同飲料的欄位:coffee、tea、soda、water、juice、milk、energy_drink、smoothie、hot_chocolate 語 beer)。
每種飲料都需要與訂購該飲料的參與者名字關聯起來,使用參與者的名字作為 key,他們選擇的飲料作為 value。此外,這個任務還要求將提供的資訊組織成一個 JSON物件,該物件不僅概述了每種飲料類型訂購的總數量,還列出了訂購每種飲料的參與者名單。
這段 prompt text 的目的是要求整理並呈現一場實體聚會場合中,參與者們根據各自偏好訂購的不同類型飲料的詳細資訊,並將這些資訊以結構化的JSON格式呈現。這樣不僅有助於清晰地理解每個人的選擇,還便於管理和準備相應的飲料數量,以滿足聚會需求。
Given a group order for a gathering of user preference below, return a JSON object that captures the beverage preferences for each attendee. The JSON object should include fields for 10 different beverages: coffee, tea, soda, water, juice, milk, energy_drink, smoothie, hot_chocolate, and beer. Additionally, each beverage should be associated with the names of the attendees who ordered it, with their names as keys and their chosen beverage(s) as the value.
Please organize this information into a JSON object that outlines the total quantities for each beverage type ordered and lists the names of the attendees next to their beverage choice.
The attendees and their beverage choices are as follows:
1. Alice: coffee
2. Bob: tea
3. Charlie: soda
4. Dana: water
5. Evan: juice
6. Fiona: milk
7. George: energy_drink
8. Hannah: smoothie
9. Ian: hot_chocolate
10. Jenna: beer
11. Karl: coffee
12. Lila: tea
13. Mason: soda
14. Nora: water
15. Oliver: juice
16. Penelope: milk
17. Quentin: energy_drink
18. Rachel: smoothie
19. Steve: hot_chocolate
20. Tina: beer
下方的 JSON 結構就是 Gemini 的輸出結果,LLM 分常擅長於從一段幾近雜亂的自然語言輸入語料中整理出結構化的資料 pattern。
{
"coffee": {
"quantity": 2,
"names": ["Alice", "Karl"]
},
"tea": {
"quantity": 2,
"names": ["Bob", "Lila"]
},
"soda": {
"quantity": 2,
"names": ["Charlie", "Mason"]
},
"water": {
"quantity": 2,
"names": ["Dana", "Nora"]
},
"juice": {
"quantity": 2,
"names": ["Evan", "Oliver"]
},
"milk": {
"quantity": 2,
"names": ["Fiona", "Penelope"]
},
"energy_drink": {
"quantity": 2,
"names": ["George", "Quentin"]
},
"smoothie": {
"quantity": 2,
"names": ["Hannah", "Rachel"]
},
"hot_chocolate": {
"quantity": 2,
"names": ["Ian", "Steve"]
},
"beer": {
"quantity": 2,
"names": ["Jenna", "Tina"]
}
}
下面這段 prompt text 的範例則是上一段範例的優化,在這段優化後的 prompt text 中我明確的透過 prompt text 告訴 Gemini 要將整理後的資料以一個明確的 JSON structure 作為輸出結果,重新將這段 prompt text 發入 Gemini 的話你依舊會得到如同第一段 prompt text 同樣的 JSON 輸出,差別點只在於我這一次不讓 Gemini 自由發揮。
Given a group order for a gathering of user preference below, return a JSON object that captures the beverage preferences for each attendee. The JSON object should include fields for 10 different beverages: coffee, tea, soda, water, juice, milk, energy_drink, smoothie, hot_chocolate, and beer. Additionally, each beverage should be associated with the names of the attendees who ordered it, with their names as keys and their chosen beverage(s) as the value.
Please organize this information into a JSON object that outlines the total quantities for each beverage type ordered and lists the names of the attendees next to their beverage choice.
Expected output JSON structure example:
```
{
"coffee": {
"quantity": 2,
"orderers": ["Alice", "Karl"]
},
"tea": {
"quantity": 2,
"orderers": ["Bob", "Lila"]
},
...
"beer": {
"quantity": 2,
"orderers": ["Jenna", "Tina"]
}
}
```
The attendees and their selections are:
1. Alice: coffee
2. Bob: tea
3. Charlie: soda
4. Dana: water
5. Evan: juice
6. Fiona: milk
7. George: energy_drink
8. Hannah: smoothie
9. Ian: hot_chocolate
10. Jenna: beer
11. Karl: coffee
12. Lila: tea
13. Mason: soda
14. Nora: water
15. Oliver: juice
16. Penelope: milk
17. Quentin: energy_drink
18. Rachel: smoothie
19. Steve: hot_chocolate
20. Tina: beer
當你未在 prompt text 中指定預期的 LLM 輸出格式時,LLM 會根據其預訓練時期學得的 pattern 和理解選擇某一種最適合的輸出格式來生成回應內容。
Write me an outline of SEO best practices.
這段 prompt text 會輸出如下的內容。
I. Keyword Research
- Perform keyword research based on search volume, relevance, and competition
- Choose keywords that align with user intent
- Group keywords into semantically related categories
- Use long-tail keywords for better targeting
II. Content Strategy
- Create high-quality, informative content relevant to your target audience
- Use a content calendar to plan and schedule content creation
- Create a mix of content formats (blog posts, infographics, videos, etc.)
- Update your content regularly to keep it fresh and relevant
III. On-Page Optimization
- Use descriptive and keyword-rich titles and meta descriptions
- Include keywords in page headers (H1, H2, etc.)
- Optimize images with relevant alt text
- Use internal linking to create a cohesive and user-friendly experience
- Ensure your website is mobile-friendly
IV. Technical SEO
- Set up a sitemap and submit it to Google Search Console
- Use clear and descriptive URLs
- Implement structured data markup to enhance search results
- Minify CSS and JavaScript to improve page speed
- Enable HTTPS to secure your website
V. Backlinks
- Build backlinks from high-quality websites in your niche
- Focus on relevance and authority rather than quantity
- Use social media and influencer outreach to earn backlinks naturally
VI. Analytics
- Set up Google Analytics to track website traffic and user behavior
- Use analytics data to identify underperforming pages and improve them
- Make informed decisions based on data-driven insights
VII. Continual Improvement
- Monitor search engine algorithm updates and adapt your strategy accordingly
- Conduct regular SEO audits to identify areas for improvement
- Stay up-to-date with the latest SEO trends and best practices
但如果你希望 LLM 生成一個符合你預期中特定格式的大綱,你可以在 prompt text 中加入代表大綱開始部分的文字(或用來組織文章的特殊 symbol),讓 LLM 根據你開始的那個模式來完成剩下的部分。簡單來說,這就像是給 LLM 一個 sample 或 pattern,LLM 會依照這些脈絡資訊提示的格式來生成內容。
這樣做可以幫助你獲得格式統一且符合預期的輸出結果。如果你需要特定的列表符號、標題層級或是其他任何特定格式,只需在提供給模型的提示文本中明確示範開頭部分,模型就會嘗試匹配並延續這個格式完成整個大綱,如以下優化後的 prompt text:
Write me an outline of SEO best practices.
◆ Introduction
➔ Brief overview of SEO and its importance in digital marketing.
➔ Explanation of how SEO practices evolve with search engine algorithms.
➔ Introduction to the core components of SEO: keyword research, on-page optimization, off-page optimization, and technical SEO.
◆ Keyword Research
...
◆ On-Page Optimization
...
我們可以看到 LLM 會按照 prompt text 中所指引的組織方式進行生成內容的輸出:
Here's a detailed outline incorporating your initial points on SEO best practices:
◆ **Introduction**
➔ Brief overview of SEO and its importance in digital marketing.
➔ Explanation of how SEO practices evolve with search engine algorithms.
➔ Introduction to the core components of SEO: keyword research, on-page optimization, off-page optimization, and technical SEO.
◆ **Keyword Research**
➔ The significance of keyword research in crafting an SEO strategy.
➔ Techniques for effective keyword discovery and selection.
➔ Tools and resources for keyword research (e.g., Google Keyword Planner, SEMrush).
➔ Understanding user intent and how it influences keyword choice.
➔ Strategies for using long-tail keywords to capture niche markets.
◆ **On-Page Optimization**
➔ Best practices for optimizing title tags and meta descriptions.
➔ Importance of header tags (H1, H2, H3) for structuring content.
➔ Guidelines for optimizing content with keywords without overstuffing.
➔ Techniques for optimizing images: file naming, alt text, and compression.
➔ URL optimization: clean, keyword-rich URLs for better crawlability.
➔ Internal linking: strategies to improve site navigation and distribute link equity.
➔ Mobile optimization: ensuring the site is mobile-friendly and responsive.
◆ **Content Strategy**
➔ Creating high-quality, relevant content that addresses user needs and intents.
➔ Importance of content freshness and updating existing content.
➔ Role of multimedia (images, videos, infographics) in engagement and SEO.
➔ Content length and its impact on SEO performance.
➔ Strategies for content promotion to enhance visibility and backlinks.
◆ **Off-Page Optimization**
➔ Building a natural backlink profile: methods and best practices.
➔ The importance of social signals in SEO and how to leverage them.
➔ Local SEO strategies: Google My Business optimization and local citations.
➔ The role of guest blogging and external content creation in link building.
◆ **Technical SEO**
➔ Site speed optimization: tools and techniques to improve loading times.
➔ Secure sockets layer (SSL) and its importance for SEO.
➔ Creating and submitting a sitemap to search engines.
➔ The importance of making a website accessible and crawlable for search engines.
➔ Mobile optimization and the impact on rankings.
◆ **SEO Tools and Analytics**
➔ Overview of essential SEO tools for effective management and tracking.
➔ Using Google Analytics to monitor traffic, behavior, and conversion metrics.
➔ Introduction to Google Search Console for tracking website performance in search.
➔ Continuous monitoring and adapting strategies based on analytics insights.
◆ **Conclusion**
➔ Emphasizing the importance of an integrated SEO strategy that aligns with business goals.
➔ The necessity of staying updated with the latest SEO trends and algorithm changes.
➔ Encouragement for ongoing optimization and adaptation for sustained SEO success.
This outline provides a comprehensive framework for discussing SEO best practices, from foundational concepts to advanced strategies, ensuring a well-rounded understanding of effective SEO.
Add contextual information
以下第一段 prompt text 詢問 LLM 如何提升網站在 Google 搜尋結果中的可見度,特別是當網站在目標關鍵字的排名較低,且頁面載入速度慢的情況下。 使用者很可能會透過 LLM 的推論獲得一個非常一般性的答案,原因在於這種問題屬於「零樣本學習」(zero-shot learning)的形式。
Few-shot learning 指的是模型在沒有接受過針對特定任務的直接訓練或範例的情況下,嘗試用預訓練的資料集來推論問題的答案或完成任務的方式。由於詢問的問題非常廣泛,且沒有提供具體的背景資訊或特定的 SEO 策略需求,模型只能根據其廣泛的訓練資料庫和一般性的 SEO 原則來提供答案。
How can I improve my website's visibility in Google search results? My site currently ranks low for its target keywords and has a slow page load time.
如下方的 LLM 推論結果所示,LLM 最終給了我們一些非常基本的 SEO 建議,如優化關鍵字使用、提高頁面 loading 速度、提升內容品質等通用策略。然而,這些答案通常缺乏針對特定網站狀況的深入分析或個性化的策略建議。
1. **Conduct Extensive Keyword Research:**
- Identify and target relevant keywords people use to search for your business or industry.
- Use keyword research tools to find high-volume, low-competition keywords that align with your brand.
- Incorporate these keywords into your website's title, headings, meta descriptions, and content.
2. **Optimize Page Titles and Meta Descriptions:**
- Create unique, compelling page titles and meta descriptions for each page on your website.
- Ensure that they accurately reflect the page's content and include relevant keywords.
- Keep your titles concise (under 70 characters) and ensure your meta descriptions are around 160 characters.
3. **Improve Page Loading Speed:**
- Analyze your website's loading time using tools like Google PageSpeed Insights or GTmetrix.
- Optimize images by compressing them without compromising quality.
- Minify HTML, CSS, and JavaScript files to reduce their size.
- Enable caching to deliver static content faster.
- Consider using a content delivery network (CDN) to distribute your content more efficiently.
4. **Create High-Quality, Unique Content:**
- Provide valuable, informative, and engaging content that resonates with your target audience.
- Ensure your content is well-written, error-free, and relevant to your keywords.
- Include images, videos, or other multimedia elements to enhance the user experience.
- Update your content regularly to demonstrate freshness and relevance.
5. **Build High-Quality Backlinks:**
- Acquire backlinks from reputable, authoritative websites in your industry.
- Focus on quality rather than quantity. Avoid spammy or low-quality links.
- Use a mix of dofollow and nofollow links.
- Reach out to other websites in your niche to guest post or collaborate.
6. **Optimize Your Website for Mobile Devices:**
- Ensure your website is responsive and adapts to different screen sizes.
- Test your website across various devices and use Google's Mobile-Friendly Test tool to identify issues.
- Prioritize mobile usability by displaying content effectively and optimizing mobile navigation.
7. **Utilize Google Search Console:**
- Set up Google Search Console to monitor your website's performance in search results.
- Utilize the provided data to identify errors, crawl issues, and opportunities for improvement.
- Submit your sitemap to help Google understand your website's structure and content.
8. **Monitor Your Analytics and Make Data-Driven Adjustments:**
- Implement analytics tools like Google Analytics to track your website's traffic and user behavior.
- Analyze traffic sources, bounce rates, time on page, and conversion rates.
- Use the insights gained to make data-driven improvements to your website's content, design, and user experience.
如果希望從 LLM 獲得更具體、針對性且高品質的推論結果,最好在設計 prompt text 時提供更多的背景資訊、具體目標和遇到的具體問題,這樣 LLM 才能在其回答中考慮到這些因素,從而提供更加精準和實用的建議。
以下的範例是我優化後的一個版本,在這個版本中我們進行了以下幾項要點的重新設計
- 我們定了清晰的輸出結構:使用 ◆ 和 ➔ 作為條列項目的符號,清晰地劃分了主要建議和具體實施步驟,使內容組織有序,易於閱讀。
- 具體的SEO目標:明確指出了提升網站在Google搜尋結果中的能見度、改善關鍵詞排名和頁面加載速度作為目標,這有助於聚焦回答。
- 要求推論結果包含實際範例:強調了基於網站實際情況提供具體建議和範例,這能夠增加回答的針對性和實用性。
Given the SEO best practices from Semrush below:
"""
SEO Best Practices: 10 Ways to Boost Organic Rankings & Traffic
◆ SEO Best Practices are guidelines to improve a site's organic rankings in search engines like Google, leading to more website visitors.
➔ High rankings increase visibility and click-through rates (CTRs).
➔ The top-ranked page in Google's SERPs receives the majority of clicks.
◆ Understanding and satisfying search intent is crucial for ranking on the first page of Google.
➔ Different types of search intent include informational, navigational, commercial, and transactional.
➔ Google ranks pages higher that accurately match the user's search intent.
◆ Every page should target one primary keyword to optimize its chances of ranking on Google.
➔ The title tag, main headers (H1), introduction, and URL should include the target keyword.
➔ Keyword research tools like Semrush can help identify the best target keyword.
◆ Page titles and meta descriptions are key to attracting clicks from SERPs (Search Engine Results Pages).
➔ Title tags should be concise (50-60 characters) to prevent being cut off in SERPs.
➔ Meta descriptions should be compelling, include the target keyword, and accurately summarize the page content.
◆ Optimizing images improves user experience and contributes to overall SEO.
➔ Choose the correct file format (e.g., JPEG, PNG, WebP) based on the type of image.
➔ Compress images to reduce file size without compromising quality.
➔ Provide alt text for images to improve accessibility and SEO.
◆ Page loading speed is a critical factor for Google, especially on mobile devices.
➔ Use tools like Google's PageSpeed Insights to evaluate and improve loading times.
➔ Optimizing images, minifying CSS/JavaScript, and leveraging browser caching are strategies to improve speed.
◆ An effective internal linking structure helps establish an information hierarchy and enhances SEO.
➔ Link from high-ranking pages to newer or lower-ranking pages to distribute authority.
➔ Ensure links are relevant to the content and provide value to the reader.
◆ Improving user experience (UX) is vital for SEO.
➔ Page speed, mobile-friendliness, and visual appeal affect both UX and SEO.
➔ Avoid intrusive pop-ups and use white space effectively to improve readability.
◆ SEO-friendly URL structures give users and search engines clues about the content of the destination page.
➔ Short, descriptive URLs that include the target keyword perform better in SERPs.
➔ Logical structure and organization of URLs can help users navigate your site more effectively.
◆ Earning authoritative backlinks is likened to receiving "votes of confidence" from other sites.
➔ Focus on creating high-quality content that naturally attracts backlinks.
➔ Analyze competitors' backlinks to identify potential link-building opportunities.
◆ Creating useful content is essential for ranking higher on Google.
➔ Address users' needs and questions comprehensively to become a go-to resource.
➔ Use original research, data, and insights to provide unique value.
"""
Background:
PetPetGo is Taiwan's largest online pet store, specializing in a wide range of pet supplies for cats and dogs, including food, snacks, healthcare products, litter, scratchers, and much more, with discounts of up to 49% off. The website features various sections for hot deals, new arrivals, and brand-specific products, along with shipping and return information.
SEO Goal:
To enhance PetPetGo's visibility in Google search results, specifically aiming to improve rankings for target keywords and optimize page load speed.
Question:
Given the SEO best practices from Semrush, how can I improve my website's visibility in Google search results? Please provide specific actionable recommendations and examples based on my website's context.
Format Requirements:
- Please respond in English.
- Use ◆ as the primary bullet point for each SEO best practice recommendation.
- If necessary, use ➔ as the secondary bullet point to detail specific examples or steps under each primary recommendation.
- Provide concrete suggestions focusing on the following aspects:
1. Page load speed optimization
2. Keyword strategy
3. Internal linking structure
4. User experience (UX) improvements
5. Acquiring high-authority backlinks
- For each recommendation, include practical examples tailored for PetPetGo, such as keyword optimization for a specific product page or concrete methods to improve the loading speed of a feature page.
相較於第一段 prompt text,我們優化後的 prompt text 讓我們能夠更精確的指引 LLM 針對某個特定目標網站與內容類型去提出更加具體的優化建議,推論結果改良的地方大致可羅列出以下幾項:
- 結構清晰,易於理解:這個回答通過 ◆ 和 ➔ 的條列格式清晰地劃分了每一項SEO策略和具體實施步驟,使得閱讀者能夠輕鬆跟隨思路,並且快速抓住重點。
- 提供了實際操作範例:每一項建議後都跟隨了一個具體的實施範例,這不僅幫助讀者更好地理解建議的具體應用,也增加了建議的可行性和實用價值。
- 針對性強:這些建議直接針對 PetPetGo 的網站特點和需求,如針對「狗糧」頁面的圖片優化、針對「貓砂」產品頁面的關鍵詞策略等,這種針對性使得建議更加貼合PetPetGo的實際情況。
- 易於實施:提出的策略和範例都是實際可行的,並且大多數建議使用了容易獲得的工具和資源(如Google’s PageSpeed Insights、Semrush等),這讓 PetPetGo 能夠輕鬆地按照這些建議行動。
- 強調了持續優化的重要性:在結尾處提醒 PetPetGo 注意持續監控這些變更並基於結果和持續的 SEO best practices 進行優化,這體現了對 SEO 工作持續性和動態調整的理解。
To improve PetPetGo's visibility in Google search results, leveraging the SEO best practices from Semrush, here’s a targeted approach with actionable recommendations:
◆ **Page Load Speed Optimization**
➔ Utilize Google's PageSpeed Insights for specific insights into what can be improved to boost your site's loading times.
- **Example**: If PageSpeed Insights indicates that images on the "Dog Food" page are too large, compress these images without losing quality using tools like TinyPNG or Photoshop's "Save for Web" feature.
◆ **Keyword Strategy**
➔ Conduct thorough keyword research to identify high-value, relevant keywords for your target audience. Tools like Semrush can provide insights into keyword volume, competition, and relevance.
- **Example**: For the "Cat Litter" product page, research and target specific long-tail keywords like "dust-free cat litter in Taiwan" to match user search intent more closely.
◆ **Internal Linking Structure**
➔ Create a strategic internal linking plan to help users and search engines navigate your site more effectively. This can distribute page authority across your website and help improve rankings.
- **Example**: Link from a high-traffic blog post like "The Ultimate Guide to Dog Nutrition" to related product pages such as "Organic Dog Food" to drive traffic and spread link equity.
◆ **User Experience (UX) Improvements**
➔ Enhance the overall user experience on your site by ensuring it is mobile-friendly, easy to navigate, and aesthetically pleasing. Google places a high value on mobile usability.
- **Example**: Make sure your "New Arrivals" section is easily accessible on mobile devices, with large touch targets for product links and fast-loading images.
◆ **Acquiring High-Authority Backlinks**
➔ Focus on generating high-quality content that naturally attracts backlinks from reputable sites within the pet care industry. Guest blogging, infographics, and original research are great ways to earn these links.
- **Example**: Collaborate with a popular pet health blogger to write a guest post on "5 Essential Health Supplements for Senior Dogs," linking back to your site’s relevant product category.
By implementing these strategies with the provided examples, PetPetGo can significantly enhance its SEO performance, leading to better visibility in Google's search results. It's important to monitor these changes and continue to optimize based on results and ongoing SEO best practices.
Add prefixes(前綴詞)
在 prompt text design 中,「前綴詞」是你添加到 prompt text 中的一個詞或短語,根據你放置前綴詞的位置,它可以服務於多個目的:
- 輸入前綴詞(Input prefix):在輸入中添加前綴詞,可以向 LLM 標示輸入中語義上有意義的部分。例如,前綴詞「English:」和「French:」可以明確區分兩種不同的語言。
- 輸出前綴詞(Output prefix):即使輸出是由 LLM 生成的,你也可以在提示中為輸出添加前綴詞。輸出前綴詞給模型提供了關於預期回應的資訊。例如,輸出前綴詞「JSON:」向模型指示輸出應該是JSON格式。
- 範例前綴詞(Example prefix):在 Few-shot learning prompt 中,給範例添加前綴詞可以提供模型在生成輸出時可用的標籤,這使得輸出內容更容易被解析。
以下我們依舊使用 SEO 作為範例來設計 prompt text。我設計的這段 prompt text 目的是用於指導 Gemini 根據 SEO 難度將 Keywords 分類為以下幾種類別:高難度、中難度、低難度。
- 指令:首先明確指出任務,即根據 SEO 難度對關鍵詞進行分類。
- 類別:列出所有可能的分類選項,這裡是高難度、中難度、和低難度,讓 Gemini 知道其所有可能的輸出範圍。
接著,每一條「Input Keyword」和「Expected SEO Difficulty」的組合都是一組範例,指導 Gemini 如何根據 Keyword 的性質預測其 SEO 難度。
這些範例提供了一個明確的框架,幫助 Gemini 學習如何:
- 解析關鍵詞:識別和理解每個「Input Keyword」代表的意義。
- 預測難度:根據關鍵詞的特點和市場競爭情況,將其分類到正確的難度等級。
這種設計方法不僅使 Gemini 能夠更準確地理解和執行分類任務,還提高了 Gemini 對於 SEO 相關問題的敏感性和判斷能力。透過這些具體的範例,Gemini 可以學習到不同類型的關鍵詞可能對應到的SEO難度,從而在面對新的、未知的關鍵詞時,也能作出合理的預測。
此外,這種 prompt text design 還展示了如何利用結構化的資訊來提升 Gemini 推論的效能,特別是在處理複雜或是高度專業化的領域時。透過清晰的指令、明確的類別分類,以及豐富的範例資料,可以有效地引導 Gemini 學習和適應特定的任務需求。
Instructions: Classify the keyword based on SEO difficulty as one of the following categories.
Categories:
- High Difficulty
- Medium Difficulty
- Low Difficulty
Input Keyword: Digital Marketing
Expected SEO Difficulty: High Difficulty
Input Keyword: Local Coffee Shop Near Me
Expected SEO Difficulty: Medium Difficulty
Input Keyword: How to Bake a Chocolate Cake
Expected SEO Difficulty: Low Difficulty
Input Keyword: Best Smartphone 2024
Expected SEO Difficulty: High Difficulty
Input Keyword: Online Yoga Classes
Expected SEO Difficulty: Medium Difficulty
Input Keyword: Quick Healthy Recipes
Expected SEO Difficulty: Low Difficulty
Input Keyword: Affordable SEO Services
Expected SEO Difficulty: High Difficulty
Input Keyword: DIY Home Decor Ideas
Expected SEO Difficulty: Medium Difficulty
Input Keyword: Starting a Small Business
Expected SEO Difficulty: High Difficulty
Input Keyword: Easy Vegan Meals
Expected SEO Difficulty: Low Difficulty
Input Keyword: Learn Web Development
Expected SEO Difficulty: High Difficulty
Input Keyword: Best Travel Deals
Expected SEO Difficulty: Medium Difficulty
Input Keyword: Grow Indoor Plants
Expected SEO Difficulty: Low Difficulty
Input Keyword: Email Marketing Strategies
Expected SEO Difficulty: High Difficulty
Input Keyword: Freelance Writing Tips
Expected SEO Difficulty: Medium Difficulty
Input Keyword: Homemade Dog Food Recipes
Expected SEO Difficulty: Low Difficulty
Input Keyword: Cybersecurity Basics
Expected SEO Difficulty: High Difficulty
Input Keyword: Budget Wedding Planning
Expected SEO Difficulty: Medium Difficulty
Input Keyword: Learning a New Language
Expected SEO Difficulty: Low Difficulty
Input Keyword: Investing in Stocks 101
Expected SEO Difficulty: High Difficulty
Input Keyword: Sustainable Living Ideas
Expected SEO Difficulty: Medium Difficulty
Input Keyword: Effective Study Techniques
Expected SEO Difficulty:
使用上述的 prompt text 我們透過 Gemini 可以得到以下正確的推論輸出:
Low Difficulty
Prompt iteration strategies
Use different phrasing
使用不同的措辭或語句重新表達相同的意思,這樣做往往能誘發 Gemini 推論出不同的回應。LLMs 對於 非常敏感,稍微的變化就可能帶來截然不同的結果。
What is SEO link building?
這段 prompt text 是關於連結建立的一段具體要求,但仍然沒有指明需要什麼類型的信息(例如,定義、策略、好處)。
How does link building benefit SEO?
這個版本的 prompt text 則是更加明確的詢問 link building 在 SEO 上的好處,引導 Gemini 提供更專注的信息,闡述 link building 的重要性而不只是如何進行。
What are some common strategies for SEO link building?
這段 prompt text 則是更進一步要求 Gemini 提供 link building 的策略,將推論重心從『為什麼』轉移到『如何』進行 SEO link building。這應該會誘發出關於 link building 的各種方法或方法的回應。
Can you list step-by-step SEO link building strategies for a new e-commerce website?
上述這段優化後的 prompt text 不僅問到 link building 的策略,還更精確的要求提供一個針對『新電子商務網站』的逐步指南。它指定了網站的類型,表明回應應考慮電子商務網站的獨特需求和挑戰。
What is a detailed month-by-month SEO link building plan for increasing organic traffic to a new e-commerce website specializing in eco-friendly products?
最後這段 prompt text 則是要求提供一個全面的、有時間限制的計畫,並針對一個『非常特定類型的電子商務網站』。這應該促使 Gemini 提供一個高度詳細的 link building 策略,考慮到環保產品這個利基市場的需求,旨在一定時期內增加有機流量。
Switch to an analogous task
如果原本的 prompt text 無法讓 Gemini 按預期回應,嘗試轉換到一個類似的任務上,可能會有意想不到的效果。這種方法類似於解決問題時的創造性思考,從另一個角度來達到相同的目標。
以下這段 prompt text design 要求 Gemini 基於部落格標題的內容和焦點,進行分類和分析,找出最符合的 SEO 主題。在這個例子中,最直接相關的類別是『Voice Search Optimization』,因為部落格標題明確提到了『語音搜尋』的優化指南。
Given the SEO-related blog title "The Ultimate Guide to Optimizing Your Website for Voice Search", categorize it into one of the following specific SEO topics:
1. Keyword Research
2. On-Page SEO
3. Content Creation
4. Link Building
5. Technical SEO
6. Local SEO
7. Mobile Optimization
8. User Experience (UX)
9. Search Intent
10. Voice Search Optimization
11. SEO Analytics and Reporting
12. Image Optimization
13. SEO Strategy Planning
14. Social Media Integration for SEO
15. Content Marketing for SEO
16. Page Speed Optimization
17. International SEO
18. E-commerce SEO
19. Google Algorithm Updates
20. Secure Sockets Layer (SSL) for SEO
Which topic does this blog title best align with, and why?
這段 prompt text design 會讓 Gemini 生成更詳細的回應,而不是僅僅列出一個分類主題的原因在於最後的問題部分:『Which topic does this blog title best align with, and why?』(這篇部落格標題最符合上述哪一個主題,並說明原因。)
當 prompt text 要求解釋『為什麼』時,它不僅僅是在尋求一個分類的答案,而是要求 Gemini 提供理由和論據來支持其選擇,這自然會導致更詳盡、更冗長的文本輸出。
此外,這樣的設計鼓勵 Gemini 不僅僅考慮標題的表面含義,還要根據 SEO 的各個主題的定義和範疇,思考該標題與哪個主題最為吻合,並且需要從技術、策略和實務的角度進行論述。
10. Voice Search Optimization
The blog title "The Ultimate Guide to Optimizing Your Website for Voice Search" best aligns with the topic of Voice Search Optimization. The title indicates that the blog post is specifically about optimizing a website for voice search, which is a distinct area of SEO that requires specific strategies and techniques.
以下這段更新後的 prompt text design 同樣是要求 Gemini 根據部落格的標題來選擇一個最符合的 SEO 相關領域作為分類,但不要求 Gemini 提供額外的解釋性文字。
Multiple choice problem: Which of the following options best describes the SEO-related blog title "The Ultimate Guide to Optimizing Your Website for Voice Search"?
Options:
- Keyword Research
- On-Page SEO
- Content Creation
- Link Building
- Technical SEO
- Local SEO
- Mobile Optimization
- User Experience (UX)
- Search Intent
- Voice Search Optimization
- SEO Analytics and Reporting
- Image Optimization
- SEO Strategy Planning
- Social Media Integration for SEO
- Content Marketing for SEO
- Page Speed Optimization
- International SEO
- E-commerce SEO
- Google Algorithm Updates
- Secure Sockets Layer (SSL) for SEO
以下是 Gemini 的輸出:
Voice Search Optimization
Change the order of prompt content
改變 prompt text 的順序也可能影響 Gemini 的回應,prompt text 不僅僅是內容重要,其結構和排序也會影響 Gemini 的推論結果。
Version 1:
[examples]
[context]
[input]
在上述版本一的 prompt text design 結構中,首先提供具體的範例,接著給出相關的上下文說明,最後才是實際的輸入問題或指令。這種順序適合於情境需要先透過範例來建立理解或背景,然後再提出具體的問題或任務。
Version 2:
[input]
[examples]
[context]
上述版本二的 prompt text 結構設計上先直接提出問題或輸入指令,隨後提供相關範例來輔助理解,最後給出更廣泛的上下文背景。這種順序適合於當問題或任務本身很明確,但需要透過範例和上下文來進一步闡述或解釋。
Version 3:
[examples]
[input]
[context]
最後第三版的 prompt text design 結構中,開頭同樣是範例,緊接著是輸入問題或指令,最後才是上下文說明。這種安排與版本一相似,但是把問題或輸入放在了上下文之前,可能適用於那些範例直接與問題相關,而上下文則提供補充信息的情況。
Fallback responses
如果遇到 Gemini 返回了 Fallback response,比如因為 safety filter 而無法提供具體幫助的情況,嘗試調整 Gemini 的 Temperature 可能有所幫助。
當 Gemini 提供了 Fallback response 時,Google 建議嘗試提高模型的「Temperature」。「Temperature」是指控制 Gemini 生成回應時隨機性的參數。Temperature 較低(接近 0)時,Gemini 生成的回應會比較保守,趨向於最有可能的回應;當 Temperature 提高時,Gemini 生成的回應會增加多樣性,變得更加創新和不可預測。
提高 Temperature 可以使得 Gemini 在面對可能觸發安全過濾器的情況時,嘗試生成更多樣化和創新的回應,而不是直接給出回避性的答案。這樣做的目的是為了在保持回應安全和適當的同時,儘可能豐富和擴展 Gemini 的回應能力。然而,提高 Temperature 也意味著增加了回應中出現不確定或不相關信息的風險,因此需要小心調整,以找到適當的平衡點,確保回應既有創意又保持相關性和準確性。