MoE LLM Engineering: VRAM, Cost, and Version Switching

    This article covers practical engineering considerations for MoE large models: how total and activated parameters affect VRAM and compute, how to interpret training cost figures with the right scope, how to benchmark performance under controlled conditions, how to choose a deployment approach, and how to use a model gateway to isolate business code from model version changes.

    1. Sparse Activation: Total Parameters, Activated Parameters, and VRAM

    Mixture-of-Experts (MoE) models contain many expert subnetworks, and each token is computed by only a few experts. The DeepSeek-V3 technical report discloses that the total parameter count is 671 billion (671B), while each token activates about 37 billion parameters (37B), giving an activation ratio of approximately 5.5%.

    These two numbers drive different resource requirements. Activated parameters determine the compute per token, while total parameters determine the VRAM occupied by model weights. They are not interchangeable.

    Weight VRAM can be roughly estimated with the following formula:

    Weight VRAM ≈ Total parameters × Bytes per parameter

    Storage precision Bytes per parameter Estimated weight VRAM (671B)
    FP8 1 About 671 GB
    BF16 2 About 1,342 GB

    This formula only accounts for weights. Actual runtime also requires KV cache, activations, communication buffers, and framework overhead, so actual VRAM demand is higher than the estimate.

    For example, a server with 8 × 80 GB GPUs has 640 GB total VRAM, which is below the 671 GB of weights estimated for FP8. This means a single machine cannot hold the full weights, and cross-node deployment or hardware with larger per-GPU memory is required.

    2. Training Cost: Check the Scope Before Citing

    The training cost data in the report is as follows:

    Item Value Note
    Training data volume 14.8 trillion tokens Disclosed in the report
    Hardware used 2,048 H800 GPUs Disclosed in the report
    Total training GPU hours 2.788 million hours Disclosed in the report
    Pretraining 2.664 million hours Disclosed in the report
    Remaining stages About 124,000 hours 2.788 million minus 2.664 million, corresponding to context extension and post-training in the report
    Unit price assumption USD 2 per GPU-hour Assumption used in the report, not an actual bill
    Converted training cost About USD 5.576 million 2.788 million hours multiplied by USD 2

    When using this number, note the following:

    • Limited scope: The figure only covers GPU hours converted for formal training. It excludes preliminary architecture exploration, ablation experiments, data engineering, labor costs, failed experiments, and infrastructure depreciation.
    • Unit price determines the result: If the GPU unit price changes, the cost result changes proportionally. For example, at USD 3 per GPU-hour, the same GPU hours correspond to about USD 8.364 million.
    • Not directly comparable: This figure does not represent other teams’ total R&D costs, nor can it be directly compared with other models’ training budgets.

    The report’s engineering methods mainly focus on parallel communication and memory management. Training used a combination of 16-way pipeline parallelism, 64-way expert parallelism, and ZeRO-1 data parallelism, with DualPipe scheduling to overlap computation and communication as much as possible. These configurations serve training; deployment requires separate design.

    MoE training also needs to handle load balancing. If routing sends tokens to a few experts for a long time, those experts become bottlenecks while other experts sit idle. The report adopts an auxiliary-loss-free load balancing strategy, maintaining a bias term for each expert and dynamically adjusting routing based on recent load. This reduces additional interference with the training objective.

    3. Performance Data: Use It with Conditions Stated

    The report states that the model’s generation speed is about 3× faster than the previous V2. This conclusion comes from the test environment used in the report, including hardware model, batch size, sequence length, and concurrency. In a different environment, results may differ significantly, so it should not be treated directly as the expected benefit for your own workload.

    When re-benchmarking, record the following metrics:

    Metric Meaning Scenario to watch
    TTFT (time to first token) Time from request submission to the first token returned Online chat
    TPOT (time per output token) Average time per token during generation Streaming output experience
    Output throughput (tokens/s) Number of tokens generated per unit time Batch processing, cost accounting
    P99 latency Latency upper bound for 99% of requests Service level objective (SLO)
    Throughput under concurrency Total output capacity at different concurrency levels Capacity planning

    Re-benchmarking checklist:

    • Fix the hardware model, number of GPUs, and number of nodes
    • Fix the inference framework and version number
    • Fix batch size and concurrency, and test multiple values separately
    • Fix input and output sequence lengths, covering the typical distribution of the workload
    • Fix sampling parameters, including temperature, top_p, and maximum output length
    • Warm up before collecting data to avoid cold-start effects
    • Record P50 and P99, not only the average

    4. Deployment Selection: Calculate the Threshold First, Then Choose the Approach

    Before deployment, make decisions in the following order:

    1. Confirm the VRAM threshold: Use the formula in Section 1 to estimate weight VRAM, then add KV cache and runtime overhead. If a single machine cannot fit the model, plan for multiple nodes or hardware with larger VRAM.
    2. Choose the parallelism approach: Expert parallelism distributes different experts across multiple GPUs, and cross-GPU and cross-node communication increases latency. Training parallel configurations cannot be directly copied to inference; test separately based on latency targets.
    3. Define performance goals: Specify metrics such as TTFT, P99, and peak concurrency. Without clear goals, it is impossible to judge whether the hardware is sufficient.
    4. Calculate unit cost: Divide hardware cost per hour by measured throughput to get the cost per million output tokens. This number is more informative than looking at hardware price alone.

    Different scenarios have different priorities:

    Scenario Main focus Suggested approach
    Offline batch processing Throughput and cost per token Increase batch size and accept higher per-request latency
    Online chat TTFT and P99 latency Control batch size and reserve headroom for peak traffic
    Small-team private deployment VRAM threshold and operational complexity First assess whether VRAM requirements can be met, then consider multi-node options

    5. Version Iteration: Use a Model Gateway to Isolate Business Code from Versions

    Model versions update frequently, and business code should not be directly bound to a specific model name. A recommended approach is to add a gateway layer between the business and the model, with the gateway mapping logical model names to actual versions.

    A simple routing configuration example is as follows:

    1. routes:
    2. chat-default:
    3. primary: deepseek-v3
    4. fallback: deepseek-v2
    5. canary:
    6. model: new-version
    7. ratio: 0.05

    Business code calls only chat-default. When switching versions, only the configuration needs to be changed; the business service does not need to be redeployed.

    Gateway design recommendations include:

    • Capability matrix: Record capabilities such as maximum context length, tool-calling support, and structured-output support for each version. The gateway checks whether a request exceeds the target version’s capabilities before routing.
    • Canary release: First route a small amount of traffic to the new version, and compare quality, latency, and error rate.
    • Fast rollback: Configuration changes should be reversible within minutes, and rollback should not depend on redeployment.
    • Per-version metrics: TTFT, P99, error rate, and human evaluation results should all be recorded by version, so problems are not mixed together and impossible to attribute.

    Version switching steps:

    • Re-benchmark the new version in the test environment using the same benchmark set, and compare it with the old version
    • Confirm that the new version’s VRAM threshold and hardware plan still meet requirements
    • Update the capability matrix and check whether business requests depend on features not supported by the new version
    • Shift about 5% of traffic to the new version and observe for at least one full business cycle
    • After metrics stabilize, gradually increase the ratio, and keep the old version configuration for rollback
    • After full切换, keep the old version deployed for a period before decommissioning it