Elamur Research

Efficiently Scaling Transformer Inference

Paper · 2022 · Reiner Pope, Sholto Douglas, Aakanksha Chowdhery et al.

Summary

A Transformer can read a supplied prompt in parallel, but it must generate a continuation in order. Each new token depends on what the system has already produced. For a large network spread across accelerator chips, every generation step calls for reading weights and stored attention state, performing matrix multiplications, and exchanging data across the interconnect. Efficiently Scaling Transformer Inference asks how to organize these operations when a service needs a quick response, a long context, or a low cost per token. The authors estimate the costs of arithmetic, device-memory access, and communication separately, then use those estimates to choose how to divide the work among chips.

The best arrangement can change within a single request. During prefill, the phase that processes the input, all newly supplied tokens are available together. Their intermediate representations can grow so large that gathering pieces of the weight matrices costs less than exchanging those representations. During decode, the phase that produces the continuation, a forward pass advances each sequence by a single token. The authors keep the weights on their assigned chips and split the matrices along both dimensions. That arrangement lowers the communication volume per chip as the system scales, while retaining a stored weight layout that also supports gathering during prefill.

The attention cache creates a separate placement problem. Multiquery attention shares the keys and values for a sequence across its query heads, which reduces how much history the network needs to retain. A layout that assigns query heads to different chips can still copy the same history onto each chip. For decode, the authors instead give different chips different sequences. They exchange the relatively small projections for the current token so that each chip can read only the cached history it needs. The paper reports support for up to 32× larger contexts in its headline comparison.

When the implementation runs PaLM 540B across 64 TPU v4 chips, it takes 29 ms to generate a token with int8 weights at a small batch size and reaches 76% model FLOPS utilization at a large batch size while prefilling a 2048-token context. Model FLOPS utilization compares the observed token throughput with the throughput corresponding to the hardware’s peak arithmetic performance. In the interactive example, the system takes 1.9 seconds to process 64 new user tokens, use 1920 tokens of cached history, and generate a 64-token reply. An offline configuration reaches 73% overall FLOPS efficiency while processing 1984 input tokens and producing 64 output tokens.

The authors compare their latency and utilization with FasterTransformer and also run Megatron-Turing NLG 530B in their own implementation. That comparison gives them a way to examine execution improvements with the same network family used by the baseline, alongside the gains from PaLM’s architecture. The results show which combinations of batch size, hardware allocation, tensor placement, and precision give attractive tradeoffs under the measured conditions. The fastest response and the cheapest token occupy different places on that frontier.

Deep dive: Efficiently Scaling Transformer Inference

Efficiently Scaling Transformer Inference explains how distributing weights and attention across chips changes generation speed, cost, and context capacity. · about 44 minutes to read

The problem and its context

The difference between reading and generating

In text generation, the source of parallel work changes when the system finishes reading the input. During input processing, it can compute representations for many positions together. The attention mask preserves the rule about which positions can see earlier tokens, while the known input allows the work across positions to proceed in parallel. During generation, the next input to the network is itself a result of the current step. A chip cannot compute the layer activations for that future token while the system is still deciding what it will be.

A batch gives the accelerator independent work across sequences. While each sequence advances in order, a forward pass can advance several sequences together. Increasing the number of sequences gives the hardware more work to do with a single load of the weights. It also expands the amount of state associated with the batch. The weights serve every sequence, whereas each sequence has its own history. The balance between these sources of work and traffic changes with the batch and the amount of preceding text.

The authors frame this problem against the growth of large language models. Earlier work they cite connects scale to performance on natural language processing benchmarks, including experiments with few-shot learning and studies of scaling laws. They point to systems with 100B+ parameters and then to PaLM and Megatron-Turing NLG in the 500B+ range. The ability to distribute training across many chips establishes that large networks can be built. Deploying the resulting parameters for sequential generation poses a different scheduling and memory problem. Language Models are Few-Shot Learners · Scaling Laws for Neural Language Models · PaLM · Megatron-Turing NLG 530B

Which resources a request uses

A request needs enough device memory to hold its share of a network’s weights. For the largest networks the paper studies, this requires multiple accelerators. Partitioning spreads storage across the chips and allows the memory interfaces and compute cores to work in parallel. It also creates dependencies between chips. If each computes part of a matrix product, their contributions must reach the places that need the result before the relevant downstream operation can proceed.

Past positions add a growing demand on memory. Each attention layer retains keys and values for earlier tokens so that later queries can use them. The paper calls this retained state the key-value cache, or KV cache. A larger batch gives the system more histories to store, and a longer context gives it more positions in each history. The same weights can serve all histories, so a capacity estimate based only on parameter count misses a part of the workload that grows independently.

For an illustration, the authors consider a 500B+ parameter network with multi-head attention, a batch of 512 sequences, and 2048 context tokens per sequence. The cache would occupy 3TB, or 3 times the storage occupied by the parameters in that example. Those bytes also have to be read during generation. Adding enough memory to hold the histories solves the capacity problem. Reading the histories quickly enough to sustain a desired generation rate is a bandwidth problem.

Attention also contributes arithmetic. In the full attention mechanism considered by the paper, processing a long input increases the number of interactions among positions, producing quadratic growth in the attention work with input length. During decode, the query for the current position looks back over cached positions. That means the amount of attention history consulted in a step can grow even while the number of newly processed positions stays fixed. This is why a long prompt challenges both phases, through different patterns of work.

Why the application changes the target

For a person using a chatbot, how soon the system starts responding and how quickly the response continues both matter. If a service uses more chips to make a step finish sooner, the additional hardware can raise the resource cost of each token. The same tension occurs with batching. A small batch can shorten the execution of an individual inference, while a larger one can give the accelerator more work for each weight load. The paper cites dialogue systems as a setting where a tight response-time target matters. LaMDA

An offline job might score a collection of examples or generate material for distillation. There the cost of completing the whole job can matter more than the wait for any individual sequence. A setting with more work per batch may be suitable if it raises tokens processed per chip per second. The practical question for both workloads is how much parallel work the system can expose without running out of memory or making communication the limiting step.

The scale of a deployment is consequently part of the question. A chip added to an existing group brings more memory, more arithmetic capacity, and another path for moving data. The resulting speedup depends on how the work is divided. If every chip must repeatedly collect essentially the same volume of activations, reducing the local matrix work eventually exposes that transfer as the dominant part of a step. A useful partitioning scheme changes the amount that each chip needs to exchange as the group grows.

What earlier systems contributed

The paper places its work within GPU and parallel computing research on dividing large networks among accelerators. Megatron-LM supplies a way to split the two matrix multiplications in a feedforward block so that the first produces a local intermediate suitable for the second. GSPMD provides the notation the authors use for assigning tensor dimensions to device axes. They also discuss NeMo Megatron and Alpa as prior approaches to training large networks. Alpa uses integer-linear programming to choose among parallel strategies. The authors’ own analysis asks which tensor transfers dominate for a given workload and how that answer changes with chip count. Megatron-LM

FasterTransformer provides the authors’ main inference comparison. The paper describes its combination of tensor parallelism, which divides the work inside an operation, and pipeline parallelism, which places different stages of the network on different groups of devices. It also identifies memory optimizations as part of FasterTransformer’s approach. DeepSpeed Inference extends available storage by using CPU and NVMe memory through ZeRO offload. Another approach discussed by the authors packs sequences more tightly at large batch sizes to reduce the amount of computation spent on padding. These techniques address distinct parts of the deployment problem, from placing the parameters to making better use of each operation. DeepSpeed Inference

The related work also includes efficient models and compression. The authors cite methods that alter attention, use distillation to produce smaller networks, prune parameters, or store values at lower precision. The inference framework incorporates weight quantization and can be considered alongside such architectural or representational changes. Multiquery attention itself predates the paper. The authors take it as an available architectural choice and ask how a distributed implementation can realize its memory saving. Reformer · DistilBERT · MobileBERT · LLM.int8()

The method, step by step

