Back to Prompting Recipes

Zero-Shot CoT

ReasoningSimple

Reasoning

Trigger step-by-step reasoning without examples.

Summary

Zero-Shot Chain of Thought (Zero-Shot CoT) is a simplified version of Chain of Thought that doesn't require examples. By simply adding phrases like "Let's solve this step by step" or "Let's think about this carefully" to a prompt, you can trigger the LLM to break down its reasoning process. This technique is remarkably effective despite its simplicity and requires minimal prompt engineering.

Implementation

Add a phrase like "Let's solve this step by step" or "Let's think about this carefully" after your question or problem statement. No examples are needed, making this technique particularly easy to apply. For best results, ensure your problem is clearly stated before the reasoning prompt.

Effective trigger phrases

  • "Let's solve step by step": Math, logic problems
  • "Think carefully": Complex reasoning
  • "Let's analyze this": Multi-faceted questions
  • "First, let's understand": Deconstruction tasks
  • "Let's work through this": Step-by-step procedures

Best for

  • Quick improvements to reasoning tasks
  • Situations where providing examples is impractical
  • Simple queries that benefit from structured reasoning
Code View

Zero-Shot CoT Implementation

// Zero-Shot CoT recipe using OpenAI
// Install: bun add openai

import OpenAI from "openai";

async function main() {
  const input = "Add your prompt here.";
  const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
  const system = "You are a senior AI engineer and technical writer. Use the prompting technique to answer the request clearly and precisely. Recipe: Zero-Shot CoT. Description: Trigger step-by-step reasoning without examples. Focus: Reasoning Provide actionable, implementation-ready guidance.";
  const user = `Request: ${input}`;

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

  const openaiText = openaiResponse.choices[0]?.message?.content?.trim() ?? "";

  console.log(openaiText);
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});