Self-hosting Gemma 4 on vLLM starts with choosing the right size
A team that wants Gemma 4 running inside infrastructure it controls should choose the model size before anything else, because the choice is driven by two things: the minimum BF16 GPU memory each model needs and the features the application depends on, such as tool calling, reasoning output, image input or speculative decoding. The vLLM Gemma 4 recipe lists minimum BF16 hardware as one 24 GB GPU for E2B and E4B, one 40 GB GPU for 12B, and one 80 GB GPU for 31B and 26B-A4B. Those figures are a starting floor for loading weights, not a sizing plan, so the team still needs to account for context length, concurrency and KV cache headroom before it commits to hardware.
vLLM is an open-source inference and serving engine for large language models, licensed under Apache-2.0 according to its GitHub repository, and it originated at UC Berkeley as a community project associated with the PyTorch Foundation. It has no paid edition, so the license cost is zero, but running it is not free. The vllm serve command starts an OpenAI-compatible server with endpoints such as /v1/chat/completions, so applications written for the OpenAI API can point at a Gemma 4 deployment with a changed base URL. Teams should confirm that their client libraries and the specific endpoints they call are supported by the vLLM release they plan to run, since the vLLM online serving documentation lists the current set.
Cost comes from three places: the accelerator capacity the model runs on, the surrounding infrastructure such as storage, networking, load balancing and monitoring, and the people who install, operate, patch and upgrade the platform. Accelerator cost recurs whether you rent cloud GPUs or amortize owned hardware, and it rises with the memory tier you pick. Ask any implementation partner for a quote that separates one-time work, such as build and hardening, from recurring work, such as upgrades to new vLLM minor releases, which the project ships about every two weeks. Confirm the GPU model, memory per device and the number of devices in writing before comparing quotes, because the same model size can fit very different budgets depending on those choices.
Which Gemma 4 size fits which GPU memory budget
This table sets each Gemma 4 size against the minimum BF16 hardware in the vLLM Gemma 4 recipe, then adds the trade-offs and speculative decoding settings that come after the memory decision. Read the hardware column as a floor for loading the model in BF16, not as a sizing guide for your traffic, context length or concurrency. Confirm every minimum against the recipe before you order hardware.
| Model size | Minimum BF16 hardware (recipe) | Trade-off to weigh | When to choose it |
|---|---|---|---|
| E2B | One 24 GB GPU | Smallest footprint of the family, so the lowest capacity needed, but it has the least headroom for quality-sensitive work. | Tight memory budgets and high request volume where a lighter model is acceptable. |
| E4B | One 24 GB GPU | Same minimum hardware as E2B, so the decision turns on quality needs rather than the memory floor. | A single 24 GB GPU is available and the workload needs more capability than E2B. |
| 12B | One 40 GB GPU | Needs a larger card than the E-series, so the hardware cost per instance rises with the step up. | A 40 GB GPU is the largest card you can dedicate to one instance. |
| 26B-A4B | One 80 GB GPU | Requires an 80 GB card at BF16, so memory headroom for the KV cache is the main constraint to test. | Workloads that need more capability than 12B on a single 80 GB GPU. |
| 31B | One 80 GB GPU | Same minimum card as 26B-A4B, with the dense 31B model as the larger option to benchmark for your traffic. | You need the largest Gemma 4 option in the recipe and can run it on one 80 GB GPU. |
| Precision (BF16 baseline) | Recipe minimums assume BF16 weights | Lower precision formats may reduce memory, but confirm their support and quality in the recipe before relying on them. | Start from BF16 to establish a baseline, then test alternatives on your own workload. |
| Speculative decoding (MTP assistant) | Matching -assistant checkpoint via --speculative-config | The recipe recommends num_speculative_tokens between 2 and 8 by model size. The assistant checkpoint adds memory, so budget for it on top of the target model. | Latency matters more than peak throughput and the extra memory fits your card. |
How AMD, TPU and Xeon options differ from NVIDIA
The Gemma 4 recipe states its minimum BF16 hardware in GPU memory terms: one 24 GB GPU for E2B and E4B, one 40 GB GPU for 12B, and one 80 GB GPU for 31B and 26B-A4B. These are the figures you can plan a purchase or instance type against directly, and they describe the model weights at the recipe's settings. Longer context, higher concurrency and extra features all add memory on top of that baseline.
- Memory headroom: Treat the listed minimums as a floor. Confirm how much memory remains for the KV cache at the context length and concurrency you expect.
- Speculative decoding: The recipe pairs each model with a matching -assistant checkpoint, set through --speculative-config, with num_speculative_tokens between 2 and 8 depending on model size.
- Parallelism: Tensor parallelism within a node is the documented way to split a model across several GPUs.
- Version pinning: vLLM ships minor releases about every two weeks, so pin the release you validated against and retest when you move.
Check the recipe's hardware table and flags against the exact vLLM version you deploy before you order capacity.
vLLM documents support for AMD ROCm GPUs in its installation guide, so AMD is a supported platform at the engine level. The Gemma 4 recipe's memory figures are written for GPU memory on a single card, but the sources available here do not give Gemma 4 results on AMD hardware. Do not assume the NVIDIA layouts carry over to AMD parts without checking the recipe and your own test runs.
- Per-GPU memory: Compare the memory on the AMD card you are considering with the minimum for your model size, then add headroom for the KV cache.
- Recipe coverage: Confirm whether the recipe includes ROCm layouts, flags and parser settings for Gemma 4, or whether you must derive them yourself.
- Feature parity: Test multimodal input, tool and reasoning parsers, and speculative decoding separately on ROCm, since a feature that works on CUDA may not be covered for the same model on AMD.
- Software stack: Pin the ROCm version, container image and vLLM release together, because each combination must be validated as one unit.
Ask your vendor or the vLLM project for a written statement of Gemma 4 status on the exact AMD part and ROCm version you plan to run.
The installation guide lists NVIDIA CUDA, AMD ROCm and Intel XPU GPUs, x86, ARM and Apple silicon CPUs, and IBM Z CPUs as directly supported. It also says further accelerators run through third-party hardware plugins that live outside the main repository. TPU does not appear in that list of supported platforms, so any TPU path depends on a plugin, and the sources available here do not confirm Gemma 4 on TPU.
- Plugin ownership: Identify who maintains the TPU plugin, where it is published and how fast it follows vLLM releases.
- Version compatibility: Confirm which vLLM release the plugin supports, since a plugin outside the main repository can lag behind new releases.
- Gemma 4 coverage: Ask whether the plugin supports the Gemma 4 sizes you need, and whether it covers multimodal input, parsers and speculative decoding.
- Operating model: Decide who triages a failure that sits in the plugin rather than in vLLM itself, and how you will roll back.
If the plugin cannot show Gemma 4 running with the features your application uses, treat TPU as a research path until the gaps are closed.
vLLM runs on x86 CPUs, and Xeon processors are x86 CPUs, so the installation guide supports the architecture. That statement is architecture-level. The sources available here do not give Gemma 4 memory figures, throughput or feature results for Xeon, so the GPU minimums in the recipe do not translate to a CPU server. Intel XPU GPUs are a separate platform in the same guide and should not be confused with Xeon CPUs.
- System memory: Size host RAM from measurements of your own model and context length, not from GPU figures.
- Throughput: Measure latency and tokens per second with your workload, because the sources do not provide CPU benchmarks for this model.
- Feature support: Confirm multimodal input, tool and reasoning parsers, and speculative decoding on the CPU backend before depending on them.
- Model choice: Whether any Gemma 4 size is practical on a Xeon server is a measurement question that this page cannot answer.
Before you commit to a Xeon design, run the exact model, release and parser settings on the target hardware and record the results so the decision rests on your own numbers.
Setting up Gemma 4 on vLLM in order
This sequence takes a team from choosing a Gemma 4 checkpoint to a running, verified vLLM endpoint with the parsers and speculative decoding the application needs. Each step ends with a check so problems surface before users depend on the server.
Confirm the checkpoint and chat template
The platform engineer selects the Gemma 4 size and confirms the exact Hugging Face checkpoint name, including whether a matching -assistant checkpoint exists for speculative decoding. Confirm the chat template the checkpoint ships with, because vLLM needs a chat template to serve the chat completions API and can take one through --chat-template if the model lacks it. Check the vLLM Gemma 4 recipe for the precision it targets. You are done when you can name the checkpoint, its precision, and where the chat template comes from.
Size the GPU for the chosen model
Match the model size to accelerator memory using the minimum BF16 hardware in the vLLM Gemma 4 recipe: one 24 GB GPU for E2B and E4B, one 40 GB GPU for 12B, and one 80 GB GPU for 31B and 26B-A4B. Treat these as floors. Context length, batch size and KV cache demand add memory on top, so confirm headroom with your own workload before buying or allocating hardware. The infrastructure owner should record the GPU model, memory and driver stack, and you are done when the chosen hardware meets or exceeds the recipe minimum for that checkpoint.
Install vLLM and start the server with recipe flags
The platform engineer installs vLLM on a host whose accelerator and driver stack appear in the vLLM installation docs, then starts the server with vllm serve using the flags listed in the Gemma 4 recipe. Pin the vLLM version you test against, since releases ship about every two weeks, and record it with the flags. Start the server on a private interface, not a public one. You are done when the process loads the weights without errors and logs show the model is ready to accept requests.
Add tool and reasoning parsers if needed
If the application calls tools or consumes reasoning output, the engineer adds the parser flags that the Gemma 4 recipe specifies, so tool call and reasoning text are returned in structured fields rather than raw model output. Parser choice depends on the model family and the vLLM release, so confirm the exact parser name against the recipe and the release you pinned. Restart the server and send one request that triggers a tool call. You are done when the response contains a structured tool call the application can parse.
Configure the MTP assistant checkpoint for speculative decoding
If you want speculative decoding, the engineer downloads the matching -assistant checkpoint for the same Gemma 4 size and passes it through --speculative-config as the recipe describes. Set num_speculative_tokens within the recipe range of 2 to 8, using the value for your model size, and start with the recipe value rather than a tuned guess. Because speculative decoding changes decoding behavior and memory use, benchmark with and without it on your own prompts. You are done when the server starts with the assistant loaded and the logs confirm speculative decoding is active.
Verify chat completions responses
The application owner or engineer sends test requests to /v1/chat/completions using a representative prompt set, including one multi-turn conversation and one request that uses the parser path if it applies. Confirm the response has the expected message structure, sensible output, and finish reasons, and that the endpoint is reachable only through the network path you intend. If you set --api-key, test that requests without the key are rejected on /v1 routes. You are done when repeated requests return well-formed responses and the access checks behave as designed.
Verify the metrics output
The platform engineer queries /metrics on the API server and confirms Prometheus-format output covering request counts, token throughput, latency histograms and KV cache use. Because /metrics is not protected by --api-key, confirm your reverse proxy blocks it from user-facing networks and that only your monitoring system can scrape it. Send a short load test and check that counters and latency histograms move. You are done when the metrics change under test traffic and the scrape path is restricted to monitoring.
Multimodal limits, tool calls and reasoning output
The chat completions API only works when the model has a chat template, either built into the checkpoint or supplied with --chat-template on vllm serve. For Gemma 4, confirm in the vLLM Gemma 4 recipe that the exact checkpoint you pick ships a template that handles system messages, tool results and multimodal content parts, because a missing or mismatched template fails at request time, not at load time. Your application sends messages in the OpenAI format to /v1/chat/completions, so template behavior is part of your API contract. Test it with a request that includes a tool result and an image before any application team depends on it.
Tool calling and reasoning output change application code more than most flags do. The --tool-call-parser and --reasoning-parser settings decide how the server turns raw model output into structured tool_calls and separated reasoning fields. Pick the parser named in the recipe for your checkpoint, not a parser that happens to work for another model family. If the parser is wrong, your code receives tool-call markup inside content, or reasoning text leaks into the user-visible answer. Ask the team to confirm both parser names against the recipe and to write a contract test that checks the response shape for a tool call and a plain answer. If your applications show reasoning to users, decide that before launch, since it affects what you log and how you filter output.
Multimodal input consumes memory on top of the language model weights and the KV cache, and image or audio tokens count against the context length you configure. The recipe's minimum BF16 hardware figures assume a text workload, so a deployment that accepts images at high resolution or many images per request needs its own budget. Limit the number of images per request, set the maximum multimodal items per prompt if the server version offers that control, and measure peak GPU memory with realistic image sizes. Confirm the image and audio limits for your exact checkpoint in the recipe and the vLLM release you run, and record them in your capacity plan so that a request exceeding them is rejected predictably rather than causing out-of-memory errors.
How clients, the vLLM server and GPUs connect
The request starts at an application that calls a reverse proxy which allowlists only the endpoints meant for users. The proxy forwards to the vLLM OpenAI-compatible server, which runs the model on GPUs and can use a Gemma 4 assistant checkpoint for speculative decoding. Prometheus scrapes /metrics from the server, and that path stays inside the isolated network. Check that the proxy blocks /metrics, /health and the other control endpoints from outside, because --api-key does not protect them.
Request path from client to GPUs, with metrics kept inside the isolated network.
Securing the Gemma 4 endpoint and its operations
A Gemma 4 server on vLLM has more than one surface: the user-facing API, the operational endpoints, the traffic between nodes and the weights on disk. The cards below cover the controls that connect those surfaces, along with the checks to confirm before the endpoint serves users.
Api key does not cover every endpoint
The --api-key option protects the /v1, /v2, /inference and /cohere routes, but not /invocations, /pause, /resume, /abort_requests, /metrics or /health. Put a reverse proxy in front of the server that allowlists only the routes meant for users. Then test each unprotected route from outside the network to confirm it cannot be reached by clients or other tenants.
Multi-node traffic needs isolation
vLLM's security documentation states that communication between nodes in a multi-node deployment is insecure by default, with no authorization or encryption. Gemma 4 at the sizes covered here usually runs on one node, but if you add nodes for capacity, place them on an isolated network that only the serving nodes can reach. Confirm the isolation with a network test before the first multi-node run.
Parallelism and scaling docsMetrics for capacity and cache pressure
The server exposes Prometheus-format metrics at /metrics, covering request counts, token throughput, latency histograms and KV cache use. Those signals show whether Gemma 4 is short on memory for context before users see timeouts. Restrict who can scrape /metrics, since the route is outside the API key, and decide which histogram buckets your latency targets need.
Production metrics docsKubernetes deployment options
The vLLM docs list several Kubernetes paths: native manifests, Helm, the vLLM production-stack, AIBrix, KServe, KubeRay, LeaderWorkerSet, llm-d and NVIDIA Dynamo. Each path makes different choices about routing, autoscaling and secret handling. Pick one path before writing manifests, and confirm that its network policy and probe settings match the proxy and metrics controls above.
vLLM on KubernetesAir-gapped operation with offline docs
vLLM includes an --enable-offline-docs option for air-gapped environments, which lets the server host its API documentation without reaching external content. Teams in isolated networks should also confirm that the Gemma 4 chat template and tokenizer files are present locally, because chat completions depend on them. Test the server with no outbound connectivity before accepting it into the production boundary.
Model weight provenance
Gemma 4 weights and their assistant checkpoints come from outside your environment, so the serving platform inherits whatever they contain. Record the source, the exact revision and a checksum for each file, and store the approved copies in a location your change process controls. Pin the revision in the deployment, so an upgrade or a new download cannot silently change the model under production traffic.
Questions buyers ask before self-hosting Gemma 4 on vLLM
What does it cost to run vLLM for Gemma 4?
vLLM has no paid edition, so the software license is not the cost. The spend comes from four places: GPU or other accelerator capacity, the surrounding infrastructure (storage, networking, load balancing, monitoring and backups), implementation work, and the staff who operate the service after go-live. Accelerator capacity is usually the largest recurring line, and it recurs for as long as the deployment runs. Implementation is mostly one-time, although upgrades and patching recur. When requesting a quote, ask for each cost line separately, the hardware assumed for each Gemma 4 size, and which items the quote excludes, such as ongoing operations.
How long does a Gemma 4 vLLM setup take?
Duration depends on the scope agreed in writing before work starts, and no general timeline is given here. The main drivers are the Gemma 4 size chosen, whether the GPUs are already racked and provisioned, the identity and gateway integrations required, whether multimodal input or tool calling must be validated, and how many test rounds the security and compliance teams need before approving the service. A single-node deployment with an existing API gateway is far simpler than a multi-node one that needs network isolation, monitoring and a formal change process. Ask any partner for a phased plan that names the acceptance tests for each phase.
What does the client team need to provide?
Plan for four inputs before work begins: accelerator capacity in an environment you control (cloud account, data center or air-gapped network), a named owner for the model and API access decisions, the identity and network controls the service must sit behind, and a test set that reflects your real prompts and documents. You also need someone who can approve container images, model weights and the change process. The vLLM security documentation says the --api-key option does not protect every endpoint, so your team must decide the reverse proxy allowlist and who can reach the metrics and health routes.
Can an internal team deploy Gemma 4 on vLLM alone?
Yes, if the team has experience with GPU servers, Linux, container runtimes and inference operations. vLLM is Apache-2.0 licensed and its recipes give concrete starting points, so the work is achievable without a vendor. The risk lies in the details the recipes do not decide for you: the correct memory headroom for your context lengths, the security posture of the API, logging and tracing for audits, and how the team will handle new vLLM releases, which ship about every two weeks. Many teams keep operations in-house and use a partner for the design review, the hardening or a planned upgrade.
Which GPU should we start with for Gemma 4?
Start from the model size you need, then confirm the memory. The vLLM Gemma 4 recipe lists minimum BF16 hardware as one 24 GB GPU for E2B and E4B, one 40 GB GPU for 12B, and one 80 GB GPU for 31B and 26B-A4B. These are minimums for weights at BF16, so the KV cache, the context length you plan to serve and the number of concurrent users will require more memory. Check the recipe for the parallelism settings for each size, and confirm accelerator support for AMD, Intel XPU or CPU paths in the vLLM installation documentation before buying hardware.
How do vLLM upgrades affect a Gemma 4 deployment?
vLLM ships new minor releases about every two weeks, for example v0.28.0 on August 26, v0.29.0 on September 9, v0.30.0 on September 22 and v0.31.0 on October 5, 2026. Each upgrade can change engine behavior, flags, parser behavior or kernel support, so an upgrade needs a staging environment, a regression run against your own prompts, and a rollback path. Pin the image version in production, read the release notes for each change, and confirm that the Gemma 4 recipe still matches the version you run. Decide in advance how often your team will evaluate new releases.
What support does the community project give compared with a partner?
The vLLM project is open source, and its community supports the software through its GitHub repository, releases and documentation. That support has no contractual response time and does not cover your environment, your identity setup or your audit evidence. A partner provides scoped work under a written agreement: implementation, customization, integrations, hardening, backups, upgrades and documentation inside your infrastructure. DeployOpen plans, implements and supports self-hosted open-source platforms this way, and offers ongoing support and continuous testing as retainers. Ask any provider which deliverables and response commitments appear in the signed scope.
Does a Gemma 4 deployment need a formal security review?
For regulated workloads, yes, and the review should happen before users connect. The vLLM security documentation says node-to-node traffic in a multi-node deployment is insecure by default and must sit on an isolated network. It also says the --api-key option does not cover /metrics, /health, /pause or /invocations, so a reverse proxy should allowlist only the endpoints users need. Ask for a written review of exposure, logging and secrets handling. DeployOpen can run security testing against the deployed service, but it does not issue audit reports or certifications, which independent auditors and certification bodies do.
How DeployOpen scopes Gemma 4 on vLLM work
DeployOpen plans, implements, hardens, documents and supports self-hosted vLLM inside your own infrastructure, whether that is your cloud accounts, your data centers or an isolated network. For a Gemma 4 engagement, the written scope usually names the chosen model size and precision, the accelerator hosts and their drivers, the speculative decoding setup if you want it, the API exposure through a reverse proxy, the metrics and logging hooks, and the runbooks your operators will use. Most engagements are fixed-scope, so scope, deliverables and timelines are agreed in writing before any work starts.
Ask for the scope in terms of decisions and evidence, not hours alone. The document should state which model variant and hardware tier is in scope, whether multimodal input is included, which parsers and chat template handling are configured, how the vLLM server is tested against the OpenAI-compatible endpoints your applications call, and who signs off on the security configuration. Confirm also which vLLM release line will be pinned, since the project ships new minor releases about every two weeks, and whether an upgrade is part of the agreed work or a later task. Confirm what your team receives at handover: configuration in version control, documentation of the deployed state and access to the operational runbooks.
Ongoing support, upgrades and continuous testing are available as a retainer, which suits teams that will track vLLM releases and Gemma 4 checkpoint changes after go-live. DeployOpen does not publish a price list. A quote follows from the written scope, so the inputs that move cost are the ones described above: the number and class of accelerators, the number of environments, the security testing depth and the length of support. Ask any provider, including DeployOpen, to price these as separate line items so you can see what is one-time and what recurs.