A layout specifies which pieces of each array, or tensor, a chip stores and uses. It also determines which pieces must arrive from other chips to carry out a layer. The authors begin by describing the work exposed to each forward pass. They use the shapes of weights, intermediate activations, and cached histories to estimate what each chip must read or exchange. This narrows the set of layouts worth measuring and helps explain why the preferred choice can change from one phase to the next.

Selecting and implementing a distributed inference layout

The steps in order.

Selecting and implementing a distributed inference layoutStep 1: Separate prompt processing from token generation1. Separate prompt processing from token generationStep 2: Count tokens available in each pass2. Count tokens available in each passStep 3: Estimate arithmetic, memory reads, and transfers3. Estimate arithmetic, memory reads, and transfersStep 4: Select a feedforward layout for each phase4. Select a feedforward layout for each phaseStep 5: Place attention state by heads or sequences5. Place attention state by heads or sequencesStep 6: Pair tensor exchanges with matrix operations6. Pair tensor exchanges with matrix operationsStep 7: Measure configurations across batches and chip counts7. Measure configurations across batches and chip counts

Set the token workload for each phase

The inference setup groups sequences of an equal input length and describes a fixed output length per sequence. This makes it possible to state exactly how many tokens a forward pass handles in the benchmarks. At prefill, the available work is the product of the number of sequences and the size of the input:

Prefill tokens = B × Lᵢₙ

Prefill tokens counts the positions processed across the batch. B counts sequences, and Lᵢₙ is the input token count per sequence. The multiplication gives the total number of input positions that the network can process together. The notation Lᵢₙ refers to the input length, which can be distinguished from the amount of history already cached when the system processes an incremental prompt.

During decode, the authors use a sequential loop of length Lgen, the number of tokens to generate for each sequence. A pass produces the information needed to sample a new token for each example. Within a pass, the feedforward layers see just B active positions, one per sequence. Over the full loop the system generates B × Lgen tokens, but this total cannot be treated as a single matrix multiplication over all output positions. When a layout calculation uses L for the sequence dimension handled in a pass, decode therefore has a short active sequence dimension even when its attention looks back over many cached tokens.

This distinction prevents a misleading comparison. A prefill batch and a decode batch can contain the same number of sequences and use the same total context length, yet offer very different amounts of work per forward pass. The feedforward part cares about how many token representations it operates on now. The attention part also cares about the earlier representations that each of those positions will consult. The authors size the relevant tensors according to those different roles.

Keep arithmetic and memory access in separate accounts

The paper estimates how much matrix arithmetic is associated with applying the parameters to a token:

Parameter matmul FLOPs per token ≈ 2N

Parameter matmul FLOPs per token counts floating-point operations in the parameter-related matrix multiplications of a decoder-only network. N is the parameter count. The factor 2 represents a multiplication and an addition. The approximation accounts for the dominant parameter operations and treats the additional attention matrix products separately. The authors explain that those attention products frequently make up a small share of the total arithmetic for large networks, while particular attention workloads can still be limited by their own matrix operations.

To estimate arithmetic time, the authors consider the rate at which the assigned chips could execute the work at peak FLOPS. FLOPs are a count of operations and FLOPS is a rate. The peak-rate calculation helps identify how far performance could improve if the arithmetic were the only burden. The hardware must also supply the operands. High-bandwidth memory, abbreviated HBM, holds weights and cached keys and values on each device. Moving these data into the compute cores takes time even when the arithmetic itself is short.

The largest HBM reads have different relationships to the workload. A weight shard is relevant to all the tokens processed by its local matrix multiplication. Increasing the number of tokens in the operation increases the arithmetic done with that shard. Cache reads during decode are tied to the individual sequences, so an increase in batch size also increases the number of histories consulted. The authors expect cache loading to become important in large workloads, giving 2048+ tokens of context with batch size 512+ as an example.

Chip-to-chip communication adds an independent cost. A layout can reduce weight reads and arithmetic per chip as the chip count rises, while leaving a substantial volume of activations to exchange. These estimates identify which cost deserves closer examination. The implementation can overlap transfers and arithmetic, so the estimated time for each operation describes work the system must schedule, with the exposed time depending on that schedule.

Describe a tensor by its logical shape and physical placement

The authors describe TPU v4 chips as a torus with three hardware axes. A torus connects the ends of an axis as well as adjacent positions along it. The chip count of the selected slice is:

C = X × Y × Z

C is the total chip count. X, Y, and Z are the numbers of chips along the respective physical axes. Lower-case x, y, and z in a layout label identify those axes when appended to a tensor dimension.

The paper uses E for embedding width, the dimension of a token representation entering the block, and F for the feedforward intermediate width. An activation with batch, sequence, and embedding dimensions has logical shape BLE. If its embedding entries are divided over every hardware axis, the shape on each chip is:

[B, L, E / (X × Y × Z)]

B is the number of sequences, L is the relevant sequence dimension, and E is the full embedding width. X, Y, and Z specify the physical division of that last dimension. The brackets list the extent of each local tensor dimension. With this placement, a chip holds all batch and sequence positions for its share of the embedding entries. In the paper’s notation an omitted hardware axis means the tensor is replicated over that axis.

A chip can hold a piece defined by where it sits in the output tensor, or it can hold a partial sum that contributes to the same output positions as pieces computed elsewhere. The difference arises from how matrix multiplication combines values. Splitting an output dimension gives different chips different result coordinates. Splitting the dimension being summed gives the chips contributions that must be added. The paper labels the latter as partial sums along the hardware axis on which the contributions are spread. This tells the implementation when it can pass a shard directly to the next operation and when it needs a reduction.

Account for what each collective moves

A collective is a group communication operation with a common pattern. In an all-gather, each participant starts with a piece of the tensor and ends with the pieces joined together. In a reduce-scatter, the participants contribute partial results, those contributions are summed, and each chip receives a shard of the summed output. An all-reduce sums contributions and gives every participating chip the entire result. The authors often break it into a reduce-scatter followed by an all-gather, which gives them control over the placement of the intermediate result.

An all-to-all performs a different task. Each chip sends the appropriate piece of its current data to the chip that will use it under a new division. For example, a tensor divided by attention heads can be rearranged into a tensor divided by sequences. The logical tensor is preserved while the chips responsible for particular entries change. This operation connects the layout used to compute the attention projections with the layout used to read histories.

The paper’s all-gather estimate is:

Tg = (D / W) × ((K − 1) / K)

Tg is the time for the all-gather in the analytical estimate. D is the size of the completed output on one chip, W is the network bandwidth in corresponding data units per unit time, and K is the number of participating partitions. Each chip already has its local chunk. The factor (K − 1) / K accounts for the remaining chunks that must be transferred. The appendix obtains that factor by considering transfers of chunks of size D / K through K − 1 links in the collective.

The reduce-scatter has the same estimate with D taken as the size of its larger input. For an all-reduce built from the two phases on matching buffer sizes, the paper gives:

Tr = 2 × Tg

Tr is the estimated all-reduce time, Tg is the matching all-gather time, and 2 counts the two equal estimated costs. In the feedforward derivations, the authors typically approximate (K − 1) / K by 1 for large K. In that simplified account, the relevant data size is the input to a reduce-scatter or the output of an all-gather. The rule allows them to compare layouts by asking how large that buffer is on each chip.

Begin with stationary weights split along one dimension

The feedforward block applies a matrix that takes a token from embedding width E to intermediate width F, then applies a matrix projecting back. In the 1D weight-stationary baseline, the partition is placed along the feedforward dimension. Every chip stores selected columns of the first weight matrix and the corresponding rows of the second. Its local part of the first multiplication produces the intermediate coordinates that its part of the second multiplication needs. There can therefore be a direct local handoff between the multiplications.

Communication is needed around that pair. The first multiplication needs the appropriate input activations, so an all-gather brings together embedding entries. The second produces partial contributions to the final embedding entries, so a reduce-scatter combines the contributions and distributes the result. The input buffer for the reduce-scatter and the output buffer for the all-gather both correspond to the full logical BLE extent on a chip. Using the collective approximation, the resulting cost is:

T₁ = 2BLE / W

