← Back to Articles

Why AI Needs to Show Its Work: The Power of Chain-of-Thought Reasoning

Seventh Article — Chain of Thought

Why AI Needs to Show Its Work: The Power of Chain-of-Thought Reasoning
Why AI Needs to Show Its Work: The Power of Chain-of-Thought Reasoning

Hook:

You ask an AI to solve "If Dheen has 5 apples, gives 2 to Gowri, then buys 7 more, how many apples does he have?" Without chain-of-thought, it spits out "10." With chain-of-thought, it writes:

  1. Start with 5 apples.
  2. Subtract 2: 5–2 = 3.
  3. Add 7: 3 + 7 = 10.

I am a banker, want to give a banking touch :-). Imagine you ask an AI to calculate a client's return on an investment: "Smitha invests $5,000, then deposits another $7,000 after 2 months, ending up with $15,000 after a year. What's her overall ROI?" Without chain-of-thought (CoT), the AI might instantly declare "XX%," leaving you to wonder how it got there. With CoT, it reveals every step — each deposit, each timespan — so you see exactly how it reached its final figure.

Now you know it didn't just guess — it reasoned.

Why This Matters:
Chain-of-thought (CoT) transforms AI from a black-box answer machine into a transparent collaborator, crucial for:

  • Regulatory Compliance: Auditable explanations behind key decisions like credit approvals or risk assessments.
  • Error Reduction: Pinpointing mistakes in calculations, from basic ROI to complex derivatives pricing.
  • Client Trust: Offering clear, step-by-step reasoning instills confidence in AI-driven advice or reports.

What Is Chain-of-Thought?

Simple Definition:
Chain-of-thought (CoT) is a prompting technique that encourages AI to outline intermediate reasoning steps before delivering a final answer — akin to a financial analyst showing you their workbook, not just their conclusion.

Analogy: A Chef vs. a Finished Dish
If an AI is a culinary master, CoT is the recipe it follows. Without it, you just get a finished cake. With CoT, you see each ingredient, each mixing step, and can spot where anything might have gone wrong — much like verifying the rationale for a loan recommendation or investment strategy.

Key Components

Focus on three pillars:

  1. Reasoning Steps: Break down complex financial tasks — like interest rate calculations or risk modeling — into smaller, logical chunks.
  2. Logical Progression: Ensure each step (e.g., interest accrual, principal repayment) follows naturally so you can audit every phase.
  3. Intermediate Thoughts: State assumptions or calculations explicitly to prevent hidden errors in collateral evaluation or projected returns.

How It Works

Step 1: Use CoT Prompts

Add phrases like "Think step-by-step" or "Show your work" to your prompts.

Basic Prompt:

Calculate the ROI for a $5,000 investment that grew to $8,000 in 3 years.

AI Output: "60% ROI."

CoT Prompt:

Calculate the ROI for a $5,000 investment that grew to $8,000 in 3 years.
Reason step-by-step, then state the final answer.

Output:

  1. Profit = 8,000−5,000 = $3,000.
  2. ROI = (3,000/5,000) * 100 = 60%.
    Final Answer: 60%.

Why Care

Such transparency helps confirm that interest calculations, fees, or time value of money were factored in correctly.

Step 2: Validate Logic

With CoT, you can spot errors before they become catastrophic:

If the AI writes: 
1. Profit = 8,000 + 8,000 + 5,000 = 13,000

You immediately know it added when it should have subtracted — preventing a miscalculation that could affect loan structuring or investment reports.

Step 3: Combine with Few-Shot Learning

Provide worked examples to train the AI's reasoning style:

Example:

Question: "If a pizza is divided into 8 slices and Ram eats 3, how many are left?"
Reasoning:
1. Total slices = 8.
2. Subtract eaten slices: 8–3 = 5.
Answer: 5 slices.
New Question: "A bakery sells 15 cupcakes by noon and bakes 20 more. How many do they have?"

By showing the AI simplified examples, you train it to handle complex financial or accounting tasks in the same step-by-step manner.

Code Example (OpenAI API):

response = openai.ChatCompletion.create(
model="gpt-4",
messages=[{
"role": "user",
"content": "A car travels at 60 mph for 2.5 hours. How far does it go? Explain step-by-step."
}],
temperature=0.3
)
# Output includes distance formula and calculation.

In a finance context, you might swap "car travel" for "bond yield" calculations or "amortization schedules."

Real-World Applications

  • Education: AI tutors like Socratic by Google use CoT to teach math and science.
  • Customer Support: Chatbots explain refund policies step-by-step to avoid confusion.
  • Legal Tech: Tools like Casetext break down case law analysis into digestible steps.
  • Fraud Detection: Anomaly detection algorithms detail each red flag — like unusual transaction frequencies — so compliance officers can investigate suspicious activity.

Challenges & Best Practices

Pitfalls:

Verbosity: CoT can over-explain, turning "2 + 2" into five lines and frustrating busy relationship managers or analysts.

Fabricated Steps: AI can invent logic if it lacks data — e.g., "Subtract 10 because interest rates rose" when there's no basis for that conclusion.

Pro Tips:

  1. Trim the Fat: Add a constraint like "Be concise but thorough" to balance detail and brevity and avoid overly long justifications.
  2. Validate with Code: For ROI or cash flow queries, ask the AI to produce a short Python snippet you can run to confirm numbers.
  3. Iterate: Prompt engineering is iterative: refine your instructions when the AI's logic wanders into nonsense or jargon-laden tangents.

Tools & Resources

  • LangChain: Framework for building CoT workflows, perfect for multi-step financial tasks.
  • OpenAI API: Set temperature=0 for more deterministic step-by-step logic.
  • Wolfram Alpha: Pair CoT with computational validation for advanced math, such as compound interest or derivative pricing.

Conclusion

Chain-of-thought doesn't just make AI smarter — it makes it accountable. By demanding transparency in every calculation, bankers and finance professionals can trust AI's reasoning and collaborate more effectively, turning a once-mysterious oracle into a reliable, auditable partner.

Next Up:
"From Words to Vectors: How AI Understands Meaning" (Article 8). Explore embeddings — the secret language of machines that powers everything from customer sentiment analysis to automated credit scoring!

Call-to-Action

What's the most surprising or illogical calculation you've seen an AI make in finance? Share your stories below — let's dissect how CoT could fix them and improve our industry's trust in AI!