Path to Production: Serving dgem at Scale
This track takes dgem from your laptop to a production endpoint and keeps it running. Identifiers such as
<PROJECT>, <REGION> and <ENDPOINT_ID> are placeholders. The cloud stages run a serving image that you
build into your own Artifact Registry.
The journey
Section titled “The journey”| Step | Page | What you get |
|---|---|---|
| 1 | Run on your laptop | A first decision in minutes on Apple Silicon or a local NVIDIA GPU |
| 2 | Use a remote GPU | Point the CLI, Studio and MCP at any hosted endpoint |
| 3 | Deploy on Cloud Run | Your own scale-to-zero GPU service: no cost when idle, a few minutes of cold start |
| 4 | Production on Vertex AI | An always-warm endpoint with autoscaling replicas and zero cold start |
| 5 | Gateway and routing | One URL for users, automatic failover from Vertex to Cloud Run, IAP |
| 6 | Latency and capacity | Request design, engine settings and how to measure your own |
| 7 | Operations runbook | Health, promotion, rollback, teardown and troubleshooting |
| 8 | Monitoring and alerts | Health checks, dashboards, alerts and what to do when they fire |
Hosting it yourself? Build the serving image first; Evaluate dgem on your own GPU covers GPU requirements, checking the install with the regression matrix, and a custom evaluation on your own labelled data.
Crawl → walk → run
Section titled “Crawl → walk → run”| Stage | Platform | Use it for | Cost model | Cold start |
|---|---|---|---|---|
| Crawl | Apple Silicon (diffgemma, Metal, q4) or a local NVIDIA GPU | Development, writing policies, offline and private data | Your machine | None (Metal is a different engine; its latency doesn’t transfer to GPU serving) |
| Walk | Cloud Run GPU, 1× RTX PRO 6000 | Batch evaluation, research, bursty internal use, failover | Per instance-second; no cost when idle | A few minutes from idle (lean image + Direct VPC egress) |
| Run | Vertex AI dedicated endpoint, g4-standard-48 + 1× RTX PRO 6000 | Production: always warm, IAM, autoscaling, monitoring, images | Per replica-hour while deployed | None (min replicas ≥ 1) |
The same image, policies, CLI, HTTP API and MCP server work on every stage. Latency depends on your policies, concurrency and network: measure it on your own deployment (method).
TL;DR recommendations
Section titled “TL;DR recommendations”- GPU: use a Blackwell GPU (RTX PRO 6000). The checkpoint is NVFP4 (4-bit); Blackwell runs FP4 natively, and the L4 was slower on every request type in our tests. Other GPUs are untested (requirements).
- Production: a Vertex AI dedicated endpoint with minimum replicas ≥ 1, autoscaling on GPU duty cycle.
- Failover and batch: a scale-to-zero Cloud Run GPU service using the lean image and Direct VPC egress.
- One gateway (
dgem serve) in front of both, routingvertex_firstwith automatic failover. - Requests:
"samples": 1by default; opt in to4only when you need agreement/standard error; never"auto"on latency-sensitive paths. Put all questions about one input in one request. - Change safely: validate every new serving image next to your current deployment before switching traffic (runbook).
Method
Section titled “Method”- Tools:
scripts/serving_speed.py(latency and concurrency),scripts/coldstart_probe.py(Cloud Run cold start),scripts/contract_diff.py(API contract). Failed requests are counted as errors, never as zero latency. - Use a single client in the same region as the endpoint: that measures service-side characteristics, not end-user internet latency.