From Reactive to Reasoning: Building a Thinking Model from a Non-Thinking Model Using Chain-of-Thought

Shivam YadavShivam Yadav
4 min read

By [shivam yadav] – Published on Hashnode


Introduction

Most AI models today are reactive — they give answers instantly based on patterns in their training data. That works well for direct questions, but falls short when solving multi-step reasoning problems like math, logic puzzles, or complex decision-making.

What if you could make such a non-thinking model reason step-by-step without retraining it?

That’s exactly where Chain-of-Thought (CoT) prompting comes in.

In this article, you’ll learn:

  • The difference between a thinking and non-thinking model

  • What Chain-of-Thought prompting is

  • How to apply CoT to make models reason better

  • Real-world examples with code


Thinking vs. Non-Thinking Models

FeatureNon-Thinking ModelThinking Model
ApproachGives direct outputExplains reasoning before output
SpeedFast but may guessSlower but more accurate
TransparencyOpaque answersStep-by-step reasoning
Example"The answer is 42""First, multiply X by Y, then subtract Z, result is 42"

Example:

Prompt (Non-thinking): "What's 17 * 23?"
Output: "391"

Prompt (Thinking with CoT): "What's 17 * 23? Think step-by-step."
Output: "First, 17 × 20 = 340. Then, 17 × 3 = 51. Add them: 340 + 51 = 391."

What is Chain-of-Thought Prompting?

Definition:
Chain-of-Thought (CoT) prompting is a technique where you explicitly ask an AI model to break down its reasoning into steps before providing a final answer.

This works even on models that aren’t explicitly trained to reason — because you guide them to simulate reasoning via the prompt.

Core idea:

Don’t just ask for the answer. Ask for the reasoning first, then the answer.


How to Apply Chain-of-Thought Prompting

1. Basic Structure

The simplest way:

Question: [Your problem here]
Instruction: "Think step-by-step."

Example:

Question: "A shop sells pens for $2 each. If you buy 5 pens and pay with a $20 bill, how much change do you get? Think step-by-step."

Output:

Step 1: 5 pens × $2 = $10
Step 2: Paid $20, so change = $20 - $10 = $10
Answer: $10

2. Explicit Reasoning Template

You can also give the AI a reasoning format:

Question: "What is 25% of 240?"
Reasoning:
1. Convert percentage to decimal
2. Multiply by the number
Answer:

3. Few-Shot + Chain-of-Thought

Combine examples (few-shot) with step-by-step reasoning to help the model follow your pattern.

Example:

Q: 12 × 8  
A: Step 1: 10 × 8 = 80  
   Step 2: 2 × 8 = 16  
   Step 3: 80 + 16 = 96  
   Final Answer: 96  

Q: 14 × 15  
A: Step 1: 10 × 15 = 150  
   Step 2: 4 × 15 = 60  
   Step 3: 150 + 60 = 210  
   Final Answer: 210  

Q: 23 × 19  
A:

Why Chain-of-Thought Works

  • Forces logical sequencing — The model processes the problem in chunks rather than guessing.

  • Reduces hallucinations — By writing reasoning first, it’s less likely to give absurd answers.

  • Transparent output — You can see why the model gave that answer.

  • Improves accuracy — Especially for math, coding, and reasoning-based tasks.


Real-World Use Cases

  1. Math tutoring bots – Explain how to solve a problem instead of just giving answers.

  2. Debugging assistants – Walk through reasoning for finding a bug.

  3. Customer support AI – Explain product choices step-by-step.

  4. Planning agents – Break down multi-step business or project plans.


Example in Code (JavaScript + OpenAI API)

import OpenAI from "openai";

const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

async function solveWithCOT(question) {
  const prompt = `
  You are a reasoning assistant. 
  Answer the following question by thinking step-by-step before giving the final answer.

  Question: ${question}
  `;

  const response = await client.chat.completions.create({
    model: "gpt-4o-mini",
    messages: [{ role: "user", content: prompt }],
  });

  console.log(response.choices[0].message.content);
}

solveWithCOT("If a train travels 60 km in 1.5 hours, what is its speed in km/h?");

Limitations of Chain-of-Thought

  • Longer responses → May increase token usage (cost).

  • Not foolproof → Some models may still skip reasoning.

  • Reasoning ≠ Truth → AI can explain wrong answers confidently.


Conclusion

Turning a non-thinking model into a thinking model doesn’t always require retraining — sometimes, it’s just about better prompting.
With Chain-of-Thought prompting, you can make AI models:

  • More accurate

  • More transparent

  • More useful for complex tasks

The best part? It’s just one extra line:

“Think step-by-step.”


💬 Question for you:
Have you tried CoT prompting in your own AI projects? Did it improve accuracy? Share your experiments in the comments!

0
Subscribe to my newsletter

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

Written by

Shivam Yadav
Shivam Yadav