T₁ is the communication time estimated for the 1D feedforward layout. B counts sequences, L counts positions per sequence in the operation, E gives the embedding width, and W is network bandwidth expressed consistently with the tensor size. The factor 2 accounts for the two transfers. There is no chip-count term in the approximation. Adding chips reduces the weight shard and its arithmetic, but eventually the activation transfers can set the pace.

Split stationary matrices along both dimensions

The 2D weight-stationary layout assigns the embedding width to the x axis and the intermediate width to the y and z axes. For an example with E of 1024 and F of 4096, the paper divides the former 4 ways and the latter 16 ways on 64 chips. The resulting 256-by-256 weight tiles are square. The two dimensions are of different sizes, so an even split of the available chip count between them would give a different tile shape.

This placement changes what the chips gather and reduce. Between successive multiplications, the layout alternates which group of chips combines activations. A group working along one partition axis needs only the entries selected by its position on the other. The chips exchange activation slices without gathering the whole logical activation on every chip. Although the strategy introduces an additional gather and reduction pair, each exchange concerns a tensor already divided along another axis.

The appendix collects the two contributions in this expression:

T₂ = (2BL / W) × (E / X + F / (Y × Z))

T₂ is estimated communication time for the 2D layout. B and L describe the active token batch, and W is network bandwidth. E and F are the embedding and feedforward dimensions. X is the number of partitions along E, and Y × Z is the partition count along F. The sum represents the two widths that govern the collective sizes, and 2 accounts for a gather and a reduction for each contribution.

To minimize the sum, the paper examines the common aspect ratio:

F = 4E

F is the feedforward intermediate width and E is the embedding width. The multiplier 4 is the paper’s assumption for this calculation. Under that assumption and with the total chip count fixed, the continuous choice for the embedding partition is:

X = 0.5 × √C

X is the number of subdivisions of the embedding dimension, C is chip count, and √ denotes the square root. The coefficient 0.5 gives the embedding dimension a smaller share of the chip partitioning. The companion choice is:

Y × Z = 2 × √C

Y and Z are the numbers of chips on the axes assigned to the intermediate dimension, C is total chip count, and 2 is the coefficient for their combined partition count. These choices balance the local widths in the communication estimate. In a deployment, the choices must correspond to axis sizes available on the hardware.

The optimized expression becomes:

T₂ = 8BLE / (√C × W)

T₂ denotes the estimated time after balancing the layout, B is the sequence batch size, L is the active sequence dimension, and E is the embedding width. C gives the number of chips, W is network bandwidth, and 8 is the coefficient in the paper’s expression under its width assumption. The inverse square-root dependence gives the communication term room to fall as more chips are used.

The authors describe the communication comparison with the 1D strategy using the criterion:

√C > F / E

C is chip count, and F / E is the ratio of intermediate width to embedding width. For the width ratio assumed in the derivation, the paper places the crossover above 16 chips. This is a comparison of the estimated communication terms. It gives an intuition for the two regimes. On small slices, retaining the intermediate completely on the chips that produced it avoids another exchange. On larger slices, exchanging narrower activations can save more time than that extra exchange costs.

Change what moves as the token batch grows

The stationary-weight layouts exchange activations whose size rises with the number of tokens being processed. The weight matrices have the same shape throughout the sweep over token batch sizes. Once the activation traffic becomes large enough, a chip can do more economical work by gathering the weights it needs and keeping its assigned activations more local. A partial gather makes sense between the extremes. It can keep activations local across some device axes while retaining a division of the matrix computation along others.

The authors start from the same stored weight tiles as in 2D weight-stationary execution. Immediately before the relevant matrix multiplications, they can gather over x, over x and y, or over all axes. The corresponding placements divide the activations by batch over the gathering axes. With gathering over x and y, for instance, the weights remain sharded along z. The gather reconstructs a weight slice of size EF / Z on each participating chip, and the remaining activation exchange handles a smaller slice because the batch has already been spread over x and y. The all-axis version can keep the feedforward activations on their assigned chips between multiplications.

For the cost analysis, let G denote the size of the gathering group. The estimate for exchanging the weights is:

Tw = 2EFG / (C × W)

Tw is estimated weight communication time, E and F describe the weight matrix, and G counts the chips in the gathering group. C counts all chips in the execution layout, and W denotes network bandwidth. The factor 2 covers the weight communication for the two matrices in the feedforward pair. A larger group gathers a greater portion of each matrix.

The corresponding activation estimate is:

Ta = 2BLE / (G × W)

Ta is estimated activation communication time, B is the number of sequences, L gives positions per sequence in the operation, and E is the embedding width. G again counts the gathering participants and W is network bandwidth. The factor 2 accounts for the remaining activation gather and reduction. In the estimate, activation communication declines as the gathering group grows. At the all-axis endpoint, the activation exchange over remaining axes can be omitted. The analytical family describes how the terms scale, using the collective approximation in its treatment of group sizes.

The continuous optimum balances the term that rises with group size against the term that falls:

G = √(BLC / F)

G is the estimated optimal gathering group size, B and L determine the token count in the pass, C is total chip count, and F is the intermediate width. The square root gives the group size at which the two terms balance. The paper’s main derivation uses L for the sequence extent. The appendix writes S in the corresponding optimum, where it occupies the same role in the token count. The implementation chooses among group sizes supported by the available axes while keeping a common stored layout.

Inserting the continuous optimum gives:

Tgathered = 4E√(BLF) / (√C × W)

Tgathered is estimated total communication for the weight-gathered layout at the optimum. E and F are the embedding and feedforward widths, B and L give the active token batch, C is the full chip count, and W is network bandwidth. The coefficient 4 belongs to the balanced sum of the terms. With widths and hardware held fixed, the optimized estimate grows with the square root of the token workload, whereas stationary-weight activation traffic grows in direct proportion to it. Prompt processing can therefore justify gathering over more axes. Decode has fewer active positions per pass and can reuse the original stationary tiles.

Give each sequence’s cache a place to live

Attention starts by projecting token representations into queries, keys, and values. A query determines which eligible positions a head attends to by interacting with their keys. The corresponding values supply the information the head combines. In multi-head attention, the head dimension supplies a natural way to distribute this work. A chip can own some heads, each with its own queries and history of keys and values. If there are more chips than heads, this division can require some replication. The attention study starts from a projection layout compatible with the feedforward layout.

Multiquery attention retains H query heads, with H denoting the number of such heads, while sharing a key head and a value head among them. At fixed head width, this reduces the logical cache size by a factor of H relative to separate keys and values for each head. Keeping the projection placement convenient for the feedforward block can still leave a physical problem. If chips own different query heads for the same sequences, each needs the shared key and value state. Replicating that state across the chips can absorb the savings offered by the smaller tensors.

The authors distinguish the placement of the projection matrices from the placement used for attention itself. WQ is the query projection matrix, WK and WV project to keys and values, and WO projects attention output back to the block’s representation. The matrices with a head dimension can be distributed consistently with the feedforward weights. In the multiquery design, the query and output projections have that dimension. The key and value projections would also have a head dimension with multi-head attention.

For decode, an all-to-all redistributes the current query, key, and value tensors over the batch dimension. The chips that perform the attention operation now own different sequences and can read the corresponding shares of the KV cache. The ideal fully batch-sharded comparison divides the cache load per chip by C, the chip count, relative to a copy on every chip. This saving concerns the repeated HBM read of history. The layout pays for the exchange of current tensors over the interconnect to achieve it.

The difference in size between those objects is what makes the exchange attractive. Current queries, keys, and values describe the new position for each sequence in a generation step. Cached keys and values can describe a history of 2048 tokens. Moving the current tensors allows the system to divide the larger recurring read among chips. The layout also spreads persistent cache storage, which can make a longer context or a larger batch feasible in the first place.

During prefill the current query tensor is much larger. Many query positions can use the same key and value tensors, so the cache access is shared across more arithmetic. Redistributing the queries by batch would also require moving more data than in decode. The authors therefore use the head-oriented layout for prefill. The attention decision depends on the ratio of current queries to historical state, while the feedforward decision depends on the balance of weight and activation traffic.

