V4 Local Deployment Guide: VRAM Estimation, Four Deployment Options, and Troubleshooting

    A practical guide to deploying the V4 model family locally, covering how to estimate VRAM for weights and KV Cache, matching model versions (Flash and Pro) to hardware configurations, and four step-by-step deployment options using Ollama, vLLM, Ray-based multi-node parallelism, and multi-replica production clusters with load balancing. Includes common pitfalls and troubleshooting tips.

    1. First, Confirm the Parameter Count and VRAM Baseline

    Before deploying, check the official model card for the exact model name, version number, release date, and license. The parameter counts used in this article are illustrative examples: Flash has roughly 28 billion total parameters with about 1.3 billion activated per inference; Pro has roughly 1.6 trillion total parameters with about 4.9 billion activated. Both support context windows at the million-token scale.

    Both versions use a Mixture-of-Experts (MoE) architecture. Compute cost during inference is determined by the activated parameters, but VRAM must hold the weights of all experts. Therefore, VRAM usage is driven mainly by total parameter count and quantization precision — size your hardware based on total parameters.

    1.1 Estimating Weight VRAM

    The estimation formula is:

    Weight VRAM ≈ total parameters × bytes per parameter

    FP16/BF16 uses 2 bytes per parameter, INT8 uses 1 byte, and INT4 uses roughly 0.5 bytes. Quantization scale factors push actual usage slightly above the theoretical value. Based on this formula, the weight sizes are:

    Precision Flash weights Pro weights
    FP16/BF16 ~568 GB ~3.2 TB
    INT8 ~284 GB ~1.6 TB
    INT4 ~142 GB ~800 GB

    1.2 Estimating KV Cache

    Beyond weights, runtime also requires KV Cache, activation values, and framework overhead. When choosing GPUs, multiply the weight footprint by 1.3 as headroom, then calculate KV Cache separately. The KV Cache formula is:

    KV Cache ≈ 2 × number of layers × number of KV heads × head dimension × bytes per element × context length × concurrency

    The layer count, KV head count, and head dimension must be read from the model’s config.json — do not fill them in from memory. Using a hypothetical set of values to demonstrate the magnitude: 60 layers, 8 KV heads, head dimension 128, BF16 at 2 bytes per element. The KV Cache per token is 2×60×8×128×2 = 245,760 bytes, roughly 0.25 MB. With a 1-million-token context and concurrency of 1, the KV Cache alone is about 246 GB. This shows that million-token contexts far exceed the usual 1.3x headroom — long-context workloads need dedicated VRAM planning.

    2. Version and Hardware Selection

    Version choice depends on three questions: hardware budget, the output quality your business requires, and whether your team can maintain a multi-node cluster.

    • Single 24GB GPU: Cannot fit Flash at any precision, since even INT4 weights are ~142 GB. This hardware can only validate the workflow, or run with CPU offloading at very low speed. If the publisher has released a smaller model in the same family, prefer that.
    • Single node with 8×80GB (640 GB total): Can run Flash INT8. With 1.3x headroom that’s ~369 GB, leaving room for KV Cache.
    • Pro version: INT4 with 1.3x headroom is ~1040 GB, requiring two 8×80GB servers. INT8 is ~2.08 TB, requiring four. FP16 is ~4.16 TB, requiring seven.

    It’s advisable to validate business results with Flash first before investing in Pro hardware. Whether Pro produces more stable outputs on long reasoning chains should be verified with your own evaluation set. The evaluation set should include real business questions, reference answers or scoring rubrics, and record each version’s accuracy and average response time.

    Configuration Total VRAM Runnable versions and precision Notes
    1×24GB consumer GPU 24 GB Cannot run Flash directly Workflow validation only; CPU offloading required, very slow
    8×24GB consumer GPUs 192 GB Flash INT4, short context Very little headroom; PCIe communication limits throughput
    4×80GB enterprise GPUs 320 GB Flash INT4, short to medium context Suitable for small/medium team testing
    8×80GB single node 640 GB Flash INT8 Suitable for small/medium production; control concurrency for long contexts
    2× 8×80GB nodes 1280 GB Flash FP16; Pro INT4 Pro requires cross-node parallelism
    4× 8×80GB nodes 2560 GB Pro INT8 Suitable for high concurrency and complex reasoning
    7+ 8×80GB nodes 4480 GB+ Pro FP16 Highest investment; only for extremely precision-sensitive scenarios

    “Runnable” in the table means weights plus headroom fit in memory — it does not guarantee stable operation under long contexts and high concurrency. Still calculate KV Cache per Section 1.2 when sizing.

    2.1 Other Hardware Requirements

    • RAM: At least as much as the total VRAM of a single node. Insufficient memory slows model loading and paging.
    • Storage: Reserve disk space based on weight size. Pro’s FP16 weights are ~3.2 TB; storing multiple quantized versions requires more.
    • Interconnect: Use NVLink within a node, or at least PCIe 4.0. For cross-node communication, prefer InfiniBand or high-speed Ethernet.
    • OS: Linux is recommended.

    When VRAM cannot hold all weights, the system pages between RAM and VRAM, and throughput is limited by the memory-to-VRAM transfer bandwidth. Taking an A100 80GB as an example: VRAM bandwidth is ~2 TB/s, while typical system RAM offers only tens of GB/s. So prioritize VRAM capacity when selecting GPUs.

    3. Environment Setup and Model Download

    3.1 Base Environment

    Verify the GPU driver works, then create an isolated Python environment:

    1. nvidia-smi
    2. conda create -n v4 python=3.10 -y
    3. conda activate v4
    4. python -c "import torch; print(torch.cuda.is_available())"

    The last command should print True. PyTorch and CUDA versions must match; use the installation command from the official PyTorch website. For domestic (non-NVIDIA) accelerators, install the vendor’s SDK and the corresponding deep learning framework instead.

    3.2 Downloading the Weights

    1. On the official model page, confirm the exact model name, version number, and license.
    2. Download using the method provided by the publisher. Weights are usually hosted via Git LFS, so install LFS first:
    1. git lfs install
    2. git clone <official repo URL>
    1. Verify the weights actually downloaded. If the weight files are only a few hundred bytes, you downloaded LFS pointer files — run git lfs pull:
    1. ls -lh <weights directory>/*.safetensors
    1. Verify the SHA256 checksums against the officially published values. Re-download if they don’t match:
    1. sha256sum <weight file name>

    If the publisher provides a mirror, verify checksums after downloading from the mirror as well. Read the license terms before commercial use to confirm whether separate authorization is needed. Third-party inference engines and drivers follow their own open-source licenses.

    3.3 Placeholder Replacement Rules

    Replace angle-bracket placeholders in this article with actual values:

    • <model path>: absolute path to the weights directory, e.g. /data/models/<model directory>, which must contain config.json.
    • <model name>:<quantization tag>: replace with the actual name from ollama list or the Ollama model library — the name must match exactly.
    • <head node IP>, <local intranet IP>: use the intranet address shown by ip addr, not a public address.

    4. Four Deployment Options

    Option 1: Quick Single-Node Trial with Ollama

    Suitable for a single machine with enough VRAM or RAM to quickly validate model behavior. The prerequisite is that the target model is available in the Ollama model library; otherwise this option doesn’t apply.

    1. ollama pull <model name>:<quantization tag>
    2. ollama run <model name>:<quantization tag>

    Once the service is running, test via the local API:

    1. curl http://localhost:11434/api/generate -d '{"model": "<model name>:<quantization tag>", "prompt": "Introduce yourself in one sentence", "stream": false}'

    Run ollama ps to see where the model is loaded. When the PROCESSOR column shows 100% GPU, the model runs entirely on the GPU. If it shows a CPU/GPU mix, some layers are offloaded to CPU and speed drops noticeably — switch to a smaller quantization or add VRAM.

    Option 2: High-Performance Single-Node Serving with vLLM

    vLLM uses PagedAttention to manage KV Cache and supports continuous batching — it works for both offline batch inference and OpenAI-compatible API serving. Pin the version on install, e.g. pip install vllm==<version number>; use the version documented in the vLLM release notes as supporting the model.

    Before starting, check the tensor parallel degree. --tensor-parallel-size must evenly divide the model’s number of attention heads and cannot exceed the number of local GPUs. Check the attention head count as follows:

    1. python -c "import json; c=json.load(open('<model path>/config.json')); print(c.get('num_attention_heads'))"

    If the field name differs in your config file, follow the model card. Start the API server:

    1. vllm serve <model path> --tensor-parallel-size 8 --max-model-len 32768 --gpu-memory-utilization 0.9 --port 8000 --api-key <your API key>

    Example offline inference code:

    1. from vllm import LLM, SamplingParams
    2. llm = LLM(
    3. model="<model path>",
    4. tensor_parallel_size=8,
    5. max_model_len=32768,
    6. gpu_memory_utilization=0.9,
    7. )
    8. outputs = llm.generate(["Explain mixture-of-experts models"], SamplingParams(temperature=0.7, max_tokens=256))
    9. print(outputs[0].outputs[0].text)

    Clients migrating from a cloud API only need to change base_url, api_key, and model:

    1. from openai import OpenAI
    2. client = OpenAI(base_url="http://<server IP>:8000/v1", api_key="<your API key>")
    3. resp = client.chat.completions.create(
    4. model="<model path>",
    5. messages=[{"role": "user", "content": "Hello"}],
    6. )
    7. print(resp.choices[0].message.content)

    The model parameter must match the model path used in vllm serve. If clients access the server from other machines, the server must listen on 0.0.0.0, and the firewall should only open necessary ports.

    Option 3: Multi-GPU, Multi-Node Parallelism (Ray)

    For cross-node deployment, use tensor parallelism within a node and pipeline parallelism across nodes. Taking two 8-GPU servers as an example: tensor parallel size 8, pipeline parallel size 2, for 16 GPUs total. vLLM uses Ray to manage nodes in multi-node scenarios.

    First, on both machines, set the local intranet address so vLLM doesn’t pick the wrong network interface:

    1. export VLLM_HOST_IP=<local intranet IP>
    2. export NCCL_SOCKET_IFNAME=<intranet NIC name>

    Start Ray on the head node (IP <head node IP>):

    1. ray start --head --port=6379

    Start Ray on the worker node and join the cluster:

    1. ray start --address=<head node IP>:6379

    From any machine, confirm both nodes have joined and the total GPU count is 16:

    1. ray status

    Once verified, start the service on the head node:

    1. vllm serve <model path> --tensor-parallel-size 8 --pipeline-parallel-size 2 --distributed-executor-backend ray --max-model-len 32768 --gpu-memory-utilization 0.9 --port 8000 --api-key <your API key>

    After startup, use nvidia-smi to confirm VRAM is being used on both machines. If only one machine shows VRAM usage, the worker node usually failed to join the Ray cluster, or VLLM_HOST_IP is set incorrectly. Cross-node network bandwidth directly affects throughput — prefer InfiniBand or high-speed Ethernet.

    Option 4: Production Cluster with Multiple Replicas

    When a single service instance can’t handle the concurrency, deploy multiple replicas with a gateway in front for load balancing. Each replica is an independent set of vLLM services — for example, two groups of two-node Pro INT4, four servers total.

    Start each replica independently per Option 3, using different ports or servers. Example Nginx load balancing configuration (replace addresses with actual intranet addresses):

    1. upstream v4_backend {
    2. least_conn;
    3. server <replica 1 IP>:8000 max_fails=2 fail_timeout=10s;
    4. server <replica 2 IP>:8000 max_fails=2 fail_timeout=10s;
    5. }
    6. server {
    7. listen 80;
    8. location /v1/ {
    9. proxy_pass http://v4_backend;
    10. proxy_read_timeout 600s;
    11. proxy_buffering off;
    12. }
    13. }

    proxy_buffering off ensures real-time streaming output. proxy_read_timeout must be longer than the maximum single generation time, otherwise long outputs get cut off by the gateway.

    Three additional things for production. First, use health checks to confirm replica availability, e.g. periodically hitting /health. Second, enable /metrics and connect it to Prometheus to monitor throughput, queue time, and VRAM utilization. Third, enforce access control with --api-key and at the gateway layer.