TECHNOLOGY

TensorFlow Serving REST: instances and inputs describe different tensor packaging contracts

In this article
THE QUICK TAKE

Row and column prediction formats differ in input grouping and response envelopes; changing the request key is not a semantics-free formatting edit.

A compact request changes the expected response

A client switches a prediction payload from instances to inputs to make a multi-input request more compact. Its decoder still reads predictions, the response envelope associated with the row representation. The model can execute correctly while the application fails to find the returned values. Treat a format change as a complete request-and-response contract update. It affects grouping and decoding, not merely the appearance of equivalent JSON text in a request fixture copied into a client library.

Row representation groups individual instances

The REST reference describes row-oriented instances and column-oriented inputs. Row representation requires compatible leading dimensions across named inputs, while the column form permits each named input to carry its own shape. Select the form matching the actual signature rather than forcing every model into a table-of-examples assumption. An input representing shared context may not have the same leading dimension as a separate tensor representing the collection being scored by the model.

Logical tensor names still come from the signature

The signature guide defines the named model inputs and outputs. Both packaging formats must preserve those logical meanings. Explicit table contracts offer useful background on field relationships: compactly grouping columns does not authorize independent reordering of their sample associations. A structurally valid request can still present values in the wrong semantic alignment if a client changes ordering while translating from its original row-based representation into named tensor arrays.

Output decoding follows the request representation

The REST documentation distinguishes predictions for row responses from outputs for column responses and describes the treatment of single versus multiple named output tensors. The SavedModel guide provides context for the underlying exported output interface. Axis interpretation also helps separate valid dimensions from correct meaning. Verify the final decoded application values rather than considering the request conversion complete as soon as the server returns a successful status and a JSON body.

Round-trip a recognizable multi-input sample

Prepare named inputs whose values make accidental permutation visible. Send the supported row and column forms where both are appropriate, then compare the decoded model outputs with the same reference computation. Include a model whose inputs have different leading dimensions to test the reason for choosing column packaging. A correct client documents both the input shape relationships and the response envelope it consumes, rather than treating instances and inputs as interchangeable spelling for every prediction interface.

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.

Explore GPU hosting
← All articles