Principle:SeldonIO Seldon core Explainer Pipeline Integration
| Field | Value |
|---|---|
| Overview | Integrating explainer models into Seldon pipelines using custom transform steps for input/output adaptation. |
| Domains | Explainability, Data_Flow |
| Workflow | Model_Explainability |
| Related Implementation | SeldonIO_Seldon_core_Seldon_Pipeline_CRD_Explainer |
| Last Updated | 2026-02-13 00:00 GMT |
Description
When an explainer needs to work with a pipeline (rather than a single model), custom transform models adapt data between the pipeline format and the explainer's expected format. The explainer uses pipelineRef instead of modelRef to reference the pipeline for black-box inference. Transform models extend MLServer's MLModel class to reshape tensors.
The key challenge with pipeline-level explanation is format mismatch:
- The explainer expects inputs and outputs in a specific format (e.g., raw text in, class label out).
- The pipeline may have intermediate transformations that change tensor shapes, names, or data types.
- Custom transform models bridge this gap by reshaping the pipeline's output to match what the explainer expects.
The pipeline integration pattern involves:
- Deploy the base pipeline: The inference pipeline with all its steps (e.g., speech-to-text, then sentiment classification).
- Create output transform models: Custom MLServer models that reshape the pipeline output to match the explainer's expected format.
- Deploy the explanation pipeline: A new pipeline that wraps the base pipeline's output through the transform model.
- Deploy the explainer with pipelineRef: The explainer references the explanation pipeline for its black-box queries.
Theoretical Basis
Pipeline-level explanation requires adapting the explanation interface to work with multi-step inference graphs. Transform models act as adapters in the adapter pattern, converting between the explainer's expected input format and the pipeline's actual format. The pipelineRef mechanism routes the explainer's black-box queries through the full pipeline.
This design preserves the model-agnostic nature of the explanation algorithms while supporting complex inference topologies. The explainer still treats the pipeline as a black box; it only needs a consistent input/output interface, which the transform models provide.
The tensorMap field in pipeline steps enables tensor renaming, mapping the pipeline's input tensor name to the transform model's expected input name without additional code.
Usage
When adding explainability to pipeline-based inference (e.g., speech-to-sentiment). This pattern is necessary whenever the base inference involves multiple models in a pipeline, and the explainer cannot directly reference a single model's prediction function.
Knowledge Sources
- Repo: SeldonIO/seldon-core
- Doc: Seldon Core 2 Documentation
Related Pages
- SeldonIO_Seldon_core_Seldon_Pipeline_CRD_Explainer - implements this principle - Concrete pattern for integrating explainers into pipelines.
- SeldonIO_Seldon_core_Explainer_Model_Deployment - related principle - The explainer CRD uses pipelineRef instead of modelRef for pipeline integration.
- SeldonIO_Seldon_core_Explanation_Generation - related principle - The explanation generation flow is the same once the pipeline is set up.
Implementation:SeldonIO_Seldon_core_Seldon_Pipeline_CRD_Explainer