Apply to my task
arXiv:2507.08664 ★ 85 Jul 11, 2025

INoT (Introspection of Thought): a virtual multi-agent debate inside a single prompt

Key result

Two virtual agents arguing inside a single prompt deliver +7.95% accuracy while saving 58% of tokens vs 5-7 API calls. INoT gives you deep logic checking through an internal debate instead of expensive external iterations (as in CoT or IoT). Pseudocode sets a strict loop: argument → critique → rebuttal → adjustment. The LLM follows this structure like a program, writing from the perspective of two opponents. Consensus within 10 rounds instead of 7 calls to the model.

01

TL;DR

INoT is a technique that moves iterations inside a single prompt using pseudocode. Instead of calling the LLM over and over (as in Chain-of-Thought or Iteration of Thought), the model simulates a debate between two virtual agents within one response. You describe the reasoning logic in PromptCode (a mix of Python and natural language), paste it into the prompt, and the LLM follows that logic like a program. The two agents argue, critique each other, push back, and adjust their positions until they reach consensus or hit the round limit (usually 10).

Classic methods (CoT, IoT, Tree-of-Thought) improve the answer through external iterations: every reflection step is a new request to the model. A medium-difficulty task can take 5-7 API calls. Every call costs tokens. If the task needs deep checking (math, code, chains of logic), the cost multiplies. On top of that, the model reprocesses the context from scratch on every iteration, which is inefficient.

INoT uses pseudocode as an instruction for the LLM. The model doesn't execute code in the technical sense; it generates text by following structured instructions that look like code. Two virtual agents (Agent_A and Agent_B) go through a loop: generate an answer → critique each other → rebut → adjust their positions. The process repeats until the agents agree or the round limit is reached. All of this happens inside a single model response, with no external iterations. The result: 58.3% fewer tokens and a 7.95% accuracy gain (compared with the best baseline methods).

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

ONE PROMPT contains:

1. PromptCode Definition
   → Defines the reasoning "language" (Python + natural language)
   → LLM role: "Reasoning code executor"

