arXiv:2610.34731cs.AROct 2026

Manuscript Offprint

arXiv:2610.34731

MCF: A Memory- and Communication-Aware Co-Designed Framework for Long-Context LLM Inference

Huaizhi Zhang, Jiacheng Zhu, Xuqi Zhu, Junkyu Lee, Klaus McDonald-Maier, Xiaojun Zhai

Huaizhi Zhang

University of Essex

United Kingdom

hz24245@essex.ac.uk

Junkyu Lee

University of Essex

United Kingdom

j.lee@essex.ac.uk

Jiacheng Zhu

University of Essex

United Kingdom

jz23222@essex.ac.uk

Klaus McDonald-Maier

University of Essex

United Kingdom

kdm@essex.ac.uk

Xuqi Zhu

University of Essex

United Kingdom

xz18173@essex.ac.uk

Xiaojun Zhai

University of Essex

United Kingdom

xzhai@essex.ac.uk

Abstract

This paper presents Memory- and Communication-Aware Framework for Long-Context LLM Inference (MCF) that optimizes long-context inference through communication-aware and stage-adaptive KV-cache layout transitions. At the core of MCF is Memory-Aware Replication and Scheduling (MARS), a dynamic orchestration mechanism for chunked prefill. MARS exploits early-stage memory headroom by selectively replicating highly reused KV blocks, improving locality and hiding KV propagation latency behind attention computation. As prefill progresses and memory pressure increases, MARS progressively drains redundant replicas and converges the KV cache into a sharded decode-ready layout, avoiding expensive layout conversion at the prefill-decode boundary. For decoding, MCF adopts a query-centric execution model in which KV shards remain stationary while lightweight query tensors are routed across workers. This changes communication from KV-cache-dependent transfer to query-dependent transfer, reducing communication growth with context length. MCF further integrates a hardware-software co-designed execution layer based on an FPGA compute-NIC datapath, enabling metadata-driven KV routing and collective operations directly in the network path. Experiments show that MCF improves TTFT, throughput, and scalability over state-of-the-art distributed inference systems, with larger benefits as context length and cluster size increase.

Keywords: LLM Serving, Distributed Inference, KV-Cache Management, In-Network Computing, Zero-copy Communication

1 Introduction

Long-context inference is becoming a critical workload for Large Language Models (LLMs). Applications such as retrieval augmented generation [9], code generation [14], document analysis [17], and agentic reasoning often require prompts with tens of thousands of tokens. For such workloads, the prefill stage becomes a dominant contributor to Time-To-First-Token (TTFT), because the system must process the entire input context and materialize the corresponding Key-Value (KV) cache before decoding can begin.

Many existing distributed inference systems rely on tensor parallelism and pipeline parallelism. Tensor parallelism partitions model weights across devices, while pipeline parallelism partitions model layers. These techniques are effective for scaling model parameters and computation, but they do not directly address the sequence-dependent KV-cache growth in long-context inference. During prefill, each new query chunk must attend to all historical KV blocks. During decode, every generated token must access the increased KV cache. As a result, long-context inference introduces different types of memory and communication bottleneck to conventional model-parallel weight partitioning.

Context parallelism addresses this issue by partitioning the sequence dimension and distributing KV cache across workers. However, existing context-parallel designs [12, 13] often rely on static KV sharding and fixed communication patterns, such as ring-style KV propagation. While such designs preserve a memory-efficient layout, they repeatedly move historical KV blocks during inference. As the number of chunks grows, this repeated communication becomes increasingly expensive under bandwidth-constrained distributed inference. It would also be inefficient in heterogeneous or dynamically changing communication environments, where link bandwidth, latency, or node availability can vary over time.

Moreover, we observe that prefill is not a uniform execution phase. Early in prefill, the accumulated KV cache is small and each worker has substantial memory headroom. At the same time, early KV blocks have the highest future reuse because they will be attended by many subsequent chunks. Near the end of prefill, memory pressure increases and the system must recover a compact KV layout suitable

Zhang et al.

for decode. This temporal asymmetry suggests that a single static KV-cache layout is suboptimal.

We thus propose MCF, a Memory-Communication-Aware Distributed Inference Framework for Long-Context LLMs to response to this challenge. At the core of MCF is MARS, a stage-aware KV-cache orchestrator that dynamically controls KV replication and convergence during chunked prefill. MARS temporarily replicates high-reuse KV blocks when memory headroom is available, reduces the frequency of remote KV accesses and the critical-path latency of KV transfers in later chunks, and progressively retires redundant replicas as their reuse window expires. By the end of prefill, MARS guarantees that all KV blocks converge to an owner-only sharded layout, enabling efficient KV-stationary decode.

MCF further introduces a distributed chunked-prefill execution model that pipelines local computation with KV propagation and missing-block fetching. Rather than treating communication as a serialized phase after computation, MCF overlaps chunk execution with dynamic KV movement. This improves TTFT for long-context inference.

To realize this dynamic execution efficiently, we design a hardware-software co-designed unified execution framework. The software runtime emits MARS metadata, including routing identifiers, operation codes, KV block identifiers, and destination sets. The hardware maps this metadata to an FPGA compute-NIC datapath that performs KV propagation, collective communication, and decode-state reduction in the data plane. This design translates MARS's dynamic scheduling decisions into high-performance distributed inference.

This paper makes three key contributions:

• We propose MARS, a stage-aware KV-cache orchestrator that dynamically replicates, drains, and converges KV blocks across prefill stages, exploiting early memory headroom while guaranteeing a sharded decode-ready layout.

• We design a distributed chunked-prefill execution model that pipelines local computation with KV propagation and remote KV-cache fetching, improving compute-communication overlap and reducing TTFT for long-context inference.

• We design a hardware-software co-designed unified execution framework that bridges MARS and hardware execution. By integrating a metadata-driven FPGA compute-NIC datapath, the framework realizes dynamic KV routing and collective operations in hardware, enabling high-performance distributed inference.

References (13)