# nvidia/tensorrt-edge-llm architecture

> Architecture diagram of the GitHub repository nvidia/tensorrt-edge-llm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nvidia/tensorrt-edge-llm
- Repository: https://github.com/nvidia/tensorrt-edge-llm
- Video tour (about a minute): https://gitdiagram.com/nvidia/tensorrt-edge-llm/video

## Overview

TensorRT Edge-LLM is an NVIDIA edge inference framework for text, vision, audio, speech, and action models. A typical path takes a model checkpoint through export or direct engine building, then deploys the resulting artifacts in the shared C++ runtime; requests are scheduled, preprocessed and decoded, with generated tokens streamed back to a caller. The graph also preserves multimodal handling, cache reuse, speculative decoding, multi-device execution, and the experimental Python server. Several runtime links are based on the README or source-index references; unsampled implementation details are not inferred.

Main entry points: [`cpp/runtime/llmInferenceRuntime.h`](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/llmInferenceRuntime.h) (Inference runtime), [`cpp/runtime/exec/engineExecutor.cpp`](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/exec/engineExecutor.cpp) (TensorRT executor), [`cpp/runtime/modelArtifacts.cpp`](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/modelArtifacts.cpp) (Model artifacts), [`experimental/pybind/edgellm_pybind.cpp`](https://github.com/nvidia/tensorrt-edge-llm/blob/main/experimental/pybind/edgellm_pybind.cpp) (Native bindings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontends["Model preparation"]
  node_pybuilder["Direct builder<br/>[builder.py]"]
  node_cppbuilder["Engine builder<br/>[llmBuilder.cpp]"]
  node_artifacts["Model artifacts<br/>[modelArtifacts.cpp]"]
end

subgraph group_serving["Request serving"]
  node_serverapi["HTTP API<br/>[routes.py]"]
  node_serverengine["Python engine<br/>[engine.py]"]
  node_pybind["Native bindings<br/>[edgellm_pybind.cpp]"]
end

subgraph group_runtime["Inference runtime"]
  node_scheduler["Request scheduler<br/>[requestEngine.cpp]"]
  node_runtime["Inference runtime"]
  node_preprocess["Input preparation<br/>[stepPreparer.cpp]"]
  node_tokenizer["Tokenization<br/>[tokenizer.cpp]"]
  node_decode["Decoding strategies"]
  node_stream["Token streaming<br/>[streaming.h]"]
  node_kv[("KV cache<br/>[kvCacheManager.cpp]")]
  node_contextcache[("Context reuse")]
  node_multimodal["Multimodal runners"]
end

subgraph group_execution["GPU execution"]
  node_executor["TensorRT executor<br/>[engineExecutor.cpp]"]
  node_pipeline["Tensor pipeline<br/>[pipelineIO.cpp]"]
  node_plugins["TensorRT plugins<br/>[pluginUtils.cpp]"]
  node_kernels["CUDA kernels<br/>[embeddingKernels.h]"]
  node_multidevice["Multi-device"]
end

node_user(("Application caller"))
node_checkpoint["HF checkpoint"]

node_checkpoint -->|"builds from"| node_pybuilder
node_checkpoint -->|"builds from"| node_cppbuilder
node_pybuilder -.->|"produces artifacts"| node_artifacts
node_cppbuilder -->|"builds engines"| node_artifacts
node_artifacts -->|"deploys into"| node_runtime
node_user -->|"sends requests"| node_serverapi
node_serverapi -->|"routes requests"| node_serverengine
node_serverengine -->|"calls native runtime"| node_pybind
node_user -.->|"calls API"| node_pybind
node_pybind -->|"exposes runtime"| node_runtime
node_runtime -.->|"submits requests"| node_scheduler
node_scheduler -->|"executes generation"| node_runtime
node_runtime -->|"prepares steps"| node_preprocess
node_runtime -.->|"uses decoding"| node_decode
node_runtime -.->|"handles tokens"| node_tokenizer
node_runtime -.->|"runs multimodal inputs"| node_multimodal
node_runtime -.->|"manages cache"| node_kv
node_runtime -.->|"reuses context"| node_contextcache
node_runtime -.->|"streams output"| node_stream
node_runtime -.->|"assembles tensors"| node_pipeline
node_runtime -.->|"invokes engine"| node_executor
node_executor -.->|"binds tensor inputs"| node_pipeline
node_executor -->|"loads plugins"| node_plugins
node_plugins -.->|"dispatches kernels"| node_kernels
node_runtime -.->|"coordinates devices"| node_multidevice

click node_pybuilder "https://github.com/nvidia/tensorrt-edge-llm/blob/main/experimental/builder/core/builder.py"
click node_cppbuilder "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/builder/llmBuilder.cpp"
click node_artifacts "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/modelArtifacts.cpp"
click node_serverapi "https://github.com/nvidia/tensorrt-edge-llm/blob/main/experimental/server/api/routes.py"
click node_serverengine "https://github.com/nvidia/tensorrt-edge-llm/blob/main/experimental/server/runtime/engine.py"
click node_pybind "https://github.com/nvidia/tensorrt-edge-llm/blob/main/experimental/pybind/edgellm_pybind.cpp"
click node_scheduler "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/scheduler/requestEngine.cpp"
click node_runtime "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/llmInferenceRuntime.h"
click node_preprocess "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/preprocess/stepPreparer.cpp"
click node_tokenizer "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/tokenizer/tokenizer.cpp"
click node_decode "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/decoding/decoderRegistry.cpp"
click node_stream "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/streaming.h"
click node_kv "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/kvCacheManager.cpp"
click node_contextcache "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/state/contextCache/contextCacheManager.cpp"
click node_multimodal "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/multimodal/common/multimodalRunner.cpp"
click node_executor "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/exec/engineExecutor.cpp"
click node_pipeline "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/state/pipelineIO.cpp"
click node_plugins "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/plugins/utils/pluginUtils.cpp"
click node_kernels "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/kernels/embeddingKernels/embeddingKernels.h"
click node_multidevice "https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/multiDevice/runtimeCoordinator.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pybuilder,node_cppbuilder,node_artifacts toneBlue
class node_serverapi,node_serverengine,node_pybind toneAmber
class node_scheduler,node_runtime,node_preprocess,node_tokenizer,node_decode,node_stream,node_kv,node_contextcache,node_multimodal toneMint
class node_executor,node_pipeline,node_plugins,node_kernels,node_multidevice toneRose
class node_user,node_checkpoint toneIndigo
```

## Components

### Model preparation

- [Direct builder](https://github.com/nvidia/tensorrt-edge-llm/blob/main/experimental/builder/core/builder.py): `experimental/builder/core/builder.py`
- [Engine builder](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/builder/llmBuilder.cpp): `cpp/builder/llmBuilder.cpp`
- [Model artifacts](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/modelArtifacts.cpp): `cpp/runtime/modelArtifacts.cpp`

### Request serving

- [HTTP API](https://github.com/nvidia/tensorrt-edge-llm/blob/main/experimental/server/api/routes.py): `experimental/server/api/routes.py`
- [Python engine](https://github.com/nvidia/tensorrt-edge-llm/blob/main/experimental/server/runtime/engine.py): `experimental/server/runtime/engine.py`
- [Native bindings](https://github.com/nvidia/tensorrt-edge-llm/blob/main/experimental/pybind/edgellm_pybind.cpp): `experimental/pybind/edgellm_pybind.cpp`

### Inference runtime

- [Request scheduler](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/scheduler/requestEngine.cpp): `cpp/scheduler/requestEngine.cpp`
- [Inference runtime](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/llmInferenceRuntime.h): `cpp/runtime/llmInferenceRuntime.h`
- [Input preparation](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/preprocess/stepPreparer.cpp): `cpp/runtime/preprocess/stepPreparer.cpp`
- [Tokenization](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/tokenizer/tokenizer.cpp): `cpp/tokenizer/tokenizer.cpp`
- [Decoding strategies](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/decoding/decoderRegistry.cpp): `cpp/runtime/decoding/decoderRegistry.cpp`
- [Token streaming](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/streaming.h): `cpp/runtime/streaming.h`
- [KV cache](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/kvCacheManager.cpp): `cpp/runtime/kvCacheManager.cpp`
- [Context reuse](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/state/contextCache/contextCacheManager.cpp): `cpp/runtime/state/contextCache/contextCacheManager.cpp`
- [Multimodal runners](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/multimodal/common/multimodalRunner.cpp): `cpp/multimodal/common/multimodalRunner.cpp`

### GPU execution

- [TensorRT executor](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/exec/engineExecutor.cpp): `cpp/runtime/exec/engineExecutor.cpp`
- [Tensor pipeline](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/state/pipelineIO.cpp): `cpp/runtime/state/pipelineIO.cpp`
- [TensorRT plugins](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/plugins/utils/pluginUtils.cpp): `cpp/plugins/utils/pluginUtils.cpp`
- [CUDA kernels](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/kernels/embeddingKernels/embeddingKernels.h): `cpp/kernels/embeddingKernels/embeddingKernels.h`
- [Multi-device](https://github.com/nvidia/tensorrt-edge-llm/blob/main/cpp/runtime/multiDevice/runtimeCoordinator.cpp): `cpp/runtime/multiDevice/runtimeCoordinator.cpp`

### Other components

- **Application caller**
- **HF checkpoint**

## Connections

- HF checkpoint → Direct builder: builds from (evidence: `README.md`)
- HF checkpoint → Engine builder: builds from (evidence: `README.md`)
- Direct builder → Model artifacts: produces artifacts
- Engine builder → Model artifacts: builds engines (evidence: `README.md`)
- Model artifacts → Inference runtime: deploys into (evidence: `README.md`)
- Application caller → HTTP API: sends requests (evidence: `README.md`)
- HTTP API → Python engine: routes requests (evidence: `experimental/server/runtime/engine.py`)
- Python engine → Native bindings: calls native runtime (evidence: `experimental/server/runtime/engine.py`)
- Application caller → Native bindings: calls API
- Native bindings → Inference runtime: exposes runtime (evidence: `experimental/pybind/edgellm_pybind.cpp`)
- Inference runtime → Request scheduler: submits requests (evidence: `cpp/scheduler/requestEngine.cpp`)
- Request scheduler → Inference runtime: executes generation (evidence: `cpp/scheduler/requestEngine.cpp`)
- Inference runtime → Input preparation: prepares steps (evidence: `cpp/runtime/llmInferenceRuntime.h`)
- Inference runtime → Decoding strategies: uses decoding
- Inference runtime → Tokenization: handles tokens
- Inference runtime → Multimodal runners: runs multimodal inputs
- Inference runtime → KV cache: manages cache
- Inference runtime → Context reuse: reuses context
- Inference runtime → Token streaming: streams output
- Inference runtime → Tensor pipeline: assembles tensors
- Inference runtime → TensorRT executor: invokes engine
- TensorRT executor → Tensor pipeline: binds tensor inputs
- TensorRT executor → TensorRT plugins: loads plugins
- TensorRT plugins → CUDA kernels: dispatches kernels
- Inference runtime → Multi-device: coordinates devices