2. Image Augment (optional, if there's an image)
   → Step-by-step analysis: basic perception → details → context → verification

3. Reasoning Logic (main block)
   → Initialization: Agent_A and Agent_B produce initial answers
   → LOOP (up to 10 rounds or until consensus):
      - Presentation: each agent makes its arguments
      - Critique: Agent_A critiques Agent_B, Agent_B critiques Agent_A
      - Rebuttal: each answers the opponent's critique
      - Adjustment: the agents revise their positions
      - Agreement check: if result_A == result_B → exit
   → Output: final result with no explanation

Everything runs in ONE request to the LLM.
03

Example

Task: You're testing a business hypothesis for a new online service. You need to decide whether to launch a marketplace for local repair technicians in Chicago, focused on fixing electronics and appliances. You have several arguments for and against, but it's hard to weigh the risks objectively.

Prompt:

<Role>
RoleName: PromptCode Executor
RoleDesc: You execute PromptCode reasoning code. Follow the logic in <ReasoningLogic> strictly line by line.
</Role>

<PromptCode>
PromptCode is structured reasoning code, a mix of Python and natural language. It defines the logical steps for solving the task.
</PromptCode>

<Rule>
<ReasoningLogic>: The most important part. Reason through the task line by line, following this logic!
</Rule>

<ReasoningLogic>
# Initialize the agents
Agent_A = DebateAgent("Assess whether it makes sense to launch a marketplace for local electronics and appliance repair technicians in Chicago")
Agent_B = DebateAgent("Assess whether it makes sense to launch a marketplace for local electronics and appliance repair technicians in Chicago")

result_A, thought_A = Agent_A.reason()
result_B, thought_B = Agent_B.reason()

# Debate parameters
MaxRounds = 10
Counter = 0
agreement = False

While not agreement or Counter < MaxRounds:
    Counter += 1

    # At each step, think as Agent_A, then as Agent_B

    # Step 1: Present arguments
    argument_A = Agent_A.reason()
    argument_B = Agent_B.reason()

    # Step 2: Mutual critique (Debate)
    critique_A = Agent_A.critique(argument_B)  # A critiques B's position
    critique_B = Agent_B.critique(argument_A)  # B critiques A's position

    # Step 3: Rebuttals to the critique
    rebuttal_A = Agent_A.rebut(critique_B)  # A answers B's critique
    rebuttal_B = Agent_B.rebut(critique_A)  # B answers A's critique

    # Step 4: Adjust positions
    result_A, thought_A = Agent_A.adjust(rebuttal_B)  # A revises in light of B's rebuttal
    result_B, thought_B = Agent_B.adjust(rebuttal_A)  # B revises in light of A's rebuttal

    # Step 5: Agreement check
    agreement = (result_A == result_B)

final_result = result_A if agreement

Output final_result with no additional explanation.
</ReasoningLogic>

Result:

The model will show several rounds of internal debate: Agent_A may open with an optimistic take (“the market is big, competition is moderate”), Agent_B will push back (“high CAC, tough unit economics”), and then the exchange of critique forces both to adjust their assessments. At the end you get a consensus conclusion: a recommendation that weighs the arguments from both sides. The output format depends on whether the agents agree: if they reach consensus, you get a clear answer; if not (within 10 rounds), you get Agent_A's last result.

04

Why It Works

The LLM's weakness: Models are prone to confirmation bias. The first generated answer becomes an “anchor,” and later iterations often just reinforce the initial position instead of critically reconsidering it. With external iterations (CoT, IoT), each new request reprocesses the full context but still gravitates toward the previous conclusion.

The LLM's strength: Models are great at following structured instructions and simulating roles. When the reasoning logic is spelled out explicitly (like a program), the LLM reproduces the pattern more precisely than with vague natural-language directions. Pseudocode removes ambiguity: .critique(), .rebut(), .adjust() are unambiguous commands that can't be read different ways.

How the method exploits this: INoT creates two independent thinking contexts inside one response through the Agent_A and Agent_B roles. The model writes from each agent's perspective in turn, following the structure of the While loop. The pseudocode enforces a strict sequence: argument → critique → rebuttal → adjustment. The model can't cut corners and skip a step; the code dictates the order. The two agents are forced to challenge each other's positions, which breaks confirmation bias. The result: a deeper logic check in one request instead of 5-7 API iterations.

Prompt control levers:

  • MaxRounds (10): lower it to 3-5 for simple tasks (saves tokens), raise it to 15 for extra-hard ones (more reflection iterations)
  • Agent roles: instead of faceless Agent_A/B, give them distinct personalities (“skeptical analyst” vs “optimistic entrepreneur”) → sharper critique and more varied angles
  • Exit condition agreement = (result_A == result_B): replace it with “agreement on the key points” or “difference in numerical score < 10%” for tasks where full consensus is impossible
  • without explanation at the end: remove this phrase to see the final reasoning, not just the result
  • Image Augment: if the task has no images, delete the whole block (saves ~200 prompt tokens)
05

Prompt Template

<Role>
RoleName: PromptCode Executor
RoleDesc: You execute PromptCode reasoning code. Follow the instructions in <ReasoningLogic> strictly line by line, like a program.
</Role>

<PromptCode>
PromptCode is structured reasoning code. It's a hybrid of Python and natural language that defines the logical steps for solving the task.
</PromptCode>

<Rule>
Module purposes:
<Image Augment>: Follow this when analyzing images. If there are no images, ignore it.
<ReasoningLogic>: The most important part. Reason through the task line by line using this logic!
</Rule>

<Image Augment>
Follow this module to analyze images.

<Basic Visual Understanding> (What do you see?)
- Identify people, animals, key elements
- Recognize colors, shapes, patterns, axes, legends, spatial relationships
- Detect any text in the image
</Basic Visual Understanding>

<Advanced Visual Analysis> (How does it look?)
- Analyze lighting, shadows, reflections
- Examine textures, materials, surfaces
- Consider hints of motion (if applicable)
</Advanced Visual Analysis>

<Context Awareness> (What does it mean?)
- Use accompanying text, metadata and task instructions to refine your understanding
- Compare the image with known patterns or knowledge to improve accuracy
- Recognize symbolic or cultural references that affect interpretation
</Context Awareness>

<Inference and Verification> (Is the analysis reliable?)
- Cross-check image details against available text descriptions
- Avoid assumptions when things are unclear: acknowledge uncertainty instead of guessing
- Keep it logically consistent: your visual interpretation must match the input task
</Inference and Verification>
</Image Augment>

<ReasoningLogic>
if image in task:
    import <Image Augment>

# Initialize agents with independent thinking
Agent_A = DebateAgent("{task}")
Agent_B = DebateAgent("{task}")

result_A, thought_A = Agent_A.reason()
result_B, thought_B = Agent_B.reason()

# Debate parameters
MaxRounds = {num_rounds}
Counter = 0
agreement = False

While not agreement or Counter < MaxRounds:
    Counter += 1

    At each step, think as Agent_A, then as Agent_B, 
    responding as two independent debaters with deep reflection.

    # Step 1: Agents present arguments
    argument_A = Agent_A.reason()
    argument_B = Agent_B.reason()

    # Step 2: Mutual critique (debate phase)
    critique_A = Agent_A.critique(argument_B)  # A critiques B's reasoning
    critique_B = Agent_B.critique(argument_A)  # B critiques A's reasoning

    # Step 3: Agents respond to the critique (rebuttal phase)
    rebuttal_A = Agent_A.rebut(critique_B)  # A rebuts B's critique
    rebuttal_B = Agent_B.rebut(critique_A)  # B rebuts A's critique

    # Step 4: Adjust based on rebuttals (adjustment phase)
    result_A, thought_A = Agent_A.adjust(rebuttal_B)  # A refines based on B's rebuttal
    result_B, thought_B = Agent_B.adjust(rebuttal_A)  # B refines based on A's rebuttal

    # Step 5: Agreement check
    agreement = (result_A == result_B)

final_result = result_A if agreement

Output final_result without explanation.
</ReasoningLogic>

Filling in the placeholders: - {task}: your specific task (a question, problem, calculation) - {num_rounds}: the number of debate rounds (10 recommended; 3-5 for simple tasks, up to 15 for complex ones) - If the task has no image, delete the whole <Image Augment> block and the line if image in task: import <Image Augment>


🚀 Quick start: paste this into the chat:

Here's the INoT (Introspection of Thought) template, a technique for running a debate between two virtual agents inside one prompt. Adapt it to my task: [your task]. 

Ask me questions so you can correctly fill in the {task} and {num_rounds} fields and decide whether the Image Augment section is needed.

[paste the template above]

The LLM will ask about the details of your task, its difficulty (to set the number of rounds) and whether there are images, because the debate parameters (number of rounds, whether visual analysis is included) directly affect reasoning depth and token spend. The model will take the pseudocode structure from the template and plug in your context.

06

Limitations

⚠️ Overkill for simple tasks: For questions like “capital of France” or “translate this word,” running 10 rounds of agent debate is a waste of tokens. The method is built for tasks that need deep logic checking: math, code, multi-step reasoning, evaluating business decisions.

⚠️ Long prompt: The full INoT structure with Image Augment takes ~600-800 tokens. That eats into the context window. If you're working with long documents or a long chat history, there's less room left for the task.

⚠️ Consensus isn't guaranteed: The agents may not agree within the round limit. Then result_A is output, but it may not be the most balanced decision. For tasks where full confidence matters, raise MaxRounds or add an “explain the disagreements” condition instead of outputting a single result.

⚠️ No substitute for external checks when stakes are high: A virtual debate inside one model is still a single text-generation process. For critical decisions (finance, medicine, law), combine INoT with external verification or use several different models.

07

How It Was Studied

The team tested INoT on six benchmarks across three domains: Math (GSM8K, MATH), Code (HumanEval, MBPP), QA (HotpotQA, SQuAD 1.1). They compared it with seven baseline methods: IO (direct prompting), CoT, Self-Consistency CoT, LogiCoT, Tree-of-Thought, GIoT and AIoT. All methods ran on the same model, DeepSeek-V2.5, to isolate the effect of prompt engineering from differences between models. Temperature for DeepSeek-V2.5 was set to 1 (creativity), and 0 for the rest (determinism). Each test is the average of five runs.

The experiment's logic: Baseline methods (especially IoT and ToT) need multiple API calls: on each iteration the model generates, then an external script checks the output and sends the next request. INoT packs all the iteration logic into a single prompt. The researchers measured not only accuracy (F1, pass@1, Solve Rate) but also token spend, building Pareto charts of “performance vs cost.”

The scale of the savings was the surprise: INoT improved accuracy by 7.95% on average (up to 11.6% on some tasks), but the main insight is a 58.3% reduction in token cost compared with the best baseline. In practice: for a task where IoT makes 7 requests of 500 tokens each (3,500 total), INoT fits into 1 request of ~1,500 tokens (prompt + response). At scale (thousands of tasks a day), the savings are critical.

They also checked versatility: They ran INoT on visual tasks (ScienceQA-IMG, LLaVA-Bench) with multimodal models. The Image Augment module improved accuracy on image QA tasks, confirming that pseudocode works for more than just text. That matters: most prompting techniques are tuned for one domain, while INoT is universal.

08

Adaptations and Extrapolations

🔧 Technique: Debug mode → visibility into the process

By default INoT outputs only final_result without explanation. That's compact, but it doesn't show how the agents reached their conclusion. For learning or checking the logic, it helps to see the intermediate steps.

Change: Add print() at each step of the loop and remove without explanation:

While not agreement or Counter < MaxRounds:
    Counter += 1
    print(f"=== ROUND {Counter} ===")

    argument_A = Agent_A.reason()
    argument_B = Agent_B.reason()
    print(f"Arguments:\nAgent_A: {argument_A}\nAgent_B: {argument_B}")

    critique_A = Agent_A.critique(argument_B)
    critique_B = Agent_B.critique(argument_A)
    print(f"Critique:\nA→B: {critique_A}\nB→A: {critique_B}")

    rebuttal_A = Agent_A.rebut(critique_B)
    rebuttal_B = Agent_B.rebut(critique_A)
    print(f"Rebuttals:\nA: {rebuttal_A}\nB: {rebuttal_B}")

    result_A, thought_A = Agent_A.adjust(rebuttal_B)
    result_B, thought_B = Agent_B.adjust(rebuttal_A)
    print(f"Adjustment:\nA: {result_A} (reasoning: {thought_A})\nB: {result_B} (reasoning: {thought_B})")

    agreement = (result_A == result_B)
    print(f"Agreement reached: {agreement}\n")

final_result = result_A if agreement
print(f"FINAL RESULT: {final_result}")
Explain the reasoning that led to this result.

Effect: The model will output a detailed debate log: you'll see where the agents diverged, which arguments landed, and in which round they reached consensus. Useful for understanding the “weak spots” in the model's reasoning.


🔧 Technique: Give the agents personalities → sharper critique

Faceless Agent_A and Agent_B can produce similar arguments. Give them specific roles with explicit mindsets and the model will reproduce distinct viewpoints more sharply.

Example for evaluating a business idea:

# Instead of:
Agent_A = DebateAgent("{task}")
Agent_B = DebateAgent("{task}")

# Use:
Agent_Optimist = DebateAgent(
    role="Optimistic entrepreneur",
    mindset="Looks for opportunities, focuses on growth and market potential. Biased toward action.",
    task="{task}"
)

Agent_Skeptic = DebateAgent(
    role="Skeptical financial analyst", 
    mindset="Looks for risks, checks the numbers, demands evidence. Focused on sustainability and unit economics.",
    task="{task}"
)

Effect: The optimist will push for speed to market and market capture; the skeptic will demand ROI calculations and stress tests. The debate gets more concrete, and the final conclusion more balanced.


🔧 Technique: Exit on a quality threshold → not just consensus

The standard condition agreement = (result_A == result_B) suits tasks with a single correct answer (math, code). For subjective assessments (strategy, creative work), an exact match is rare.

Change: Replace the check with “both agents rate the solution above a threshold”:

# Instead of:
agreement = (result_A == result_B)

# Use:
confidence_A = Agent_A.rate_confidence(result_A)  # scale 0-10
confidence_B = Agent_B.rate_confidence(result_B)

agreement = (confidence_A >= 8 and confidence_B >= 8)

if agreement:
    final_result = synthesize(result_A, result_B)  # merge both conclusions

Effect: The agents can propose different solutions, but both rate them as well-founded. The final output is a synthesis of ideas rather than a pick of one option.

09

Resources

Introspection of Thought Helps AI Agents
arXiv:2507.08664v1 [cs.AI] 11 Jul 2025

The study builds on work on Chain-of-Thought prompting (Wei et al.), Tree-of-Thought (Yao et al.), Iteration of Thought (Wang et al.), Program of Thoughts (Chen et al.), and Image-of-Thought (Mitra et al.)

Haoran Sun, Shaoning Zeng
Yangtze Delta Region Institute (Huzhou), University of Electronic Science and Technology of China

Research digest

Key result

Two virtual agents arguing inside a single prompt deliver +7.95% accuracy while saving 58% of tokens vs 5-7 API calls. INoT gives you deep logic checking through an internal debate instead of expensive external iterations (as in CoT or IoT). Pseudocode sets a strict loop: argument → critique → rebuttal → adjustment. The LLM follows this structure like a program, writing from the perspective of two opponents. Consensus within 10 rounds instead of 7 calls to the model.

Principle

Instead of vague natural-language instructions, use pseudocode (PromptCode): a mix of Python and commands like `Agent_A.critique(argument_B)`. The model treats it as a program to execute line by line. Two agents (Agent_A and Agent_B) get the same task but reason independently. Then comes a While loop: each round the agents present arguments, critique each other, rebut the critique and adjust their positions. If `result_A == result_B`, exit; if not, run the next round up to the limit (usually 10). It's like a staged debate with a tight script: every participant knows when to speak, when to listen and when to rethink their position.

Why it works

LLMs suffer from confirmation bias: the first answer becomes an anchor, and later iterations often just reinforce the initial idea. With external loops (CoT, IoT), each new request reprocesses the full context but still gravitates toward the previous conclusion. Pseudocode removes ambiguity: `.critique()` and `.rebut()` are unambiguous commands that can't be read different ways. The model writes from each agent's perspective in turn, creating two independent thinking contexts inside one response. The agents are forced to challenge each other's positions, which breaks the anchoring. Result: 58.3% fewer tokens (one request instead of 5-7) and +7.95% accuracy thanks to deeper mutual logic checking.

When to apply

Tasks that need deep logic checking → business decisions (testing hypotheses, strategy), math, code review, multi-step reasoning, especially when you need a balanced assessment from several angles. NOT a fit for simple factual questions like 'capital of France', where 10 rounds of debate is a waste of tokens.

Mini recipe

1. Set the model's role: `RoleName: PromptCode Executor`: the model should treat the prompt as executable reasoning code 2. Initialize the agents: `Agent_A = DebateAgent("{your_task}")` and `Agent_B = DebateAgent("{your_task}")`: two independent participants with the same goal 3. Configure the debate loop: `MaxRounds = 10` (3-5 for simple tasks, up to 15 for complex ones), exit condition `agreement = (result_A == result_B)` 4. Describe the round logic: presentation (`argument_A`, `argument_B`) → critique (`critique_A`, `critique_B`) → rebuttals (`rebuttal_A`, `rebuttal_B`) → adjustment (`adjust`) → agreement check 5. Run it through the prompt: the whole structure in one request; the model executes it line by line like a program

Examples

[BAD]: `Evaluate my business idea: a marketplace for electronics and appliance repair technicians in Chicago. Should I launch it?` [GOOD]: Use the INoT template with pseudocode: ``` Agent_A = DebateAgent("Assess whether it makes sense to launch a marketplace for local electronics and appliance repair technicians in Chicago") Agent_B = DebateAgent("same task") MaxRounds = 10 While not agreement or Counter < MaxRounds: argument_A = Agent_A.reason() argument_B = Agent_B.reason() critique_A = Agent_A.critique(argument_B) critique_B = Agent_B.critique(argument_A) rebuttal_A = Agent_A.rebut(critique_B) rebuttal_B = Agent_B.rebut(critique_A) result_A = Agent_A.adjust(rebuttal_B) result_B = Agent_B.adjust(rebuttal_A) agreement = (result_A == result_B) Output final_result ``` The model will show several rounds of internal debate: Agent_A opens optimistic ('the market is big'), Agent_B pushes back ('high CAC'), and the exchange of critique forces both to adjust their assessments. At the end you get a consensus conclusion that weighs the arguments from both sides.

In plain words

The deal with INoT is that AI models are, by nature, terrible yes-men. Once a model spits out a first answer, it clamps onto it and ignores mistakes to the bitter end, just to avoid contradicting itself. That's called confirmation bias. To make the AI actually think instead of faking confidence, the researchers came up with a way to bake the logic of an argument right into the prompt's structure through PromptCode, a mix of code and plain language. The model no longer just “writes text”; it runs an algorithm that forces it to pit two different viewpoints against each other within a single generation.

It's as if you went to a lawyer for advice and they suddenly started staging a full trial in front of you, hopping from the defense chair to the prosecutor's seat. Instead of handing you the first opinion that pops into their head, they ask themselves awkward questions, catch themselves fudging, and hunt for weak spots in the arguments. Technically it's one monologue, but in practice it's a tough internal audit where the truth is hard-won rather than pulled out of thin air in a second.

Technically it works through pseudocode that makes the model simulate a debate between two virtual agents. You write a strict script into the prompt: agent A proposes a solution, agent B hunts for flaws, and they argue for up to 10 rounds until they reach consensus. That kills the main problem of older methods like Chain-of-Thought, where the model often just “thought out loud,” confirming its own blunder. Here, iteration inside the prompt makes the AI literally recheck every step, using programming logic to keep the quality of thought in check.

The method was tested on hard tasks, but the principle is universal for any business or analytics work. If you need to evaluate a marketplace launch or audit code for vulnerabilities, a regular request will give you sugar-coated fluff or a surface-level review. INoT turns the model into a full analytics department that won't rest until it has taken your idea apart piece by piece. GEO, SEO, coding or strategy: anywhere a mistake is costly, the AI's internal debate beats a simple “think again.”

Bottom line: it's time to stop trusting the model's first word and start making it doubt itself. Introspection of thought via pseudocode is the jump from plain chat to programmable thinking. Either you use PromptCode and get a carefully vetted result, or you keep getting hallucinations wrapped in a confident tone. 10 rounds of internal critique are worth more than a hundred empty generations, because that's the only way to squeeze real objectivity out of AI.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on INoT (Introspection of Thought): a virtual multi-agent debate inside a single prompt arXiv:2507.08664

Sign in to apply this study New accounts get 50 free credits.