Introduction
In Large Language Model (LLM) serving, providers face a fundamental trade-off between throughput and context length. Serving requests with extensive contexts requires more GPU memory than a single card typically offers. To address this, engineers employ Tensor Parallelism (TP), splitting the model across multiple GPUs. However, TP introduces a "communication tax" where GPUs must constantly synchronize, reducing overall processing speed compared to single-GPU (TP=1) execution.
Current deployments often rely on static partitioning: some GPUs are dedicated to short requests (TP=1) and others to long ones (TP=4). Because long-context requests typically represent a "long-tail" distribution—sporadic but resource-intensive—these high-TP instances often sit underutilized, wasting expensive compute resources.
The Gyges System
Gyges is a novel system designed to bridge this gap by dynamically transforming parallelism strategies at runtime. It allows a cluster to switch between high-throughput (TP=1) and high-capacity (TP=4) modes in milliseconds. By implementing "in-place" transformations for KV caches and model weights, Gyges achieves up to a 6.57x throughput improvement over existing state-of-the-art solutions.
Technical Innovations
Gyges overcomes three major technical hurdles to enable rapid parallelism transformation:
1. Header-Centric KV Cache
Standard KV cache layouts are typically "token-first," which leads to fragmented memory when redistributing data across GPUs. Gyges reorganizes the cache into a "header-centric" layout ([Block, Header, K/V, Token]). This structural change allows the system to re-map memory pages to different GPUs without physical data movement or trimming, reducing memory overhead by 91.6%.
2. Parallelism-Aware Weight Padding
Model weights often do not align perfectly with the 2MB memory pages used by GPU drivers. Gyges proactively adds a minimal amount of padding (less than 0.7% of total weight size) during model loading. This ensures that weight segments align perfectly with memory pages across TP=1, 2, or 4 configurations, enabling "in-place" weight transformation without costly re-allocations.
3. Layer-Staggered Transformation
Instead of a "stop-the-world" approach, Gyges transforms layers sequentially. This allows active requests to continue processing in a hybrid state, effectively masking the transformation latency and maintaining system responsiveness.
4. Transformation-Aware Scheduler
A global scheduler tracks instance states and intelligently routes long-context requests to existing high-TP instances first. It only triggers a "scale-up" transformation when absolutely necessary, optimizing resource utilization across the cluster.
Performance Evaluation
The system was evaluated using real-world production traces from Alibaba Group on clusters equipped with NVIDIA H20 and A100 GPUs. Key results include:
- Throughput: Gyges outperformed systems like KunServe and LoongServe by 1.75x to 6.57x.
- Transformation Speed: The time cost for parallelism transformation was reduced by 97% compared to naive migration methods.
- Latency: Time to First Token (TTFT) and Time Per Output Token (TPOT) were reduced by up to 53% and 74%, respectively.
Conclusion and Future Work
Gyges demonstrates that the standard KV cache layout and weight alignment are primary bottlenecks for dynamic scaling. By rethinking these data structures, Gyges enables high-efficiency LLM serving that adapts to fluctuating workload demands. Future work includes scaling beyond TP=4 to multi-node configurations and integrating with disaggregated prefill/decode architectures.
Summary updated