Skip to content
PromptsBuddy

A deadlock that only appears under load is the kind of bug standard models guess at. GPT-4o proposes a fix that compiles, you add “think step by step” when it fails, and the second fix breaks a different test. Forty minutes later you are still reading stack traces.

Reasoning models like o1 and o3 are built to break that loop. They plan, check and backtrack before answering, which is what multi-file bugs, tangled refactors and concurrency problems demand. The catch is that prompting habits that helped on standard models now hurt, and a vague request can cost real money and a long wait for a worse result.

This guide covers what to send, what to cut, and when not to use a reasoning model at all.

Key takeaways

  • Use a reasoning model only when extra thinking time would improve a human expert’s answer.

  • Send a goal, relevant code, constraints, a definition of done and an output format. Skip step-by-step instructions.

  • Set reasoning effort, leave generous token headroom, and run a pass/fail check before you trust the answer.

A note on model names. o1 and o3 started this category, and they remain the names people search for. As of November 2026, OpenAI’s reasoning guide points new projects to its newer reasoning models and the Responses API. Everything below applies to o1, o3 and o3-mini, and the prompting principles carry over to newer models. Check the current model list before you pick one.


How Reasoning Models Think Differently from Standard AI Models

A standard model like GPT-4o writes its answer one token at a time and can’t take anything back. If it commits to a wrong assumption early, everything after it is built on that mistake.

Reasoning models add a hidden thinking phase before the visible answer. They try an approach, notice when it isn’t working, and switch. OpenAI reported that o1’s performance improves with more time spent thinking at test time. That is test-time compute scaling, and it is why these models do better on problems that need many verified steps. openai

The gap is measurable. In OpenAI’s launch evaluations, GPT-4o solved on average 12% of 2024 AIME problems, while o1 averaged 74% with a single sample per problem. On competitive programming, GPT-4o scored an Elo of 808 (11th percentile of human competitors) and o1 scored 1673 (89th percentile). Benchmarks measure what they measure, so test the gap on your own tasks. openaiopenai

Two practical consequences:

  • You never see the raw thinking. Reasoning tokens are hidden, but they still occupy space in the context window and are billed as output tokens. openai

  • Responses are slow. Hard requests can take tens of seconds, which rules out chat-speed loops.


Choose the Right Model and Reasoning Effort for Your Task

Many bad results come from using a reasoning model when you didn’t need one, or from running it at the wrong effort.

Task

Tier

Why

Rename a variable, write a regex, format JSON, explain a function

Fast model (GPT-4o class)

A reasoning model’s answer wouldn’t change, and you’d pay for the wait

Algorithm problem, SQL with several joins, a bug with a clear failing test

Reasoning model, low to medium effort

A pass/fail target lets the model verify its own work

Multi-file refactor, concurrency bug, security-sensitive logic

Reasoning model, medium to high effort

Many interacting constraints; mistakes are expensive

OpenAI’s guidance matches this split. It describes high effort as suited to hard reasoning, complex debugging, deep planning, and high-value tasks where quality matters more than latency. openai

The test: would a senior engineer give a noticeably better answer after an extra hour? If yes, use a reasoning model. If the answer wouldn’t change, use a fast one.


The five-part prompt for complex code

OpenAI’s own advice is that reasoning models work best with a clear goal, strong constraints, and an explicit output contract, without prescribing every intermediate step. Here is that advice as a structure: openai

  1. Goal: one sentence on the outcome.

  2. Context: the relevant code, schemas or logs inside clear delimiters.

  3. Constraints: language version, fixed libraries, performance limits, style rules.

  4. Definition of done: the behaviour or tests that must hold.

  5. Output format: diff, full file, or code plus a list of assumptions.

text

Goal:
Fix the deadlock between reserve_then_charge() and refund_then_restock().

Context:
"""
[orders.py, 14 lines]
"""
Observed: when both run concurrently, neither returns.

Constraints:
- Python 3.11, standard library only
- Keep both function names and signatures

Definition of done:
- Both functions can run concurrently and always finish
- No lock is acquired in two different orders

Output:
A unified diff, then a list of any assumptions.

Every line is information the model can’t guess. Nothing tells it how to think.


A worked example you can reproduce

Here is the bug behind that prompt. One function takes the inventory lock and then the payment lock. The other takes them in the opposite order. Each function looks correct on its own, which is why this kind of bug is easy to misdiagnose.

