﻿# MLServer decode_args: input names become part of the runtime interface

Understand how MLServer decode_args maps protocol inputs to an annotated prediction signature, and why renaming a Python argument can change the serving contract.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-mlserver-decode-args-signature-names-input-mapping/
Language: en

## An internal rename breaks a caller

A custom question-answering runtime renames a Python parameter from context to passage for readability. Existing clients still send an input named context. When automatic argument decoding uses the prediction signature, the rename can affect the serving boundary rather than remaining an internal code cleanup.

Trace which interface supplies argument names before refactoring. The model library may accept either local variable name, but the decoder still needs a consistent mapping from the incoming protocol payload to the callable runtime.

## Decode_args derives a structured interface

The [custom-runtime guide](https://docs.seldon.ai/mlserver/user-guide/custom) explains that decode_args uses a method signature to identify input names, expected content types and response encoding. This simplifies runtimes whose IO can be expressed through built-in codecs.

It also describes using the full request interface for cases requiring more control, such as variable inputs or content types. Choose that boundary intentionally rather than depending on a simplified signature to express semantics it does not actually define.

## Names and types operate together

The [content-type guide](https://docs.seldon.ai/mlserver/user-guide/content-type) explains the codec system behind high-level Python values. A matching name alone does not guarantee a matching decoded representation; input types and codec scope still determine the object passed into inference.

[Explicit JSON Lines schemas](/journal/data-guide-jsonlines-explicit-schema/) provide related background on field contracts. A well-formed serialized input can still be incompatible with a consumer expecting another field name or another semantic interpretation of its value.

## Align model metadata with the callable boundary

The [model-settings reference](https://docs.seldon.ai/mlserver/api-reference/modelsettings) documents input and output metadata. Review that metadata alongside the runtime signature and real caller payloads so the advertised interface matches the decoder's expectations.

[Tokenizer release manifests](/journal/tokenizer-artifact-release-manifest/) illustrate why code-adjacent contracts deserve version identity. A model with unchanged weights can expose a different practical interface if runtime argument names or decoding rules change in the accompanying service release.

## Verify compatibility with an old caller payload

Keep a representative request from the supported public contract and replay it against the changed runtime. Check input association, decoded Python values and returned output encoding, rather than testing the model method only through direct Python calls.

If a rename is intentional, define the interface migration explicitly. If it is internal, preserve the external mapping. The useful result is a runtime whose convenience annotation remains consistent with what callers are actually allowed to send.
