Open-Weight LLM Deployment: VRAM Sizing, Licensing, and Prelaunch Checks

    Before deploying an open-weight LLM, verify its license, estimate GPU memory requirements, and evaluate it against real workloads. This guide covers VRAM calculations, model selection, quantization trade-offs, and strategies for processing documents that exceed a model’s context window.

    Verify the License First

    Publicly available model weights do not automatically permit unrestricted commercial use. Before starting a project, have legal counsel review the following items and retain a record of the findings:

    • Commercial use: Whether commercial use is permitted and what additional restrictions apply.
    • User or revenue thresholds: Whether the license imposes limits based on monthly active users or revenue.
    • Redistribution: Whether the model can be bundled, resold, or embedded in other products.
    • Derivative models: Whether fine-tuned models require attribution or must use the same license.
    • Use restrictions: Whether specific industries, regions, or applications are prohibited.
    • Audit records: Record the license version, download source, file hash, approval reference, and archive location.

    Estimate GPU Memory Requirements

    GPU memory consumption has three main components: model weights, the KV cache, and runtime overhead.

    Model weights

    1. Weight memory ≈ Parameter count × Bytes per parameter

    FP16 and BF16 use 2 bytes per parameter, INT8 uses 1 byte, and INT4 uses approximately 0.5 bytes. Quantization scales introduce some additional overhead.

    KV cache

    1. KV cache memory ≈ 2 × Number of layers × Number of KV heads
    2. × Head dimension × Context length
    3. × Batch size × Bytes per element

    Runtime overhead

    Runtime overhead includes activations, the inference framework, and the CUDA context. As a practical estimate, allow an additional 10%–20% beyond the weight and KV cache subtotal. Validate the estimate against the memory usage reported in your inference framework’s logs.

    Example 1: A 7B dense model, batch size 1

    Assume 32 layers, 32 KV heads, a head dimension of 128, FP16 precision, and a context length of 4,096 tokens.

    • Weights: 7 × 10⁹ × 2 bytes ≈ 14 GB
    • KV cache: 2 × 32 × 32 × 128 × 4,096 × 1 × 2 bytes ≈ 2.1 GB
    • Subtotal: Approximately 16.1 GB
    • With 10%–20% overhead: Approximately 18–20 GB

    Under these assumptions, the model fits on a single GPU with 24 GB of memory.

    Example 2: The same model, batch size 8

    Increasing the batch size to 8 raises the KV cache requirement proportionally to approximately 17 GB. Weights and KV cache together exceed 31 GB, so the workload no longer fits on a single 24 GB GPU.

    Concurrency is a major variable in the memory budget. Include the target concurrency when sizing hardware.

    Example 3: A 13B model, batch size 1

    Assume 40 layers, 40 KV heads, a head dimension of 128, FP16 precision, and a context length of 4,096 tokens.

    • Weights: Approximately 26 GB
    • KV cache: Approximately 3.4 GB
    • Subtotal: Approximately 29.4 GB
    • With overhead: Approximately 32–35 GB

    Plan for a GPU with at least 40 GB of memory, or use quantization to reduce the memory requirement.

    Two important caveats

    First, models that use grouped-query attention (GQA) have fewer KV heads than attention heads, which can substantially reduce KV cache memory. Use the actual KV head count from the model configuration in your calculations.

    Second, quantization reduces weight memory but can affect accuracy. Always reevaluate the quantized model using your application’s test set.

    Compare Model Options

    The memory figures below are starting references, not fixed deployment requirements. Actual usage depends on the model configuration, context length, and batch size.

    Model category Parameter scale Key license checks Single-GPU memory reference Long-context capability Deployment cost Suitable workloads Main risks
    Small dense models 7B–8B Commercial use and redistribution terms FP16: roughly 16 GB and up; INT4: roughly 5 GB and up Check the configured context limit and validate in testing Low; single-GPU deployment is possible Classification, information extraction, closed-domain question answering Limited complex reasoning; fine-tuning is often needed
    Medium dense models 13B–14B Commercial terms and user-scale thresholds FP16: roughly 30 GB and up; INT8 or INT4 can lower requirements Check the configured context limit and validate in testing Medium Multistep instructions and more complex summarization Memory pressure and limited concurrency
    Mixture-of-experts (MoE) models Large total parameter count, with fewer parameters activated per inference Whether derivative models must retain the same license Size weight memory by total parameters; multiple GPUs or quantization are often needed Often strong, but must be tested High Complex analysis and high-quality generation Operational complexity and greater variation in latency and resource usage
    Domain-specific or code models Model-dependent Training data provenance and usage terms Depends on model size Depends on training Medium Code generation and specialized question answering General-purpose capabilities may be weaker

    A practical selection workflow

    1. Define acceptable quality using an application-specific test set. Include both representative real-world samples and edge cases.
    2. Start with the smallest candidate model. Move to a larger model only if the smaller one fails to meet the quality requirements.
    3. Estimate memory at the target concurrency and context length. Use those estimates to select hardware.
    4. Complete the license review. Obtain legal approval before starting a pilot.
    5. Test the original and quantized versions separately. Record differences in quality and latency.

    For internal question answering, information extraction, and document classification, 7B–14B models are generally a reasonable starting point for evaluation. Upgrade based on measured gaps in your test results, not parameter count alone.

    Process Long Documents in Chunks

    Documents such as annual reports running to hundreds of pages may exceed a model’s context window and require chunked processing. Three common approaches involve different trade-offs:

    Approach Method Context loss Repeated computation Cost Suitable workloads
    Fixed windows Split text into fixed-length chunks without overlap High; sentences and tables can be split across boundaries Low Low Clearly structured documents with relatively independent sections
    Overlapping windows Retain some shared text between adjacent chunks Lower Increases in proportion to the overlap Medium Contract clauses and continuous narrative text
    Hierarchical summarization Summarize individual chunks, then summarize those summaries Higher; details can be lost through compression Each additional level requires another summarization pass High Long reports requiring document-wide conclusions

    Overlapping windows are often used as the default in projects. One configuration is a chunk length of 3,000 characters with a 300-character overlap.