[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-692429-105":3,"detail-sidebar-cat-0-en-105":85,"doc-detail-692429-en":135,"doc-similar-692429":179},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":78,"head_meta":80,"extra_data":82,"updated_unix":84},105,"en","prompt-engineering-a-guide-to-effective-prompting-for-llms","Prompt Engineering - A Guide to Effective Prompting for LLMs","","Prompt Engineering explains how to craft high-quality text prompts for large language models so they produce accurate, unambiguous outputs. It introduces the LLM as a next-token prediction engine, then details prompt engineering as an iterative process involving prompt wording, structure, context, and model-specific configuration. The guide covers key output settings such as token length, sampling controls, temperature, and top-k/top-p. It also presents practical prompting techniques including zero-shot, one-shot/few-shot, system/role/contextual prompting, step-back prompting, and reasoning-based methods like CoT, self-consistency, ToT, and ReAct, plus best practices and JSON repair with schemas.",{"@graph":14,"@context":77},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/prompt-engineering-a-guide-to-effective-prompting-for-llms/692429/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/prompt-engineering-a-guide-to-effective-prompting-for-llms/692429.png","ImageObject",300,407,{"name":42,"@type":43},"Blue Pony","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-27","2026-11-09",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",11,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69,73],{"name":60,"@type":61,"acceptedAnswer":62},"What is prompt engineering for large language models?","Question",{"text":63,"@type":64},"Prompt engineering is the iterative process of designing and refining prompts so the LLM generates accurate, task-aligned outputs by adjusting wording, structure, context, and evaluation.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How does output length affect LLM results?",{"text":68,"@type":64},"Output length controls how many tokens the LLM can generate, which impacts computation, latency, and cost. Reducing it makes the model stop once the limit is reached, so prompts may need adjustment when short outputs are required.",{"name":70,"@type":61,"acceptedAnswer":71},"Which prompting techniques are covered in the guide?",{"text":72,"@type":64},"The guide covers general prompting (zero-shot), one-shot and few-shot prompting, system/role/contextual prompting, step-back prompting, and reasoning methods such as Chain of Thought (CoT), self-consistency, Tree of Thoughts (ToT), and ReAct (reason & act).",{"name":74,"@type":61,"acceptedAnswer":75},"What best practices does the guide recommend?",{"text":76,"@type":64},"It recommends being specific about the expected output, using instructions over constraints, controlling maximum token length, using variables in prompts, experimenting with input formats and writing styles, and trying different output formats. It also includes JSON repair and schema-based working approaches.","https://schema.org",{"og:url":32,"og:type":79,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":81,"canonical":32},"index,follow",{"doc_id":83,"site_id":7},692429,1794207678,{"code":4,"msg":86,"data":87},"success",[88,92,96,100,105,109,114,119,124,127,131],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":93,"show_sort_weight":94,"slug":95},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},"Exam",70,"exam",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":102,"show_sort_weight":103,"slug":104},5,"Comic",60,"comic",{"id":106,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":107,"slug":108},6,50,"technology",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},7,"Healthcare",40,"healthcare",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},8,"Research & Report",30,"research-report",{"id":120,"doc_module":4,"doc_module_name":25,"category_name":121,"show_sort_weight":122,"slug":123},9,"Religion & Spirituality",20,"religion-spirituality",{"id":122,"doc_module":4,"doc_module_name":25,"category_name":125,"show_sort_weight":122,"slug":126},"World Cup","world-cup",{"id":128,"doc_module":4,"doc_module_name":25,"category_name":129,"show_sort_weight":128,"slug":130},10,"Lifestyle","lifestyle",{"id":132,"doc_module":4,"doc_module_name":25,"category_name":133,"show_sort_weight":101,"slug":134},19,"General","general",{"code":4,"msg":86,"data":136},{"doc_id":83,"user_id":137,"nickname":42,"user_avatar":138,"doc_module":4,"category_id":106,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":139,"file_id":140,"file_url":141,"file_type":142,"file_size":143,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":144,"language":145,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":146,"faqs":147,"seo_title":148,"seo_description":12,"update_tm":84,"read_time":149,"preview_page_count":110,"preview_urls":150},962090760266,"https://ap-avatar.wpscdn.com/davatar_276721f389ce27ea32af1340a28f341c","Prompt Engineering  \nAuthor: Lee Boonstra  \nPrompt Engineering  \nAcknowledgements  \nContent 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  \nFebruary 2025 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 13  \nGeneral prompting / zero shot 13  \nOne-shot & few-shot 15  \nSystem, contextual and role prompting 18  \nSystem prompting 19  \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  \nJSON Repair 61  \nWorking with Schemas 62  \nExperiment together with other prompt engineers 63  \nCoT Best practices 64  \nDocument the various prompt attempts 64  \nSummary 66  \nEndnotes 68  \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.  \nFebruary 2025 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 eva","cbCaibYa6pzqFdun","https://ap.wps.com/l/cbCaibYa6pzqFdun","pdf",6818112,68,"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### What about multimodal 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\n## Use variables in prompts\n## Experiment with input formats and writing styles\n## For few-shot prompting with classification tasks, mix up the classes\n## Adapt to model updates\n## Experiment with output formats\n## JSON Repair\n## Working with Schemas\n## Experiment together with other prompt engineers\n## CoT Best practices\n## Document the various prompt attempts\n# Summary\n# Endnotes","[{\"question\":\"What is prompt engineering for large language models?\",\"answer\":\"Prompt engineering is the iterative process of designing and refining prompts so the LLM generates accurate, task-aligned outputs by adjusting wording, structure, context, and evaluation.\"},{\"question\":\"How does output length affect LLM results?\",\"answer\":\"Output length controls how many tokens the LLM can generate, which impacts computation, latency, and cost. Reducing it makes the model stop once the limit is reached, so prompts may need adjustment when short outputs are required.\"},{\"question\":\"Which prompting techniques are covered in the guide?\",\"answer\":\"The guide covers general prompting (zero-shot), one-shot and few-shot prompting, system/role/contextual prompting, step-back prompting, and reasoning methods such as Chain of Thought (CoT), self-consistency, Tree of Thoughts (ToT), and ReAct (reason \\u0026 act).\"},{\"question\":\"What best practices does the guide recommend?\",\"answer\":\"It recommends being specific about the expected output, using instructions over constraints, controlling maximum token length, using variables in prompts, experimenting with input formats and writing styles, and trying different output formats. It also includes JSON repair and schema-based working approaches.\"}]","Prompt Engineering - A Guide to Effective Prompting for LLMs | PDF",171,[151,155,159,163,167,171,175],{"page_no":22,"url":152,"width":153,"height":154},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/ed614a771163db762cc819fe10ba958a.webp",983,1272,{"page_no":26,"url":156,"width":157,"height":158},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/60f2a8e18d8a3d5512c7678653600fc2.webp",982,1270,{"page_no":30,"url":160,"width":161,"height":162},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/32d360e142e055bf49a81f3cc0e3723a.webp",981,1269,{"page_no":33,"url":164,"width":165,"height":166},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/dcf1343aceefd75c1f8846c3288a4a66.webp",980,1268,{"page_no":101,"url":168,"width":169,"height":170},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/c4e7612f4a0c37eea247029b316a71d9.webp",979,1267,{"page_no":106,"url":172,"width":173,"height":174},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/15e3ca9fadbaae027747dae9a8894383.webp",978,1265,{"page_no":110,"url":176,"width":177,"height":178},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/af211712c427afde58a241e30f328ca6.webp",977,1264,{"list":180,"token":11},[181,187,193,199,205,211,217,223,229,235],{"doc_id":182,"doc_title":183,"file_type":142,"home_preview_img_url":184,"slug":185,"view_count":110,"category_name":29,"create_tm":186},672931,"Prompt Engineering - v4 - September 2024","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229990223142/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110139&Signature=kZdDBo8ZfX4xO6w74pxasOFspZk%3D","prompt-engineering-v4-september-2024",1793615330,{"doc_id":188,"doc_title":189,"file_type":142,"home_preview_img_url":190,"slug":191,"view_count":115,"category_name":29,"create_tm":192},672932,"Prompt Engineering for AI Product Management","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229990223152/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110139&Signature=gYfJhSqSF9IXf7Si9AEWrZkJZC8%3D","prompt-engineering-for-ai-product-management",1793615332,{"doc_id":194,"doc_title":195,"file_type":142,"home_preview_img_url":196,"slug":197,"view_count":101,"category_name":29,"create_tm":198},703295,"Prompt engineering best practices for LLMs on Amazon Bedrock","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230013546813/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110139&Signature=K71r72dX5BppalXjQ59ElfI%2FK6A%3D","prompt-engineering-best-practices-for-llms-on-amazon-bedrock",1794567308,{"doc_id":200,"doc_title":201,"file_type":142,"home_preview_img_url":202,"slug":203,"view_count":110,"category_name":29,"create_tm":204},672936,"THE ULTIMATE PROMPT ENGINEERING GUIDE - Master the Language of Large Language Models","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229989932247/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110139&Signature=Wpcod%2FUv36wL6oKGrc0%2BDDL91pY%3D","the-ultimate-prompt-engineering-guide-master-the-language-of-large-language-models",1793615343,{"doc_id":206,"doc_title":207,"file_type":142,"home_preview_img_url":208,"slug":209,"view_count":110,"category_name":29,"create_tm":210},721443,"Prompt engineering - An overview","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230024448895/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110139&Signature=yBuoH%2FA5ecAugKhm8kj0ypa4X8U%3D","prompt-engineering-an-overview",1795044863,{"doc_id":212,"doc_title":213,"file_type":142,"home_preview_img_url":214,"slug":215,"view_count":128,"category_name":29,"create_tm":216},672928,"Prompt Engineering for ChatGPT - A Quick Guide to Techniques, Tips, and Best Practices","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229990223027/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110139&Signature=WurTtm7%2FC3JwME4c0b5NYfpBsT8%3D","prompt-engineering-for-chatgpt-a-quick-guide-to-techniques-tips-and-best-practices",1793615324,{"doc_id":218,"doc_title":219,"file_type":142,"home_preview_img_url":220,"slug":221,"view_count":55,"category_name":29,"create_tm":222},692430,"Vortrag Prompt Engineering - From Zero to GenAI Hero","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003313825/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110139&Signature=X3FGvH%2F6jtyzhKC8Jq%2BAdwk%2F3Jk%3D","vortrag-prompt-engineering-from-zero-to-genai-hero",1794207679,{"doc_id":224,"doc_title":225,"file_type":142,"home_preview_img_url":226,"slug":227,"view_count":110,"category_name":29,"create_tm":228},682228,"KARP Begineer Guide To Ai Prompt - Understanding AI Prompt Engineering: A Complete Guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229998449348/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110139&Signature=UB8rr0dhBaGyd4l25GiP4Ve%2BTfI%3D","karp-begineer-guide-to-ai-prompt-understanding-ai-prompt-engineering-a-complete-guide",1793963051,{"doc_id":230,"doc_title":231,"file_type":142,"home_preview_img_url":232,"slug":233,"view_count":128,"category_name":29,"create_tm":234},501572,"ALIGNING LANGUAGE MODELS WITH DEMONSTRATED FEEDBACK - - DITTO","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229931051829/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110139&Signature=d9RnFwlbfJ4bTMxfB7mx1vP%2F3tk%3D","aligning-language-models-with-demonstrated-feedback-ditto",1791020812,{"doc_id":236,"doc_title":237,"file_type":142,"home_preview_img_url":238,"slug":239,"view_count":115,"category_name":29,"create_tm":240},672934,"Humanity’s Last Prompt Engineering Guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229990223387/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110139&Signature=LBGRCW4GapYxdWbxwObS1vDxcQk%3D","humanitys-last-prompt-engineering-guide",1793615339]