python

def reserve_then_charge(order):
    with inventory_lock:
        time.sleep(0.01)
        with payment_lock:
            return f"reserved+charged {order}"

def refund_then_restock(order):
    with payment_lock:          # opposite order
        time.sleep(0.01)
        with inventory_lock:
            return f"refunded+restocked {order}"

The “definition of done” in the prompt is only useful if you can check it. This small script runs both functions in parallel threads, 20 times, and fails if any run doesn’t finish within two seconds:

python

# check_no_deadlock.py
import importlib, sys, threading, time

def run_once(mod, timeout=2.0):
    out = []
    ts = [threading.Thread(target=lambda: out.append(mod.reserve_then_charge("A")), daemon=True),
          threading.Thread(target=lambda: out.append(mod.refund_then_restock("B")), daemon=True)]
    for t in ts: t.start()
    deadline = time.time() + timeout
    for t in ts: t.join(max(0, deadline - time.time()))
    return not any(t.is_alive() for t in ts)

mod = importlib.import_module(sys.argv[1])
ok = sum(run_once(mod) for _ in range(20))
print(f"{sys.argv[1]}: {ok}/20 runs finished within 2s")
sys.exit(0 if ok == 20 else 1)

We ran it against the original code and against a version where both functions take the locks in the same order (inventory first, then payment):

text

orders_broken: 0/20 runs finished within 2s     (exit code 1)
orders_fixed:  20/20 runs finished within 2s    (exit code 0)

That is the property that makes this a good prompt target. A weak prompt (“this hangs sometimes, fix it”) invites guesses. A strong one states the symptom, the constraint and a check the model’s answer must satisfy. Paste any model’s proposed fix into orders_fixed.py’s place and the script tells you in under a minute whether it worked.

Try this yourself with three variants of the prompt (vague, step-by-step, five-part) on the model you use, and record which ones pass the check on the first try. That tells you more about your own workflow than any published benchmark.


Common Prompting Mistakes to Avoid with Reasoning Models

Reasoning models work differently from standard AI models, so some prompting techniques may not help as much as you expect. Adding more instructions, examples, or reasoning effort doesn't always improve the answer. In some cases, it adds unnecessary complexity.

Here are four common mistakes to avoid.

1. Stop asking the model to "think step by step."

Reasoning models already perform internal reasoning before generating a response. You don't need to tell them how to think through every step. Instead, clearly explain the task, expected outcome, and any constraints.

2. Don't overload prompts with examples.

Start with a clear instruction and no examples (zero-shot prompting). If the output doesn't follow your expected format or style, add one or two relevant examples. Too many examples can make the prompt longer without improving the result.

3. Avoid adding unnecessary context.

More context doesn't always mean better answers. Large prompts filled with unrelated files, documentation, or code can make it harder for the model to identify important information.

Include only what the task requires. For a closer look at this problem, see our guide to context rot and attention budgeting.

4. Don't increase reasoning effort to fix every mistake.

Higher reasoning effort gives the model more room to reason, but it doesn't automatically fix unclear instructions or missing information.

If a medium-effort response is incorrect, check the prompt first. Clarify the requirements, provide missing context, or add a way to verify the result before switching to high effort.


Diagnose a bad result

Symptom

Likely cause

Fix

Empty or truncated answer

Reasoning consumed the token cap

Raise the output token limit

Slow and expensive for a simple task

Wrong tier

Route to a fast model

Confident answer that ignores your constraint

Constraint buried in prose

Put it in a dedicated Constraints block

Plausible code that calls functions that don’t exist

Missing context

Include the real signatures, then verify

Rambling explanation you didn’t want

No output format given

Specify “diff only” or “code plus assumptions”


How to Use Reasoning Models for Complex Debugging

Reasoning models are particularly useful for debugging problems that require more than a quick code fix. Instead of jumping to a solution, they can analyze error messages, compare possible causes, and identify what needs to be tested.

Debugging works best when you follow a clear process: identify the problem, form a hypothesis, test it, and rule out incorrect assumptions. Reasoning models can help with each step, especially when multiple components or dependencies are involved.

However, the quality of the result depends on the evidence you provide. Rather than asking the model to simply "fix this bug," share the relevant details and ask it to distinguish confirmed facts from possible causes.

