Deploying LLMs on Google Cloud Vertex AI

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1All 1564 services
Deploying LLMs on Google Cloud Vertex AI
Medium
~3-5 days
Frequently Asked Questions

AI Development Areas

AI Solution Development Stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1347
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1247
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    948
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1183
  • image_logo-advance_0.webp
    B2B Advance company logo design
    642
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    921

When Vertex AI becomes a bottleneck

We've been deploying LLMs on Vertex AI for over 5 years and know why the standard Model Garden falls short for high‑load systems. In practice, you face cold start endpoints, inefficient autoscaling, and uncontrollable GPU billing. For a SaaS product with p99 latency under 500 ms, you need a custom image with vLLM, TGI, or Triton. We use vLLM with prefix caching and block size 16 — this yields up to 3x throughput improvement on repeated prompts.

Over 50+ projects we've accumulated the practice of turning Vertex from a black box into a predictable platform. On one financial trading project we reduced cold start from 12 seconds to 300 ms by keeping one replica active. GPU savings from proper quantization reached 35%, translating to roughly $2,500 per month saved on a four‑GPU setup.

Why standard Model Garden doesn't fit high‑load systems

Out‑of‑the‑box models from Model Garden deploy with a single command, but you lose control over batch size, max-model-len, quantization, and scheduler selection. For high loads you need a custom image with vLLM or Triton. vLLM’s prefix caching gives up to 3x throughput gain on repeated prompts.

How we deploy LLMs: step‑by‑step

  1. Model and infrastructure audit. Evaluate latency and throughput requirements, choose GPU/TPU and quantization type (INT4 vs FP16).
  2. Containerization with vLLM or TGI. Build a Docker image with optimised parameters — health check, predict route, env vars for Vertex AI Endpoints.
  3. Endpoint and autoscaling setup. Configure min_replica_count, max_replica_count, custom metrics custom.googleapis.com|model/requests_per_replica.
  4. Monitoring and alerting. Cloud Monitoring dashboard: latency p50/p95/p99, GPU utilization, token count, error rate.
  5. Documentation and training. Runbook for developers, terraform config for repeatable deployment.

Estimated timeline: 7 to 14 business days. Cost is calculated individually.

Minimizing cold starts

Cold starts occur when the endpoint scales to zero or on first call after idle. Vertex AI does not preload the model into memory. We work around this in two ways: set min_replica_count=1 for critical services (small additional cost) or use warm‑up requests via Cloud Scheduler.

# Warm up endpoint every 30 seconds
from google.cloud import aiplatform
import requests

def warm_endpoint(endpoint_name: str):
    warm_payload = {"prompt": "ping", "max_tokens": 1}
    # call rawPredict
    response = requests.post(
        endpoint_name,
        json=warm_payload,
        headers={"Authorization": f"Bearer {token}"}
    )

On a financial trading project we cut cold start from 12 seconds to 300 ms — simply kept one replica active and added client‑side keep‑alive. Contact us to discuss your scenario.

Inference choice: Cloud TPU or GPU?

Characteristic TPU v5e (8‑chip) NVIDIA A100 (80GB, 1x)
Throughput (tokens/s) ~4500 (Llama 3 8B, batch=64) ~2100
Cost per hour Higher Lower
Vertex availability Only us‑central2‑b Many regions
Setup complexity High (JAX, MaxText) Medium (PyTorch, CUDA)

Tensor Processing Unit — Google's specialised chip. Internal tests on Llama 3 8B with batch=64.

TPU v5e delivers roughly 2x more throughput per dollar for large batches, but ties you to us‑central2‑b. For production with multi‑regional HA we recommend GPU or a hybrid: TPU for batch processing, GPU for online inference.

How to configure autoscaling and monitoring?

Vertex AI automatically publishes metrics to Cloud Monitoring, but they are insufficient. We add custom metrics: generated tokens count, prefix cache hit rate (prefix_cache_hit_rate), time to first token (TTFT). This allows quick detection of model degradation after an update.

# Custom metric in Cloud Monitoring
from google.cloud import monitoring_v3

