Large Language ModelsInference & Performance Optimization
How does Decode Token Parallelism (TKNP) decouple attention ownership from model-weight placement to scale high-concurrency, long-context LLM decoding across nodes?
Question 298 of 309 · Updated
On this page
- 1. The problem TKNP is trying to solve
- 2. A small numerical example
- 3. Why conventional strategies reach different limits
- Data parallelism
- Tensor parallelism
- Pipeline parallelism
- Context parallelism and decode context parallelism
- 4. The TKNP execution model
- 5. What actually crosses the network?
- 6. A simple communication comparison
- 7. Why the design can increase KV-cache capacity
- 8. Why GQA and MLA make the problem more important
- 9. Balancing the layer-weight blocks
- 10. Dual-active-root microbatching and overlap
- 11. What the published evaluation reports — and what it does not prove
- 12. When TKNP is a good candidate
- 13. How to benchmark TKNP against DP, TP, and DCP
- 14. Operational risks and failure modes
- 15. A practical rollout plan
- 16. Common misconceptions
- 17. Interview-ready summary
1. The problem TKNP is trying to solve#
A large language model can be deployed across many GPUs in several ways. Data parallelism (DP) replicates a model and sends different requests to different replicas. Tensor parallelism (TP) splits operations inside each layer across GPUs. Pipeline parallelism (PP) places different layers on different devices. Context parallelism (CP), including decode context parallelism (DCP), distributes context or KV-cache work across devices.
These methods solve different bottlenecks. A less obvious problem appears when a serving system has enough GPUs to hold the model, but long conversations and high concurrency make the key-value (KV) cache the limiting resource.
During autoregressive decoding, each active request keeps the keys and values from its previous tokens. As the number of active requests and their context lengths grow, the aggregate KV cache grows too. The serving system needs both:
- enough memory capacity to retain the KV cache for many active sequences; and
- enough attention bandwidth and compute to read those cached states for every generated token.
The difficulty is that conventional parallelism often couples where model weights are placed to where attention and KV state are placed. A layout that is efficient for dense matrix multiplications may not be the best layout for request-local attention.
Decode Token Parallelism (TKNP) is a decode-pool architecture proposed to loosen that coupling. Its central idea is to distribute one copy of the model's layer weights across nodes while allowing every node to perform attention for its own subset of requests using KV cache stored locally on that node. The node that owns a layer's weights executes that layer's dense projections and MLP for the full active batch; the request-local attention work is spread across the nodes that own the corresponding requests.
This is an architecture-level change, not a new attention equation or a replacement for every form of parallelism. It targets a particular operating point: very large models, long contexts, high decode concurrency, and a multi-node GPU pool where cross-node communication is expensive.
2. A small numerical example#
Imagine a decode pool with four GPU nodes. Each node has eight GPUs connected by a fast intra-node fabric such as NVLink. A large model is divided into balanced layer blocks across the four nodes.
Assume, purely for illustration:
- the model has 80 transformer layers;
- each node owns the weights for 20 layers;
- there are 400 active requests;
- each node owns the KV cache and attention work for 100 of those requests.
When the batch advances through a transformer layer:
- The node that owns that layer's weights receives the current-token hidden states for the active batch.
- It executes the layer's dense projections and MLP using its local tensor-parallel group.
- The attention operation is performed on each node for the 100 requests whose KV cache is resident there.
- The resulting current-token activations are exchanged as required so the next weight-owning layer block can process the batch.
The important distinction is that a node does not need to own the weights for every layer just because it owns the KV cache for a request. Conversely, a node that owns a layer's weights does not need to hold every request's KV cache to execute that layer's dense operations.
If the 400 requests were split evenly, each node would retain approximately one quarter of the request KV state. This is not a promise that memory use is exactly divided by four: model architecture, attention implementation, metadata, temporary buffers, uneven sequence lengths, and replication all matter. It illustrates the ownership separation.
Compare that with a data-parallel deployment using four complete model replicas. Each replica owns its own weights and the KV cache for its assigned requests. This is simple and can be effective, but the model weights are replicated four times across the pool. TKNP instead distributes a single model copy across the nodes and lets each node contribute local KV capacity.
3. Why conventional strategies reach different limits#
Data parallelism#
In ordinary DP, each replica contains a complete model copy. Requests are divided between replicas.
Advantages:
- simple request isolation;
- independent replica scaling;
- no need to exchange layer activations between replicas for an ordinary request;
- straightforward failure and rollout boundaries.
Limitation:
- every replica consumes memory for a full set of model weights;
- the GPUs used for replicas cannot all contribute their memory to one shared model copy;
- at a fixed GPU count, weight replication can leave less aggregate memory available for KV cache.
DP remains useful when the model fits comfortably on each replica and request volume is the dominant scaling problem. TKNP is interesting when model-weight replication is expensive relative to the value of additional request-local KV capacity.
Tensor parallelism#
TP splits operations within a layer across GPUs. It is commonly used when a layer is too large or when a single GPU cannot provide the required compute throughput.
For attention, TP often partitions attention heads. This can distribute KV storage across ranks, but the amount of unique KV state that can be distributed is constrained by the number and arrangement of KV heads.
For grouped-query attention (GQA), many query heads share a smaller number of KV heads. Once the TP degree exceeds the useful KV-head partitioning, adding more TP ranks does not necessarily create more unique KV shards; some layouts may replicate KV data. Multi-head latent attention (MLA) can have an even smaller latent KV representation, so head-based partitioning may provide little additional KV distribution.
TP is still valuable for dense-layer computation and intra-node communication. TKNP does not eliminate TP: in the proposed design, the node executing a weight block uses local TP. The architectural distinction is that the TP group for dense computation need not define the ownership boundary for all request KV state.
Pipeline parallelism#
PP assigns different layer ranges to different stages. It reduces the amount of model weight memory required on each device, but introduces stage-to-stage activation transfers and pipeline scheduling concerns.
TKNP's balanced layer blocks have a pipeline-like aspect because layer weights are distributed across nodes. However, its key design point is not simply splitting layers into stages. It combines distributed weight ownership with attention computed locally on the nodes holding request KV state.
Context parallelism and decode context parallelism#
CP distributes context positions across devices. DCP applies context sharding to the decode phase, helping spread long-context KV storage and attention work beyond the limits of head-only TP.
This can increase usable KV capacity, but exact attention over sequence shards requires coordination. In DCP, devices compute partial attention contributions and combine them. When the context is spread across nodes, cross-node aggregation can become expensive.
TKNP takes a different route: rather than distributing each request's context across nodes and then merging partial attention results, it assigns each request's KV cache to a node and computes that request's attention locally. It separates request attention ownership from the node that owns the current layer's weights.
That is the most important conceptual difference between DCP and TKNP:
- DCP distributes a request's context/attention across ranks and combines partial results.
- TKNP distributes different requests' attention across nodes, while model layer weights are distributed separately.
They are alternative architecture choices for a decode pool, not interchangeable names for the same mechanism.
4. The TKNP execution model#
The published TKNP design uses a single model copy distributed across nodes in balanced layer blocks.
At a high level, the execution has two kinds of work:
Weight-owned dense work
- The node holding a layer block owns the corresponding projections and MLP weights.
- It executes those dense operations for the full batch.
- It uses intra-node tensor parallelism to spread large matrix operations across its local GPUs.
- Dense collectives remain within the node's high-bandwidth GPU fabric in the described design.
Request-owned attention work
- Each node owns a subset of active requests.
- It stores the KV cache for those requests locally.
- It computes attention for its own requests using their locally resident KV state.
- It does not need to send partial attention outputs to other nodes for a cross-node attention merge in the proposed design.
The model's current-token activations must move between the weight-owning layer blocks and the nodes doing request-local attention. The paper's central communication claim is that the network carries current-token activations rather than repeatedly exchanging large KV blocks or cross-node partial-attention reductions.
A useful mental model is to imagine two independent maps:
- a weight map that says which node owns each layer's parameters; and
- a request map that says which node owns each request's KV cache and attention.
Traditional layouts often make these maps closely aligned. TKNP allows them to differ.
The system still has to preserve the correct transformer computation. For a given request and layer, the attention result must be combined with the correct residual stream and then passed through the correct normalization and MLP operations. The distributed schedule must ensure the activations are routed to the right owner and returned to the correct request partition without reordering tokens or mixing request state.
5. What actually crosses the network?#
Communication is central to understanding the design.
A simplified transformer layer contains:
- normalization;
- query, key, and value projections;
- attention;
- output projection;
- residual update;
- MLP projections and activation;
- another residual update.
The exact placement of projections and attention matters. The TKNP paper describes the dense projections and MLP for a layer being executed by the active weight-owning node, while each node computes attention for its local requests.
This means the architecture still transfers activations needed to move the batch through the distributed layer blocks. It does not mean the network is idle, nor that no communication is required. The goal is to keep the expensive dense-layer collectives inside the NVLink domain and avoid cross-node aggregation of partial attention results.
For a request with a long context, moving its entire KV cache across the network at every decode step would be costly. TKNP avoids that pattern by keeping the KV cache with the node that owns the request's attention. The attention computation reads local KV state.
An engineering team should measure:
- bytes transferred per generated token;
- activation message sizes and frequency;
- inter-node latency and bandwidth utilization;
- local NVLink/NVSwitch utilization;
- synchronization and queueing time at each layer block;
- time spent waiting for the slowest request partition;
- overlap between dense computation and attention.
The design is attractive only if the saved cross-node KV/attention communication outweighs the activation routing and scheduling overhead it introduces.
6. A simple communication comparison#
Suppose four nodes each hold 100 active requests. Each request has a long KV history.
In a context-sharded design, one request's attention can require each participating node to process its local context shard and then participate in a partial-attention aggregation. This can generate cross-node communication and synchronization on the attention path.
In a request-local design, one node reads the complete KV history for its own 100 requests and produces their attention outputs locally. The distributed layer schedule still transfers current-token activations to and from the weight-owning node, but it does not require the same cross-node merge of partial attention for each request.
The amount of data in these two communication patterns depends on batch size, hidden dimension, number of layers, context length, dtype, attention variant, and network topology. Do not assume that activation traffic is always smaller than KV traffic in every deployment. Measure it with the actual workload.
The architectural hypothesis is that, for long contexts and high concurrency, retaining KV locally and avoiding repeated cross-node attention aggregation can be more efficient than sharding each request's context across nodes.
7. Why the design can increase KV-cache capacity#
A decode pool has a finite GPU memory budget. A simplified per-node memory budget is:
GPU memory
= model-weight memory
+ KV-cache memory
+ temporary activation/workspace memory
+ communication buffers
+ runtime and allocator overheadWith DP, each replica reserves memory for a full model copy. With TKNP, the model weights are distributed as one model copy across balanced layer blocks. The paper's design aims to leave each node with a similar amount of memory available for local KV cache.
This is important because long-context concurrency is often limited by the number of KV tokens the pool can retain. If each node can retain more request-local KV state, the pool may admit more active sequences before reaching its memory limit.
A toy example:
- Four nodes each have 80 GiB available after system reservations.
- A replicated DP arrangement consumes 55 GiB per node for model weights and leaves 25 GiB for KV cache and other allocations.
- A balanced distributed-weight arrangement consumes 25 GiB per node for the node's layer block and leaves 55 GiB before other allocations.
These values are hypothetical and deliberately simplified. They do not represent a measured TKNP configuration. Real memory accounting must include weights, quantization metadata, KV dtype, cache block tables, temporary buffers, communication buffers, graph pools, and fragmentation.
The key is not simply “weights are smaller.” It is that each node can contribute memory to request KV capacity without also holding a complete model replica.
8. Why GQA and MLA make the problem more important#
Attention architectures influence how much KV state can be distributed with TP.
In multi-head attention (MHA), each query head has its own key and value head. In GQA, multiple query heads share a KV head. This reduces KV-cache memory, but also means there are fewer independent KV heads to shard across TP ranks.
For example, suppose a model has 64 query heads and 8 KV heads. TP over 8 ranks can assign one KV head to each rank. Increasing TP beyond 8 cannot create more unique KV heads. Depending on the implementation, additional ranks may need replicated KV data or a different parallelization strategy.
MLA stores a compressed latent representation rather than conventional independent key and value vectors for every attention head. Its effective KV representation can be even more constrained for head-based partitioning.
TKNP's request-local attention ownership is motivated partly by this limitation. It scales attention across nodes by assigning different requests to different nodes, rather than requiring one request's KV heads or context positions to be split across every node.
This does not mean TKNP automatically supports every GQA or MLA model implementation. Model-specific kernels, cache formats, and attention semantics still need to be implemented and validated.
9. Balancing the layer-weight blocks#
A single distributed model copy needs balanced weight placement. If one node owns substantially more weights or more expensive layers than the others, that node can become the critical path.
A useful initial target is to balance:
- parameter bytes per node;
- dense-layer FLOPs per node;
- measured layer execution time;
- local TP efficiency;
- activation transfer volume;
- memory left for KV cache.
Equal layer counts do not guarantee equal execution time. Some models contain heterogeneous blocks, MoE layers, different attention mechanisms, or layers with different compute costs.
The placement problem can be expressed as minimizing the maximum node service time, subject to each node's memory budget:
minimize max_node (weight_compute_time + local_attention_time + transfer_wait)
subject to weight_memory(node) + KV_memory(node) + overhead(node) <= GPU_budget(node)This is a conceptual optimization objective, not the exact objective function claimed by the paper.
A practical deployment process should:
- profile layer-wise compute and communication;
- estimate weight memory and local KV demand;
- partition layer blocks to avoid a single slow stage;
- reserve memory for cache growth and runtime buffers;
- test the partition under the real request-length distribution;
- rebalance if one node repeatedly gates decode progress.
10. Dual-active-root microbatching and overlap#
The TKNP paper also describes dual-active-root microbatching to overlap dense computation and attention work. The broad goal is to avoid leaving one part of the distributed system idle while another is doing useful work.
A simplified intuition:
- one microbatch can be executing dense operations on a weight-owning node;
- another portion of the work can be progressing through attention on nodes that own its requests;
- careful scheduling overlaps these activities where dependencies permit.
The overlap is not free. It requires enough independent work, correctly ordered activation transfers, buffering, and a scheduler that understands the pipeline dependencies. If microbatches are too small, launch and communication overhead can dominate. If they are too large, memory pressure and queueing can increase.
The paper reports up to 11.1% throughput improvement from its dual-active-root microbatching contribution in its evaluated setup. Treat this as a paper-specific result, not a universal gain.
When implementing overlap, measure:
- compute utilization per node;
- communication-compute overlap;
- bubbles between layer blocks;
- microbatch queue depth;
- per-request latency and inter-token latency;
- KV-cache memory pressure;
- throughput at fixed latency SLOs.
Optimizing aggregate tokens per second while allowing individual requests to suffer severe tail latency may not be acceptable for an interactive service.
11. What the published evaluation reports — and what it does not prove#
The TKNP paper reports an implementation in vLLM and evaluations on Llama 3.1 405B and Nemotron-4 340B using up to 64 NVIDIA H100 GPUs.
For its long-context, high-concurrency workloads, it reports completion-throughput improvements of up to:
- 1.7× over DCP; and
- 2.06× over DP,
at matched GPU counts.
The paper also reports a KV-capacity advantage over DP in its evaluated configuration and describes the dual-active-root microbatching overlap contribution.
These numbers should be interpreted carefully:
- “Up to” identifies the best reported point, not the expected average.
- The comparison is tied to particular models, GPU counts, context lengths, batch/concurrency settings, and implementation details.
- Completion throughput is not the same as TTFT, inter-token latency, p95/p99 latency, or cost per successful request.
- Results on H100 clusters do not automatically transfer to other GPU generations, interconnects, or cloud network topologies.
- A paper implementation is not evidence that every current vLLM release exposes a stable production-ready configuration for every model.
Before adopting TKNP, reproduce the comparison with the exact model, tokenizer, KV dtype, request distribution, output lengths, and latency objectives used by your service.
12. When TKNP is a good candidate#
Evaluate TKNP when most of these conditions hold:
- the model is large enough that replicating it across many nodes is expensive;
- the workload has high decode concurrency;
- requests have long contexts and consume substantial KV memory;
- local attention can efficiently process a node's request partition;
- the inter-node network makes repeated partial-attention aggregation costly;
- dense layer operations can be kept efficient within each node's local GPU fabric;
- the deployment can tolerate the operational complexity of a distributed layer schedule.
It is less compelling when:
- the model comfortably fits on each replica;
- requests are short and KV memory is not a bottleneck;
- traffic is low or highly bursty, so a large distributed pool is underutilized;
- cross-node activation transfers dominate;
- the workload is prefill-heavy rather than decode-heavy;
- the deployment relies on simpler independent replicas for isolation or availability;
- the serving stack does not support the required architecture and model kernels.
TKNP is not a replacement for DP in every workload. It is an alternative decode-pool organization for a specific memory and communication bottleneck.
13. How to benchmark TKNP against DP, TP, and DCP#
A fair evaluation must hold the important variables constant:
- same model checkpoint and tokenizer;
- same precision and quantization;
- same GPU count and GPU type;
- same interconnect topology;
- same prompt-length and output-length distributions;
- same concurrency and arrival pattern;
- same sampling settings;
- same scheduler and batching policy where possible;
- same warmup and measurement window.
Run separate workload classes:
- short context, low concurrency;
- long context, low concurrency;
- short context, high concurrency;
- long context, high concurrency;
- mixed context lengths with realistic bursts;
- sustained traffic long enough to expose cache pressure and allocator behavior.
Track at least:
- completed output tokens per second;
- requests completed per second;
- time to first token (TTFT);
- inter-token latency (ITL);
- p50, p95, and p99 request latency;
- per-node KV-cache occupancy;
- maximum admitted concurrent requests;
- GPU compute and memory utilization;
- intra-node and inter-node network traffic;
- activation transfer wait time;
- preemption, recomputation, or request rejection rates;
- cost per million generated tokens.
Use both fixed-concurrency and fixed-SLO comparisons. A design may produce more tokens per second at unlimited latency while performing worse under a strict p99 ITL target.
A useful decision rule is: choose TKNP only if it increases useful completion throughput or capacity at the service's actual latency and reliability constraints, not merely because it reports a higher peak throughput.
14. Operational risks and failure modes#
Uneven request lengths. If one node owns many long-context requests while another owns short requests, local attention work and KV occupancy become imbalanced. Request placement must account for context length and expected output, not only request count.
Layer imbalance. A node with a slow layer block can stall the whole distributed layer schedule. Balance by measured service time and memory, not just layer count.
Activation transfer bottlenecks. If the current-token activation transfers are large or poorly overlapped, the network can become the new bottleneck. Profile actual bytes and wait time.
KV memory fragmentation. Local cache allocation can fragment memory or strand capacity. Use the serving engine's block allocator and monitor free blocks, evictions, and per-node skew.
Node failure. A node may own unique model weights as well as request KV state. Losing it can affect model execution and the requests assigned to it. Recovery may require restoring the weight block, moving or recomputing request state, and re-establishing the distributed schedule. Do not assume the architecture automatically provides fault tolerance.
Network partitions and slow nodes. A slow or unreachable weight owner can stall dependent work. Timeouts, health checks, coordinated cancellation, and a well-defined recovery path are necessary.
Rolling upgrades. All nodes must agree on model version, layer layout, tensor shapes, KV format, and activation protocol. A mixed-version distributed pool can produce invalid computations or deadlocks.
Tenant isolation. Request-local KV ownership does not by itself guarantee tenant isolation. Cache identity, request routing, memory reclamation, and observability must still enforce tenant boundaries.
Security and privacy. Activation transfers and KV state are sensitive model inputs and derived representations. Secure transport, access control, memory clearing, and tenant-aware diagnostics remain necessary.
15. A practical rollout plan#
- Establish the baseline. Measure the current DP, TP, or DCP deployment with realistic traffic and fixed SLOs.
- Confirm the bottleneck. Verify that KV capacity or cross-node attention communication, rather than prefill compute, model weights, or scheduler overhead, is limiting throughput.
- Validate model support. Confirm that the model architecture, attention implementation, KV format, and required kernels are supported by the TKNP implementation being evaluated.
- Build a balanced layer map. Partition the model weights across nodes using memory and measured execution time.
- Assign request ownership. Distribute requests to balance KV bytes and attention work, not merely request counts.
- Test activation routing. Verify tensor shapes, request IDs, token ordering, residual flow, synchronization, and numerical parity against a trusted single-node or conventional distributed reference.
- Stress memory. Test long contexts, maximum concurrency, cache growth, fragmentation, and worst-case request skew.
- Inject failures. Kill or delay a node, interrupt the network, and test whether requests fail cleanly or recover within the required SLO.
- Canary traffic. Route a small representative slice to TKNP and compare quality, latency, throughput, cost, and error rates.
- Expand only on evidence. Retain a rollback path to the previous serving topology until the new pool is stable.
16. Common misconceptions#
- “TKNP is just tensor parallelism across more GPUs.” No. It changes the ownership relationship between layer weights and request-local attention/KV state. Local TP is still used for dense operations.
- “TKNP shards each request's KV cache across all nodes.” Not in the central design described by the paper. Each node computes attention for its own requests against locally resident KV state.
- “TKNP eliminates communication.” No. It still transfers current-token activations and requires distributed scheduling. It aims to avoid cross-node partial-attention aggregation and keep dense collectives local.
- “TKNP makes every request faster.” Not necessarily. Its strongest motivation is aggregate capacity and throughput for long-context, high-concurrency decode. Individual latency depends on scheduling and topology.
- “The reported 1.7× gain is guaranteed.” No. It is an upper result from specific experiments, not a general service-level promise.
- “TKNP replaces DCP, TP, PP, and DP everywhere.” No. Each strategy addresses a different bottleneck. A production system should choose based on measured model, workload, and hardware constraints.
17. Interview-ready summary#
Decode Token Parallelism separates two decisions that conventional distributed inference often couples: where model weights live and where a request's attention/KV cache lives. It distributes one model copy across balanced layer blocks, uses local tensor parallelism for dense projections and MLPs on the weight-owning node, and lets each node compute attention for its own requests against locally resident KV cache. The design aims to increase aggregate KV capacity without replicating the full model and to avoid cross-node aggregation of partial attention results. It is most relevant to long-context, high-concurrency decode pools, but its value must be established with workload-matched benchmarks of throughput, TTFT, ITL, tail latency, memory, network traffic, and failure recovery.
References
- 1.
- 2.
- 3.vLLM — Context Parallel Deploymentdocs.vllm.ai
- 4.vLLM — Parallelism and Scalingdocs.vllm.ai
- 5.NVIDIA Megatron Core — Parallelism Strategies Guidedocs.nvidia.com
- 6.NVIDIA Megatron Core — Inference User Guidedocs.nvidia.com
Related questions
- How do context parallelism and decode context parallelism scale long-context LLM inference across GPUs while balancing KV-cache capacity, attention compute, and communication?
- How do you design hierarchical KV-cache offloading for sparse-attention LLM decoding across GPU HBM, host DRAM, and scale-up memory pools?
- We all know KV Caching speeds up token generation. What’s the primary bottleneck this technique creates in a high-throughput production system, and how do you conceptually solve it?
Explore other topics:Deep LearningRetrieval-Augmented GenerationAI Agents