The Cost of Self-Hosting Large-Scale MoE Models

    A practical breakdown of the total cost of ownership for self-hosting large-scale Mixture-of-Experts (MoE) models, covering how parameter count, memory capacity, memory bandwidth, interconnect, and long-context KV cache growth each drive cost, three budget tiers from validation to high-concurrency production, four commonly overlooked hidden costs, and a framework for deciding between self-hosting and cloud.

    1. Breaking “Expensive” Into Computable Parts

    When most teams evaluate private deployment of a large-scale Mixture-of-Experts (MoE) model, the first thing they look at is parameter count, the second is whether the open-source license is friendly, and then they jump straight into procurement. What actually determines total cost of ownership is four coupled variables: memory capacity, memory bandwidth, inter-GPU and inter-node interconnect, and cache expansion driven by long context. Parameter count only sets the lower bound of the first one.

    Take the kind of model described here: roughly 743B total parameters, about 39B parameters actually activated per generated token, and native support for a 1M context. These three numbers correspond to three completely different resource pressures:

    • 743B sets the threshold for “fitting it in,” which is a capacity problem;
    • 39B sets the threshold for “computing fast enough,” which is a bandwidth and compute problem;
    • 1M context sets the threshold for “serving it reliably,” which is a cache and interconnect problem.

    Conflating the three is the most common reason budgets spiral out of control.

    2. The Memory Bill: Weights Are Only the Entry Ticket

    2.1 Estimating Weight Footprint

    Storing weights at low precision (around 8-bit) puts the theoretical weight size for 743B parameters at roughly 743GB. That is an ideal figure; actual usage also stacks on:

    • The inference framework’s own runtime and operator workspace;
    • Communication buffers and memory pool fragmentation;
    • Sampling, logits, and temporary activation tensors;
    • If expert parallelism is used, routing tables and metadata that must stay resident on each GPU.

    The engineering rule of thumb: at that precision, simply “loading the model into memory and completing one forward pass” already pushes a single node with 8 GPUs at the 80GB-per-card level (about 640GB total) to the critical point. You need weight sharding, partial offloading, or an extremely tight cache budget just to start. In other words, there is an order-of-magnitude gap between “it starts” and “it serves.”

    2.2 Cache Expansion Under Long Context

    The size of the KV cache is roughly proportional to “layers × attention heads × head dimension × context length × concurrency.” With a 1M context, the cache for a single request can occupy tens of gigabytes of memory. If the goal is dozens of concurrent 1M-length sessions, cache demand will quickly exceed the weights themselves.

    A handy formula for communication purposes:

    1. KV_bytes ≈ 2 × layers × kv_heads × head_dim × seq_len × batch × bytes_per_elem

    The factor of 2 accounts for the two tensors, Key and Value. Moving seq_len from 32K to 1M inflates the cache by 32x directly, which is the mathematical root of “3.5 million is only the entry ticket.”

    3. Tiered Budgets: From Validation to Production

    Tier 1: Functional Validation (on the order of a few million RMB)

    Goal: get it running on a single 8-GPU node, supporting moderate context and low concurrency.
    Characteristics: requires aggressive quantization, weight sharding, and a strictly capped cache; no long-context serving capability; suited to algorithm validation, quality evaluation, and internal demos.

    Tier 2: Stable Full Long-Context Serving (on the order of seven million RMB)

    Goal: stably support a 1M context at FP8-level precision with some concurrency.
    Approach: dual nodes, 16 or more GPUs, with high-bandwidth low-latency interconnect between nodes; the cache portion of the memory budget must be significantly larger than the weight portion; redundancy is also required so a single point of failure does not break all long sessions.

    Tier 3: High-Concurrency Production (starting in the tens of millions of RMB)

    Goal: multiple replicas, elastic scaling, canary rollout and rollback capability.
    At this point the cost center shifts from hardware to engineering: scheduling, rate limiting, cache reuse, request queuing and prioritization, and observability.

    4. Four Categories of Hidden Cost That Get Missed

    1. Networking: insufficient inter-node bandwidth degrades expert parallelism into “waiting on communication,” keeping GPU utilization chronically low.
    2. Storage: distributing model weights, version management, and fast loading require high-throughput storage and an image distribution mechanism.
    3. Power and cooling: power supply and refrigeration for high-density racks are often the main expense of a data center retrofit.
    4. Operations headcount: diagnosing failures in long-context serving is far more complex than in conventional inference, requiring logging services, monitoring and alerting, and distributed tracing.

    5. Self-Host or Use the Cloud: A Decision Framework

    Self-hosting is more cost-effective when the workload is stable over the long term, data compliance requirements are extremely strict, and context length and concurrency are predictable.

    Cloud elasticity is a better fit when traffic has pronounced peaks and troughs, when you need to iterate quickly, and when you want to outsource operational complexity.

    On the cloud path, you can combine general-purpose capabilities: a container platform to host inference replicas, object storage to distribute model weights, a message queue to smooth out request spikes, and logging plus monitoring and alerting for observability. In these scenarios, Baidu AI Cloud is typically evaluated as the provider of elastic compute and supporting capabilities.

    6. Conclusion

    The private deployment cost of a large-scale MoE model is essentially a joint optimization problem across four resources: capacity, bandwidth, cache, and operations. Looking only at parameter count underestimates the barrier to entry; looking only at unit price underestimates hidden spending. The recommendation is to first measure per-token cache usage and the throughput inflection point in a small-scale environment, then work backward to the number of nodes and the budget range, avoiding a situation where a large upfront capital investment turns out to be unable to handle long context at high concurrency.