client = monitoring_v3.MetricServiceClient()
series = monitoring_v3.TimeSeries(
    metric={"type": "custom.googleapis.com/model/tokens_per_second"},
    resource={"type": "global"},
    points=[{
        "interval": {"end_time": {"seconds": now}},
        "value": {"double_value": tokens_per_sec}
    }]
)
client.create_time_series(name=project_name, time_series=[series])
Example configuration for Llama 3 70B
machine_type: g2-standard-24
accelerator_type: NVIDIA_A100_80G
accelerator_count: 4

vLLM vs TGI for inference

Parameter vLLM TGI
Throughput (batch=1) ~1200 tok/s ~1000 tok/s
Prefix caching support Yes Limited
Customisation flexibility High Medium

vLLM outperforms TGI by 1.2x in throughput for single requests and has more advanced caching.

What's included

  • Model and infrastructure audit — analyse requirements, select GPU/TPU, recommend quantization.
  • Containerization — build Docker image with vLLM or TGI, configure health check and predict route.
  • Deploy on Vertex AI Endpoints — set up autoscaling, custom metrics, and monitoring.
  • Documentation — runbook for developers, terraform config for repeatable deployment.
  • Team training — knowledge transfer on operations and alerting.
  • Technical support — 2 weeks of post‑deployment support, guaranteed stable operation under load.

Why choose us

  • Over 5 years experience in MLOps and LLM deployment
  • 50+ deployed models, including Llama 3, Mistral, Gemma, Qwen
  • Certified Google Cloud Professional ML Engineers
  • Full lifecycle support: from model selection to operation, ensuring stable performance

You can save up to 40% on GPU costs with proper autoscaling and quantization. Get a consultation for your project — we'll evaluate the optimal deployment architecture and estimate the budget.

Sample deployment via Vertex AI Endpoints

from google.cloud import aiplatform

aiplatform.init(project="my-project", location="us-central1")

# Upload model from GCS
model = aiplatform.Model.upload(
    display_name="llama3-8b-vllm",
    artifact_uri="gs://my-bucket/models/llama3-8b/",
    serving_container_image_uri="us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-2:latest",
    serving_container_command=[
        "python", "-m", "vllm.entrypoints.openai.api_server",
        "--model=/gcs/models/llama3-8b/",
        "--tensor-parallel-size=1",
        "--max-model-len=8192",
        "--host=0.0.0.0",
        "--port=8080"
    ],
    serving_container_ports=[{"containerPort": 8080}],
    serving_container_health_route="/health",
    serving_container_predict_route="/v1/completions",
    serving_container_environment_variables={
        "TRANSFORMERS_CACHE": "/gcs/hf_cache/",
    }
)

# Deploy endpoint
endpoint = aiplatform.Endpoint.create(display_name="llama3-8b-endpoint")
model.deploy(
    endpoint=endpoint,
    deployed_model_display_name="llama3-8b-v1",
    machine_type="g2-standard-12",     # 1x L4 GPU
    accelerator_type="NVIDIA_L4",
    accelerator_count=1,
    min_replica_count=1,
    max_replica_count=10,             # autoscaling
    traffic_percentage=100,
)

Request a consultation — we'll find the optimal configuration for your workload.

MLOps: Infrastructure for Training, Deploying, and Monitoring ML Models

The model is trained, metrics — F1 0.94 on validation. Three months later in production, quality drops by 12%. No one knows when — there is no monitoring. It's impossible to retrain quickly — the training script is in a Jupyter notebook of a data scientist who has already left. Data for retraining is collected manually from three disparate systems. About half of the projects come to us with this pain. We build a turnkey MLOps platform: from experiment tracking to automatic deployment and data drift monitoring. We will assess your infrastructure in 1–2 weeks, and in 4–6 weeks you will get a basic MLOps core running in production. Our team has 10+ years of experience in ML infrastructure, over 50 implementations.

How does MLOps infrastructure benefit your ML projects?

Experiment Tracking and Reproducibility

Without tracking, an ML project turns into chaos: it's unclear which checkpoint is better, which hyperparameters were used, which dataset. Reproducing a result a month later is a quest.

Why is experiment tracking the foundation of reproducibility?

