How it works

Serving modes

off, shadow and serve - how the LiteLLM plugin decides who answers a call, when it defers to the cloud model, and how rollback works.

A served task keeps its LiteLLM name, so callers change nothing. The name points at the ModelStill plugin, and the old cloud deployment moves to <task>-cloud. A deployment file sets the mode.

ModeWho answersWhat is logged
offthe cloud model, every callthe prompt and the cloud answer
shadowthe cloud model; a shadow_sample share is also sent to the student in the backgroundboth answers
servethe student, when it is the deployed model and its confidence is at least threshold; otherwise the cloud modelboth answers whenever both exist

Deferral

In serve mode the plugin defers to the cloud model and records why:

ReasonMeaning
low_confidencethe student's confidence is below the threshold
model_mismatchthe student server reported another model than student_model
student_errorthe student call failed
no_thresholdthe deployment has no threshold, so everything defers
no_confidencethe student returned no log-probs to compute confidence from

Confidence is exp_mean_logprob by default: exp of the mean token log-prob of the answer. min_token_prob looks at the least sure token instead. The threshold is calibrated on a calibration split for a target error rate with modelstill serve calibrate.

Deferred answers are training data: both answers are kept.

Rollout

Go off, then shadow, then serve. Read the shadow traffic before serving. A student is served only after its gate passes.

Rollback

Set the mode to off where the plugin takes it from (see below): the MCP tool set_deployment_mode with mode: "off", PUT /v1/tasks/{slug}/deployment, or mode: off in the deployment file (quoted or not, both read as off). The plugin re-reads its source every reload_seconds (30 by default), and every call goes back to the cloud. A broken file or a bad API reply keeps the last good deployment. To roll back to an older student instead, set the student model to its versioned name.

The endpoint watchdog can do this for you: modelstill watch check --fallback-deployment deployment.yaml writes mode: off to the file when a check is critical, and also sets the API record off when the command is connected to the API.

Where the plugin takes the mode from

Each task has a deployment file on the proxy host. When the plugin config names the API (an api block with its URL and a token), the plugin also reads the task's API deployment record on the same interval. The API record wins whenever the API answers:

APIDeployment served
not configuredthe file
answers with a record for the taskthe record (mode, threshold, shadow sample, and student model, falling back to the file's)
answers with no recordthe file
unreachable or returns something invalidthe last good deployment; a file edit made during the outage applies

So with the API configured you change the mode from the MCP tool, the API or the dashboard, with no file edit or restart. The file is the bootstrap and the fallback during an outage. Once the API answers again its record wins, so repeat an outage-time file change there. Every change gives the next calls a new deployment_id in serving_events, and the plugin's health shows the source and any error.

See Serve with the LiteLLM plugin for the configuration.

On this page