Fuse compatible operations and schedule transfers alongside arithmetic

PaLM’s parallel block sends the same normalized input to both attention and the feedforward branch, then adds their contributions. This arrangement uses one layer normalization where the serial formulation uses two. It also gives the implementation matrix operations that can be grouped. The query projection and feedforward input projections consume the same normalized tensor and can be fused. The key and value projections can be fused with each other. The attention output projection and the feedforward output matrix provide another opportunity for fusion.

Fusion lets the accelerator execute larger matrix operations. The parallel block also reduces communication because the branches can contribute to a common result before the relevant cross-chip reduction. The authors explain that this eliminates one of the two all-reduces along the layout axis used for feedforward or head parallelism. That change halves this part of the communication schedule. Its effect on overall latency depends on how much time that communication would otherwise have occupied.

The implementation uses Looped CollectiveEinsum to run portions of communication alongside matrix computation. The technique breaks an operation into pieces so that some useful arithmetic can proceed while other pieces are in transit. The authors build variants using asynchronous CollectivePermute for different hardware axes and for different priorities between throughput and response time. They also select which matrix operations to pair with particular transfers, because a transfer can overlap work only where the required operands and partial results are available at the right times.

The choice of where to scatter a reduced tensor is part of that scheduling problem. A completed result can be divided by batch or sequence, or by a hidden dimension such as the embedding or feedforward width. The authors favor hidden dimensions because those placements create better opportunities for their collective and matrix loops to overlap. They describe earlier training work that favors batch or sequence placement to save communication in layer normalization. Which placement is attractive depends on which subsequent operations determine the execution time.

Other implementation changes reduce padding and copying by adjusting the in-memory tensor layout. The authors accelerate top-k and top-p sampling, procedures that restrict the candidates from which the next token is sampled. They also use faster log-base-2 versions of Softmax and Swish, and support incremental prefill for cases where only part of a sequence needs new input processing. Their inference framework uses JAX and XLA, and the starting high-level implementation was based on T5X.

Change weight storage and measure what it saves

The authors use AQT to convert 16-bit weights to int8. The smaller representation reduces the amount read from HBM and the volume of weight traffic in the gathered layouts. The matrix multiplications in the tested implementation still use bfloat16 arithmetic. When a decode step spends much of its time getting the weights to the compute cores, shrinking those reads can reduce latency. Once a large token batch keeps those cores busy with arithmetic, the same storage change has less leverage over the dominant cost.

The procedure uses existing trained networks and variants configured for the performance study. The authors vary execution layouts, batch sizes, chip counts, and weight formats. Their benchmarks specify input and output lengths and, where relevant, how much history is already cached. The paper introduces no new training corpus or data split for learning the layout choices. Those choices come from the analytical comparison and from measuring runnable configurations.

Latency records elapsed time for a phase or for the complete inference. Decode latency per step divides the generation time by the number of output positions for a sequence. Throughput counts tokens across the whole batch per unit time. The paper reports utilization as:

MFU = Robserved / Rpeak

MFU is model FLOPS utilization, Robserved is measured token throughput, and Rpeak is the theoretical token throughput on the benchmark hardware if it operated at peak arithmetic performance with memory and communication overhead absent. The denominator depends on the hardware’s arithmetic rate and the work attributed to each token. MFU puts achieved throughput in relation to available compute, which is useful when configurations allocate different numbers of chips.

For comparisons of resource cost, the paper also uses:

Cost = C × t / (B × L)

Cost is measured in chip-seconds per token, C is the number of allocated chips, t is elapsed time for the measured work, B is the number of sequences, and L is the number of processed or generated positions per sequence in that measurement. For an entire decode run, this L represents the output length over which time was measured. The numerator charges for all assigned chips during that interval. The denominator distributes that cost over the tokens completed by the batch.

The authors sweep configurations and examine the Pareto frontier, the set of measured operating points that offer the most attractive tradeoffs between their objectives. In their benchmark description, a latency and MFU pair qualifies if, for every other listed result, its latency is no greater or its MFU is no lower, with the comparisons allowing equality. The comparison considers the entire set for a workload. A system can thus offer a useful operating point at one latency even when another configuration delivers higher utilization at a longer latency.

Experiments and results

Hardware and benchmark workloads

The main case study covers PaLM 8B, 62B, and 540B with bfloat16 and int8 weights. The authors use up to 256 TPU v4 chips. They give the specifications per chip as 275 TFLOPS for bfloat16 matrix arithmetic, 32 GiB of HBM with bandwidth of 1200 GB/s, and 270 GB/s of interconnect bandwidth. The arithmetic figure provides a basis for utilization, the memory capacity determines what fits, and the two bandwidths govern different transfers. A layout that distributes cache reads across memory interfaces can improve one of these costs while requiring work on the interconnect.

For PaLM 540B, the authors pad the attention-head count from 48 to 64 to improve placement on 64+ chips. They report an additional 18B parameters from the padding and a 3% MFU cost, which the improvement in partitioning more than recovers in their implementation. This adjustment matters when interpreting the name PaLM 540B as shorthand for the benchmarked network. The implementation deliberately performs some additional work to obtain a more favorable division across chips.

The PaLM frontier uses a context length of 2048. The prefill measurements time the processing of 2048 input tokens per sequence. The decode measurements generate 64 tokens with the context already processed. Candidate settings vary by batch size and chip count, with layouts and precision chosen for the operating point. The appendix also studies the low-latency case by holding the batch size at 1 and varying the prefill sequence length between 32 and 1024. The benchmarks are organized around token workloads and hardware allocation. Their measured outcomes are latency, token throughput, utilization, and resource cost, rather than accuracy on a named task dataset.

Low-latency generation and weight precision

At batch size 64 on PaLM 540B, the detailed decode comparison shows the effect of switching the stored weights from bfloat16 to int8. The paper’s headline 29ms per token is its low-batch generation figure for int8 weights on 64 TPU v4 chips. The frontier discussion reports the more precise per-token measurements in the chart. These timings concern the generation phase with the context available.

PaLM 540B decode latency at batch size 64 with a 2048-token context

Storing weights in int8 shortens the generation step in this low-batch comparison.

PaLM 540B decode latency at batch size 64 with a 2048-token contextBfloat16 weights: 36.9Bfloat16 weights36.9Int8 weights (this paper): 28.5Int8 weights (this paper)28.5
The numbers
System or settingms/token
Bfloat16 weights36.9
Int8 weights (this paper)28.5

At low latency targets, the authors report that int8 weights improve resource cost by just over a factor of 2. They attribute the advantage to how much of that regime is spent loading weights. At larger batches, the cost difference between weight formats is smaller. A chip can share a weight load across more token positions, and both formats still feed bfloat16 matrix computation. The weight format has changed the bytes moved more directly than the amount of arithmetic performed.

The decode sweeps put the low-batch result in context. The paper finds the lowest resource costs at batches larger than about 512, where cost is proportional to parameter count. Smaller batches can complete a generation step sooner, at a higher chip-seconds cost per token. The authors describe the minimum generation latency as 3 times lower than the latency at batch size 512. The fast operating point is relevant when a single response matters, while the larger batch is relevant when many outputs can share the assigned hardware.

Prefill reaches higher utilization

The main prefill sweep for PaLM 540B on 64 chips holds the per-sequence input length at 2048 tokens. It starts with 1 example, giving a 2048-token batch, and extends to 512 examples, which the authors describe as a batch of 1 million tokens. These are sizes of work submitted together to prefill. They expose many more positions to the matrix operations than a decode step with the same number of sequences could.

At the small end, the 2D weight-stationary layout avoids the upfront cost of gathering weights. As the batch grows, the preferred configuration switches to weight-gathered execution. At large batch size, the authors report 76% MFU and describe communication overhead as nearly negligible. They also point out that multiquery attention makes those batches possible by keeping attention state within the available memory. The feedforward result consequently depends on the system being able to admit the workload in the first place.