MLflow is an open source standard for tracking. It logs parameters, metrics, artifacts (models, graphs), and code. MLflow Model Registry is a centralized model storage with versioning and lifecycle stages (Staging → Production → Archived). Deployment via MLflow Serving or integration with external systems.

Typical initialization in code:

import mlflow

mlflow.set_experiment("fraud-detection-v2")
with mlflow.start_run():
    mlflow.log_params({"learning_rate": 3e-4, "batch_size": 64, "epochs": 10})
    mlflow.log_metric("val_f1", val_f1, step=epoch)
    mlflow.pytorch.log_model(model, "model")

This is the minimum. In production, we add logging of system metrics (GPU utilization, memory), dataset (hash, version), code (git commit hash). Weights & Biases — richer UI, collaboration features, sweep for hyperparameter optimization. MLflow — for on-premise deployment without external dependencies.

DVC (Data Version Control) — versioning of data and models on top of git. Data is stored in S3/GCS/Azure Blob, only metadata (hashes) in git. dvc repro reproduces the entire pipeline from raw data to metrics.

To ensure reproducibility of training, fix random seeds (torch.manual_seed, numpy.random.seed, random.seed) and record them in experiment metadata. Without this, debugging irregular results is painful. Log the dataset version (DVC hash) and git commit — then any experiment can be reproduced down to the byte.

Pipeline Orchestration: Kubeflow, Airflow, Prefect

A pipeline orchestrator becomes necessary when: A 100-line training script in cron is fine for simple tasks. But as soon as you have a multi-step pipeline (data loading → preprocessing → feature engineering → training → validation → deployment if quality above threshold), you need an orchestrator with retry logic, visualization, and alerts.

Kubeflow — Kubernetes-native orchestrator for ML (see Kubeflow). Each step is a Docker container. Supports parallel steps, conditional branches, artifacts between steps. Integrates with Katib (AutoML), KServe (serving), Feast (feature store).

Apache Airflow — more general DAG orchestrator. Wide ecosystem of operators (S3, Spark, DBT, Kubernetes). Easier to deploy if Airflow already exists in the company.

Prefect / Metaflow — less boilerplate. Prefect 2.x with @flow and @task decorators — quick start for small teams.

Typical training pipeline architecture on Kubeflow:

  1. Data ingestion component — fetches data from S3/DB, validates schema via Great Expectations
  2. Preprocessing component — transformations, normalization, train/val/test split
  3. Training component — training on GPU, logging to MLflow
  4. Evaluation component — metric calculation, comparison with baseline in Model Registry
  5. Conditional deployment — deploy only if new model is better than current by >2% F1

Each component is a separate Docker image. Pipeline is versioned in git. Scheduled run (retraining once a week on new data) or manual.

Model Registry and Lifecycle Management

Model Registry is not just a checkpoint store. It is a centralized system that knows:

  • Which model is currently in production (and with what metrics)
  • History of all versions with training parameters
  • Metadata: dataset, git commit, validation results
  • Lifecycle stage: None → Staging → Production → Archived

MLflow Model Registry — standard. For enterprise — Vertex AI Model Registry (GCP), SageMaker Model Registry (AWS), Azure ML Model Registry.

Model promotion through stages: automatically move model to Staging after successful eval, then manual or automatic (during A/B test) promotion to Production. Rollback — switch to previous Production version in seconds.

Serving: From FastAPI to Triton Inference Server

Simple case. FastAPI + PyTorch/ONNX on one server — 80% of production ML deployments are exactly that. Sufficient for most tasks with load up to 100 req/s.

from fastapi import FastAPI
import onnxruntime as ort

app = FastAPI()
session = ort.InferenceSession("model.onnx", providers=["CUDAExecutionProvider"])

@app.post("/predict")
async def predict(request: PredictRequest):
    inputs = preprocess(request.text)
    outputs = session.run(None, {"input_ids": inputs})
    return {"label": postprocess(outputs)}

Triton Inference Server — production standard for high loads (500+ req/s). Dynamic batching, concurrent model execution, model ensemble. Supports TensorRT, ONNX, PyTorch TorchScript, TensorFlow SavedModel.

