Inside Claude's Deep Research Orchestration Architecture

Authors
  • avatar
    Name
    Nino
    Occupation
    Senior Tech Editor

A single call to Claude’s /deep-research can consume upwards of 6.57 million tokens. To put that in perspective, in terms of data-center energy consumption, that is roughly equivalent to leaving a desk lamp on for several days. This isn't just a long conversation; it is a massive, coordinated computational effort.

Recently, while using this tool to solve a complex system design problem—preventing a local 10B Mixture of Experts (MoE) model from hallucinating citation relevance in medical transcripts—I decided to look under the hood. By reconstructing the .jsonl traces and the local .js orchestrator, a fascinating architecture emerged: a deterministic Map-Reduce pipeline designed for adversarial verification.

The Lineage: From Bug Hunting to Research

A comment on line 9 of the orchestration script reveals its origins: // Ported from bughunter architecture. WebSearch/WebFetch instead of git/grep.

This is a critical insight. The system wasn't built from a creative writing framework; it was ported from an automated bug-hunting loop. In bug hunting, you generate a failure hypothesis and then aggressively try to disprove it against the codebase. Claude's Deep Research applies this same adversarial logic to the open web. It generates hypotheses based on your query and then systematically tries to "kill" them using fetched evidence.

To build similar high-reliability systems, developers often turn to n1n.ai, which provides the unified API access needed to orchestrate multiple model types—such as Claude 3.5 for reasoning and GPT-4o for verification—within a single harness.

The Software Harness: Constraining the Model

In the context of LLMs, a "harness" is a controlled environment that restricts the model to specific, typed tasks. The orchestrator defines five primary primitives:

  1. SCOPE: Decomposing the root question into sub-tasks.
  2. SEARCH: Executing targeted web queries.
  3. EXTRACT: Pulling specific claims and verbatim quotes from sources.
  4. VERDICT: An adversarial panel voting on the validity of claims.
  5. REPORT: Synthesizing the verified evidence into a final response.

Every LLM call within this pipeline is forced to output structured JSON. This prevents "model drift," where the AI begins to hallucinate or wander off-topic in free-form prose. The orchestration forces a strict schema at the tool-call level.

The Research Policy: Constants as Governance

Much of the system's behavior is governed by four hard-coded constants at the top of the file:

const VOTES_PER_CLAIM = 3
const REFUTATIONS_REQUIRED = 2
const MAX_FETCH = 15
const MAX_VERIFY_CLAIMS = 25

These variables represent the "judgment policy." If you want a more skeptical researcher, you increase VOTES_PER_CLAIM. If you are on a budget, you lower MAX_FETCH. By using n1n.ai, developers can implement this exact logic, routing different steps of the pipeline to the most cost-effective models while maintaining high-speed throughput.

Step-by-Step Execution: The Medical Transcript Case Study

In my specific test case, I asked how to stop a 10B MoE model from hallucinating citation relevance. The model could find quotes, but 41% of them didn't actually support the rubric.

1. The Scope Phase

The orchestrator took this vague problem and broke it into five distinct research surfaces:

  • Selection-time techniques: Moving citation logic upstream.
  • NLI/Cross-encoder classifiers: Using specialized models for verification.
  • Attribution benchmarks: Looking at ALCE, RARR, and AIS.
  • UX degradation: How to show weak evidence to users.
  • Skeptical pass: Analyzing why small-LLM self-verification usually fails.

2. The Fetch & Extract Phase

The system performed a "Map" operation across these surfaces. For every page found, an extractor looked for concrete claims. The schema required a verbatim quote for every claim:

{
  "claim": "Cross-encoders outperform LLM self-correction in low-label medical domains.",
  "quote": "Simply switching stronger models cannot significantly improve...",
  "importance": "central"
}

If no relevant claim was found, the page was discarded immediately. This ensures the "Reduce" phase only handles high-signal data.

3. Triage and Sorting

With a limit of MAX_VERIFY_CLAIMS = 25, the system cannot verify everything. It uses a plain-code sorting logic:

  1. Importance: Central > Supporting > Tangential.
  2. Source Quality: Primary PDF > Secondary > Blog > Forum.

This triage is handled by the JavaScript runtime, not the LLM, ensuring that the most critical evidence is prioritized for the expensive verification step.

4. Adversarial Verification (The Verdict)

This is the most impressive part of the architecture. Each of the top 25 claims is sent to three independent agents. Their prompt is an adversarial checklist: look for cherry-picked data or overreach. The instruction is: "Default to refuted=true if uncertain."

In my run, a claim regarding GPT-3.5 precision was killed 2-1 because the verifiers noted the source paper only reported Macro-F1, which could be manipulated by thresholding, making the "0.85 precision" claim an overreach.

Building Your Own Research Harness

To replicate this level of reliability, you shouldn't rely on a single prompt. You need a pipeline that manages state and budget. By leveraging the low-latency infrastructure at n1n.ai, you can build a Map-Reduce agentic flow that uses Claude 3.5 Sonnet for the initial SCOPE and EXTRACT phases, and high-speed models like DeepSeek-V3 for the VERDICT panel.

FeatureStandard RAGDeep Research Harness
Logic TypeLinear / RetrievalAdversarial / Iterative
OutputFree-form ProseStructured & Verified JSON
Error HandlingHallucination likelyInfrastructure failure = Inconclusive
VerificationSingle-passMulti-agent Quorum (3+ votes)

Technical Pro-Tips for Implementation

  • Sanitize Inputs: The Claude orchestrator uses regex to strip ANSI escape sequences and IDN homographs from fetched web content. Never trust external data entering your LLM context.
  • Quote-First Selection: As the research discovered, the best way to stop hallucinations is to force the model to select the quote before it writes the claim.
  • Evidence Budget: Set hard limits on how many sources you will read. High-quality research is about filtering, not just collecting.

By treating LLM research as a software engineering problem rather than a prompting problem, we can achieve levels of precision (0.85+) that were previously impossible for small-scale models.

Get a free API key at n1n.ai.