The cost penalty at small batches is milder for prefill than for decode. Even batch size 1 can give prefill a substantial number of positions to process together when the input is long. For batch size 512, the authors report prefill cost per token as 2 times lower than decode cost per token. They attribute this to the higher utilization of the weight-gathered prefill layouts. The utilization curves in the appendix also show a change when the prefill configuration switches from 2D stationary weights to gathering across all hardware axes.

Interactive and offline examples

The interactive example uses PaLM 540B with int8 weights on 64 TPU v4 chips. A user supplies 64 new tokens, and the system already has the attention state for 1920 tokens from the conversation. The system processes the new text, uses the cached history, and generates a 64-token response in 1.9 seconds. The distinction between new input and retained state matters for the workload. Prefill applies the network to the new positions. Decode still has to consult the relevant history as it produces the reply.

For low-latency settings, the authors combine batch size 1 at prefill with decode batches of 32 to 64 sequences. They report that raising the decode batch up to 64 has negligible impact on latency in these settings and improves decode utilization substantially. The paper gives two ways to use different batch sizes in practice. A system can generate multiple samples from a shared input, or it can send work from a small-batch prefill server to a server that groups more sequences for decoding. Either way, the batch size appropriate to the input phase need not dictate how the output phase uses the hardware.

The offline example processes 1984 input tokens and generates 64 output tokens per example. The paper reports 73% overall FLOPS efficiency for this throughput-oriented workload. The overall measure spans both stages. The 76% measurement above concerns large-batch input processing alone. Offline configurations favor larger batches and switch feedforward layouts between phases. The authors use bfloat16 weights for their high-throughput configurations because the relative cost of weight loading is small and their large-batch int8 implementation lacks some optimizations.

How size changes the frontier

The paper compares PaLM 62B and 540B configurations that serve similar objectives. It reports similar batch sizes and the same partitioning layouts, with more chips assigned to the larger network. The high-throughput MFUs are similar. Since utilization measures performance relative to the arithmetic needed, comparable MFU says how effectively each configuration uses its hardware. Absolute resource cost still depends on the size of the network and the hardware allocation.

At low batch sizes, latency on the measured frontier grows more slowly than parameter count. The authors explain that the larger network gives them enough local work to profit from distribution over more chips before transfers dominate. They estimate an approximately square-root relationship between network size and low-batch generation latency from the measured frontier. That relationship describes the configurations that could be assembled on the hardware in the study.

Larger matrix multiplications often favor the larger networks in utilization, but the appendix identifies a reversal among long-latency decode points. PaLM 62B reaches higher MFU than PaLM 540B in that regime. The smaller configuration uses 8-way model parallelism and the larger one uses 64-way model parallelism. The authors suggest that reducing the extent of parallelism for PaLM 540B could improve the throughput-oriented regime. The exception illustrates why a larger matrix multiplication alone cannot determine utilization when the extent of cross-chip cooperation also changes.

Comparison with FasterTransformer

The cross-system comparison tests workloads of 20 input tokens with 8 output tokens, 60 input tokens with 20 output tokens, and 128 input tokens with 8 output tokens. The authors run both PaLM 540B and Megatron-Turing NLG 530B on 64 TPU v4 chips, each with 32 GiB of HBM. The FasterTransformer results use 16–32 NVIDIA A100 devices with 80GiB of HBM per device. Reporting MFU normalizes throughput by the available peak arithmetic rate and chip count. The communication and memory systems still differ across the platforms.

In the highlighted workload with 60 input and 20 output tokens, the TPU implementation of PaLM has the best absolute latency. The authors’ Megatron implementation gives the best MFU at all but one latency target in the comparison for that network. Placing their implementation of Megatron alongside FasterTransformer makes it possible to compare execution systems using Megatron as well as to see how the PaLM architecture performs on the authors’ system.

On that short-context workload, PaLM’s lead over their Megatron implementation reaches up to 10% MFU. The authors attribute most of the advantage to the parallel attention and feedforward block. They say Megatron’s larger embedding and feedforward dimensions partly offset the block advantage. The context is short enough that they observe little benefit from PaLM’s multiquery cache arrangement. That combination of architectural effects helps explain why the comparison is informative about short-context execution and why the authors also run separate long-context experiments.

The authors also compare utilization reported at different degrees of tensor parallelism. FasterTransformer reports 8-, 16-, and 32-way configurations. Its reported maximum for 32-way parallelism is 33% MFU across the benchmarks, against 46% for the 16-way configuration. The authors’ implementation reaches 44% MFU with 64-way tensor parallelism. They interpret the FasterTransformer decline as a likely sign of communication pressure at higher parallelism. Their own result shows that a larger chip group remains viable for the partitioning strategy and interconnect they use. These are figures across reported configurations, with the per-workload comparisons supplying the latency and utilization tradeoffs.

The benchmark appendix traces a frontier across the measured configurations within each input and output length pairing. It also distinguishes the frontier for Megatron-Turing NLG from the one that includes PaLM. This lets a reader evaluate the shared-network comparison and the best observed 500B-class operating points. The focus on short, matched workloads complements the paper’s own benchmarks, which also consider contexts in the 1024–4096 range and report prefill and decode separately.

What the ablations show

Feedforward layout changes how extra chips help

The feedforward decode experiment compares the 1D and 2D weight-stationary layouts at batch size 512. At that batch size the authors balance their interest in step latency with exposing enough work to obtain useful utilization. The comparison examines the layouts as chip count increases, and the paper also identifies the PaLM 540B decode comparison on 64 chips. Both approaches start to encounter communication limits, with the 2D layout performing better. This is the behavior predicted by the smaller per-chip activation exchanges in the 2D derivation.

There is a reason to look at the layout and the chip count together. At a fixed workload, dividing the network over more chips can shrink the local weight read and the local multiplication even in the 1D case. If the activation collective still takes about the same time, its share of the step grows. The 2D layout can continue reducing that term because the activation sent along one axis is already divided along the other. The comparison supports this explanation for the measured scaling and also shows that communication remains relevant under the improved layout.

The token-batch sweep in prefill tests a different prediction. The gathering variants initially spend too much on weights for the amount of activation traffic they save. Large token batches move the system into a regime where an activation exchange would be more expensive. The observed switch from stationary to gathered weights follows the direction predicted by the analysis. Since the stored weight layout is shared, this test also demonstrates an execution choice that can be made for the phase’s workload using one underlying placement of the parameters.

Separate the attention architecture from the cache placement

The authors compare three attention configurations for PaLM 540B: multiquery with batch partitioning, multiquery with the baseline head-oriented layout, and a modified multi-head variant. In the multi-head variant, the width of each head is 128, compared with 256 in the multiquery version. The adjustment is intended to keep the attention parameter count constant. Comparing the two multiquery layouts holds the attention architecture fixed; comparing with multi-head attention includes a change in how keys and values are represented.

With 64 chips and 30% of overall memory reserved for the cache, the capacity comparison favors batch-partitioned multiquery attention. The paper’s headline and the table caption describe support for contexts up to 32× larger with the optimized layout. The attention discussion gives a range of 32–64 times for the comparisons with the baseline multiquery and multi-head variants. The paper reports these figures in different places, and the capacity estimate depends on the baseline layout and available memory. Both descriptions indicate that changing the physical placement of shared keys and values yields a much larger usable history under the tested allocation.

The head-oriented multiquery case is especially informative. Sharing keys and values shrinks the logical object in both multiquery runs. Only the batch-partitioned run gives chips separate sequence histories to hold and read. The improvement therefore depends on avoiding physical copies as well as on reducing the number of key and value heads. The modified multi-head comparison shows how the alternative architecture fares with the attention parameter count controlled, while the two multiquery layouts pinpoint the placement effect more directly.

Vary the amount of history consulted

The figure showing attention timings is based on an 8-layer PaLM 540B model run across 64 chips with 256 sequences per batch. Using fewer layers permits the authors to compare latency over a range of context lengths even when the full baselines would exhaust their cache allowance. The paper identifies 118 layers for the full network and marks contexts longer than 512 as exceeding capacity for the full multi-head and baseline multiquery variants under those conditions.

