{"id":1515,"date":"2024-10-02T07:20:11","date_gmt":"2024-10-02T05:20:11","guid":{"rendered":"https:\/\/guillaume-guerard.com\/?page_id=1515"},"modified":"2024-10-02T10:08:14","modified_gmt":"2024-10-02T08:08:14","slug":"few-shot-prompting","status":"publish","type":"page","link":"https:\/\/guillaume-guerard.com\/en\/cours-de-methodologie\/few-shot-prompting\/","title":{"rendered":"Few-Shot Prompt"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"1515\" class=\"elementor elementor-1515\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-02e9046 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"02e9046\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-02c5fab\" data-id=\"02c5fab\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1703fc6 elementor-align-justify elementor-widget elementor-widget-button\" data-id=\"1703fc6\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/guillaume-guerard.com\/en\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Welcome<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-de405c2\" data-id=\"de405c2\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-29a2a8f elementor-align-justify elementor-widget elementor-widget-button\" data-id=\"29a2a8f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/complex-systems-ai.com\/\" target=\"_blank\" rel=\"noopener\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Data Science<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e56cb56 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e56cb56\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-01b6db9\" data-id=\"01b6db9\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d4b766a elementor-widget elementor-widget-heading\" data-id=\"d4b766a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Page contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Contents\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/guillaume-guerard.com\/en\/cours-de-methodologie\/few-shot-prompting\/#Few-shot_prompting_les_exemples_pour_bien_guider\" >Few-shot prompting, examples to guide you well<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/guillaume-guerard.com\/en\/cours-de-methodologie\/few-shot-prompting\/#Apprendre_par_lexemple\" >Learn by example<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/guillaume-guerard.com\/en\/cours-de-methodologie\/few-shot-prompting\/#Aider_au_raisonnement\" >Help with reasoning<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/guillaume-guerard.com\/en\/cours-de-methodologie\/few-shot-prompting\/#Generation_de_code\" >Code generation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/guillaume-guerard.com\/en\/cours-de-methodologie\/few-shot-prompting\/#Bien_pratiquer_le_few-shot_prompting\" >How to practice few-shot prompting<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Few-shot_prompting_les_exemples_pour_bien_guider\"><\/span>Few-shot prompting, examples to guide you well<span class=\"ez-toc-section-end\"><\/span><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-76fe295 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"76fe295\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-d646a15\" data-id=\"d646a15\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-24cf7d2 elementor-widget elementor-widget-text-editor\" data-id=\"24cf7d2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Few-shot prompting provides models with a few input-output examples to induce understanding of a given task, in contrast to zero-shot prompting, where no examples are provided. Providing even a few high-quality examples improved model performance on complex tasks compared to no demonstration.<\/p><p>However, few-shot prompting requires additional tokens to include examples, which can become prohibitive for longer text inputs. Additionally, the selection and composition of prompt examples can significantly influence the model&#039;s behavior, and biases such as preference for frequent words can still affect few-shot prompting results.<\/p><p>Although few-shot prompting improves capabilities for complex tasks, especially among large pre-trained models like GPT-3, careful prompt engineering is essential to achieve optimal performance and mitigate unintended model biases.<\/p><p><img decoding=\"async\" class=\"alignnone wp-image-49 size-full\" src=\"http:\/\/guillaume-guerard.com\/wp-content\/uploads\/2023\/07\/logo_sc.png\" alt=\"few-shot prompting\" width=\"238\" height=\"203\" \/><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-3acf1e4 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3acf1e4\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a882672\" data-id=\"a882672\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e0499a1 elementor-widget elementor-widget-heading\" data-id=\"e0499a1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Apprendre_par_lexemple\"><\/span>Learn by example<span class=\"ez-toc-section-end\"><\/span><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-dff40d2 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"dff40d2\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2294cdf\" data-id=\"2294cdf\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-bf4e7d8 elementor-widget elementor-widget-text-editor\" data-id=\"bf4e7d8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The principle of the few-shot prompt is to provide the LLM with a small set of relevant examples or demonstrations within the prompt itself. These examples guide the model, illustrating how to approach and respond to a particular type of task or <a href=\"https:\/\/guillaume-guerard.com\/en\/cours-de-methodologie\/definir-les-questions-scientifiques\/\">question<\/a>. Demonstrations are generally structured as follows:<\/p><ul><li><strong>Input-output pairs:<\/strong> Each demonstration typically consists of an input (e.g., a question or a piece of text) and its corresponding output (the desired answer or solution).<\/li><li><strong>Format consistency:<\/strong> The demonstrations maintain a consistent format, which helps the model recognize the pattern it should follow.<\/li><li><strong>Relevance of the task:<\/strong> The examples provided are directly relevant to the task at hand, highlighting the specific skill or knowledge required.<\/li><\/ul><p>When presented with these demonstrations, the language model engages in a process often called \u201clearning in context\u201d or \u201clearning by example.\u201d It works as follows:<\/p><ol><li><strong>Pattern recognition:<\/strong> The model analyzes the provided examples, identifying patterns in how inputs are transformed into outputs.<\/li><li><strong>Task inference:<\/strong> From these models, the model deduces the nature of the task it is asked to perform<\/li><li><strong>Generalization:<\/strong> The model then attempts to generalize from the given examples to new, unseen inputs.<\/li><li><strong>Application\u00a0<\/strong>: finally, the model applies this learned model to the new input provided at the end of the prompt.<\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-1d49466 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1d49466\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9e03af2\" data-id=\"9e03af2\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-70ab61f elementor-widget elementor-widget-heading\" data-id=\"70ab61f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Aider_au_raisonnement\"><\/span>Help with reasoning<span class=\"ez-toc-section-end\"><\/span><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4019715 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4019715\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5621571\" data-id=\"5621571\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d9a4c13 elementor-widget elementor-widget-text-editor\" data-id=\"d9a4c13\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>A few tips can greatly improve an LLM&#039;s ability to handle tasks involving multi-step reasoning, logical deduction, or domain-specific knowledge.<\/p><p>\u201cGive a possible diagnosis and explain your reasoning:<br \/>Symptoms: fever, cough, fatigue<br \/>Diagnosis: cold<br \/>Explanation: The combination of fever, cough and fatigue is typical of a cold. No serious symptoms are present, suggesting a mild viral infection.<br \/>Symptoms: Chest pain, shortness of breath, dizziness<br \/>Diagnosis: Possible heart attack<br \/>Explanation: The combination of chest pain, shortness of breath, and dizziness are warning signs of a possible heart attack. Immediate medical attention is required.<br \/>Symptoms: headache, sensitivity to light, nausea<br \/>Diagnosis:<br \/>Explanation : &quot;<\/p><p>This prompt guides the model not only to provide a diagnosis, but also to explain the reasoning behind it, demonstrating complex medical reasoning.<\/p><p>\u201cDiagnosis: Migraine<\/p><p>Explanation: These symptoms together are typical of a migraine. Headache combined with sensitivity to light (photophobia) is a strong indicator of migraine, and nausea often accompanies this condition. Although other causes are possible, this combination strongly suggests migraine.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-30617c5 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"30617c5\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f016de0\" data-id=\"f016de0\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-ffe7e66 elementor-widget elementor-widget-heading\" data-id=\"ffe7e66\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Generation_de_code\"><\/span>Code generation<span class=\"ez-toc-section-end\"><\/span><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5434cd9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5434cd9\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5bf434d\" data-id=\"5bf434d\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9664dd5 elementor-widget elementor-widget-text-editor\" data-id=\"9664dd5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Few-shot prompts can be incredibly useful in helping LLMs generate code that adheres to specific conventions, follows best practices, or meets particular requirements. Examples can demonstrate the correct syntax and structure for a particular programming language.<\/p><p>Let&#039;s see how to use few-shot prompts to generate Python functions with docstrings and type hints:<\/p><p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-1521 size-full\" src=\"http:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/fewshotprompting1.png\" alt=\"few shot prompting\" width=\"543\" height=\"523\" srcset=\"https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/fewshotprompting1.png 543w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/fewshotprompting1-300x289.png 300w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/fewshotprompting1-12x12.png 12w\" sizes=\"(max-width: 543px) 100vw, 543px\" \/><\/p><p>This prompt guides the template to generate a function with appropriate type hints and a detailed docstring, following the established pattern.<\/p><p>THE <a href=\"https:\/\/guillaume-guerard.com\/en\/cours-de-methodologie\/parfaire-la-section-resultats\/\">result<\/a> would be :<\/p><p><img decoding=\"async\" class=\"alignnone wp-image-1522 size-full\" src=\"http:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/fewshotprompting2.png\" alt=\"few shot prompting\" width=\"679\" height=\"283\" srcset=\"https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/fewshotprompting2.png 679w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/fewshotprompting2-300x125.png 300w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/fewshotprompting2-18x8.png 18w\" sizes=\"(max-width: 679px) 100vw, 679px\" \/><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-41a7ffe elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"41a7ffe\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7153bd7\" data-id=\"7153bd7\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-206be81 elementor-widget elementor-widget-heading\" data-id=\"206be81\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Bien_pratiquer_le_few-shot_prompting\"><\/span>How to practice few-shot prompting<span class=\"ez-toc-section-end\"><\/span><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5dbbab8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5dbbab8\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-05db83c\" data-id=\"05db83c\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-74111fd elementor-widget elementor-widget-text-editor\" data-id=\"74111fd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The quality and relevance of the examples you choose are essential to successfully encourage the use of a few examples. Here are some tips:<\/p><ul><li>Make sure the examples are directly related to the task you want the model to perform. Irrelevant examples can confuse the model and lead to poor performance.<\/li><li>Use a diverse set of examples that cover different aspects of the task. This helps the model generalize better to new inputs.<\/li><li>Examples should be clear and unambiguous. Avoid complex or convoluted examples that could confuse the model.<\/li><\/ul><p>One risk of encouraging the use of few examples is that the model may overfit to the examples provided, leading to results that are too similar to the examples or fail to generalize well to new inputs. To avoid this:<\/p><ul><li>Use a variety of examples that cover different scenarios and edge cases. This helps the model learn to generalize rather than just imitating the examples.<\/li><li>Avoid using too many examples, as this can lead to overfitting. A few well-chosen examples are often more effective than a large number of similar examples.<\/li><li>Test the model&#039;s performance on a range of new inputs to ensure it generalizes well. Adjust examples and prompts as needed based on these tests.<\/li><\/ul><p>By following these best practices, you will be able to create more effective few-shot prompts that guide the model in performing the desired task accurately and efficiently.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Home Data Science Few-shot prompting, examples to guide you well Few-shot prompting provides models with some \u2026 <\/p>","protected":false},"author":1,"featured_media":0,"parent":47,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":{"footnotes":""},"class_list":["post-1515","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/pages\/1515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/comments?post=1515"}],"version-history":[{"count":10,"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/pages\/1515\/revisions"}],"predecessor-version":[{"id":1531,"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/pages\/1515\/revisions\/1531"}],"up":[{"embeddable":true,"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/pages\/47"}],"wp:attachment":[{"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/media?parent=1515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}