๐ค๏ธ Parallelization
July 11, 2026 ยท View on GitHub
๐ Home โบ Workflows โบ ๐ค๏ธ Parallelization
โ 02 Routing โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 04 Orchestrator-Workers โ
๐ค๏ธ Parallelization
TL;DR: Execute independent tasks simultaneously and aggregate outputs. Two flavors: Sectioning (split data, combine all) and Voting (same task, pick best).
Core Concept
%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#64748b'}}}%%
flowchart LR
classDef user fill:#6366f1,stroke:#4f46e5,stroke-width:2px,color:#ffffff
classDef main fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#ffffff
classDef parallel fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#ffffff
IN["๐โโ๏ธ๐ฅ"]:::user --> SPLIT["๐๐ Split"]:::main
SPLIT -->|"๐๐ชบ"| A["๐ฆโก"]:::parallel
SPLIT -->|"๐๐ชบ"| B["๐ฆโก"]:::parallel
SPLIT -->|"๐๐ชบ"| C["๐ฆโก"]:::parallel
A -->|"๐ฆ๐ค"| MERGE["๐๐ Merge"]:::main
B -->|"๐ฆ๐ค"| MERGE
C -->|"๐ฆ๐ค"| MERGE
MERGE -->|"๐๐ค"| OUT["๐โโ๏ธ๐ค"]:::user
What it looks like for real โ parallel waves executing in the terminal (tasks with no mutual deps run concurrently, the lanes are the fan-out):

