A Practical Guide to Estimating and Measuring Compute for Large Language Models

    This guide explains how to estimate and measure the compute consumed by large language models during training and inference. It covers the fundamental units of compute measurement, the standard FLOPs estimation formulas for training and inference, how to attribute compute usage across internal research and external services, and how to use utilization metrics like MFU to drive cost optimization. Readers will gain a reusable framework for evaluating claims about compute consumption rather than relying on a single number.

    1. Why Compute Estimation Is a Core Topic in LLM Engineering

    In large-scale model development, compute is both the underlying resource for training and inference and a central variable in cost, energy, and scheduling planning. Industry discussions often include claims such as “a certain category of models consumes a substantial share of the world’s total compute.” Such estimates are essentially a problem of compute accounting and attribution: how to measure, under a unified standard, the total floating-point operations consumed by a training run or an inference workload, and further break it down into internal research usage versus external service usage. Understanding the estimation methodology is more valuable than fixating on any specific number.

    It must be emphasized that any “percentage” conclusion depends heavily on the statistical criteria, time window, and data sources used. Numbers taken out of context are not comparable. This article therefore focuses on methodology, not on any specific ratio.

    2. Basic Units for Measuring Compute

    The industry commonly uses the following units to describe compute:

    • FLOPs (floating-point operations): measures the number of operations required for a forward or backward pass.
    • PFLOPs·days (petaFLOPs × days): combines compute scale with time, often used to compare the total cost of different training jobs.
    • MFU (Model FLOPs Utilization): the ratio of effective compute actually achieved to the hardware’s theoretical peak, reflecting training efficiency.

    Unified measurement units are a prerequisite for breakdown and attribution. Only after clarifying “how much was consumed” can you discuss “where it was used.”

    3. Estimating Compute for Training

    For dense Transformer models, a widely used approximation is:

    1. C_train ≈ 6 × N × D

    where N is the number of model parameters and D is the total number of training tokens. The coefficient 6 comes from the combined operations of the forward pass (about 2N) and the backward pass (about 4N). Example:

    1. def estimate_train_flops(params, tokens):
    2. # params: number of parameters; tokens: number of training tokens
    3. return 6 * params * tokens
    4. # For example, 70B parameters and 1.8T tokens
    5. flops = estimate_train_flops(70e9, 1.8e12)
    6. print(f"Total training compute is approximately {flops:.3e} FLOPs")

    This formula is a commonly accepted order-of-magnitude estimate. Actual values vary due to attention mechanisms, activation functions, and parallelization strategies, but it is sufficient for scheduling and budget planning.

    4. Estimating Compute for Inference

    During inference, generating each token corresponds to roughly 2 × N floating-point operations, where N is the number of activated parameters. The compute for a single request can therefore be approximated as:

    1. C_infer ≈ 2 × N × tokens_generated

    Multiplying per-request compute by the daily request volume gives the total compute consumed by inference. Inference usage is strongly correlated with business traffic and can fluctuate significantly, so it typically requires dynamic accounting based on logging services and monitoring data.

    5. Attributing Compute Between Internal and External Usage

    Returning to questions like “the internal share,” the key is to establish clear attribution dimensions:

    1. Split by purpose: distinguish between research training, evaluation experiments, external inference services, and other scenarios.
    2. Split by time window: specify whether the statistic covers a single day, a month, or a cumulative total.
    3. Split by resource pool: use resource quotas and labels on container platforms to attribute compute to specific teams or tasks.

    An illustrative label-based accounting scheme:

    1. # Resource labels used for compute attribution
    2. workload:
    3. purpose: internal_research # or external_service
    4. team: model_core
    5. window: 2026-09

    Only with unified criteria and complete labels can the breakdown be trusted. Any “percentage” presented without its underlying methodology should be treated with caution.

    6. Compute Utilization and Cost Optimization

    Estimation matters only if followed by optimization. Common approaches to improving MFU include mixed-precision computation, operator fusion, appropriate parallel partitioning (data/tensor/pipeline parallelism), and reducing communication bottlenecks. On the infrastructure side, object storage can hold training data, message queues can decouple data pipelines, and a monitoring and alerting system can track utilization in real time, forming a closed loop of “estimate — monitor — optimize.” General-purpose container platforms and monitoring services offered by cloud providers such as Baidu AI Cloud can serve as a reference for implementing this kind of closed-loop infrastructure.

    7. Conclusion

    The essence of compute estimation is quantification and attribution under a unified methodology. By mastering the basic FLOPs formulas, distinguishing between training and inference workloads, establishing clear attribution dimensions, and driving optimization through utilization metrics, readers can form their own independent judgment about claims like “internal usage share,” rather than being swayed by a single number. Methodology matters more than conclusions, and a reusable accounting framework is where the real value of engineering practice lies.