Building Thinking Models with Chain-of-Thought (CoT)

1. What is a Thinking Model?

A thinking model is essentially a framework or process that guides reasoning to solve a problem. It doesn’t just spit out an answer; it models how a human (or an AI) might logically step through a problem to reach a conclusion.

Examples:

  • Mathematical problem solving: Step 1: Identify known variables → Step 2: Apply formulas → Step 3: Solve for unknown.

  • Decision making: Step 1: List options → Step 2: Evaluate pros/cons → Step 3: Make a choice.

2. What is Chain-of-Thought (CoT)?

Chain-of-Thought prompting is a technique in LLMs where the model is encouraged to think step-by-step reasoning process instead of jumping directly to the answer. Instead of jumping straight to an answer, the model is encouraged to "think out loud" by breaking down complex tasks into intermediate steps.

This mirrors how humans solve problems—especially in areas like:

  • Arithmetic and symbolic reasoning

  • Commonsense logic

  • Multi-step decision-making

Example

const SYSTEM_PROMPT = `
You are a math-solving assistant that always follows BODMAS and explains each step clearly. Use the following format when solving expressions:

* Solve brackets first: e.g., 12 + 8 = 20

* Division next: e.g., 20 ÷ 4 = 5

* Multiplication: e.g., 3 × 2 = 6

* Addition/Subtraction: e.g., 5 + 6 = 11

Always show each operation on its own line using bullet points. Use LaTeX formatting for inline math when appropriate. End with a clear final answer, highlighted or boxed. Do not skip steps, even if the answer seems obvious.
`;

How You Might Use It :

const messages = [
  { role: "system", content: SYSTEM_PROMPT },
  { role: "user", content: "Solve (12 + 8) ÷ 4 + 3 × 2" }
];

Why It Matters

  • Consistency: Keeps responses aligned with the intended tone and purpose.

  • Safety: Prevents the model from generating harmful or biased content.

  • Customization: Developers can tailor the AI for specific domains (e.g., medical, legal, educational).

0
Subscribe to my newsletter

Read articles from Hitashree Korgaonkar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Hitashree Korgaonkar
Hitashree Korgaonkar