ADHD vs Self-Consistency and Swarm Methods: A Multi-Agent Reasoning Comparison

ADHD (Parallel Divergent Ideation) eliminates premature convergence by spawning isolated LLM processes with distinct cognitive frames, whereas self-consistency votes on shared-context chains and swarm methods rely on continuous agent interaction.

The UditAkhourii/adhd repository implements a novel multi-agent reasoning pattern designed specifically for open-ended ideation. Unlike approaches that sample variations of the same reasoning chain or simulate collective dynamics, ADHD enforces strict contextual isolation during divergence, followed by an explicit critic phase. This architectural separation addresses the anchoring bias inherent in other methods.

Core Architectural Differences

Self-Consistency: Voting on Shared Context

Self-consistency improves reliability by generating multiple chain-of-thought (CoT) traces from the same prompt, then voting on the most frequent answer. However, all traces share a single context window, meaning early steps in one chain can anchor subsequent reasoning. According to the source analysis, this method typically uses sequential sampling with parallelism only at the API call level, and the "critic" is simply a majority vote rather than a dedicated evaluation pass.

Swarm-Based Reasoning: Emergent Dynamics

Swarm methods mimic biological systems like ant colonies, where agents follow local heuristics (e.g., pheromone trails) and update a global state continuously. While this enables emergent problem-solving, agents influence each other through shared signals during the search process. This ongoing interaction prevents the guaranteed isolation needed to explore truly divergent solution spaces, as each agent's path is biased by the collective history.

ADHD: Isolated Divergence with Explicit Critic

ADHD takes a fundamentally different approach implemented in src/engine.ts. The system spawns N independent LLM calls (termed "frames") that run as truly concurrent query() operations. As defined in src/frames.ts, each frame receives a unique cognitive frame—such as "economics-incentive" or "async-control-surface"—that re-poses the entire problem from a distinct viewpoint. Crucially, the system prompt forbids evaluation during this phase, ensuring zero shared context between frames. Only after all frames complete does a separate critic call score results on novelty, viability, and potential traps, then cluster and deepen the top-K ideas.

Implementation Deep Dive: Isolation and Parallelism

Parallel Execution in engine.ts

The divergence phase relies on true concurrency. In src/engine.ts, the run() function initiates multiple asynchronous LLM queries simultaneously:

// Conceptual flow from src/engine.ts
const frames = await Promise.all(
  frameConfigs.map(fc => query({ 
    messages: buildFramePrompt(problem, fc),
    // Each frame is completely isolated
  }))
)

This contrasts with self-consistency, which often samples sequentially from the same context, and swarm methods, which require synchronous updates to shared state (pheromone maps) that serialize execution.

Frame Isolation in frames.ts

The isolation guarantee resides in src/frames.ts. Each of the 15 cognitive frames (documented in documentation/frames.md) acts as a structural re-framing of the problem rather than a variation in sampling temperature. For example, one frame might ask "What would a regulator care about?" while another examines "Ant colony / swarm" dynamics. Because frames never see each other's outputs during generation, they cannot anchor on popular or early ideas, eliminating the "list N options" bias common in single-prompt approaches.

The Critic Phase

After divergence, ADHD enters a distinct focus phase. The critic, implemented as a separate LLM call in src/engine.ts, receives all generated ideas simultaneously. It performs scoring, clustering by underlying angle, and deepening of promising concepts—mechanically separating generation from evaluation. This two-step pipeline differs from Tree-of-Thought (ToT), where branches are evaluated at each step, potentially pruning novel but initially weak ideas.

Code Examples: Three Approaches in Practice

Using ADHD (Library)

import { run, renderText } from "adhd-agent"

const result = await run({
  problem: "Design a rate-limiter that survives leader election",
  framesPerRun: 5,   // Spawns 5 isolated cognitive frames
  topK: 2             // Critic selects and deepens top 2
})

console.log(renderText(result))

Key files: src/index.ts exports the run function; src/engine.ts orchestrates parallel execution; src/frames.ts defines the frame configurations.

Self-Consistency Implementation

import { ChatCompletionRequestMessage } from "openai"

