[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-672931-105":59,"doc-detail-672931-en":129},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":122,"head_meta":124,"extra_data":126,"updated_unix":128},105,"en","prompt-engineering-v4-september-2024","Prompt Engineering - v4 - September 2024","","Prompt Engineering explains how text prompts guide large language models to produce accurate outputs. It frames an LLM as a prediction engine and describes prompt engineering as an iterative task design process that optimizes wording, structure, context, and prompt length. The guide covers LLM output configuration (including output length), sampling controls like temperature and top-k/top-p, and practical prompting techniques such as zero-shot, one-shot/few-shot, and role or contextual prompting. It also presents advanced methods including CoT, self-consistency, Tree of Thoughts, and ReAct, plus best practices and code-oriented prompting.",{"@graph":69,"@context":121},[70,84,104],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/prompt-engineering-v4-september-2024/672931/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":98,"encodingFormat":97,"isAccessibleForFree":99,"interactionStatistic":100},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/prompt-engineering-v4-september-2024/672931.png","ImageObject",300,407,{"name":92,"@type":93},"sagouaw","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-02",true,{"@type":101,"interactionType":102,"userInteractionCount":8},"InteractionCounter",{"@type":103},"ViewAction",{"@type":105,"mainEntity":106},"FAQPage",[107,113,117],{"name":108,"@type":109,"acceptedAnswer":110},"What is prompt engineering in the context of large language models?","Question",{"text":111,"@type":112},"Prompt engineering is the process of designing high-quality prompts that guide LLMs to produce accurate outputs. It involves iterating on prompt design, optimizing prompt length, and evaluating structure and writing style relative to the task.","Answer",{"name":114,"@type":109,"acceptedAnswer":115},"Why does output length matter for prompt results?",{"text":116,"@type":112},"Output length limits the number of tokens the model generates. Generating more tokens increases computation and can raise energy use and cost, while too-short outputs require adjusting prompts to fit the desired response size.",{"name":118,"@type":109,"acceptedAnswer":119},"What are common prompting techniques covered in the document?",{"text":120,"@type":112},"The document covers general prompting (zero-shot), one-shot and few-shot prompting, and system/context/role prompting. It also includes advanced techniques such as Chain of Thought (CoT), self-consistency, Tree of Thoughts (ToT), and ReAct (reason & act).","https://schema.org",{"og:url":83,"og:type":123,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":125,"canonical":83},"index,follow",{"doc_id":127,"site_id":62},672931,1793615330,{"code":4,"msg":5,"data":130},{"doc_id":127,"user_id":131,"nickname":92,"user_avatar":132,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":133,"file_id":134,"file_url":135,"file_type":136,"file_size":137,"view_count":8,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":138,"language":139,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":67,"update_tm":128,"read_time":143},3985747862151,"https://ap-avatar.wpscdn.com/davatar_a8503ba1806abce46bf441b54a3ca4cd","Prompt Engineering  \nAuthor: Lee Boonstra  \nPrompt Engineering  \nAcknowledgements  \nReviewers and Contributors  \nMichael Sherman Yuan Cao  \nErick Armbrust Anant Nawalgaria Antonio Gulli Simone Cammel  \nCurators and Editors  \nAntonio Gulli Anant Nawalgaria Grace Mollison  \nTechnical Writer  \nJoey Haymaker  \nDesigner  \nMichael Lanning  \nSeptember 2024 2  \nTable of contents  \nIntroduction 6  \nPrompt engineering 7  \nLLM output configuration 8  \nOutput length 8  \nSampling controls 9  \nTemperature 9  \nTop-K and top-P 10  \nPutting it all together 11  \nPrompting techniques 12  \nGeneral prompting / zero shot 13  \nOne-shot & few-shot 14  \nSystem, contextual and role prompting 17  \nSystem prompting 18  \nRole prompting 21  \nContextual prompting 23  \nStep-back prompting 25  \nChain of Thought (CoT) 29  \nSelf-consistency 32  \nTree of Thoughts (ToT) 36  \nReAct (reason & act) 37  \nAutomatic Prompt Engineering 40  \nCode prompting 42  \nPrompts for writing code 42  \nPrompts for explaining code 44  \nPrompts for translating code 46  \nPrompts for debugging and reviewing code 48  \nWhat about multimodal prompting? 54  \nBest Practices 54  \nProvide examples 54  \nDesign with simplicity 55  \nBe specific about the output 56  \nUse Instructions over Constraints 56  \nControl the max token length 58  \nUse variables in prompts 58  \nExperiment with input formats and writing styles 59  \nFor few-shot prompting with classification tasks, mix up the classes 59  \nAdapt to model updates 60  \nExperiment with output formats 60  \nExperiment together with other prompt engineers 61  \nCoT Best practices 61  \nDocument the various prompt attempts 62  \nSummary 63  \nEndnotes 65  \nPrompt Engineering  \nYou don’t need to be a data scientist or a machine learning engineer – everyone can write a prompt.  \nIntroduction  \nWhen thinking about a large language model input and output, a text prompt (sometimes accompanied by other modalities such as image prompts) is the input the model uses to predict a specific output. You don’t need to be a data scientist or a machine learning engineer – everyone can write a prompt. However, crafting the most effective prompt can be complicated. Many aspects of your prompt affect its efficacy: the model you use, the model’straining data, the model configurations, your word-choice, style and tone, structure, and context all matter. Therefore, prompt engineering is an iterative process. Inadequate promptscan lead to ambiguous, inaccurate responses, and can hinder the model’s ability to provide meaningful output.  \nSeptember 2024 6  \nPrompt Engineering  \nWhen you chat with the Gemini chatbot,1 you basically write prompts, however this whitepaper focuses on writing prompts for the Gemini model within Vertex AI or by using the API, because by prompting the model directly you will have access to the configuration such as temperature etc.  \nThis whitepaper discusses prompt engineering in detail. We will look into the various prompting techniques to help you getting started and share tips and best practices to become a prompting expert. We will also discuss some of the challenges you can face while crafting prompts.  \nPrompt engineering  \nRemember how an LLM works; it’s a prediction engine. The model takes sequential text asan input and then predicts what the following token should be, based on the data it was trained on. The LLM is operationalized to do this over and over again, adding the previously predicted token to the end of the sequential text for predicting the following token. The next token prediction is based on the relationship between what’s in the previous tokens and what the LLM has seen during its training.  \nWhen you write a prompt, you are attempting to set up the LLM to predict the right sequence of tokens. Prompt engineering is the process of designing high-quality prompts that guide LLMs to produce accurate outputs. This process involves tinkering to find the best prompt, optimizing prompt length, and evaluating a prompt’s writing style an","cbCaib1mgXOe4vlx","https://ap.wps.com/l/cbCaib1mgXOe4vlx","pdf",6817075,65,"English","# Introduction\n# Prompt engineering\n## LLM output configuration\n### Output length\n## Prompting techniques\n### General prompting / zero shot\n### One-shot & few-shot\n### System, contextual and role prompting\n### Step-back prompting\n### Chain of Thought (CoT)\n### Self-consistency\n### Tree of Thoughts (ToT)\n### ReAct (reason & act)\n### Automatic Prompt Engineering\n### Code prompting\n## Best Practices\n### Provide examples\n### Design with simplicity\n### Be specific about the output\n### Use Instructions over Constraints\n### Control the max token length","[{\"question\":\"What is prompt engineering in the context of large language models?\",\"answer\":\"Prompt engineering is the process of designing high-quality prompts that guide LLMs to produce accurate outputs. It involves iterating on prompt design, optimizing prompt length, and evaluating structure and writing style relative to the task.\"},{\"question\":\"Why does output length matter for prompt results?\",\"answer\":\"Output length limits the number of tokens the model generates. Generating more tokens increases computation and can raise energy use and cost, while too-short outputs require adjusting prompts to fit the desired response size.\"},{\"question\":\"What are common prompting techniques covered in the document?\",\"answer\":\"The document covers general prompting (zero-shot), one-shot and few-shot prompting, and system/context/role prompting. It also includes advanced techniques such as Chain of Thought (CoT), self-consistency, Tree of Thoughts (ToT), and ReAct (reason \\u0026 act).\"}]","Prompt Engineering - v4 - September 2024 | PDF",164]