Compute and Budget Planning for LLM Development: From Cost Estimation to Resource Governance

    This article explains how to plan compute and funding for large language model R&D. It breaks down training, data, engineering, and inference costs; presents a simple training compute and cost estimation model with code; discusses the trade-off between training and inference costs; proposes stage-gated investment and milestone management; and outlines resource governance practices such as quotas, cost dashboards, checkpoints, and coordination with financing.

    1. Background: Why Budget and Compute Need to Be Planned Together

    The cost structure of LLM R&D differs from that of traditional software projects. Traditional projects mainly spend on labor and servers, while LLM projects are centered on compute resources. A single training run may last several weeks, and the cost of one experiment can affect the pace of the entire project. Technical teams therefore need to plan budget, compute procurement, and the R&D roadmap in one unified table.

    Funding timing is often misaligned with R&D cadence. Financing is usually completed in rounds, and restrictions on fund usage and lock-up periods can affect the timing of compute procurement. If technical leads do not understand these constraints, they may face a situation where the budget is sufficient but GPUs are unavailable, or where compute has already been purchased but funding is insufficient to support inference services.

    2. Cost Breakdown

    LLM project costs can be divided into four categories.

    1. Training cost: compute time consumed, usually the largest expense. It includes pretraining, continued training, and fine-tuning.
    2. Data cost: data collection, cleaning, labeling, storage, and compliance review. Data quality directly affects training efficiency, and the cleaning stage is often underestimated.
    3. Engineering and labor cost: salaries of research, engineering, and operations staff, plus time spent debugging distributed training environments and troubleshooting failures.
    4. Inference cost: ongoing compute cost after the model goes live, driven by request volume and related to concurrency, output length, and model size.

    There are also hidden costs, such as waste caused by failed experiments. Small-scale experiments before formal training can consume a significant amount of compute. Teams should list an experiment quota separately in the budget so that formal training is not squeezed out by small experiments.

    3. Training Cost Estimation Model

    Total training compute can be approximated with a commonly used empirical formula:

    Total training compute ≈ 6 × number of parameters × number of training tokens

    The coefficient 6 comes from estimates of forward and backward pass compute. This formula is a widely used rough estimate in the industry; it is suitable for order-of-magnitude judgment, not for precise values.

    Effective compute depends on per-GPU peak compute, GPU count, and utilization. Utilization is affected by communication overhead, data loading, memory scheduling, and other factors, and is usually far below the theoretical peak. Therefore, a utilization parameter must be included in the estimate; hardware nominal peak values cannot be used directly.

    The following example demonstrates the complete calculation flow:

    1. from dataclasses import dataclass
    2. @dataclass
    3. class TrainingPlan:
    4. params: float # Number of parameters
    5. tokens: float # Number of training tokens
    6. peak_flops: float # Per-GPU peak compute, FLOPS (assumed)
    7. utilization: float # Effective utilization, 0 to 1
    8. gpu_count: int # Number of GPUs used for training
    9. price_per_gpu_hour: float # Price per GPU-hour, CNY (assumed)
    10. def estimate_training_cost(plan: TrainingPlan) -> tuple[float, float]:
    11. """Return wall-clock training hours and resource cost in CNY."""
    12. total_flops = 6 * plan.params * plan.tokens
    13. effective_flops_per_sec = plan.peak_flops * plan.utilization * plan.gpu_count
    14. wall_clock_hours = total_flops / effective_flops_per_sec / 3600
    15. cost = wall_clock_hours * plan.gpu_count * plan.price_per_gpu_hour
    16. return wall_clock_hours, cost
    17. if __name__ == "__main__":
    18. plan = TrainingPlan(
    19. params=7e9,
    20. tokens=1e12,
    21. peak_flops=3e14,
    22. utilization=0.4,
    23. gpu_count=256,
    24. price_per_gpu_hour=20.0,
    25. )
    26. hours, cost = estimate_training_cost(plan)
    27. print(f"Estimated wall-clock training time: about {hours:.0f} hours")
    28. print(f"Resource cost: about RMB {cost / 1e4:.0f} x 10,000")

    The peak compute, unit price, and utilization in the example are assumed values, used only to demonstrate the calculation flow. Actual projects should replace them with measured data and real quotes. With the parameters above, training takes about 380 hours and the resource cost is about RMB 1.94 million.

    This result also shows the importance of utilization. Cost is inversely proportional to utilization; if utilization drops from 0.4 to 0.2, both time and cost double. Teams should first calibrate utilization through small-scale measurements, then prepare the budget accordingly.

    4. Balancing Inference Cost and Training Cost

    After training ends, costs do not stop. Inference cost continues to occur with user requests and can be estimated per request:

    • Compute per request depends on input length and output length;
    • Cost per request ≈ compute per request ÷ effective compute × unit compute price;
    • Capacity planning needs to combine peak concurrency, redundant replicas, and latency requirements.

    Common ways to reduce inference cost include model quantization, request batching, result caching, and model distillation. These methods affect output quality, so they need to be validated together with evaluation sets. The revenue after the model goes live must cover the amortized training cost and ongoing inference spending.

    5. Phased Investment and Milestone Management

    Risk in LLM projects is concentrated in early investment. Splitting the budget by stage and setting exit conditions for each stage can keep risk within an acceptable range.

    • Stage 1: Small-model validation. The goal is to validate data quality and training recipes; this has the smallest budget share.
    • Stage 2: Medium-scale ablation experiments. Used to determine key parameters such as model architecture, data ratios, and learning rate.
    • Stage 3: Formal training. Set checkpoints and periodic evaluations to check training effectiveness regularly.
    • Stage 4: Alignment, evaluation, and deployment. Complete safety evaluation, performance evaluation, and launch preparation.

    At the end of each stage, both budget execution and evaluation metrics should be checked. Only when both meet the requirements should the project move to the next stage. The function below shows this dual-gate logic:

    1. def check_budget_gate(spent: float, budget: float,
    2. eval_score: float, target: float) -> str:
    3. """Dual budget and evaluation gate: pause further investment if over budget or below target."""
    4. if spent > budget:
    5. return "Pause: over budget; re-approval required"
    6. if eval_score < target:
    7. return "Pause: evaluation target not met; review data and training recipe"
    8. return "Continue: proceed to next stage"

    6. Resource Governance: Making Compute Visible and Controllable

    Compute resources are often shared by multiple teams. Without governance, contention and waste are likely. Resource governance can start from three aspects.

    1. Quotas and priorities: set resource quotas separately for experiments, formal training, and inference services, and define preemption rules for high-priority tasks.
    2. Cost dashboard: record GPU hours and costs by project and task, integrate monitoring alerts, and automatically notify owners when costs exceed thresholds.
    3. Checkpoint strategy: save training state periodically. When a failure occurs, recover from the latest checkpoint to reduce losses caused by recomputation. The checkpoint interval requires a trade-off between storage cost and loss risk.

    Resource governance should also address data compliance and intellectual property. The source, authorization, and scope of use of training data should be recorded for auditing and traceability.

    7. Coordinating Financing and Technical Planning

    The timing of funding determines the upper limit of available compute. Technical teams should establish a regular communication mechanism with finance and management, and provide three types of information on a regular basis:

    • compute demand forecasts for the next 6 to 12 months;
    • funding needs by stage and the corresponding milestones;
    • historical compute usage records and analysis of deviations between actual and estimated costs.

    Transparent cost data can support joint decisions on procurement timing, training schedules, and stage gates.