At short contexts the gain in step time is small because the feedforward operations occupy most of the run. As the context grows, attention has more history to read and the benefit of distributing that read becomes more visible. Separately, the paper reports optimized multiquery operation at context lengths of 8192–32,768 tokens, paired with batch sizes 512 and 128, respectively. Attention accounts for 8–31% of total runtime in those settings. The batch sizes belong with the corresponding context lengths because both affect the amount of state that must fit.

The prefill analysis gives a complementary test of the mechanism. Multi-head and multiquery attention have similar input-phase latency when many query positions are computed together. The authors attribute this to attention matrix arithmetic becoming the limiting operation. During decode a new query uses a large store of past keys and values with little other new query work to share the read. The advantage grows under the phase and context conditions where the proposed placement is expected to save the most memory time.

Isolate changes to the block and schedule

For the block comparison, the authors replace PaLM’s parallel attention and feedforward branches with a serial version. Generation uses 64 chips, batch size 512, and 2D weight-stationary execution. The serial block has 14% higher latency per generation step than the parallel block. The authors attribute the difference to the greater time spent communicating activations. The result concerns the block as implemented, including the changes to opportunities for fusion and reduction.

The difference between the blocks shrinks in prefill. In the weight-gathered prefill layouts, activation communication is already smaller, which reduces the time the parallel block can save through its communication advantage. The phase comparison connects the measured block improvement to the surrounding placement of tensors. It also explains why the same architectural edit can produce different latency effects while carrying out broadly similar computations.

The paper reports about 1.4 times better performance after its low-level communication and scheduling work, compared with the simpler implementation that initially relied on compiler partitioning and scheduling. Some gathered layouts would also exhaust memory without those optimizations. This is an aggregate comparison. The performance result covers changes that make collective operations overlap matrix work and manage the execution of those operations. The paper gives no individual timing contribution for each scheduling variant, tensor layout adjustment, or sampling improvement.

Limitations

Limits the authors state

The quantization experiments cover stored weights. Activations retain their existing precision and the matrix operations use bfloat16. The authors identify activation quantization as a possible way to reduce arithmetic time at large batch sizes and shrink the activation transfers in stationary-weight layouts. Their software also lacks some large-batch int8 optimizations, so the high-throughput configurations use bfloat16. The observed precision tradeoff therefore pertains to their storage and computation paths.

The FasterTransformer appendix omits batches below 4. The authors explain that batch-sharded multiquery attention gives no speedup below that size on their setup because the smallest TPU v4 torus axis has size 4. The result follows from the number of sequences available for distribution over an axis. The paper’s separate PaLM prefill experiments include batch size 1, which serves a different purpose and uses a phase with a different attention layout.

The methods address execution of dense networks whose arithmetic and communication still impose substantial costs. In the conclusion, the authors point to sparse expert architectures, adaptive computation, and compression of data exchanged between chips as ways further work might reduce those burdens. They also identify an optimization opportunity within their own setting, suggesting less parallelism for PaLM 540B in the latency-tolerant regime. The frontier represents the best points found in their sweeps, and the authors describe room for additional configurations to improve it.

Limits of the communication calculations

The bandwidth estimates abstract away details that matter to a real schedule. The approximation for collective costs assumes sufficiently large groups, and the stationary and gathered layout calculations use compact terms for the main transfers. Small collectives, available torus shapes, the need for divisible tensor dimensions, and the placement of the next operation can alter the attainable schedule. The mathematical optimum still helps explain the direction of a change, such as why more tokens favor gathering over more axes.

The stationary-weight result with balanced tiles assumes a particular ratio of intermediate width to embedding width. A network with different dimensions changes the relative sizes of the two groups of activation transfers. Similarly, the continuous solution for the gathering group describes a balance between increasing weight traffic and decreasing activation traffic. Real execution chooses concrete device groups supported by the topology. A change in the interconnect or in the physical shape of a slice changes what those choices can achieve.

The measured implementation overlaps transfers and arithmetic. A collective whose nominal cost is large can expose only part of that cost on the critical path if suitable computation runs concurrently. Temporary buffers also determine which layouts fit. The derivations give resource estimates, while the timing results include the consequences of the actual scheduling and memory layout. Treating a communication expression as a complete prediction of inference latency would lose that distinction.

Limits visible in the experimental comparisons

The detailed implementation is evaluated on TPU v4. The authors argue that the partitioning strategies can generalize to other topologies, including single-node and multi-node NVLink systems. The evidence for particular utilization and latency values comes from the configurations they benchmarked. In the FasterTransformer comparison, differences in accelerator hardware, memory characteristics, and interconnect accompany differences in implementation. MFU accounts for peak arithmetic throughput. Those other hardware differences still affect where the performance frontier lies.

The same-network comparison with Megatron-Turing NLG helps separate differences in network architecture from system-level improvements. It does not isolate the share of a gain due to the interconnect, the tensor partition, the collective implementation, or the compiler. The PaLM results additionally combine head padding, multiquery attention, parallel blocks, layout decisions, and low-level scheduling. Controlled comparisons narrow some of these effects, such as the change from parallel to serial blocks. The headline measurements describe the resulting system as a whole.

The approximately square-root growth in low-batch latency is inferred from configurations along the measured PaLM frontier. The comparison lets the chip count rise with network size. Applying that observation to a fixed number of devices or to hardware with a different communication balance would change the premises. The measured scaling is conditional on being able to choose an effective partition and a suitable slice.

Limits of the context and service measurements

Context capacity describes how much history the system can retain and operate on. The paper measures cache feasibility, phase latency, and the share of runtime spent in attention. These outcomes leave open how reliably a network uses information at different positions in a long input. The 8-layer attention timing experiment extends the range over which competing layouts can be timed, and the 118-layer capacity observation provides a separate bound for the full configuration. A timing from the smaller network applies to that timing setup.

For int8 weights, the authors say the conversion produces no noticeable quality loss. The main experiments time execution and quantify resource use; they provide no task-by-task account of quality across contexts or output types. The precision result therefore provides more detail about latency and memory traffic than about the behavior of generated text under quantization.

The interactive and offline examples model different serving objectives through concrete workloads. In a live service, requests can arrive at different times and have different input and output lengths. A batch may take time to assemble or contain sequences that finish at different times. The reported phase and end-to-end timings concern the specified benchmark workloads, leaving queueing and variation across live requests outside the measured outcomes. Likewise, chip-seconds per token measures the hardware time consumed by an execution, while a monetary cost would depend on how that hardware is supplied and priced.

What came after

Attention architecture and the cost of keeping history

GQA takes up generalized multiquery attention and the problem of training it from multi-head checkpoints. Efficiently Scaling Transformer Inference had already made the number and placement of key and value heads consequential for distributed execution. GQA’s focus brings the checkpoint into that discussion. The architecture an inference system receives determines how much distinct attention state it can distribute by head, and a method for working from a multi-head checkpoint addresses how that architectural choice can be reached from an existing training result.

KIVI targets the KV cache with tuning-free asymmetric 2bit quantization. The earlier paper reduces the physical cache burden by sharing keys and values and distributing histories by sequence. KIVI’s stated focus is the representation of each cached value. This extends the same memory question to another part of the storage calculation. How many values a system keeps and how much space each value occupies both shape the cost of reading a history during generation.

Efficient Streaming Language Models with Attention Sinks brings attention state into a streaming setting. That setting makes the treatment of earlier positions a continuing part of execution as tokens arrive. Gemini 1.5 addresses very long contexts in multimodal understanding. Its subject places context capacity alongside a different question, what a system can understand given an extended input. These works cite the inference study from settings where storing, processing, and using prior context are all consequential.

The two phases as a scheduling problem

Splitwise makes phase splitting the organizing principle of a generative inference system. The earlier paper shows why prompt processing and generation reward different tensor placements. It also describes a prefill server feeding a decode server with a different batch size. Splitwise carries the phase distinction into the design of serving. Once phases are organized separately, the design has to account for where each runs and how it obtains the state created by the preceding phase.

