How nvidia/tensorrt-edge-llm works
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: llmInferenceRuntime.h Inference runtime · engineExecutor.cpp TensorRT executor · modelArtifacts.cpp Model artifacts · edgellm_pybind.cpp Native bindings
Components 22
Model preparation
- Direct builder
experimental/builder/core/builder.py - Engine builder
cpp/builder/llmBuilder.cpp - Model artifacts
cpp/runtime/modelArtifacts.cpp
Request serving
- HTTP API
experimental/server/api/routes.py - Python engine
experimental/server/runtime/engine.py - Native bindings
experimental/pybind/edgellm_pybind.cpp
Inference runtime
- Request scheduler
cpp/scheduler/requestEngine.cpp - Inference runtime
cpp/runtime/llmInferenceRuntime.h - Input preparation
cpp/runtime/preprocess/stepPreparer.cpp - Tokenization
cpp/tokenizer/tokenizer.cpp - Decoding strategies
cpp/runtime/decoding/decoderRegistry.cpp - Token streaming
cpp/runtime/streaming.h - KV cache
cpp/runtime/kvCacheManager.cpp - Context reuse
cpp/runtime/state/contextCache/contextCacheManager.cpp - Multimodal runners
cpp/multimodal/common/multimodalRunner.cpp
GPU execution
- TensorRT executor
cpp/runtime/exec/engineExecutor.cpp - Tensor pipeline
cpp/runtime/state/pipelineIO.cpp - TensorRT plugins
cpp/plugins/utils/pluginUtils.cpp - CUDA kernels
cpp/kernels/embeddingKernels/embeddingKernels.h - Multi-device
cpp/runtime/multiDevice/runtimeCoordinator.cpp
Other components
- Application caller
- HF checkpoint
Connections 25
- HF checkpoint → Direct builder: builds from
README.md - HF checkpoint → Engine builder: builds from
README.md - Direct builder → Model artifacts: produces artifacts
- Engine builder → Model artifacts: builds engines
README.md - Model artifacts → Inference runtime: deploys into
README.md - Application caller → HTTP API: sends requests
README.md - HTTP API → Python engine: routes requests
experimental/server/runtime/engine.py - Python engine → Native bindings: calls native runtime
experimental/server/runtime/engine.py - Application caller → Native bindings: calls API
- Native bindings → Inference runtime: exposes runtime
experimental/pybind/edgellm_pybind.cpp - Inference runtime → Request scheduler: submits requests
cpp/scheduler/requestEngine.cpp - Request scheduler → Inference runtime: executes generation
cpp/scheduler/requestEngine.cpp - Inference runtime → Input preparation: prepares steps
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