$npx -y skills add NeoLabHQ/context-engineering-kit --skill thought-based-reasoningUse when tackling complex reasoning tasks requiring step-by-step logic, multi-step arithmetic, commonsense reasoning, symbolic manipulation, or problems where simple prompting fails - provides comprehensive guide to Chain-of-Thought and related prompting techniques (Zero-shot CoT
| 1 | # Thought-Based Reasoning Techniques for LLMs |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Chain-of-Thought (CoT) prompting and its variants encourage LLMs to generate intermediate reasoning steps before arriving at a final answer, significantly improving performance on complex reasoning tasks. These techniques transform how models approach problems by making implicit reasoning explicit. |
| 6 | |
| 7 | |
| 8 | ## Quick Reference |
| 9 | |
| 10 | | Technique | When to Use | Complexity | Accuracy Gain | |
| 11 | |-----------|-------------|------------|---------------| |
| 12 | | Zero-shot CoT | Quick reasoning, no examples available | Low | +20-60% | |
| 13 | | Few-shot CoT | Have good examples, consistent format needed | Medium | +30-70% | |
| 14 | | Self-Consistency | High-stakes decisions, need confidence | Medium | +10-20% over CoT | |
| 15 | | Tree of Thoughts | Complex problems requiring exploration | High | +50-70% on hard tasks | |
| 16 | | Least-to-Most | Multi-step problems with subproblems | Medium | +30-80% | |
| 17 | | ReAct | Tasks requiring external information | Medium | +15-35% | |
| 18 | | PAL | Mathematical/computational problems | Medium | +10-15% | |
| 19 | | Reflexion | Iterative improvement, learning from errors | High | +10-20% | |
| 20 | |
| 21 | --- |
| 22 | |
| 23 | ## Core Techniques |
| 24 | |
| 25 | ### 1. Chain-of-Thought (CoT) Prompting |
| 26 | |
| 27 | **Paper**: "Chain of Thought Prompting Elicits Reasoning in Large Language Models" (Wei et al., 2022) |
| 28 | **Citations**: 14,255+ |
| 29 | |
| 30 | #### When to Use |
| 31 | - Multi-step arithmetic or math word problems |
| 32 | - Commonsense reasoning requiring logical deduction |
| 33 | - Symbolic reasoning tasks |
| 34 | - When you have good exemplars showing reasoning |
| 35 | |
| 36 | #### How It Works |
| 37 | Provide few-shot examples that include intermediate reasoning steps, not just question-answer pairs. The model learns to generate similar step-by-step reasoning. |
| 38 | |
| 39 | #### Prompt Template |
| 40 | |
| 41 | ``` |
| 42 | Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now? |
| 43 | A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11. |
| 44 | |
| 45 | Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have? |
| 46 | A: The cafeteria had 23 apples originally. They used 20 to make lunch. So they had 23 - 20 = 3. They bought 6 more apples, so they have 3 + 6 = 9. The answer is 9. |
| 47 | |
| 48 | Q: [YOUR QUESTION HERE] |
| 49 | A: |
| 50 | ``` |
| 51 | |
| 52 | #### Strengths |
| 53 | - Significant accuracy improvements on reasoning tasks |
| 54 | - Interpretable intermediate steps |
| 55 | - Works well with large models (>100B parameters) |
| 56 | |
| 57 | #### Limitations |
| 58 | - Requires crafting good exemplars |
| 59 | - Less effective on smaller models |
| 60 | - Can still make calculation errors |
| 61 | |
| 62 | --- |
| 63 | |
| 64 | ### 2. Zero-shot Chain-of-Thought |
| 65 | |
| 66 | **Paper**: "Large Language Models are Zero-Shot Reasoners" (Kojima et al., 2022) |
| 67 | **Citations**: 5,985+ |
| 68 | |
| 69 | #### When to Use |
| 70 | - No exemplars available |
| 71 | - Quick reasoning needed |
| 72 | - General-purpose reasoning across task types |
| 73 | - Prototyping before creating few-shot examples |
| 74 | |
| 75 | #### How It Works |
| 76 | Simply append "Let's think step by step" (or similar phrase) to the prompt. This triggers the model to generate reasoning steps without any examples. |
| 77 | |
| 78 | #### Prompt Template |
| 79 | |
| 80 | ``` |
| 81 | Q: A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there? |
| 82 | |
| 83 | Let's think step by step. |
| 84 | ``` |
| 85 | |
| 86 | **Alternative trigger phrases**: |
| 87 | - "Let's work this out step by step to be sure we have the right answer." |
| 88 | - "Let's break this down." |
| 89 | - "Let's approach this systematically." |
| 90 | - "First, let me understand the problem..." |
| 91 | |
| 92 | #### Two-Stage Approach (More Robust) |
| 93 | |
| 94 | **Stage 1 - Reasoning Extraction**: |
| 95 | ``` |
| 96 | Q: [QUESTION] |
| 97 | A: Let's think step by step. |
| 98 | ``` |
| 99 | |
| 100 | **Stage 2 - Answer Extraction**: |
| 101 | ``` |
| 102 | [REASONING FROM STAGE 1] |
| 103 | Therefore, the answer is |
| 104 | ``` |
| 105 | |
| 106 | #### Strengths |
| 107 | - No exemplar crafting required |
| 108 | - Generalizes across task types |
| 109 | - Simple to implement |
| 110 | |
| 111 | #### Limitations |
| 112 | - Less effective than few-shot CoT |
| 113 | - Can produce verbose or irrelevant reasoning |
| 114 | - Sensitive to exact phrasing |
| 115 | |
| 116 | --- |
| 117 | |
| 118 | ### 3. Self-Consistency |
| 119 | |
| 120 | **Paper**: "Self-Consistency Improves Chain of Thought Reasoning in Language Models" (Wang et al., 2022) |
| 121 | **Citations**: 5,379+ |
| 122 | |
| 123 | #### When to Use |
| 124 | - High-stakes decisions requiring confidence |
| 125 | - Problems with multiple valid reasoning paths |
| 126 | - When you need to reduce variance in outputs |
| 127 | - Verification of reasoning correctness |
| 128 | |
| 129 | #### How It Works |
| 130 | Sample multiple diverse reasoning paths, then select the most consistent answer via majority voting. The intuition: correct answers can be reached through multiple reasoning paths. |
| 131 | |
| 132 | #### Prompt Template |
| 133 | |
| 134 | ``` |
| 135 | [Use any CoT prompt - zero-shot or few-shot] |
| 136 | |
| 137 | [Generate |