PromptsBuddy's community prompt for debugging from a stack trace without guessing follows this approach. It focuses on evidence-based debugging without prescribing the model's internal reasoning process.

Best practices for debugging with reasoning models:

  • Provide complete error details: Include the stack trace, relevant code, exact dependency versions, and troubleshooting steps you've already tried.

  • Specify technical constraints: Mention anything that cannot change, such as a pinned library version, legacy API, or existing architecture.

  • Separate facts from assumptions: Ask the model to identify what the evidence confirms and what still needs testing.

  • Prioritize likely causes: Request a ranked list of possible causes based on available evidence and how easily each can be tested.

  • Start with a reproducible test: Ask for the smallest test that can reproduce the issue before making changes to the code.

The goal isn't to generate more possible fixes. It's to narrow down the cause, verify it, and make the smallest necessary change.


How to Verify Reasoning Model Outputs Before Using Them

Hidden reasoning can dominate the bill. OpenAI’s own documentation example shows a response with 1,186 output tokens, of which 1,024 were reasoning tokens. That is about 86% of the output spend on text you never see. openai

Set reasoning effort. Start at medium. OpenAI’s guidance is to evaluate both medium and high for complex tasks and to use the highest settings only when your own evals show a clear benefit.

Leave token headroom. If the cap is too tight, the model can use it all on thinking and return nothing visible. OpenAI recommends reserving at least 25,000 tokens for reasoning and outputs when you start experimenting, then adjusting once you know your typical usage. openai

python

from openai import OpenAI
client = OpenAI()

response = client.responses.create(
    model="o3-mini",                 # swap in whichever reasoning model you use
    reasoning={"effort": "medium"},
    max_output_tokens=25000,
    input=[
        {"role": "developer", "content": "Return a unified diff, then list assumptions."},
        {"role": "user", "content": prompt},
    ],
)

if response.status == "incomplete":
    print("Stopped early:", response.incomplete_details.reason)
print(response.output_text)
print("Reasoning tokens:", response.usage.output_tokens_details.reasoning_tokens)

The developer message is where standing instructions live. Our guide to writing system prompts that stay consistent covers how to structure that layer, and most of it carries over.

Route by difficulty. Use the tier table above as your starting rules. Send routine edits to a fast model, and reserve high effort for multi-file and concurrency work. Then adjust the rules against your own logs of cost and first-try pass rate.

Split planning from execution. In agent workflows, let the reasoning model produce the plan and hand each step to a faster model. Waiting on deep reasoning for every tool call is how workflows time out.


Verifying Reasoning Model Outputs Before Using Them

Reasoning models can produce detailed and convincing answers, but that doesn't guarantee they're correct. If a model starts with a wrong assumption, misunderstands your code, or references an outdated API, its solution may look logical but still fail in practice.

The risk is that a well-explained mistake can be harder to spot than an obvious one.

That's why you should treat AI-generated code like a pull request from an experienced developer. Review the changes and verify the results before using them.

  • Run the tests: Check whether the solution works. When possible, write a failing test first to reproduce the original bug and confirm the fix.

  • Verify functions and APIs: Make sure every suggested function, method, and API exists and is compatible with your project's versions.

  • Check the assumptions: Ask the model to list its key assumptions, then compare them against your code, documentation, and environment.

  • Test edge cases: Check whether the solution handles unexpected inputs and errors without introducing new problems.


Quick checklist

  • Is this actually a hard problem? If not, use a faster model.

  • Goal, context, constraints, definition of done and output format all present?

  • No “think step by step,” no long few-shot block, no padding?

  • Effort set, token cap generous, reasoning tokens monitored?

  • A pass/fail check ready before you read the answer?



Conclusion

Reasoning models don’t reward longer prompts. They reward clearer ones. The pattern that holds up is to pick the tier for the difficulty of the task, state the goal and the finish line precisely, and let the model plan its own route. Then verify the result with a check you wrote before you saw the answer.

Treat reasoning models as a specialist tier, not a default. Send routine edits to faster models and save high effort for the bugs and refactors that have already beaten them. Watch your reasoning-token usage while you tune.

Model names will keep changing, but this structure carries over to whatever reasoning model you use next. Take one stubborn problem from your own codebase, write the pass/fail check first, then rewrite the prompt with the five-part template and compare it with your last attempt. For more starting points, the engineering prompts in the PromptsBuddy library are written by practitioners and can be adapted to your stack.