LLM Deployment Cost Estimation: Sparse Activation and Low-Precision Formats

    This article presents a practical framework for estimating large language model inference deployment costs across GPU memory, compute, and communication. It compares dense models and mixture-of-experts models, examines routing, communication, and load-imbalance boundaries in MoE deployments, and reviews FP16, BF16, FP8, and FP4 tradeoffs for low-precision deployment. Readers gain calculation methods and deployment considerations for evaluating hardware limits and latency/throughput targets.

    1. Problem Boundary

    LLM inference cost is determined by GPU memory, compute, and communication. Whichever limit is reached first constrains the system. Evaluation should first answer two questions: whether memory can hold model weights and runtime caches, and then whether per-token latency and throughput can meet business goals.

    This article focuses on inference for decoder-only LLMs. Training cost, data cost, and holistic model-quality comparisons are out of scope. Most numbers are illustrative estimates used to show orders of magnitude and calculation methods; they are not measured results for any specific product. Actual selection should rely on stress-test data for the target hardware and workload.

    2. Compute Formulas for Dense Models and MoE

    In dense models, every token passes through all parameters for matrix multiplication. If the parameter count is N, forward matrix multiply-add compute per token is roughly 2N floating-point operations. This formula counts only matrix multiply-add; it excludes sequence-length-dependent attention compute, communication overhead, and memory access. It is a lower-bound estimate of compute, not a latency prediction.

    In mixture-of-experts (MoE) models, each token activates only some experts. Let total parameter count be P_total and activated parameter count per token be P_active. Matrix multiply-add compute per token is roughly 2 × P_active.

    Example: suppose an MoE model has P_total = 100B and P_active = 13B. Matrix compute per token is about 26 GFLOPs. A dense model of the same scale (100B) is about 200 GFLOPs. The compute ratio is about 1:7.7. This ratio reflects only theoretical matrix multiply-add compute; actual latency is also affected by memory access, communication, and scheduling.

    Batch size changes these conclusions. When batch size is greater than 1, matrix multiplication changes from vector-matrix to matrix-matrix, compute density increases, and hardware utilization usually rises. In MoE, however, different tokens in the same batch are routed to different experts, so the number of accessed experts grows with batch size. At large batch sizes, the expert weights actually read may approach all experts, reducing MoE’s memory-access advantage.

    The decoding phase deserves special attention for memory access. During single-token decoding, each step must read the weights involved in compute from GPU memory. A dense model reads all weights at every step. In single-token scenarios, MoE reads only selected experts, but as concurrency increases, the union of selected experts expands quickly. Therefore, estimating decoding speed from P_active alone can easily overestimate MoE benefits.

    3. MoE Boundaries: Routing, Communication, and Load

    MoE reduces compute but not weight storage. The router must select experts for each token in advance, and the system cannot know which expert the next token will enter. All expert weights must remain resident in GPU memory or quickly accessible memory. Thus P_total sets the lower bound on memory, while P_active mainly affects compute.

    Routing itself has overhead. Top-k selection, softmax normalization, and expert-grouped gather and scatter operations add memory access and scheduling costs. Production environments usually use fused operators and grouped matrix multiplication to reduce this overhead.

    When experts are distributed across multiple GPUs or nodes, communication is also required. With expert parallelism, each MoE layer typically needs one dispatch to send tokens to devices hosting the corresponding experts and one combine to return results to the original devices. If token count is T, each token selects k experts, hidden dimension is d, and each element occupies b bytes, the per-layer communication volume is on the order of 2 × T × k × d × b. Cross-node bandwidth is usually much lower than intra-node interconnect, so it can easily become a bottleneck.

    Load imbalance also causes problems. If some experts are selected by many tokens, devices hosting those experts slow down, and tail latency rises. Training commonly uses a capacity factor to cap each expert’s processing limit; excess tokens are dropped or rerouted, affecting output quality. Inference frameworks handle this differently. Before deployment, confirm whether the framework drops tokens and how the drop ratio affects the business workload.

    If memory is sufficient but communication bandwidth is limited, consider reducing expert parallelism or switching to a dense model. If concurrency is very low and latency requirements are strict, a dense model has a simpler execution path, and results are often easier to predict.

    4. Low-Precision Formats: How to Choose FP16, FP8, and FP4

    Numerical format determines bytes per parameter and also affects compute-unit throughput and numerical error. Common formats are listed below.

    Format Bytes per parameter Bit allocation (sign/exponent/mantissa) Common quantization granularity Hardware support Main risks
    FP16 2 1/5/10 Usually no scaling Widely supported High memory footprint
    BF16 2 1/8/7 Usually no scaling Widely supported Lower mantissa precision than FP16
    FP8 (E4M3) 1 1/4/3 Per-tensor or per-channel scaling Newer GPUs such as Hopper and later architectures; some other vendors’ accelerators Error increases with many outliers; scaling factors need calibration
    FP8 (E5M2) 1 1/5/2 Per-tensor scaling Same as above Fewer mantissa bits; validate precision-sensitive tasks
    FP4 (E2M1) 0.5 1/2/1 Block scaling Specific formats on newer GPU generations such as Blackwell Noticeable accuracy loss; depends on block size and calibration method

    Hardware support here must be verified against the official documentation for the target model. Vendors differ in FP4 block size, scaling-factor format, and native support scope. Do not assume a performance gain merely because a product says it “supports FP4.”

    Quantization granularity is key to accuracy. Per-tensor scaling is simplest, but a few outliers in a tensor widen the scaling range and reduce effective bits for most values. Per-channel or block scaling can mitigate this at the cost of storing and processing more scaling factors.

    FP8 accuracy degradation typically occurs in the following situations. Model activations contain many outliers.