From Weights to Production: A Guide to Deploying and Evaluating Open-Source LLMs

    A practical, step-by-step guide to deploying open-source large language models on your own infrastructure: reviewing license terms, estimating GPU memory requirements, verifying downloaded weights with SHA-256, and launching an inference service with vLLM while keeping security and reproducibility in mind.

    1. Background and Scope

    Model weights are the set of parameters produced after training, and they determine how a model transforms input into output. Once weights are publicly released, developers can run the model on their own machines or inside private networks instead of relying solely on remote APIs. This brings three direct benefits: request data stays inside the internal network, which helps meet data security requirements; the model can be fine-tuned on domain data or have its inference strategy adjusted; and versions can be pinned so output behavior can be tracked over time, making results reproducible.

    Self-hosting also means more work. License terms must be reviewed item by item, hardware costs estimated in advance, and service stability, access control, and log retention all need to be maintained by the team. This article is organized in the order you would actually follow to go live, and each section provides steps you can execute or verify directly.

    2. License Review and Hardware Estimation

    2.1 Confirming License Terms Item by Item

    The license determines which scenarios the model can be used in. It is recommended to organize the following items into a table and have legal or compliance staff sign off on it before moving to production.

    Check item Question to confirm Recorded conclusion
    Commercial use Is use in for-profit products or services allowed? To be filled in
    Redistribution Are the weights or copies allowed to be provided to third parties? To be filled in
    Derivative models Do fine-tuned or quantized models fall under the same terms? To be filled in
    Industry restrictions Are there additional restrictions for healthcare, finance, government, etc.? To be filled in
    Attribution and notices Must copyright notices be retained or the source be credited? To be filled in

    The legal review record should be archived together with the model version number in the team’s compliance documentation. Licenses may change between versions, so re-run this checklist whenever you upgrade the model.

    2.2 Estimating GPU Memory Requirements

    GPU memory consists mainly of three parts: the model weights, the activation values during inference, and the KV cache that stores attention results. The weights portion can be roughly estimated with the following formula:

    Required memory (GiB) ≈ parameter count × bytes per parameter ÷ 1024³

    The unit here is GiB (2 to the power of 30 bytes), which differs from the commonly used GB (10 to the power of 9 bytes). To convert to GB, multiply by roughly 1.074. Taking 16-bit floating point as an example, each parameter occupies 2 bytes. A 10-billion-parameter model therefore needs about 18.6 GiB of memory for weights alone.

    The table below lists weight memory estimates for common model sizes, calculated at 2 bytes per parameter (FP16) and 1 byte (INT8):

    Model size FP16 (GiB) INT8 (GiB)
    7B ~13.0 ~6.5
    13B ~24.2 ~12.1
    70B ~130.4 ~65.2

    These figures cover the weights only. Quantization schemes usually carry extra metadata such as scaling factors, so actual usage is slightly higher than the estimate. The memory used by activations and the KV cache depends on context length, batch size, and framework implementation; in practice, reserve an additional 20% to 50% on top of the weight estimate. This range is based on experience—rely on actual measurements: run the model once at your target context length and maximum concurrency, record the peak memory usage, and only then finalize procurement or allocation.

    2.3 Preparing the Runtime Environment

    Use an isolated environment to manage dependencies, and pin the versions of the GPU driver, acceleration libraries, and inference framework. These three components have compatibility constraints between them, and version mismatches are a common cause of startup failures. Teams should write the dependencies into a lock file (such as a requirements.txt or a container image definition) and put it under version control, ensuring every deployment produces the same result.

    It is also a good idea to maintain a compatibility matrix recording every combination that has been verified:

    Component Version Verification result
    GPU driver As applicable Pass / Fail
    CUDA or other acceleration library As applicable Pass / Fail
    Inference framework As applicable Pass / Fail

    3. Downloading Weights and SHA-256 Verification

    Weight downloads should follow the workflow of “review the manifest first, then download, then verify.” Pulling files by name without checking their contents can introduce problems when network interruptions occur or files are tampered with.

    The specific steps are:

    1. Confirm the model repository URL and version number, and record the corresponding commit identifier.
    2. Obtain the complete file manifest, including weight shards, configuration files, and tokenizer files.
    3. Download the files one by one, enabling resume from breakpoint, and set a timeout and a limited number of retries for each request.
    4. Compute the SHA-256 digest of each file and compare it against the expected value in the manifest.
    5. Once everything passes, generate a local verification record and archive it. Set the weights directory to read-only to prevent modification during operation.

    Pseudocode for illustration:

    1. version = "release version number"
    2. manifest = get_file_manifest(repo_url, version)
    3. verification_records = []
    4. for file in manifest.files:
    5. local_path = download(file.url, target_dir/file.name,
    6. resume=True, timeout=60s, max_retries=3)
    7. actual_digest = compute_sha256(local_path)
    8. if actual_digest != file.expected_sha256:
    9. delete(local_path)
    10. raise Error("Verification failed", file.name)
    11. verification_records.append({file: file.name, digest: actual_digest, time: now})
    12. write(target_dir/verification_records.json, verification_records)
    13. set_read_only(target_dir)

    Verification results can be quickly checked with the sha256sum command. Run sha256sum -c SHA256SUMS in the weights directory; all files must show OK to pass. If any file shows FAILED, delete it and download it again—do not manually edit the manifest or skip verification.

    4. Deploying the Inference Service

    4.1 Loading the Model and Starting the Service

    Before starting, confirm that the environment matches the compatibility matrix from Section 2. Taking vLLM, a common inference framework, as an example, the startup command can be written as:

    1. python -m vllm.entrypoints.openai.api_server \
    2. --model /models/model_directory \
    3. --served-model-name internal_model_name \
    4. --host 127.0.0.1 \
    5. --port 8000 \
    6. --max-model-len 8192 \
    7. --gpu-memory-utilization 0.85

    Adjust the parameters according to the documentation of the framework you use. --max-model-len limits the total context length of a single request and directly affects KV cache usage. --gpu-memory-utilization controls the fraction of GPU memory the framework may occupy; setting it too high can leave activations and other processes short of memory. By default the service listens only on the local address—when exposing it externally, place it behind a gateway rather than opening the port directly.