Enterprise On-Premises LLM Deployment: A Guide to Licensing, VRAM, and Rollback Planning

    This guide explains how to decide whether an enterprise should self-host a large language model and how to carry out the deployment. It covers open-weight licensing, comparing self-hosting costs with API usage, the four deployment stages from environment setup to rollout and rollback, a method for estimating GPU memory, and the trade-offs of quantization.

    The short answer: Whether self-hosting makes sense depends on three questions. Does the data have to stay inside the internal network? Is the inference volume stable enough to spread the hardware cost? Can the team maintain the inference service over the long term? If two of these three conditions are not met, API calls are usually the simpler option. If all three are met, follow the four stages described below.

    1. Open Weights and Licensing

    “Open weights” means the model’s parameter files are publicly available for download. This is not the same as open source. The license determines whether you can use the model commercially, continue training it, and redistribute it. Training code, training data, and training details are not always public, so read the full license text before deploying.

    The checklist below helps organize the questions. It is not legal advice. Your legal team should make the final determination.

    • Commercial use: Does the license allow use in revenue-generating business, and does it set limits on user numbers or revenue?
    • Retraining: Does it allow continued pretraining or fine-tuning on the weights, and can the fine-tuned model be used externally?
    • Redistribution: Does it allow you to give the weights or derivative models to partners or customers, or to include them in your own products?
    • Attribution: Does it require labeling the model’s source and version in the interface or documentation?
    • Output restrictions: Does it prohibit using model outputs to train other models?
    • Use-case restrictions: Does it prohibit certain scenarios, such as medical diagnosis or surveillance?

    2. Estimate Costs Before Deciding to Self-Host

    API pricing is based on usage, so costs rise with call volume. Self-hosting requires an upfront investment in hardware or rented compute. After that, the marginal cost of each inference is lower. However, self-hosting also includes hardware depreciation, electricity, data center or cloud rental fees, operations staff, and idle equipment time. If daily request volume stays low and GPU utilization is poor, self-hosting can cost more than an API.

    Use the template below to run the numbers.

    • Monthly fixed costs: Hardware depreciation (purchase price divided by the expected months of use), plus cloud rental or data center fees, plus electricity, plus operations labor allocated per month.
    • Monthly variable costs: Compute consumption estimated from daily request volume and average token count per request.
    • Break-even point: Fixed costs divided by the API cost per call. This gives the number of calls needed each month to break even.
    • Utilization threshold: If expected utilization falls below the level needed to reach break-even, prioritize an API or a shared compute cluster.

    3. Four Stages of On-Premises Deployment

    Open weights are only the starting point. Deployment requires a complete engineering pipeline, which can be divided into four stages.

    Stage 1: Environment Setup

    Most environment problems come from mismatched versions. Pin the following versions first and record them in the project documentation.

    • Operating system: Choose a mainstream distribution such as Ubuntu 22.04 LTS.
    • GPU drivers and compute framework: For NVIDIA, record the CUDA and driver versions. For AMD, record the ROCm version and kernel driver version.
    • Inference framework and quantization tools: Pin exact minor versions, and check them against the versions recommended in the model documentation.
    • Python and dependencies: Lock versions in requirements.txt, and isolate them in a virtual environment or container.

    Use a Dockerfile to fix the environment. Tag images with explicit version numbers, not latest. Mount the weights as a volume rather than baking them into the image, so you can switch model versions easily. The example below is illustrative. The base image tag must match the requirements of your framework and driver.

    1. FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
    2. WORKDIR /app
    3. COPY requirements.txt .
    4. RUN pip install --no-cache-dir -r requirements.txt
    5. COPY serve.py .
    6. # Mount the weights as a volume; do not bake them into the image
    7. CMD ["python", "serve.py"]

    Stage 2: Model Loading and Quantization

    Released weights are usually stored in FP16 or BF16, which requires a large amount of GPU memory. Quantization represents the weights with fewer bits, which lowers memory requirements. The code below is pseudocode. The interface names are illustrative and must be replaced with the real API of your framework.

    1. from inference_framework import AutoModel, quantize
    2. model = AutoModel.from_pretrained("/models/llm-v1")
    3. model = quantize(model, bits=8, method="smooth")
    4. model.generate(prompt="你好", max_tokens=512)

    After loading, record the VRAM baseline before deciding whether to quantize. Quantization is one variable among several, and every option must be validated against your business test set.

    Stage 3: Inference Serving

    The inference service should expose a unified HTTP interface. Business systems call that interface, so switching models or falling back to an API requires no changes to business code. The serving layer needs clear settings for the following.

    • Concurrency and batching: Use the continuous batching supported by your framework, and set the maximum concurrency, maximum input and output lengths, and a per-request timeout.
    • Health checks: Provide liveness and readiness probes. The service should not receive traffic until the model has finished loading.
    • Monitoring metrics: Track time to first token, tokens generated per second, VRAM usage, error rate, and queue wait time.
    • Alerts: Set thresholds for latency, error rate, and VRAM usage, and notify the owner when a threshold is exceeded.

    Stage 4: Rollout and Operations

    Roll out in batches. First, validate in a test environment using a replica of real traffic. Then increase traffic gradually, for example to 5%, 20%, and 100%. At each step, wait for metrics to stabilize before moving to the next.

    Plan rollback in advance. Version the model weights, the inference image, and the configuration, and keep the previous stable version available. If quality drops or latency spikes, shift traffic back to the previous version or to the API baseline. Before every production launch, run a rollback drill to confirm the switching steps and how long they take.

    4. GPU Memory Estimation

    The formula for weight memory is:

    Weight memory ≈ parameter count × bytes per parameter

    Common precisions use the following bytes per parameter: FP16 or BF16 uses 2 bytes, INT8 uses 1 byte, and INT4 uses 0.5 bytes. For a 7-billion-parameter (7B) model, FP16 weights take about 14 GB, INT8 about 7 GB, and INT4 about 3.5 GB. Group-wise quantization adds a small amount of memory for scaling parameters, so actual figures run slightly above the theoretical values.

    Total memory also includes the following items. Do not estimate based on weights alone.

    • KV cache: 2 × number of layers × number of KV heads × head dimension × sequence length × concurrent requests × bytes per element. With long contexts and high concurrency, this can exceed the weights themselves.
    • Activations: Intermediate results during the forward pass, which depend on batch size and sequence length.
    • Framework overhead: Runtime, CUDA context, and memory fragmentation.

    Run stress tests at your target batch size and maximum sequence length. Record peak memory with nvidia-smi or the framework’s built-in statistics, then leave a safety margin. When choosing a GPU, size it by peak memory, not by weight size.

    5. Quantization Trade-offs

    Option Bytes per Parameter 7B Weight Memory (Theoretical) Main Risk Acceptance Requirement
    FP16/BF16 2 About 14 GB High memory usage Serve as the quality baseline
    INT8 1 About 7 GB Some tasks