From the runnable version of this exact pattern: 03-parallelization.nika.yaml โ offline, no API key.
Key Insight
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ ๏ธ IMPORTANT: Parallelization vs Orchestrator-Workers โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ In Parallelization, all spawned subagents are IDENTICAL. โ
โ Same prompt, same capabilities. They are INTERCHANGEABLE. โ
โ โ
โ ๐ค๏ธ Parallelization: ๐ฆโก = ๐ฆโก = ๐ฆโก (clones) โ
โ ๐ฆ Orchestrator-Workers: ๐ฆ๐ โ ๐ฆโก โ ๐ฆ๐จ (specialists) โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Characteristics
| Property | Value |
|---|---|
| Complexity | Medium |
| Parallelism | High |
| Human-Loop | Optional |
| Iteration | None |
2 Types of Parallelization
Type 1: ๐ค๏ธ Sectioning (Split DATA)
Break a task into independent subtasks run in parallel, then combine ALL results.
%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#64748b'}}}%%
flowchart LR
classDef user fill:#6366f1,stroke:#4f46e5,stroke-width:2px,color:#ffffff
classDef main fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#ffffff
classDef parallel fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#ffffff
S_IN["๐โโ๏ธ๐ฅ 100 files"]:::user --> S_SPLIT["๐๐ค๏ธ"]:::main
S_SPLIT -->|"๐๐ชบ"| S1["๐ฆโก Files 1-50"]:::parallel
S_SPLIT -->|"๐๐ชบ"| S2["๐ฆโก Files 51-100"]:::parallel
S1 -->|"๐ฆ๐ค"| S_MERGE["๐๐ Combine ALL"]:::main
S2 -->|"๐ฆ๐ค"| S_MERGE
S_MERGE -->|"๐๐ค"| S_OUT["๐โโ๏ธ๐ค"]:::user
Examples:
- Guardrails: One instance processes queries, another screens for inappropriate content
- Evals: Each LLM call evaluates a different aspect of model performance
Type 2: ๐ณ๏ธ Voting (Same TASK, pick BEST)
Run the same task multiple times to get diverse outputs, then select the best.
%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#64748b'}}}%%
flowchart LR
classDef user fill:#6366f1,stroke:#4f46e5,stroke-width:2px,color:#ffffff
classDef main fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#ffffff
classDef parallel fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#ffffff
classDef success fill:#10b981,stroke:#059669,stroke-width:2px,color:#ffffff
V_IN["๐โโ๏ธ๐ฅ Write headline"]:::user --> V_COPY["๐๐ 3 attempts"]:::main
V_COPY -->|"๐๐ชบ"| V1["๐ฆโก Version A"]:::parallel
V_COPY -->|"๐๐ชบ"| V2["๐ฆโก Version B"]:::parallel
V_COPY -->|"๐๐ชบ"| V3["๐ฆโก Version C"]:::parallel
V1 -->|"๐ฆ๐ค"| VOTE{"๐๐ณ๏ธ Compare"}:::main
V2 -->|"๐ฆ๐ค"| VOTE
V3 -->|"๐ฆ๐ค"| VOTE
VOTE -->|"๐โ
B wins"| BEST["๐ Best"]:::success
Voting Selection Strategies
| Strategy | How It Works | Best For |
|---|---|---|
| LLM Judge | Main Agent compares outputs and selects best | Creative content, subjective quality |
| Scoring Rubric | Each output scored against criteria, highest wins | Code review, compliance checks |
| Consensus | Majority agreement required | Critical decisions, validation |
| Weighted Vote | Outputs weighted by model capability | Mixed model ensemble |
Summary
| Type | Workers | Input | Output |
|---|---|---|---|
| ๐ค๏ธ Sectioning | IDENTICAL | Different DATA chunks | Combine ALL |
| ๐ณ๏ธ Voting | IDENTICAL | Same DATA | Pick ONE best |
When to Use
Parallelization is effective when the divided subtasks can be parallelized for speed, or when multiple perspectives are needed for higher confidence results.
When NOT to Use
- Tasks depend on each other's output
- Sequential order matters
- Limited resources
Variant: ๐ Parallel Tool Calling
Execute multiple independent ๐ง tool calls in a single message for efficiency.
%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#64748b'}}}%%
flowchart TB
classDef main fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#ffffff
classDef state fill:#10b981,stroke:#059669,stroke-width:2px,color:#ffffff
MA["๐ Main Agent"]:::main -->|Single Message| TOOLS
subgraph TOOLS["๐ Parallel Tool Calls"]
T1["๐ง Read file1.ts"]
T2["๐ง Read file2.ts"]
T3["๐ง Read file3.ts"]
end
T1 --> RESULTS["โ
All Results"]:::state
T2 --> RESULTS
T3 --> RESULTS
RESULTS --> MA
classDef toolbox fill:#dbeafe,stroke:#3b82f6,stroke-width:2px,color:#1e40af
TOOLS:::toolbox
Variant: ๐งฌ Master-Clone
Spawn multiple isolated ๐ฆ instances handling independent domains with no shared state.
Key Characteristics
| Property | Value |
|---|---|
| Isolation | Complete - each clone has own context |
| State Sharing | None - clones cannot communicate |
| Best For | Independent domains, parallel generation |
| Merge Strategy | Combine all outputs (no conflict resolution needed) |
Diagram
%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#64748b'}}}%%
flowchart TB
classDef main fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#ffffff
classDef subagent fill:#ec4899,stroke:#db2777,stroke-width:2px,color:#ffffff
classDef state fill:#10b981,stroke:#059669,stroke-width:2px,color:#ffffff
MA["๐ Main Agent"]:::main
MA -->|"Context: fr-FR"| C1["๐ฆ Clone: fr-FR"]:::subagent
MA -->|"Context: es-ES"| C2["๐ฆ Clone: es-ES"]:::subagent
MA -->|"Context: de-DE"| C3["๐ฆ Clone: de-DE"]:::subagent
C1 -->|9 files| R1[Result: fr-FR]
C2 -->|9 files| R2[Result: es-ES]
C3 -->|9 files| R3[Result: de-DE]
R1 --> MERGE["โ
Merge Results"]:::state
R2 --> MERGE
R3 --> MERGE
MERGE --> MA
When to Use Master-Clone
| Use Case | Why Master-Clone? |
|---|---|
| Multi-locale generation | Each locale is independent domain |
| Multi-platform builds | iOS, Android, Web don't share state |
| Parallel documentation | Each doc section is self-contained |
| A/B test generation | Variants shouldn't influence each other |
| Multi-tenant operations | Tenant data must be isolated |
๐ This pattern, as a file
Runnable version (offline mock, no API key ยท nika check proves the DAG before any token is spent): patterns-as-code/03-parallelization.nika.yaml โ see Patterns as Code.
โ 02 Routing โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 04 Orchestrator-Workers โ