SARATHI approaches the same scheduling issue through chunked prefills with decodes piggybacked on them. Breaking prompt processing into chunks changes the unit of prefill work that can be scheduled together with generation. The earlier experiments explain what makes such a choice consequential. Prefill presents many positions with opportunities for efficient matrix arithmetic, while a decode step advances each sequence by a single position and consults its accumulated history. How the two forms of work are combined affects the workload the accelerator sees.

Sarathi-Serve puts the throughput and latency tradeoff at the center of its serving problem. The PaLM experiments describe that tradeoff through batch size, chip count, and the layouts used by each phase. A serving system also faces the question of how to schedule work to reach an operating point with both useful throughput and acceptable response time. Llumnix takes up dynamic scheduling for serving, placing the emphasis on decisions made while the workload is running.

Weight precision, hardware budgets, and decode work

SmoothQuant follows the quantization direction through accurate and efficient post-training quantization. Atom explicitly studies low-bit quantization for serving. The earlier TPU measurements establish a concrete reason to distinguish which quantities change precision. Storing weights in int8 helps most while weight movement dominates, and a separate question arises when arithmetic or the transfer of activations sets the pace. Later work on serving quantization takes place against that distinction between representation and execution.

FlexGen studies high-throughput inference with a single GPU. It shares the interest in completing more token work within a constrained hardware budget, but the available device memory and the movement of data must be considered for that single-device setting. The scaling paper studies how to profit from many communicating accelerators. FlexGen’s setting makes clear how the hardware budget can define a different version of the throughput problem.

Medusa studies acceleration through multiple decoding heads, and Draft & Verify approaches acceleration through self-speculative decoding. The original analysis treats each decode pass as an advance of one token per sequence. These later directions address the organization of decoding itself. If a procedure changes the work a decode pass can accomplish, it also changes the workload against which weight reads, cache reads, arithmetic, and cross-chip transfers have to be weighed.

Cite

Cite as Reiner Pope, Sholto Douglas, Aakanksha Chowdhery, Jacob Devlin, James Bradbury, Anselm Levskaya, Jonathan Heek, Kefan Xiao, Shivani Agrawal and Jeff Dean. 2022. Efficiently Scaling Transformer Inference. arXiv:2211.05102.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.2211.05102 · arXiv 2211.05102

@misc{pope2022efficiently,
  title = {{Efficiently Scaling Transformer Inference}},
  author = {Reiner Pope, Sholto Douglas, Aakanksha Chowdhery, Jacob Devlin, James Bradbury, Anselm Levskaya, Jonathan Heek, Kefan Xiao, Shivani Agrawal and Jeff Dean},
  year = {2022},
  doi = {10.48550/arxiv.2211.05102},
  eprint = {2211.05102},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2211.05102}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/pope-2022-efficiently-scaling-transformer-inference/

References

