How to Choose Open-Source LLMs: A Guide to Licenses, VRAM, and Compliance

    Selecting the right open-source large language model (LLM) requires more than just comparing benchmark scores. This article provides a comprehensive guide to evaluating open-source LLMs for production use, covering the differences between open weights and fully open models, license compliance checks, VRAM estimation for inference (including weights and KV cache), data compliance for fine-tuning, and essential pre-deployment verification steps.

    1. Differentiate Between Open Weights and Fully Open Source

    Many models are labeled “open source,” but they often only release the weight files. While weights determine a model’s inference capabilities, a fully open-source release typically includes training code, inference code, training data descriptions, and evaluation methods. The difference impacts three things: result reproducibility, commercial use, and redistribution to customers.

    Item Common Situation for Open Weight Models Impact on Project
    Model Weights Usually public Can be downloaded and deployed locally
    Training Code Often not public Hard to reproduce training; reliance on publisher’s claims
    Inference Code Often provides reference implementation Need to verify if the inference framework supports the model architecture
    Training Data Description Mostly provides only an overview Hard to assess data sourcing authorization risks
    Evaluation Methods Mostly provides leaderboard scores Scores don’t directly represent business outcomes; requires custom evaluation

    To determine if a model is suitable for your project, read three types of materials first: the Model Card, the original license, and official release notes. Summaries and community paraphrasing are for reference only; the final conclusion must be based on the original license.

    2. License Checklist and Recording Template

    License terms vary significantly:

    • Apache-2.0: A permissive license allowing commercial use, modification, and redistribution, requiring retention of copyright and modification notices. It includes an explicit patent grant from contributors, which may terminate if you initiate patent litigation against the licensor.
    • MIT: A permissive license allowing commercial use, modification, and redistribution, requiring retention of copyright and license notices. It does not include an explicit patent grant clause.
    • Custom Community Licenses: May set user scale or revenue thresholds, restrict specific use cases, and require derivative models to use the same license. These usually come with usage policies that must be read version by version.
    • Research-Only Licenses: Most do not allow commercial use. Authorization scope must be confirmed before going live.

    Before deployment, verify each item in the checklist below:

    Check Item Questions to Confirm Information to Record
    Commercial Authorization Does the license allow use in commercial products? Are there revenue or user caps? License name, version, original link
    Redistribution Can the weights be packaged into your own software or image for customer delivery? Release date and applicable model version
    Derivative Models Must fine-tuned models be released under the same license? Applicable model version
    Usage Restrictions Do prohibited scenarios (e.g., specific content generation or automated decisions) conflict with your business? Usage policy version and date
    Attribution Requirements Must the model source be credited on product pages, docs, or interfaces? Original text of attribution requirements
    License Changes Does the new version follow old terms? Re-verified before upgrade? Review record before each upgrade

    It is recommended to keep records using the following template, updated with each model version upgrade:

    Field Example Content
    License Name and Version Custom Community License v2.1
    License Link and Archive Location Official link, plus a PDF snapshot saved in the internal knowledge base
    Model Name and Version Model name + specific version tag
    Release Date Date marked on the official release page
    Usage Policy Version and Date Usage policy version number and effective date
    Reviewer and Review Date Responsible person’s name, date
    Next Review Trigger New version release, license change, business scenario change

    Beyond the license itself, consider export controls, trademarks, and usage policies. Export controls may restrict the cross-border transfer of weights or related technical materials, depending on your location and target market. Model names and logos may be trademarked; confirm this before naming your product. Usage policies can sometimes be stricter than the license, such as prohibiting applications in certain industries. Consult legal counsel if: your product targets overseas customers, your business involves high-risk fields like healthcare, finance, or recruiting, or you plan to redistribute the weights.

    This section is a technical summary and does not constitute legal advice. Decisions regarding commercial use and redistribution should be confirmed by legal or compliance personnel.

    3. Model Selection and VRAM Estimation

    Model selection should start from business metrics. General leaderboards only show performance on specific test sets and do not directly represent business outcomes. It is recommended to compare candidate models on a proprietary evaluation set, covering real-world questions, edge cases, and refusal scenarios.

    Dimension Focus Check Method
    License Commercial use and redistribution terms Read original license, record version
    Parameter Size Determines VRAM footprint and inference latency Check parameter count in model card
    Architecture Dense or Mixture of Experts (MoE) See below, requires empirical testing
    Context Length Window size required for long document processing Test information recall on proprietary long documents
    Language and Domain Capability Accuracy on business corpus Compare using a proprietary evaluation set
    Quantization Support Ability to run at lower precision Check for GPTQ, AWQ, or GGUF formats; re-test accuracy and refusal rate post-quantization
    File Format Security of weight files Prefer safetensors format and compare hash with official release
    Community and Maintenance Bug fix and update frequency Check release logs and open issues

    VRAM estimation for MoE models requires special attention. If all weights are fully loaded without expert offloading, VRAM is usually estimated based on total parameters, while inference speed is closer to the compute volume determined by activated parameters. Actual usage depends on expert parallelism methods, offloading strategies, and the inference framework, so final numbers must be based on empirical testing.

    3.1 Weight VRAM

    Weight VRAM ≈ Parameter count × Bytes per parameter. FP16 or BF16 uses 2 bytes per parameter, INT8 uses 1 byte, and INT4 uses 0.5 bytes. For a 7B dense model, FP16 weights are roughly 7 × 10⁹ × 2 bytes = 14 GB, or about 13.0 GiB. Quantization metadata (like scaling factors) and framework implementations incur minor overhead.

    3.2 KV Cache

    The KV cache stores the keys and values of each generated token to avoid recomputing attention. It grows linearly with batch size and sequence length and frequently exceeds the weights themselves in long-context scenarios.

    KV Cache Bytes ≈ Batch Size × Sequence Length × 2 × Num Layers × Num KV Heads × head_dim × Bytes per element

    Parameters are read as follows:

    • Batch Size: Simultaneous requests processed, based on target concurrency.
    • Sequence Length: Max tokens for input plus output, based on business limits.
    • 2: Stores K and V data separately.
    • Num Layers, Num KV Heads, head_dim: Read from the model’s config.json, typically num_hidden_layers, num_key_value_heads, and head_dim. If head_dim is absent, divide hidden size by the number of attention heads. Models using Grouped-Query Attention (GQA) have far fewer KV heads than attention heads, significantly reducing cache size.
    • Bytes per element: 2 for FP16 or BF16, 1 for FP8 or INT8.

    Note that quantizing weights does not automatically shrink the KV cache. To reduce KV cache footprint, you must separately set the KV cache data type in the inference framework and verify accuracy changes on your evaluation set.

    3.3 Runtime Overhead and Empirical Testing Steps

    Runtime overhead includes CUDA contexts, internal framework buffers, and activations, which are hard to calculate precisely, making empirical testing recommended. Follow these steps:

    1. Load the model on target hardware and record the idle VRAM usage as a baseline for weights and basic overhead.
    2. Send stress test requests based on target maximum concurrency and longest sequence length, running continuously and recording peak VRAM.
    3. Use the peak VRAM plus a 10% to 20% margin as the minimum configuration requirement for that GPU type.
    4. If switching to quantized weights or lower KV cache precision, repeat steps 1 to 3 and re-test accuracy and refusal rates on your proprietary evaluation set.

    3.4 Example Calculation

    The following example uses hypothetical conditions and does not represent any specific model. Assume a 7B dense model, 32 layers, 32 KV heads, head_dim of 128. Weights use FP16, KV cache uses FP16, batch size is 4, sequence length is 4096, and estimated runtime overhead is 2 GiB.

    Item Calculation Result
    Weights 7 × 10⁹ × 2 bytes ~13.0 GiB
    KV Cache per token 2 × 32 × 32 × 128 × 2 bytes 524,288 bytes (0.5 MiB)
    KV Cache per sequence 0.5 MiB × 4096 ~2 GiB
    KV Cache for batch size 4 2 GiB × 4 ~8 GiB
    Total 13.0 + 8 + 2 ~23 GiB
    Plus 15% margin 23 × 1.15 ~26.5 GiB

    Based on this, a 24 GB GPU is insufficient; 32 GB or above is safer. If weights are changed to INT4, weights drop to about 3.3 GiB, but the KV cache remains 8 GiB, totaling about 13.3 GiB. This demonstrates that in long-context and high-concurrency scenarios, the KV cache is often the primary VRAM consumer.

    Common mistakes include: using general leaderboards instead of business evaluations; assuming VRAM halves after quantization while ignoring the KV cache; and purchasing hardware based on theoretical estimates without performing stress tests.

    4. Fine-Tuning Data Compliance Checklist

    Fine-tuning data may contain copyrighted content or personal information, and compliance risks are often overlooked. Confirm each item in the table below before going live and retain corresponding evidence.

    Check Item Questions to Confirm Evidence to Retain
    Data Source Authorization Does each batch have clear usage authorization? Is it permitted for training commercial models? Authorization agreements, collection permits, or internal data use approvals
    Personal Information Does the data contain names, phone numbers, ID numbers, addresses, etc.? PII identification results and processing records
    Sensitive Information Does it contain health, financial, or minor information? Was separate consent obtained? Consent records or exclusion explanations
    De-identification & Anonymization Were replacement, deletion, or generalization completed before training? De-identification rules and spot-check results
    Retention & Deletion How long are raw data and intermediate files kept? How is user consent withdrawal handled? Retention period explanations, deletion logs
    Evaluation Set Isolation Is the evaluation set completely separate from training data? Are there duplicate samples? Deduplication and isolation check reports
    Cross-Border Transfer Does the data need to be transferred overseas for annotation or training? Transfer assessment records
    Annotator Management Have annotators signed NDAs? Are there access controls? Agreement signing records, permission lists

    This checklist only covers technical checkpoints and does not constitute legal advice. Matters involving personal information and cross-border transfers should be confirmed by legal or compliance personnel.

    5. Deployment Checklist

    After passing the license, VRAM, and evaluation phases, complete the following checks before deployment:

    Check Item Specific Requirements
    License Version Freeze Record the license name, version, and original snapshot during deployment, corresponding to the template in Section 2
    Weight Hash Verification Calculate the SHA-256 of the safetensors files and compare them one by one with the officially released hashes
    Post-Quantization Re-evaluation After quantization or changing KV cache precision, re-run the proprietary evaluation set and record accuracy and refusal rate changes
    VRAM Margin Confirmation Use the empirical results from Section 3 to confirm the target GPU type has sufficient margin
    Usage Policy Contrast Compare business scenarios with prohibited clauses to ensure no conflicts
    Attribution Labeling Add appropriate attribution in product pages, documentation, or interfaces as required by the license