KServe — Kubernetes-native ML serving with autoscaling, canary deployments, A/B testing out of the box. Scale-to-zero for inactive models — savings on infrastructure up to 40% annually for a project with 10 models.

Monitoring: Data Drift, Model Drift, Infrastructure Metrics

Monitoring — what is usually done last and regretted first. Three levels.

Infrastructure monitoring. Latency (P50/P95/P99), throughput (req/s), error rate (4xx, 5xx), GPU/CPU utilization. Prometheus + Grafana — standard. Alert when P99 latency > threshold or error rate > 1%.

Data drift monitoring. Distribution of input data changes over time. Detect via PSI (Population Stability Index) for numerical features: PSI > 0.2 — strong drift. Chi-squared test for categorical, Kolmogorov-Smirnov test for continuous. Evidently AI — open source library with ready-made drift tests.

Model drift monitoring. If ground truth is delayed (e.g., we know conversion after a week) — monitor real metrics. If not — surrogate metrics: distribution of prediction scores, proportion of confident predictions.

Alerting. Three levels: INFO (minor drift, log it), WARNING (significant, notify team), CRITICAL (quality dropped below threshold — automatic switch to fallback model).

Why is data drift monitoring important?

Without it, you learn about model degradation only from user complaints or ringing SLA. A drift alert allows you to retrain the model in advance, before errors start causing losses. In one of our projects, PSI monitoring detected drift 2 days after a data source change — this saved the campaign.

Common Mistake Consequences Solution
Lack of data versioning Irreproducible experiments Implement DVC or similar
Manual model deployment Human errors, slow rollback Automate CI/CD pipeline
Monitoring only by business metrics Late drift detection Add data drift monitoring (PSI, KS)

Feature Store

Feature Store solves the training-serving skew problem. If preprocessing during training and inference is implemented in two different places — divergence is inevitable.

A Feature Store is needed when:

  • Several models use the same features
  • Features are computed from streaming data (real-time)
  • Large team with different people on feature engineering and model training

Feast — open source Feature Store. Offline store (S3 + Parquet) for training, online store (Redis, DynamoDB) for low-latency inference. Feature definitions as code, materialization job syncs offline → online.

Tecton (commercial), Vertex AI Feature Store (GCP), SageMaker Feature Store (AWS) — managed options with less ops overhead.

CI/CD for ML

ML CI/CD is regular CI/CD plus specific ML steps.

ML-specific checks in CI:

  • Reproducibility check: run training with a fixed seed, result must match
  • Data validation: Great Expectations or Pandera on schema/distribution checks
  • Model performance check: automatic eval on holdout, block merge if degradation > threshold
  • Latency regression test: inference must meet SLA

GitOps for deployment. Merge to main → CI triggers training → eval → if passes → automatic deployment to Staging → smoke tests → manual promotion to Production or automatic upon successful canary.

Tools: GitHub Actions / GitLab CI for CI, ArgoCD for GitOps deployment on Kubernetes.

What's Included in MLOps Platform Development

We provide a full cycle of work, documentation, and team training.

Stage Duration Result
Audit of current infrastructure and data pipeline 1–2 weeks Roadmap with risks and priorities
Core deployment: MLflow, orchestrator, serving 4–6 weeks Working training and deployment pipeline
Feature Store and CI/CD for ML 2–3 months Feature Store, automatic retrain and deployment
Drift monitoring and alerting 3–4 weeks Dashboards, alerts, incident playbook
Team training and documentation 1–2 weeks Runbook, policies, training for data scientists

Total time from audit to full MLOps platform: 3–5 months. Also possible phased launch: basic level (tracking + serving) in 4–6 weeks.

Cost is calculated individually based on data volume, number of models, and infrastructure requirements. Order an MLOps infrastructure audit — get a roadmap in 1–2 weeks. Contact us for a project assessment — we will send a preliminary estimate within 2 business days.

Note: warranty on architectural solutions — 12 months. We provide integration certificates with major cloud providers (AWS, GCP, Azure). During our work, we have not lost a single client after the first implementation — the experience of 50+ successful MLOps projects speaks for itself. Get a consultation on building an MLOps platform today.