Million-Token LLM Inference on Multi-Chip Systems: A Deployment Guide
Deploying a million-token-context LLM on a new class of accelerators requires more than loading weights and generating a first response. This guide explains how to plan prefill and decode workloads separately, preserve operator semantics across devices, evaluate independent tensor parallelism for grouped output projections, treat low-precision weight conversion as a separate delivery stage, and validate cache behavior and scheduling with mixed long and short requests. It also outlines an evidence-based rollout process for quality, capacity, and latency.
Deploying a large model on another class of accelerator and generating the first piece of text only proves that the inference path is connected. Stable service at a given context length and concurrency level depends on whether key operators actually run on the accelerator, whether cross-device communication cancels out the benefits of parallelism, and whether model behavior still meets expectations after weight conversion. For models that support million-token contexts, a data copy, temporary buffer, or cache allocation issue that is invisible in short requests can become a major bottleneck in long requests.
1. Define the workload before setting deployment targets
Inference resource planning should distinguish prefill from token-by-token decode. Prefill processes the input sequence and builds the attention cache. Long inputs place pressure on compute, temporary buffers, and cache allocation. The decode stage generates output step by step and repeatedly reads the existing cache. Its performance is often more sensitive to memory bandwidth, batching efficiency, and cross-device synchronization. End-to-end average throughput cannot explain the problems in each stage. At a minimum, record time to first token, inter-token interval, and request completion latency separately.
The memory budget also cannot be estimated only from parameter count and weight bit width. In addition to resident weights, it must include the attention key-value cache (KV cache), operator workspace, communication buffers, and runtime reserve. If the model uses a sparse expert architecture, activating only some experts per token does not mean the remaining weights do not need to be stored. Where weights reside still depends on the sharding and offloading strategy. Capacity acceptance should be based on peak memory at the target concurrency, not merely on usage after the service starts.
The maximum context supported by a model is not the same as the maximum request length the service promises. The former describes the model’s input capability. The latter is also constrained by concurrency, output budget, and latency targets. Define at least three workload classes: short interactive input, long-document processing, and mixed concurrency. For each, specify the input length distribution, output limit, arrival rate, and acceptable latency. Without a shared workload definition, cross-chip performance numbers are difficult to compare directly.
2. Unify operator semantics and keep hardware differences in the implementation layer
Multi-chip migration should not begin with line-by-line translation of device-specific kernels. A more maintainable approach is to first build an operator inventory for the model execution graph, covering attention, matrix multiplication, normalization, positional encoding, and quantization and dequantization. If the model uses expert routing, include token dispatch, aggregation, and their communication operations. Unified interfaces should define input and output shapes, data types, layouts, broadcasting rules, and necessary numerical tolerance. Different devices can choose different kernel implementations, but observable computation semantics should not change.
For long-context models with hybrid attention, the adaptation focus is to confirm how masks, compressed representations, and cache indices cooperate across different attention branches. Even if the architecture reduces theoretical computation and cache overhead by compressing historical information or using selective access, the backend may not obtain the same benefit. For example, if an operator first expands a compressed representation fully into a temporary buffer and then performs computation, the persistent cache savings may be offset by peak memory during prefill. Therefore, check operator results, actual tensor layouts, and intermediate buffer sizes at the same time, rather than only confirming that the model can run.
During debugging, keep a generic fallback path to distinguish semantic errors from device kernel issues. For production acceptance, record fallback trigger counts, reasons, and time spent. A low-frequency operator fallback may be acceptable, but implicit layout conversions and host-to-device copies on every layer or every decode step will accumulate across the full model. Adaptation results should clearly distinguish “covered,” “numerically validated,” and “performance-accepted for the target workload” to avoid mixing three different conclusions.
3. Plan tensor parallelism independently for grouped output projections
Tensor parallelism splits the weights and computation within a layer across multiple devices. For an output projection with a grouped structure, evaluate whether to set a separate tensor-parallel group for that module instead of applying the same parallelism degree to the entire execution graph. The value of this approach is that different layers have different weight sizes, compute density, and communication requirements. Local changes to the partitioning method may reduce peak weights or intermediate tensors on some devices.
During design, first map where tensors come from, where they are sharded, and what layout the next layer requires. For example, when splitting a linear projection along the output dimension, each shard can produce a different output slice. If the downstream layer can consume that sharded layout directly, immediate concatenation is unnecessary. When splitting along the reduction dimension, each device produces a partial contribution to the same output, and those contributions must logically be summed. Whether to keep the full result after reduction or continue with a sharded result after reduction should be determined by the downstream layout. If different device groups are used between modules, include redistribution cost in measurements.
In practice, establish a baseline with uniform sharding across the full model, then change only the target projection module. Compare per-device peak memory, prefill time, decode latency, and communication share. If independent sharding reduces memory but introduces excessive synchronization overhead during small-batch decode, treat it as a deployment option for memory-constrained scenarios rather than a universal default.
4. Treat low-precision weight conversion as a separate delivery stage
Weights stored in a mix of FP4 and FP8 do not mean the target device can perform inference in the original format. Before conversion, confirm the source weight encoding and scaling rules, the storage format that target operators can read, and the input and accumulation precision used during computation. Storage precision and compute precision are different concepts. Low-bit weights may be restored to higher precision before computation or inside the operator, and the actual benefit depends on whether intermediate tensors are additionally read or written.
Conversion should be performed offline. First parse encoded values, scale factors, group granularity, and tensor layouts according to the source format to recover the numerical meaning of the weights. Then, depending on the target backend, either requantize them into a supported FP8 format or store them as BF16. Requantization requires checking the new scaling granularity, rounding behavior, and overflow. Storing as BF16 usually increases weight footprint and cannot recover information already lost during earlier quantization of the source weights. Each converted artifact should record the source weight version, target format, conversion configuration, and integrity checksum, so that quality changes after launch can be traced.
Validation can be divided into three layers. First, spot-check weight blocks and single-operator outputs. Next, compare activations from representative layers against a reference implementation. Finally, validate end-to-end task quality. A few passages that read similarly are not enough to prove successful conversion. Long-document retrieval, structured output, and multi-step reasoning are more likely to expose errors that short samples do not cover. Character-by-character identity for all generated results does not need to be the only criterion, but acceptable numerical deviation and task quality variation should be agreed in advance.
5. Validate cache and scheduling with mixed long and short requests
Long requests consume more cache and may also occupy prefill resources, affecting time to first token for other requests. During stress testing, send short interactive requests and long-document requests into the service at the same time, rather than measuring them only separately. Evaluate chunked prefill, queues by input length, and admission control based on remaining cache capacity. If chunks are too large, short requests may still wait. If chunks are too small, scheduling and kernel launch overhead may increase. Trade-offs should be based on the tail latency of both long and short requests under mixed load.
If the runtime supports paged cache, further observe cache block utilization and reclamation. Paged allocation helps avoid reserving a large contiguous space for each request, but it cannot eliminate the capacity actually occupied by active requests. If prefix reuse is enabled, ensure that reused cache corresponds to the same model, token sequence, positional semantics, and applicable configuration, and that tenant isolation requirements are met. Tests should cover request cancellation, request timeout, and service restart, and check whether resources are reclaimed as expected, rather than validating only the normal completion path.
6. Roll out based on evidence, not a device checklist
Deliver in three stages. First, complete operator, weight, and numerical validation on a single device or the smallest device group. Next, run long sequences and mixed concurrency on the target parallel topology. Finally, use continuous stress testing and canary traffic to validate resource reclamation, fault isolation, and rollback. For horizontal comparisons, fix the model version, input distribution, output limit, and quality threshold, and record the precision path, device topology, batching strategy, and actual concurrency. Looking only at throughput can easily mistake increased queueing time or reduced output quality for a performance improvement.
Production acceptance should answer at least four questions: Are there unexpected fallbacks for key operators? Is there still sufficient memory headroom at the target concurrency? Does task quality meet the bar after precision conversion? If a failure occurs, can the service return to a validated model and runtime configuration? Unified operator interfaces reduce migration and maintenance costs. Local parallel strategies alleviate peak memory pressure. Precision conversion expands the range of deployable hardware. Whether these three are combined well should ultimately be judged by quality, capacity, and latency evidence under the same workload.
