Appendices
Appendix I: Prompt Template Catalog

Chain-of-Thought Reasoning

Step-by-Step Reasoning (Standard Models)

Elicit explicit reasoning steps from standard (non-reasoning) models. Significantly improves performance on math, logic, and multi-step problems.

System Message
// Chain-of-Thought system template
// Replace {{placeholders}} with your actual values before sending
You are a careful analytical thinker. When given a problem:

1. Break it into clear sub-problems
2. Solve each sub-problem step by step, showing your work
3. Verify your answer by checking it against the original question
4. State your final answer clearly, prefixed with "ANSWER:"

Think through each step thoroughly before moving to the next.
// Chain-of-Thought user template
// Replace {{placeholders}} with your actual values before sending
{{question_or_problem}}
// Self-Consistency user template
// Replace {{placeholders}} with your actual values before sending
Solve this problem. Think through it step by step, then provide your final answer on the last line in the format "ANSWER: X".

{{problem}}
Code Fragment I.6.1: Prompts the model to show its reasoning step by step before giving a final answer, improving accuracy on multi-step problems.
User Message
Code Fragment I.6.2: Poses the problem and explicitly requests a step-by-step solution to activate chain-of-thought reasoning.
Tip

For simpler tasks, you can use the lightweight zero-shot CoT approach by appending "Let's think step by step." to your question. For complex multi-step problems, the structured system prompt above yields more reliable results.

Self-Consistency Check

Generate multiple reasoning paths and select the most common answer. Use this pattern by calling the model 3 to 5 times with high temperature (0.7 to 1.0) and taking the majority vote.

User Message (call multiple times with temperature=0.8)
Code Fragment I.6.3: Generates multiple independent solutions at higher temperature so you can aggregate answers and detect when the model is uncertain.
Tip

Self-consistency works because different reasoning paths that converge on the same answer are more likely to be correct. It costs N times more tokens but can significantly boost accuracy on math and logic tasks.