{"id":1566,"date":"2024-10-02T14:18:01","date_gmt":"2024-10-02T12:18:01","guid":{"rendered":"https:\/\/guillaume-guerard.com\/?page_id=1566"},"modified":"2024-10-04T15:40:30","modified_gmt":"2024-10-04T13:40:30","slug":"least-to-most-prompting","status":"publish","type":"page","link":"https:\/\/guillaume-guerard.com\/en\/cours-de-methodologie\/least-to-most-prompting\/","title":{"rendered":"Least-to-most prompting"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"1566\" class=\"elementor elementor-1566\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-17383cf elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"17383cf\" 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-0e39fd2\" data-id=\"0e39fd2\" 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-096a325 elementor-align-justify elementor-widget elementor-widget-button\" data-id=\"096a325\" 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-b1856b6\" data-id=\"b1856b6\" 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-2e79e79 elementor-align-justify elementor-widget elementor-widget-button\" data-id=\"2e79e79\" 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-bcbaf4d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"bcbaf4d\" 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-b4fa2fe\" data-id=\"b4fa2fe\" 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-c8a8553 elementor-widget elementor-widget-heading\" data-id=\"c8a8553\" 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\/least-to-most-prompting\/#Least-to-Most_Prompting_diviser_pour_mieux_regner\" >Least-to-Most Prompting, divide and conquer<\/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\/least-to-most-prompting\/#Decomposer_le_probleme_initial\" >Break down the initial problem<\/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\/least-to-most-prompting\/#Decomposer_le_probleme_par_etapes\" >Break down the problem into steps<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Least-to-Most_Prompting_diviser_pour_mieux_regner\"><\/span>Least-to-Most Prompting, divide and conquer<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-8e1f6df elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8e1f6df\" 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-6ec48eb\" data-id=\"6ec48eb\" 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-da53c03 elementor-widget elementor-widget-text-editor\" data-id=\"da53c03\" 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>Least-to-most prompting can be combined with other prompting techniques such as thought chain and self-consistency. For some tasks, the two steps of least-to-most prompting can be merged to form a single-pass prompt.<\/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=\"least-to-most 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-1b1be81 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1b1be81\" 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-4f477d2\" data-id=\"4f477d2\" 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-d639c60 elementor-widget elementor-widget-heading\" data-id=\"d639c60\" 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=\"Decomposer_le_probleme_initial\"><\/span>Break down the initial problem<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-a377e0d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a377e0d\" 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-be3cbc0\" data-id=\"be3cbc0\" 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-d13dcb3 elementor-widget elementor-widget-text-editor\" data-id=\"d13dcb3\" 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>Here is a practical example:<\/p><pre>CUSTOMER INQUIRY: I just bought a T-shirt from your Arnold collection on March 1st. I saw that it was on discount, so bought a shirt that was originally $30, and got 40% off. I saw that you have a new discount for shirts at 50%. I&#039;m wondering if I can return the shirt and have enough store credit to buy two of your shirts? INSTRUCTIONS: You are a customer service agent tasked with kindly responding to customer inquiries. Returns are allowed within 30 days. Today&#039;s date is March 29th. There is currently a 50% discount on all shirts. Shirt prices range from $18-$100 at your store. Do not make up any information about discount policies. Determine if the customer is within the 30-day return window.<\/pre><p>It returns the wrong response as shown below, when asked directly:<\/p><p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-1581 size-large\" src=\"http:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most-1024x546.webp\" alt=\"least-to-most prompting\" width=\"1024\" height=\"546\" srcset=\"https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most-1024x546.webp 1024w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most-300x160.webp 300w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most-768x409.webp 768w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most-1536x819.webp 1536w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most-2048x1092.webp 2048w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most-18x10.webp 18w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p><p>The simplest to fastest approach is followed and illustrated in the OpenAI playground.<\/p><p>The sequence followed consists of first asking the model (for reasons of consistency, we use several prompts) the <a href=\"https:\/\/guillaume-guerard.com\/en\/cours-de-methodologie\/definir-les-questions-scientifiques\/\">question<\/a> next:<\/p><pre>What subproblems must be solved before answering the inquiry?<\/pre><p>Subsequently, the LLM generates 4 subproblems that must be solved for the instruction to be completed.<\/p><p><img decoding=\"async\" class=\"alignnone wp-image-1582 size-large\" src=\"http:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most2-1024x546.webp\" alt=\"least-to-most prompting\" width=\"1024\" height=\"546\" srcset=\"https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most2-1024x546.webp 1024w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most2-300x160.webp 300w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most2-768x409.webp 768w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most2-1536x819.webp 1536w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most2-2048x1092.webp 2048w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most2-18x10.webp 18w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/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-cb2fc49 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"cb2fc49\" 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-abbf3ff\" data-id=\"abbf3ff\" 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-7298c78 elementor-widget elementor-widget-heading\" data-id=\"7298c78\" 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=\"Decomposer_le_probleme_par_etapes\"><\/span>Break down the problem into steps<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-051b8c8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"051b8c8\" 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-6cfe2ab\" data-id=\"6cfe2ab\" 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-0001e03 elementor-widget elementor-widget-text-editor\" data-id=\"0001e03\" 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>Following the least-to-most approach, the LLM is asked to answer the four sub-problems or tasks that he has identified.<\/p><p>However, the subproblems are asked one at a time, and the previous problem and answer are included in the prompt. Therefore, the prompt is built on one question\/answer or subproblem at a time.<\/p><p>The previous prompts are included for reference and serve a few-step training purpose.<\/p><p>The scenario presented to the LLM may be considered ambiguous, but the LLM does a remarkable job of following the sequence and arriving at the correct answer.<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1583 size-large\" src=\"http:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most3-1024x586.webp\" alt=\"least-to-most prompting\" width=\"1024\" height=\"586\" srcset=\"https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most3-1024x586.webp 1024w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most3-300x172.webp 300w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most3-768x439.webp 768w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most3-1536x879.webp 1536w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most3-2048x1172.webp 2048w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most3-18x10.webp 18w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p><p>It is also possible to break down each step into a separate prompt. This will allow the LLM to provide more explanation of their response process.<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1632 size-full\" src=\"http:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most5.jpg\" alt=\"least-to-most\" width=\"773\" height=\"526\" srcset=\"https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most5.jpg 773w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most5-300x204.jpg 300w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most5-768x523.jpg 768w, https:\/\/guillaume-guerard.com\/wp-content\/uploads\/2024\/10\/least-to-most5-18x12.jpg 18w\" sizes=\"(max-width: 773px) 100vw, 773px\" \/><\/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 Least-to-Most Prompting, divide and conquer Least-to-most prompting can be \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-1566","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/pages\/1566","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=1566"}],"version-history":[{"count":13,"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/pages\/1566\/revisions"}],"predecessor-version":[{"id":1635,"href":"https:\/\/guillaume-guerard.com\/en\/wp-json\/wp\/v2\/pages\/1566\/revisions\/1635"}],"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=1566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}