{"id":33531,"date":"2025-07-01T12:40:10","date_gmt":"2025-07-01T10:40:10","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/?p=33531"},"modified":"2025-07-01T12:41:16","modified_gmt":"2025-07-01T10:41:16","slug":"chain-of-thought-ai","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/","title":{"rendered":"Chain-of-Thought Prompting: the trick to help AI think better"},"content":{"rendered":"\n<p>We\u2019ve seen that large language models (LLMs) are capable of generating amazing texts. But when we give them complex problems, they sometimes respond too directly, without showing the kind of reasoning we\u2019d expect from a human being.<br>That\u2019s where a revolutionary technique comes in: <strong>Chain-of-Thought prompting<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-is-chain-of-thought-prompting\">What is Chain-of-Thought Prompting?<\/h3>\n\n\n\n<p>Imagine you have to solve a tricky riddle. You wouldn\u2019t immediately blurt out the answer, right? First, you\u2019d analyze the problem, break it down into simpler parts, and think through each step until you reached a solution.<br><strong>Chain-of-Thought (CoT) prompting<\/strong> helps LLMs reason in exactly that way.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-does-it-consist-of\">What does it consist of?<\/h3>\n\n\n\n<p>It\u2019s a technique where you ask the model to <strong>explain its reasoning step by step<\/strong> before giving the final answer.<br>Instead of just asking for the solution, you ask it to <strong>show how it got there<\/strong>: what data it uses, what formulas it applies, and how it logically connects the information.<br>This is especially useful for complex problems that require multiple steps.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-does-it-work\">How does it work?<\/h3>\n\n\n\n<p>Basically, instead of saying:<br><strong>&#8220;Give me the answer to this problem&#8221;<\/strong>,<br>you say:<br><strong>&#8220;Explain how you reach the answer.&#8221;<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-example\">Example<\/h3>\n\n\n\n<p><strong>Standard prompt:<\/strong><br>What\u2019s the next number in the sequence 2, 4, 8?<br><strong>Model\u2019s answer:<\/strong> 16<\/p>\n\n\n\n<p><strong>Chain-of-Thought prompt:<\/strong><br>Explain step by step how to get the next number after 2, 4, 8.<br><strong>Answer:<\/strong> The first number is 2. The second is 4, which is 2\u00d72. The third is 8, which is 4\u00d72. The rule seems to be \u201cmultiply by 2.\u201d So 8\u00d72 = 16.<\/p>\n\n\n\n<p>With this technique, we don\u2019t just get the answer\u2014we also get the <strong>reasoning<\/strong> behind it.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-techniques-for-using-chain-of-thought-prompting\">Techniques for Using Chain-of-Thought Prompting<\/h3>\n\n\n\n<p>Here are a few ways to apply it:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u201cLet\u2019s think step by step\u201d<\/strong><br>This simple phrase is often enough to trigger reasoning in the model.<\/li>\n\n\n\n<li><strong>Guiding questions<\/strong><br>Include prompts like:\n<ul class=\"wp-block-list\">\n<li>What are the important facts?<\/li>\n\n\n\n<li>What can we infer?<\/li>\n\n\n\n<li>How are the pieces of information connected?<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Few-shot prompting with CoT examples<\/strong><br>Provide one or two examples in the prompt that show step-by-step reasoning. The model will mimic the pattern.<\/li>\n\n\n\n<li><strong>Problem decomposition<\/strong><br>For tough problems, ask the model to break the task down into parts and solve each one before giving the final answer.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-why-is-chain-of-thought-important\">Why is Chain-of-Thought Important?<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Higher accuracy on complex problems<\/strong><br>Helps the model give better answers when logic, inference, or planning is needed.<\/li>\n\n\n\n<li><strong>Better insight into reasoning<\/strong><br>By seeing the steps, we can judge whether the model reasoned correctly.<\/li>\n\n\n\n<li><strong>Easier error correction<\/strong><br>If the answer is wrong, we can see where the reasoning went off track.<\/li>\n\n\n\n<li><strong>More human-like thinking<\/strong><br>The steps make the process more natural\u2014closer to how a person would reason.<\/li>\n\n\n\n<li><strong>Transparency<\/strong><br>We can see how the model arrived at the answer.<\/li>\n\n\n\n<li><strong>Versatility<\/strong><br>Works for math, logic, decision-making, data analysis, and more.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-practical-examples\">Practical Examples<\/h3>\n\n\n\n<p><strong>1. Simple math problem<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">pythonCopiaModifica&lt;code&gt;import openai\n\n<span class=\"hljs-comment\"># Insert your API key<\/span>\nopenai.api_key = <span class=\"hljs-string\">\"YOUR_API_KEY\"<\/span>\n\n<span class=\"hljs-comment\"># Prompt with chain-of-thought<\/span>\nprompt = (\n    <span class=\"hljs-string\">\"Solve the following math problem step by step:\\n\"<\/span>\n    <span class=\"hljs-string\">\"Problem: A train travels 300 kilometers in 3 hours. What is its average speed?\\n\\n\"<\/span>\n    <span class=\"hljs-string\">\"Instructions:\\n\"<\/span>\n    <span class=\"hljs-string\">\"1. Find the formula for average speed.\\n\"<\/span>\n    <span class=\"hljs-string\">\"2. Plug in the values.\\n\"<\/span>\n    <span class=\"hljs-string\">\"3. Do the math and explain the result.\\n\"<\/span>\n    <span class=\"hljs-string\">\"Answer:\"<\/span>\n)\n\nresponse = openai.ChatCompletion.create(\n    model=<span class=\"hljs-string\">\"gpt-4\"<\/span>,\n    messages=&#91;\n        {<span class=\"hljs-string\">\"role\"<\/span>: <span class=\"hljs-string\">\"system\"<\/span>, <span class=\"hljs-string\">\"content\"<\/span>: <span class=\"hljs-string\">\"You are a math expert who explains each step of your reasoning.\"<\/span>},\n        {<span class=\"hljs-string\">\"role\"<\/span>: <span class=\"hljs-string\">\"user\"<\/span>, <span class=\"hljs-string\">\"content\"<\/span>: prompt}\n    ]\n)\n\n<span class=\"hljs-keyword\">print<\/span>(response.choices&#91;<span class=\"hljs-number\">0<\/span>].message.content)\n&lt;\/code&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Explanation:<\/strong><br>The prompt guides the model to use the formula for speed (speed = distance \/ time), substitute the values (300 \/ 3), and explain how it arrives at the result (100 km\/h).<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>2. Complex example with multiple steps<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">pythonCopiaModifica&lt;code&gt;<span class=\"hljs-keyword\">import<\/span> openai\n\nopenai.api_key = <span class=\"hljs-string\">\"YOUR_API_KEY\"<\/span>\n\nmessages = &#91;\n    {<span class=\"hljs-string\">\"role\"<\/span>: <span class=\"hljs-string\">\"system\"<\/span>, <span class=\"hljs-string\">\"content\"<\/span>: (\n        <span class=\"hljs-string\">\"You are an expert in analyzing complex problems. Use chain-of-thought to explain each step of your reasoning clearly.\"<\/span>\n    )},\n    {<span class=\"hljs-string\">\"role\"<\/span>: <span class=\"hljs-string\">\"user\"<\/span>, <span class=\"hljs-string\">\"content\"<\/span>: (\n        <span class=\"hljs-string\">\"Example:\\n\"<\/span>\n        <span class=\"hljs-string\">\"A company has different departments with different quarterly results. We need to understand how the increased marketing budget impacts sales.\\n\\n\"<\/span>\n        <span class=\"hljs-string\">\"Suggested steps:\\n\"<\/span>\n        <span class=\"hljs-string\">\"1. List departments and sales data.\\n\"<\/span>\n        <span class=\"hljs-string\">\"2. Connect marketing spending to sales variation.\\n\"<\/span>\n        <span class=\"hljs-string\">\"3. Assess whether there is a correlation between budget increase and sales.\\n\\n\"<\/span>\n        <span class=\"hljs-string\">\"Now solve this problem using chain-of-thought:\\n\"<\/span>\n        <span class=\"hljs-string\">\"Problem: A $5,000 ad campaign led to an increase of 150 units sold, each at $20. Explain how to calculate the ROI step by step.\"<\/span>\n    )}\n]\n\nresponse = openai.ChatCompletion.create(\n    model=<span class=\"hljs-string\">\"gpt-4\"<\/span>,\n    messages=messages\n)\n\nprint(response.choices&#91;<span class=\"hljs-number\">0<\/span>].message.content)\n&lt;<span class=\"hljs-regexp\">\/code&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Explanation:<\/strong><br>The prompt asks the model to explain how to calculate ROI:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Calculate total revenue (150\u00d720 = $3,000),<\/li>\n\n\n\n<li>Compare it to the investment ($5,000),<\/li>\n\n\n\n<li>Then apply the ROI formula:<br>(revenue\u2013investment)\/investment\u00d7100(revenue \u2013 investment) \/ investment \u00d7 100(revenue\u2013investment)\/investment\u00d7100<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-best-practices-for-cot\">Best Practices for CoT<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Be specific:<\/strong><br>Clearly state what steps you want the model to follow.<\/li>\n\n\n\n<li><strong>Give examples:<\/strong><br>Add detailed examples to show the model how to behave.<\/li>\n\n\n\n<li><strong>Provide a good initial context:<\/strong><br>The first message should explain what kind of expert the model should act as.<\/li>\n\n\n\n<li><strong>Test and improve:<\/strong><br>If the output isn\u2019t what you expected, tweak the prompt and try again.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-the-future-of-reasoning-in-ai\">The Future of Reasoning in AI<\/h3>\n\n\n\n<p><strong>Chain-of-Thought prompting<\/strong> is a big step forward in how we interact with language models.<br>We don\u2019t just get answers\u2014we get the <strong>path<\/strong> to those answers.<\/p>\n\n\n\n<p>Whether you&#8217;re solving math problems or analyzing complex data, CoT helps you get inside the model\u2019s \u201cmind\u201d and obtain more <strong>clear<\/strong>, <strong>reliable<\/strong>, and <strong>well-reasoned<\/strong> responses.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019ve seen that large language models (LLMs) are capable of generating amazing texts. But when we give them complex problems, they sometimes respond too directly, without showing the kind of reasoning we\u2019d expect from a human being.That\u2019s where a revolutionary technique comes in: Chain-of-Thought prompting. What is Chain-of-Thought Prompting? Imagine you have to solve a&#8230; <a class=\"more-link\" href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/\">Read more<\/a><\/p>\n","protected":false},"author":313,"featured_media":30224,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[47],"tags":[11545,13414],"collections":[],"class_list":{"0":"post-33531","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-deep-learning","8":"tag-generative-ai","9":"tag-prompting","10":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Chain-of-Thought: AI Reasoning Done Right<\/title>\n<meta name=\"description\" content=\"Discover how Chain-of-Thought prompting helps AI think more like a human by breaking down complex problems step by step. Boost accuracy, transparency, and reasoning in your prompts with this powerful technique.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Chain-of-Thought Prompting: the trick to help AI think better\" \/>\n<meta property=\"og:description\" content=\"Discover how Chain-of-Thought prompting helps AI think more like a human by breaking down complex problems step by step. Boost accuracy, transparency, and reasoning in your prompts with this powerful technique.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-01T10:40:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-01T10:41:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1792\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Orli Dun\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Orli Dun\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/\"},\"author\":{\"name\":\"Orli Dun\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/37ca255c359cc54110ac89eb4fa7db42\"},\"headline\":\"Chain-of-Thought Prompting: the trick to help AI think better\",\"datePublished\":\"2025-07-01T10:40:10+00:00\",\"dateModified\":\"2025-07-01T10:41:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/\"},\"wordCount\":656,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/AI-Cover.webp\",\"keywords\":[\"generative AI\",\"prompting\"],\"articleSection\":[\"Deep Learning\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/\",\"name\":\"Chain-of-Thought: AI Reasoning Done Right\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/AI-Cover.webp\",\"datePublished\":\"2025-07-01T10:40:10+00:00\",\"dateModified\":\"2025-07-01T10:41:16+00:00\",\"description\":\"Discover how Chain-of-Thought prompting helps AI think more like a human by breaking down complex problems step by step. Boost accuracy, transparency, and reasoning in your prompts with this powerful technique.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/AI-Cover.webp\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/AI-Cover.webp\",\"width\":1792,\"height\":1024,\"caption\":\"aziende ai\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/chain-of-thought-ai\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI\\\/ML\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Deep Learning\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/deep-learning\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Chain-of-Thought Prompting: the trick to help AI think better\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Codemotion.Italy\\\/\",\"https:\\\/\\\/x.com\\\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/37ca255c359cc54110ac89eb4fa7db42\",\"name\":\"Orli Dun\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/alura-profile-100x100.png\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/alura-profile-100x100.png\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/alura-profile-100x100.png\",\"caption\":\"Orli Dun\"},\"description\":\"From finance to the digital revolution! Systems Engineer | Cloud &amp; AI | Tech Creator | Community Manager at Alura Latam #foramillionfriends\",\"sameAs\":[\"https:\\\/\\\/orlidun.vercel.app\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/orlibetdungonzalez\"],\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/author\\\/orli-dun\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Chain-of-Thought: AI Reasoning Done Right","description":"Discover how Chain-of-Thought prompting helps AI think more like a human by breaking down complex problems step by step. Boost accuracy, transparency, and reasoning in your prompts with this powerful technique.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/","og_locale":"en_US","og_type":"article","og_title":"Chain-of-Thought Prompting: the trick to help AI think better","og_description":"Discover how Chain-of-Thought prompting helps AI think more like a human by breaking down complex problems step by step. Boost accuracy, transparency, and reasoning in your prompts with this powerful technique.","og_url":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2025-07-01T10:40:10+00:00","article_modified_time":"2025-07-01T10:41:16+00:00","og_image":[{"width":1792,"height":1024,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover.webp","type":"image\/webp"}],"author":"Orli Dun","twitter_card":"summary_large_image","twitter_creator":"@CodemotionIT","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Orli Dun","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/"},"author":{"name":"Orli Dun","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/37ca255c359cc54110ac89eb4fa7db42"},"headline":"Chain-of-Thought Prompting: the trick to help AI think better","datePublished":"2025-07-01T10:40:10+00:00","dateModified":"2025-07-01T10:41:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/"},"wordCount":656,"commentCount":0,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover.webp","keywords":["generative AI","prompting"],"articleSection":["Deep Learning"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/","url":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/","name":"Chain-of-Thought: AI Reasoning Done Right","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover.webp","datePublished":"2025-07-01T10:40:10+00:00","dateModified":"2025-07-01T10:41:16+00:00","description":"Discover how Chain-of-Thought prompting helps AI think more like a human by breaking down complex problems step by step. Boost accuracy, transparency, and reasoning in your prompts with this powerful technique.","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover.webp","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover.webp","width":1792,"height":1024,"caption":"aziende ai"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/chain-of-thought-ai\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"AI\/ML","item":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/"},{"@type":"ListItem","position":3,"name":"Deep Learning","item":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/deep-learning\/"},{"@type":"ListItem","position":4,"name":"Chain-of-Thought Prompting: the trick to help AI think better"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/37ca255c359cc54110ac89eb4fa7db42","name":"Orli Dun","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2026\/04\/alura-profile-100x100.png","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2026\/04\/alura-profile-100x100.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2026\/04\/alura-profile-100x100.png","caption":"Orli Dun"},"description":"From finance to the digital revolution! Systems Engineer | Cloud &amp; AI | Tech Creator | Community Manager at Alura Latam #foramillionfriends","sameAs":["https:\/\/orlidun.vercel.app\/","https:\/\/www.linkedin.com\/in\/orlibetdungonzalez"],"url":"https:\/\/www.codemotion.com\/magazine\/author\/orli-dun\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-600x400.webp","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-600x600.webp","author_info":{"display_name":"Orli Dun","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/orli-dun\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover.webp",1792,1024,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-150x150.webp",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-300x171.webp",300,171,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-768x439.webp",768,439,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-1024x585.webp",1024,585,true],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-1536x878.webp",1536,878,true],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover.webp",1792,1024,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-100x100.webp",100,100,true],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-180x128.webp",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-896x504.webp",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-400x225.webp",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-600x400.webp",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/10\/AI-Cover-600x600.webp",600,600,true]},"uagb_author_info":{"display_name":"Orli Dun","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/orli-dun\/"},"uagb_comment_info":0,"uagb_excerpt":"We\u2019ve seen that large language models (LLMs) are capable of generating amazing texts. But when we give them complex problems, they sometimes respond too directly, without showing the kind of reasoning we\u2019d expect from a human being.That\u2019s where a revolutionary technique comes in: Chain-of-Thought prompting. What is Chain-of-Thought Prompting? Imagine you have to solve a&#8230;&hellip;","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/33531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/313"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=33531"}],"version-history":[{"count":2,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/33531\/revisions"}],"predecessor-version":[{"id":33533,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/33531\/revisions\/33533"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/30224"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=33531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=33531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=33531"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=33531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}