async function selfConsistent(prompt: string, n: number) {
  const traces = await Promise.all(
    Array.from({ length: n }).map(() =>
      openai.createChatCompletion({
        model: "gpt-4",
        messages: [{ role: "user", content: prompt }],
        temperature: 0.7,   // Varies sampling but shares context window
      })
    )
  )
  // Voting mechanism serves as implicit critic
  const answers = traces.map(t => t.data.choices[0].message?.content ?? "")
  return mostFrequent(answers)
}

Limitation: All traces derive from the same initial context, preserving anchoring bias from the original problem statement.

Swarm-Style Sketch

async function antColonySearch(problem: string, agents: number) {
  const pheromones = new Map<string, number>()
  for (let i = 0; i < agents; i++) {
    const idea = await openai.createChatCompletion({
      model: "gpt-4",
      messages: [{ 
        role: "system", 
        content: `Explore "${problem}" following pheromone: ${JSON.stringify([...pheromones])}` 
      }],
    })
    // Agents influence each other through shared map
    const key = extractKeyIdea(idea)
    pheromones.set(key, (pheromones.get(key) || 0) + 1)
  }
  return [...pheromones.entries()].sort((a, b) => b[1] - a[1])[0][0]
}

Key distinction: The pheromones map creates information flow between agents, whereas ADHD's frames remain blind to each other until the final critic step.

Performance Characteristics and Trade-offs

Benchmarks reported in README.md demonstrate ADHD's specific advantages for open-ended engineering problems:

  • +190% breadth of solutions explored
  • +290% novelty compared to single-shot baselines
  • +520% improvement in trap detection (identifying hidden failure modes)

Self-consistency excels at closed-form reasoning (math, logic) where a single correct answer exists, but remains limited by the shared context's anchoring effect. Swarm methods suit optimization and routing problems where emergent behavior is desirable, though they require careful tuning of interaction rules and global state. ADHD targets "brain-storm-room" scenarios—design tasks, architectural decisions, and complex engineering challenges where discovering non-obvious angles matters more than converging on a consensus.

Summary

  • True Isolation: ADHD enforces zero shared context during the divergence phase, unlike self-consistency (shared window) and swarm methods (pheromone/state sharing).
  • Explicit Critic: A dedicated evaluation phase separates generation from judgment, implemented in src/engine.ts after parallel frame completion.
  • Cognitive Frames: Divergence is driven by structural reframing (defined in src/frames.ts) rather than random sampling or local heuristics.
  • Concurrency: Frames execute as parallel query() calls, maximizing throughput compared to sequentially dependent approaches.
  • Use Case Alignment: Choose ADHD for ideation requiring breadth and novelty; use self-consistency for verification tasks and swarm methods for emergent optimization.

Frequently Asked Questions

What makes ADHD different from standard self-consistency?

Self-consistency generates multiple answers by sampling different chain-of-thought traces from the same prompt, then votes on the most common result. ADHD instead spawns completely isolated reasoning processes using distinct cognitive frames, preventing any single chain from influencing others. The critic phase then explicitly evaluates and refines these isolated ideas rather than simply counting votes.

How does ADHD prevent anchoring bias compared to swarm methods?

Swarm methods allow agents to communicate through indirect signals (pheromones, global state) or direct interaction during the search process. ADHD eliminates this by design: according to src/frames.ts, frames are constructed to never share context during the divergence phase. The system prompt explicitly forbids evaluation until the critic step, ensuring each frame explores its own solution space without anchoring on the group's intermediate findings.

When should I use ADHD over Tree-of-Thought?

Use ADHD when the problem requires exploring fundamentally different angles on the same question (e.g., "How would an economist vs. a security researcher view this system?"). Tree-of-Thought (ToT) branches explore variations of the same reasoning path, evaluating each step locally. ADHD's frames re-pose the entire problem, making it superior for open-ended design tasks where breadth matters more than depth along a single logical chain, as detailed in documentation/vs-cot-and-tot.md.

Is ADHD suitable for closed-form reasoning tasks like math problems?

No. ADHD is optimized for open-ended ideation where multiple valid solutions exist and novelty is valued. For closed-form problems with a single correct answer (mathematical proofs, logic puzzles), self-consistency or direct chain-of-thought prompting typically performs better because they leverage the model's deterministic reasoning rather than seeking divergent perspectives. The repository's benchmarks focus on engineering design challenges where trap detection and solution breadth are critical.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →