Skip to content

Multimodal and omni models on TPU

Use this guide for models that take images, video or audio with text and answer in text (multimodal), or that answer with speech or images (omni). On TPU7x, the multimodal path's aggregated topology is validated nightly: every pod encodes the media, prefills and decodes, and the router extends prefix-cache affinity to images by hashing each image with the text around it and estimating its token cost. Omni serving (vLLM-Omni) is GPU and Intel XPU only, summarized at the end. Chapter 20 explains the affinity scoring this extends.

Prerequisites

  • A GKE tpu7x node pool with 2x2x1 topology. The TPU overlay (ACCELERATOR_TYPE=tpu/v7, INFRA_PROVIDER=gke, aggregated only) runs Qwen/Qwen3-VL-32B-Instruct on 8 replicas of 4 chips each, --tensor-parallel-size=4, every pod requesting all 4 chips of its node. Lower replicas in the overlay's Deployment to try it on a smaller pool.
  • A PriorityClass named medium: the TPU pods set priorityClassName: medium and the guide does not create it. Create it or drop the field.
  • The repository, CRDs, namespace and Secret from the quickstart, steps 1 to 3.
  • The encode-disaggregated topologies (E/PD, E/P/D) run on NVIDIA GPUs only and are experimental.

Steps

1. Set the environment and topology

export REPO_ROOT=$(realpath $(git rev-parse --show-toplevel))
export GUIDE_NAME=multimodal-serving
export NAMESPACE=llm-d-multimodal-serving
export MONITORING=false
export MONITORING_VALUES=
export TOPOLOGY=aggregation
export ACCELERATOR_TYPE=tpu/v7
export MODEL_SERVER=vllm
export INFRA_PROVIDER=gke
export MODEL=Qwen/Qwen3-VL-32B-Instruct
source ${REPO_ROOT}/guides/env.sh

export TOPOLOGY_DIR="${REPO_ROOT}/guides/${GUIDE_NAME}/aggregation"
export ROUTER_VALUES="${TOPOLOGY_DIR}/router/aggregation.values.yaml"
export MODEL_SERVER_PATH="${TOPOLOGY_DIR}/modelserver/${ACCELERATOR_TYPE}/${MODEL_SERVER}/${INFRA_PROVIDER}"
export MONITORING_COMPONENT=monitoring
export POD_SELECTOR=llm-d.ai/guide=aggregation
export ROUTER_BASE_VALUES="${REPO_ROOT}/guides/recipes/router/base.values.yaml"

For google/gemma-4-31B-it, use the aggregation/modelserver/tpu/v7/vllm/gemma4/ overlay as MODEL_SERVER_PATH, set MODEL=google/gemma-4-31B-it, and swap in the commented-out Gemma 4 estimate: block in aggregation/router/aggregation.values.yaml: Gemma 4 spends a fixed token budget per image (70, 140, 280, 560 or 1120), while Qwen3-VL's cost is width x height / 1024.

Check: ls ${MODEL_SERVER_PATH} lists a kustomization.yaml.

2. Deploy the router

helm install ${GUIDE_NAME} \
  ${ROUTER_STANDALONE_CHART} \
  -f ${ROUTER_BASE_VALUES} \
  ${MONITORING_VALUES} \
  -f ${ROUTER_VALUES} \
  -n ${NAMESPACE} --version ${ROUTER_CHART_VERSION}

The values tune the affinity filter for Qwen3-VL-32B-Instruct on H200 at TP=2: peakPrefillThroughput: 15751, affinityThreshold: 0.6 (the 0.8 default would never engage on multimodal prompts) and maxTTFTPenaltyMs: 36000 for vision-encoder time that token counts miss. Recalibrate them for TPU7x with the calibration recipe.

Check: the EPP pod is Running.

3. Deploy the model servers

kubectl apply -n ${NAMESPACE} -k ${MODEL_SERVER_PATH}

Check: all pods selected by ${POD_SELECTOR} are Running and ready (kubectl get pods -n ${NAMESPACE} -l ${POD_SELECTOR}).

4. Send a multimodal request

export IP=$(kubectl get service ${GUIDE_NAME}-epp -n ${NAMESPACE} -o jsonpath='{.spec.clusterIP}')
kubectl run mm-test --rm -i --restart=Never \
  --image=${CURL_TEST_IMAGE} \
  --namespace="${NAMESPACE}" \
  --env="IP=${IP}" \
  --env="MODEL=${MODEL}" \
  -- /bin/sh -c 'IMG="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAS0lEQVR42u3PQQkAAAgAsetfWiP4FgYrsKZeS0BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEDgsqnc8OJg6Ln3AAAAAElFTkSuQmCC"
    curl -sS -X POST "http://${IP}/v1/chat/completions" -H "Content-Type: application/json" \
      -d "{\"model\": \"${MODEL}\", \"messages\": [{\"role\": \"user\", \"content\": [{\"type\": \"image_url\", \"image_url\": {\"url\": \"${IMG}\"}}, {\"type\": \"text\", \"text\": \"What color is this image?\"}]}], \"max_tokens\": 64}" \
      | jq -r ".choices[0].message.content"'

The image is a 64x64 PNG embedded in the request, so the pods need no outbound network. The router reads an inline image's size itself; for an image URL it falls back to defaultResolution, and for video it reads x-llm-d-video-fps, x-llm-d-video-duration-seconds and x-llm-d-video-resolution headers.

Check: the answer names the color, red.

5. Verify multimodal routing

Send the same prompt of about 700 tokens with the same image twice, then a text-only request:

kubectl run mm-cache-test --rm -i --restart=Never \
  --image=${CURL_TEST_IMAGE} \
  --namespace="${NAMESPACE}" \
  --env="IP=${IP}" \
  --env="MODEL=${MODEL}" \
  -- /bin/sh -c 'P=$(for i in $(seq 1 40); do printf "The router hashes the text and the image of a multimodal request to find a warm pod. "; done)
    IMG="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAS0lEQVR42u3PQQkAAAgAsetfWiP4FgYrsKZeS0BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEDgsqnc8OJg6Ln3AAAAAElFTkSuQmCC"
    for i in 1 2; do
      curl -sS -o /dev/null -w "image request ${i}: HTTP %{http_code}\n" -X POST "http://${IP}/v1/chat/completions" \
        -H "Content-Type: application/json" \
        -d "{\"model\": \"${MODEL}\", \"messages\": [{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"${P} What color is this image?\"}, {\"type\": \"image_url\", \"image_url\": {\"url\": \"${IMG}\"}}]}], \"max_tokens\": 16}"
    done
    curl -sS -o /dev/null -w "text-only request: HTTP %{http_code}\n" -X POST "http://${IP}/v1/chat/completions" \
      -H "Content-Type: application/json" \
      -d "{\"model\": \"${MODEL}\", \"messages\": [{\"role\": \"user\", \"content\": \"How are you today?\"}], \"max_tokens\": 16}"'

for pod in $(kubectl get pods -n ${NAMESPACE} -l ${POD_SELECTOR} -o jsonpath='{.items[*].metadata.name}'); do
  port=$(kubectl get pod ${pod} -n ${NAMESPACE} -o jsonpath='{.spec.containers[?(@.name=="modelserver")].ports[?(@.name=="modelserver")].containerPort}')
  echo "== ${pod}"
  kubectl get --raw "/api/v1/namespaces/${NAMESPACE}/pods/${pod}:${port}/proxy/metrics" \
    | grep -E '^vllm:(request_success_total|prefix_cache_hits_total|mm_cache_(queries|hits)_total)' || true
done

Check: both image requests land on one pod: its vllm:request_success_total grows by 2, vllm:prefix_cache_hits_total by roughly the prompt length, and vllm:mm_cache_hits_total by 1. Different pods mean affinity did not apply; read kubectl logs -n ${NAMESPACE} deploy/${GUIDE_NAME}-epp.

6. Clean up

kubectl delete -n ${NAMESPACE} -k ${MODEL_SERVER_PATH}
helm uninstall ${GUIDE_NAME} -n ${NAMESPACE}
kubectl delete namespace ${NAMESPACE}

Check: the namespace is gone.

7. Omni models (GPU and Intel XPU only)

The omni path serves models whose output is speech or images on vLLM-Omni (and SGLang for the image tasks), chosen with TASK: omni (Qwen/Qwen3-Omni-30B-A3B-Instruct, text and spoken answers on /v1/chat/completions), text-to-image (/v1/images/generations), image-to-image (/v1/images/edits) and text-to-speech (/v1/audio/speech). It has no TPU configuration. The router routes on load only (queue-scorer for omni, active-request-scorer for the others), because diffusion models do not decode token by token and the Qwen3-Omni pipeline runs with prefix caching off.

Check: not applicable on TPU; follow the upstream page on a GPU cluster.

Troubleshooting

Symptom Cause Fix
TPU pods rejected at admission priorityClassName: medium does not exist Create the PriorityClass or drop the field
Pod Pending Selector, chip count or TP changed without the others Change nodeSelector, google.com/tpu and --tensor-parallel-size together
Same image requests land on different pods Affinity not applied, or token estimate wrong for the model EPP logs; for Gemma 4 the static estimate: block
Affinity never engages affinityThreshold above the cacheable share of your prompts Keep 0.6 or lower for multimodal prompts
Video routed with default cost Client sent no video metadata headers Send the three x-llm-d-video-* headers

References