Prefill-as-a-Service: How Inference Is Reshaping the AI Compute Landscape
This article explains why AI infrastructure is shifting from selling raw compute to selling reusable inference state, and introduces Prefill-as-a-Service (PrfaaS). It outlines three prerequisites for making this model viable: a hybrid model architecture that reduces state transfer volume, dedicated high-compute prefill clusters, and scheduling, caching, and metering mechanisms. It also covers the expected impact on inference cost, hardware procurement, and pricing, along with practical steps for evaluating and building such a system.
1. The Trend: From Selling Compute to Selling Reusable State
Over the past two years, the commercialization of AI infrastructure has centered on training: whoever operates the larger clusters with higher interconnect bandwidth holds the pricing power. As application-side call volume rises, however, the cost structure is tilting toward inference. Within inference, what gets paid for repeatedly is often not the model parameters themselves, but the compute consumed by re-prefilling the same context over and over.
Turning the intermediate state produced during inference—commonly known as the KV cache—from “temporary garbage” into a first-class asset that is persistent, addressable, reusable, and measurable is giving rise to a new service model: Prefill-as-a-Service (PrfaaS). Its commercial core is straightforward: convert one-time, repeated computation into a state asset that is computed once and reused many times, then charge based on calls and cache hits.
Whether this path holds up depends not on marketing narratives but on three hard conditions: model architecture, hardware form, and scheduling and metering mechanisms. Each is discussed below.
2. Prerequisite One: The Model Must Use a Hybrid Architecture
The most fundamental prerequisite is that the model uses a hybrid architecture (typically a design that alternates attention mechanisms with linear/state-space structures). The reason is not that it is “more fashionable,” but that the volume of state to be transferred differs by an order of magnitude.
At a 32K context length, a dense attention architecture requires state throughput of roughly 60 Gbps to move state across nodes; at the same length, a hybrid architecture requires only 4–8 Gbps. That roughly tenfold difference directly determines whether standard Ethernet can carry the load.
This is often misread as “hybrid architectures make compute cheaper.” A more accurate statement is that hybrid architectures do not reduce the amount of prefill computation; they compress the volume of state that must be migrated across machines. The result is a “compute-heavy, transfer-light” profile that fits PrfaaS’s division of labor: compute is concentrated on a few nodes, and the lightweight output is distributed.
A rough engineering check for whether a model is worth adapting:
# Illustrative only: estimate whether single-request state transfer time is acceptabledef state_transfer_ok(state_bytes, link_gbps, sla_ms=200):seconds = state_bytes * 8 / (link_gbps * 1e9)return seconds * 1000 <= sla_ms# Dense architectures often fail to fit standard Ethernet at long context lengthsprint(state_transfer_ok(state_bytes=8 * 1024**3, link_gbps=10)) # Falseprint(state_transfer_ok(state_bytes=256 * 1024**2, link_gbps=10)) # True
The conclusion is direct: if the model still uses pure dense attention, discussing PrfaaS is premature. Slim down the state at the architecture level first, then talk about serviceability.
3. Prerequisite Two: Dedicated High-Compute Clusters for Prefill
The second condition is often overlooked: prefill and decode have different hardware requirements.
Prefill is essentially large-batch matrix multiplication and is compute-bound; decode generates tokens one by one and is bound by bandwidth and latency. This has led to a class of specialized accelerator chips that deliberately reduce memory bandwidth in exchange for higher FLOPS density and lower unit cost. This tradeoff is reasonable in prefill scenarios: cheaper, more “specialized” compute handles the most time-consuming stage.
Public engineering practice shows that separating prefill from a homogeneous cluster and assigning it to a dedicated compute pool can improve overall throughput by about 54% over the homogeneous baseline. The gains come from three layers:
- Resource matching: high-compute, low-bandwidth devices are no longer held back by the bandwidth demands of the decode stage;
- Queue decoupling: long prefills no longer block the first-token latency of short requests;
- Lower cost: the most time-consuming stage runs on the hardware with the lowest unit cost.
4. Prerequisite Three: Scheduling, Caching, and Metering Mechanisms
The first two conditions are the physical foundation; the third determines whether this can become a business model.
- Tiered caching: write state into tiered storage (local memory/local disk/object storage), with “a hit saves compute” as the core metric;
- Affinity scheduling: route requests carrying the same prefix to the same replica to maximize hit rate, while setting a prefix-length threshold to avoid fragmentation;
- Metering: charge based on the number of prefill tokens saved by cache hits, the number of reuses, and the state residency duration, rather than a blanket per-GPU-hour rate;
- Observability: track hit rate, transfer time, and eviction rate through logging and monitoring/alerting systems, forming a closed loop for continuous tuning.
Illustrative scheduling logic:
def route(req, cache_index, min_prefix=1024):hit = cache_index.lookup(req.prefix)if hit and hit.matched_tokens >= min_prefix:return hit.node, "cache_hit"return least_loaded_prefill_pool(), "cold_prefill"
5. Impact and Implementation Recommendations
The impact on the AI field can be summarized in three points. First, the inference cost curve is rewritten, with repeated-prefix scenarios such as long context, multi-turn dialogue, and repository-level code Q&A benefiting most. Second, hardware procurement shifts from “all-rounder” to “division of labor,” with prefill pools and decode pools selected separately. Third, the service model moves from per-token billing to billing for “reuse value.”
Implementation recommendations: first quantify the prefix repetition rate of your own requests; if repetition is high and contexts are long, then evaluate migrating to a hybrid architecture and pooling prefill resources. At the same time, prioritize building cache observability—otherwise the hit rate cannot be optimized, and the business model has no foundation. If an organization lacks the conditions to build this itself, it can use general capabilities such as the container platform, object storage, and monitoring/alerting offered by platforms like Baidu AI Cloud to quickly set up a validation environment, then gradually evolve into an independent inference state service.
