In this article
A serving Transformer is an application preprocessing component; its output schema must match the predictor, regardless of the neural model architecture.
A preprocessing refactor leaves inference numerically plausible
An image endpoint moves normalization into a KServe Transformer while its predictor image still normalizes the incoming tensor. Requests succeed but receive preprocessing twice. The serving graph is operationally connected while the model’s numerical input contract has changed. Describe which component owns decoding, resizing, normalization and output interpretation. The word Transformer here names a serving component, not evidence that a particular transformer neural architecture owns or automatically performs those operations for the application.
KServe defines an ordered handler lifecycle
The custom-transformer guide describes preprocess, predict and postprocess. The preprocessing output feeds prediction, and prediction output feeds postprocessing. With predictor_host, the built-in prediction path calls the predictor. When overriding handlers, preserve the intended boundary deliberately. Successful execution of every handler does not establish that the tensor entering the model has the same numerical interpretation as the tensor used during training or an isolated reference evaluation.
Transport must preserve the declared tensor contract
The data-plane guide distinguishes serving protocol families. The custom-transformer guide describes REST and the gRPC Open Inference path. Choose the transport and message representation actually supported by the predictor, rather than assuming a Python object can be forwarded identically through every endpoint. Attention-mask axes offer a useful parallel: compatible dimensions do not prove the correct semantic interpretation of axes, channels or prepared model features.
The resource declaration exposes separate components
The control-plane API defines predictor and transformer components in an InferenceService. Keep their deployed image identities and configuration revisions visible together. A changed preprocessing image can modify model behavior while weights remain unchanged. Tokenizer release manifests provide related background on preserving model-adjacent interpretation artifacts. Treat the whole input-preparation contract as a release dependency rather than documenting only the predictor’s checkpoint identifier and expecting the rest to remain compatible implicitly.
Compare the boundary tensor with a reference
Use a recognizable raw input and capture the prepared predictor input in a controlled test. Compare it with the isolated reference transformation, then verify the final interpreted response. Exercise the actual transport instead of testing handlers only through direct Python calls. A correct custom transformer applies each intended transformation at its documented owner and produces a predictor-compatible request; model quality cannot be inferred solely from a ready service and a well-formed response body.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.