> ## Documentation Index
> Fetch the complete documentation index at: https://doc.blueapi.ir/llms.txt
> Use this file to discover all available pages before exploring further.

# EMEP Internal Component Dependency Graph

> Runtime dependency graph showing which EMEP components call which, with a legend explaining edge types and grouping.

The component dependency graph defines the runtime call relationships between all 16 EMEP components. A directed edge from A to B means component A invokes component B during execution.

## Dependency Graph

```mermaid theme={null}
graph TB
    subgraph Interface["Interface Layer"]
        CLI["CLI Specification"]
        API["API Specification"]
        CFG["Configuration"]
    end

    subgraph Orchestration["Orchestration"]
        EXP["ExperimentTracker"]
        DM["DeploymentManager"]
    end

    subgraph Core["Core Engine"]
        MCA["ModelCompatibilityAnalyzer"]
        ML["ModelLoader"]
        TE["TensorEngine"]
        ME["MergeEngine"]
        CG["CandidateGenerator"]
        EE["EvolutionEngine"]
        EV["EvaluationEngine"]
        BE["BenchmarkEngine"]
        FE["FitnessEngine"]
        MR["ModelRegistry"]
        DR["DatasetRegistry"]
        AS["ArtifactStore"]
    end

    subgraph Serving["Serving & Storage"]
        QE["QuantizationEngine"]
        IB["InferenceBackend"]
    end

    CLI --> EXP
    CLI --> MR
    API --> EXP
    API --> MR
    CFG --> EXP
    CFG --> MR
    CFG --> DR

    EXP --> MR
    EXP --> AS
    EXP --> EE
    EXP --> EV

    MR --> ML
    MR --> AS
    MR --> MCA

    MCA --> ML
    MCA --> TE

    ML --> AS
    ML --> TE

    ME --> ML
    ME --> TE
    ME --> MCA
    ME --> CG

    CG --> AS
    CG --> MR

    EE --> ME
    EE --> FE
    EE --> CG
    EE --> EXP

    EV --> BE
    EV --> IB
    EV --> FE
    EV --> EXP

    BE --> DR
    BE --> AS

    FE --> EV

    DM --> QE
    DM --> IB
    DM --> AS
    DM --> MR
    DM --> EXP

    QE --> ML
    QE --> AS

    IB --> ML
    IB --> QE
```

## Legend

| Edge Style          | Meaning                                      |
| ------------------- | -------------------------------------------- |
| Solid arrow         | Direct synchronous invocation                |
| Dashed arrow        | Asynchronous or event-driven invocation      |
| Bidirectional arrow | Mutual dependency (shared state or callback) |

## Component Grouping

| Group             | Components                                                                                                                                                                                               | Responsibility                                                     |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| Interface Layer   | CLI, API, Configuration                                                                                                                                                                                  | User-facing entry points and configuration loading                 |
| Orchestration     | ExperimentTracker, DeploymentManager                                                                                                                                                                     | Experiment lifecycle and release management                        |
| Core Engine       | ModelCompatibilityAnalyzer, ModelLoader, TensorEngine, MergeEngine, CandidateGenerator, EvolutionEngine, EvaluationEngine, BenchmarkEngine, FitnessEngine, ModelRegistry, DatasetRegistry, ArtifactStore | Primary data processing, merge, evolution, and evaluation pipeline |
| Serving & Storage | QuantizationEngine, InferenceBackend                                                                                                                                                                     | Post-merge optimization and inference execution                    |

## Key Dependency Patterns

1. **ExperimentTracker is central**: All major operations log through ExperimentTracker, which depends on ModelRegistry and ArtifactStore for persistence.
2. **MergeEngine is a hub**: MergeEngine calls ModelLoader, TensorEngine, ModelCompatibilityAnalyzer, and CandidateGenerator. No other component calls all four.
3. **EvolutionEngine drives the loop**: EvolutionEngine calls MergeEngine and FitnessEngine, creating the iterative search cycle.
4. **EvaluationEngine is isolated from MergeEngine**: EvaluationEngine does not call MergeEngine directly. It receives candidates from CandidateGenerator via ExperimentTracker.
5. **InferenceBackend is a leaf**: InferenceBackend is called by EvaluationEngine and DeploymentManager but calls only ModelLoader and QuantizationEngine.

## Cycle Detection

The only intentional cycle is EvolutionEngine → MergeEngine → CandidateGenerator → (via ExperimentTracker) → EvaluationEngine → FitnessEngine → EvolutionEngine. This is the primary research loop. All other dependencies are acyclic.

## Next Steps

See [System Dependency Map](/maps/system-dependency-map) for the executive pipeline view, or [Data Flow Map](/maps/data-flow-map) for the data class flows between components.