50 references, from the paper's own bibliography.

  1. T5x, 2021. URL https://github.com/google-research/t5x. OpenAlex ↗ · Scholar ↗
  2. AmirAli Abdolrashidi, Lisa Wang, Shivani Agrawal, Jonathan Malmaud, Oleg Rybakov, Chas Leichner, and Lukasz Lew. Pareto-optimal quantized resnet is mostly 4-bit. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3091–3099, 2021. OpenAlex ↗ · Scholar ↗
  3. Reza Yazdani Aminabadi, Samyam Rajbhandari, Minjia Zhang, Ammar Ahmad Awan, Cheng Li, Du Li, Elton Zheng, Jeff Rasley, Shaden Smith, Olatunji Ruwase, and Yuxiong He. Deepspeed inference: Enabling efficient inference of transformer models at unprecedented scale. arXiv preprint arXiv:2207.00032, 2022. our card
  4. James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: Composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax. OpenAlex ↗ · Scholar ↗
  5. Christopher Brix, Parnia Bahar, and Hermann Ney. Successfully applying the stabilized lottery ticket hypothesis to the transformer architecture. arXiv preprint arXiv:2005.03454, 2020. OpenAlex ↗ · Scholar ↗
  6. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D. Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Advances in Neural Information Processing Systems, volume 33, pages 1877–1901, 2020. URL https://proceedings.neurips.cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf. our card
  7. Ernie Chan, Marcel Heimlich, Avi Purkayastha, and Robert Van De Geijn. Collective communication: theory, practice, and experience. Concurrency and Computation: Practice and Experience, 190 (13):0 1749–1783, 2007. OpenAlex ↗ · Scholar ↗
  8. Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019. our card
  9. Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020. our card
  10. Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Charles Sutton Hyung Won Chung, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. PaLM: Scaling language modeling with Pathways. arXiv preprint arXiv:2204.02311, 2022. URL https://arxiv.org/abs/2204.02311. our card
  11. Lyndon Clarke, Ian Glendinning, and Rolf Hempel. The mpi message passing interface standard. In Programming environments for massively parallel distributed systems, pages 213–218. Springer, 1994. OpenAlex ↗ · Scholar ↗
  12. Tri Dao, Daniel Y Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. Flashattention: Fast and memory-efficient exact attention with io-awareness. arXiv preprint arXiv:2205.14135, 2022. OpenAlex ↗ · Scholar ↗
  13. Tim Dettmers, Mike Lewis, Younes Belkada, and Luke Zettlemoyer. Llm. int8 (): 8-bit matrix multiplication for transformers at scale. arXiv preprint arXiv:2208.07339, 2022. our card
  14. EffectiveTransformer. Effective transformer. https://github.com/bytedance/effective_transformer). [Online; accessed October-2022]. OpenAlex ↗ · Scholar ↗
  15. FasterTransformer. Fastertransformer: Gpt guide. https://github.com/NVIDIA/FasterTransformer/blob/main/docs/gpt_guide.md). [Online; accessed October-2022]. OpenAlex ↗ · Scholar ↗
  16. William Fedus, Jeff Dean, and Barret Zoph. A review of sparse expert models in deep learning. arXiv preprint arXiv:2209.01667, 2022. OpenAlex ↗ · Scholar ↗
  17. Google. Cloud TPU. https://cloud.google.com/tpu, 2022. [Online; accessed October-2022]. OpenAlex ↗ · Scholar ↗
  18. Manish Gupta and Puneet Agrawal. Compression of deep learning models for text: A survey. arXiv preprint arXiv:2008.05221, 2020. OpenAlex ↗ · Scholar ↗
  19. Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Tom Hennigan, Eric Noland, Katie Millican, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karen Simonyan, Erich Elsen, Jack W. Rae, Oriol Vinyals, and Laurent Sifre. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022. our card
  20. Sebastian Jaszczur, Aakanksha Chowdhery, Afroz Mohiuddin, Lukasz Kaiser, Wojciech Gajewski, Henryk Michalewski, and Jonni Kanerva. Sparse is enough in scaling transformers. Advances in Neural Information Processing Systems, 34:0 9895–9907, 2021. OpenAlex ↗ · Scholar ↗
  21. Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. our card
  22. Nikita Kitaev, Łukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. arXiv preprint arXiv:2001.04451, 2020. our card
  23. Vijay Korthikanti, Jared Casper, Sangkug Lym, Lawrence McAfee, Michael Andersch, Mohammad Shoeybi, and Bryan Catanzaro. Reducing activation recomputation in large transformer models. arXiv preprint arXiv:2205.05198, 2022. our card
  24. Sneha Kudugunta, Yanping Huang, Ankur Bapna, Maxim Krikun, Dmitry Lepikhin, Minh-Thang Luong, and Orhan Firat. Beyond distillation: Task-level mixture-of-experts for efficient inference. arXiv preprint arXiv:2110.03742, 2021. OpenAlex ↗ · Scholar ↗
  25. Dmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu, Dehao Chen, Orhan Firat, Yanping Huang, Maxim Krikun, Noam Shazeer, and Zhifeng Chen. GShard: Scaling giant models with conditional computation and automatic sharding. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=qrwe7XHTmYb. our card
  26. Lukasz Lew, Vlad Feinberg, Shivani Agrawal, Jihwan Lee, Jonathan Malmaud, Lisa Wang, Pouya Dormiani, and Reiner Pope. Aqt: Accurate quantized training), 2022. URL http://github.com/google/aqt. OpenAlex ↗ · Scholar ↗
  27. Bingbing Li, Zhenglun Kong, Tianyun Zhang, Ji Li, Zhengang Li, Hang Liu, and Caiwen Ding. Efficient transformer-based large scale language representations using hardware-friendly block structured pruning. arXiv preprint arXiv:2009.08065, 2020a. OpenAlex ↗ · Scholar ↗
  28. Zhuohan Li, Eric Wallace, Sheng Shen, Kevin Lin, Kurt Keutzer, Dan Klein, and Joey Gonzalez. Train big, then compress: Rethinking model size for efficient training and inference of transformers. In International Conference on Machine Learning, pages 5958–5968. PMLR, 2020b. OpenAlex ↗ · Scholar ↗
  29. Jack W. Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, H. Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, Eliza Rutherford, Tom Hennigan, Jacob Menick, Albin Cassirer, Richard Powell, George van den Driessche, Lisa Anne Hendricks, Maribeth Rauh, Po-Sen Huang, Amelia Glaese, Johannes Welbl, Sumanth Dathathri, Saffron Huang, Jonathan Uesato, John Mellor, Irina Higgins, Antonia Creswell, Nat McAleese, Amy Wu, Erich Elsen, Siddhant M. Jayakumar, Elena Buchatskaya, David Budden, Esme Sutherland, Karen Simonyan, Michela Paganini, Laurent Sifre, Lena Martens, Xiang Lorraine Li, Adhiguna Kuncoro, Aida Nematzadeh, Elena Gribovskaya, Domenic Donato, Angeliki Lazaridou, Arthur Mensch, Jean-Baptiste Lespiau, Maria Tsimpoukelli, Nikolai Grigorev, Doug Fritz, Thibault Sottiaux, Mantas Pajarskas, Toby Pohlen, Zhitao Gong, Daniel Toyama, Cyprien de Masson d'Autume, Yujia Li, Tayfun Terzi, Vladimir Mikulik, Igor Babuschkin, Aidan Clark, Diego de Las Casas, Aurelia Guy, Chris Jones, James Bradbury, Matthew Johnson, Blake A. Hechtman, Laura Weidinger, Iason Gabriel, William S. Isaac, Edward Lockhart, Simon Osindero, Laura Rimell, Chris Dyer, Oriol Vinyals, Kareem Ayoub, Jeff Stanway, Lorrayne Bennett, Demis Hassabis, Koray Kavukcuoglu, and Geoffrey Irving. Scaling language models: Methods, analysis & insights from training Gopher. CoRR, abs/2112.11446, 2021. our card
  30. Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: Memory optimizations toward training trillion parameter models. In SC20: International Conference for High Performance Computing, Networking, Storage and Analysis, pages 1–16. IEEE, 2020. OpenAlex ↗ · Scholar ↗
  31. Aurko Roy, Mohammad Saffar, Ashish Vaswani, and David Grangier. Efficient content-based sparse attention with routing transformers. arXiv preprint arXiv:2003.05997, 2020. our card
  32. Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108, 2019. our card
  33. Tal Schuster, Adam Fisch, Jai Gupta, Mostafa Dehghani, Dara Bahri, Vinh Q Tran, Yi Tay, and Donald Metzler. Confident adaptive language modeling. arXiv preprint arXiv:2207.07061, 2022. OpenAlex ↗ · Scholar ↗
  34. Noam Shazeer. Fast transformer decoding: One write-head is all you need. arXiv preprint arXiv:1911.02150, 2019. OpenAlex ↗ · Scholar ↗
  35. Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. In ICLR (Poster). OpenReview.net, 2017. URL http://dblp.uni-trier.de/db/conf/iclr/iclr2017.html#ShazeerMMDLHD17. OpenAlex ↗ · Scholar ↗
  36. Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-LM: Training multi-billion parameter language models using model parallelism. CoRR, abs/1909.08053, 2019. URL http://arxiv.org/abs/1909.08053. our card
  37. Shaden Smith, Mostofa Patwary, Brandon Norick, Patrick LeGresley, Samyam Rajbhandari, Jared Casper, Zhun Liu, Shrimai Prabhumoye, George Zerveas, Vijay Korthikanti, et al. Using deepspeed and megatron to train megatron-turing nlg 530b, a large-scale generative language model. arXiv preprint arXiv:2201.11990, 2022. our card
  38. Sainbayar Sukhbaatar, Edouard Grave, Piotr Bojanowski, and Armand Joulin. Adaptive attention span in transformers. arXiv preprint arXiv:1905.07799, 2019. our card
  39. Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. Mobilebert: a compact task-agnostic bert for resource-limited devices. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2158–2170, 2020. our card
  40. Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, et al. Lamda: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022. URL https://arxiv.org/pdf/2201.08239. our card
  41. TPUv4. Google Cloud unveils world’s largest publicly available ML hub with Cloud TPU v4, 90% carbon-free energy. https://cloud.google.com/blog/products/compute/google-unveils-worlds-largest-publicly-available-ml-cluster. OpenAlex ↗ · Scholar ↗
  42. Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021. OpenAlex ↗ · Scholar ↗
  43. Hanrui Wang, Zhanghao Wu, Zhijian Liu, Han Cai, Ligeng Zhu, Chuang Gan, and Song Han. Hat: Hardware-aware transformers for efficient natural language processing. arXiv preprint arXiv:2005.14187, 2020. our card
  44. Shibo Wang, Jinliang Wei, Amit Sabne, Andy Davis, Berkin Ilbeyi, Blake Hechtman, Dehao Chen, Karthik Srinivasa Murthy, Marcello Maggioni, Qiao Zhang, Sameer Kumar, Tongfei Guo, Yuanzhong Xu, and Zongwei Zhou. Overlap communication with dependent computation via decomposition in large deep learning models. In To appear in the Proceedings of the 28th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), 2023. OpenAlex ↗ · Scholar ↗
  45. XLA. XLA: Optimizing compiler for TensorFlow. https://www.tensorflow.org/xla, 2019. [Online; accessed September-2019]. OpenAlex ↗ · Scholar ↗
  46. Yuanzhong Xu, HyoukJoong Lee, Dehao Chen, Blake Hechtman, Yanping Huang, Rahul Joshi, Maxim Krikun, Dmitry Lepikhin, Andy Ly, Marcello Maggioni, Ruoming Pang, Noam Shazeer, Shibo Wang, Tao Wang, Yonghui Wu, and Zhifeng Chen. GSPMD: general and scalable parallelization for ml computation graphs. arXiv preprint arXiv:2105.04663, 2021. OpenAlex ↗ · Scholar ↗
  47. Ofir Zafrir, Guy Boudoukh, Peter Izsak, and Moshe Wasserblat. Q8bert: Quantized 8bit bert. In 2019 Fifth Workshop on Energy Efficient Machine Learning and Cognitive Computing-NeurIPS Edition (EMC2-NIPS), pages 36–39. IEEE, 2019. our card
  48. Dongqing Zhang, Jiaolong Yang, Dongqiangzi Ye, and Gang Hua. Lq-nets: Learned quantization for highly accurate and compact deep neural networks. In Proceedings of the European conference on computer vision (ECCV), pages 365–382, 2018. OpenAlex ↗ · Scholar ↗
  49. Lianmin Zheng, Zhuohan Li, Hao Zhang, Yonghao Zhuang, Zhifeng Chen, Yanping Huang, Yida Wang, Yuanzhong Xu, Danyang Zhuo, Joseph E Gonzalez, et al. Alpa: Automating inter-and intra-operator parallelism for distributed deep learning. arXiv preprint arXiv:2201.12023, 2022. our card
  50. Aojun Zhou, Yukun Ma, Junnan Zhu, Jianbo Liu, Zhijie Zhang, Kun Yuan, Wenxiu Sun, and Hongsheng Li. Learning n:m fine-grained structured sparse neural networks from scratch. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=K9bw7vqp_s. OpenAlex ↗ · Scholar ↗