TL;DR
This paper introduces SURGE, a novel GPU encoding system designed to efficiently process massive, logically partitioned datasets. SURGE tackles the bottleneck of inter-process communication (IPC) in embedding pipelines, achieving comparable throughput to fixed-batch methods but with significantly reduced memory usage and faster time-to-first-output, making it practical for large-scale production deployments.
What Problem Does This Paper Address?
Modern applications like information retrieval and recommendation systems rely heavily on generating dense text embeddings. These embeddings are often derived from vast datasets (millions or billions of text documents) that are logically partitioned based on categories, regions, or other metadata. The challenge lies in efficiently processing these partitions using GPUs, which are most effective when processing large, contiguous batches of data.
Traditional approaches face a dilemma:
- Partition-by-Partition (PBP): Processing each partition independently leads to frequent, costly inter-process communication (IPC) overhead, significantly limiting throughput, especially for compute-light models.
- Fixed-Size Batching (FSB): Ignoring partition boundaries and batching texts into large, fixed-size chunks amortizes IPC but requires massive amounts of memory (O(N)) to hold all embeddings before regrouping, and offers no output until the entire process is complete, making it infeasible for large datasets and problematic for fault tolerance.
This creates a tension between efficient GPU utilization and the inherent structure of partitioned data, leading to either low throughput or prohibitive memory requirements.
Methods
SURGE introduces a "SuperBatch" aggregation strategy that bridges the gap between logical partitions and efficient GPU batching. Key techniques include:
- SuperBatch Aggregator: This component accumulates incoming partitions until a predefined minimum batch size (
Bmin) is reached, triggering a GPU encode call. This significantly reduces the number of IPC calls compared to PBP. - Two-Threshold Policy: To manage memory, SURGE employs a
Bminfor efficiency and aBmaxas a memory-safety trigger. This ensures that even with adversarial partition arrival orders (e.g., a very large partition arriving after many small ones), the peak memory usage remains bounded by O(Bmin+nmax), wherenmaxis the size of the largest single partition. This is a crucial improvement over FSB's O(N) memory requirement. - Asynchronous I/O Pipeline: SURGE decouples GPU computation from storage writes. While one SuperBatch is being encoded, the serialization and upload of the previous SuperBatch occur asynchronously. This "producer-consumer" pattern hides I/O latency, further boosting throughput.
- Zero-Copy Embedding Serialization: Using Apache Arrow, SURGE avoids the creation of numerous intermediate Python objects during serialization, reducing memory overhead and speeding up the process significantly (22-25x faster).
- Cost Model (Theorem 1): The authors developed an analytical model that predicts throughput based on IPC overhead, compute cost, and batching strategy. This model accurately quantifies the benefits of batching and helps determine when SURGE is most effective.
- Decision Framework ($/CV): A framework based on the IPC-dominated fraction and the coefficient of variation of partition sizes helps users decide if SURGE is applicable to their workload.
Datasets
The paper primarily uses a synthetic dataset of 10 million texts across 4,000 partitions, generated to match production workload characteristics (log-normal distribution of partition sizes). This dataset is used for controlled evaluation and ablation studies. For model generalization, they also evaluate on benchmarks using the MiniLM-L6-v2, bge-base-en-v1.5, and E5-large models, which are trained on various large-scale text datasets.
Key Insights and Ideas
- IPC is the Dominant Bottleneck: For compute-light models and a large number of partitions, the overhead of inter-process communication (IPC) is the primary limiter of throughput, not GPU compute capacity itself.
- Bounded Memory is Crucial for Scale: Fixed-size batching's O(N) memory requirement makes it impractical for datasets exceeding tens of millions of texts, especially on commodity hardware. SURGE's O(
Bmin+nmax) bound is a game-changer for production deployments. - Streaming Output Matters: The ability to output results incrementally (fast Time-to-First-Output) is critical for monitoring, fault tolerance, and user experience in long-running production jobs.
- Analytical Models Drive Design: The development of a cost model and memory bound provided the theoretical foundation for SURGE's design, enabling precise predictions and validation of its effectiveness.
- Engineering Synergy: While individual components like zero-copy serialization and async I/O are known, their principled combination under the guidance of the analytical models is what unlocks SURGE's full potential.
Key Results
- Throughput: SURGE achieves comparable throughput to optimized fixed-batch methods (e.g., FB-100K) at ~26,000 texts/s, reaching the IPC-amortized throughput ceiling.
- Memory Efficiency: SURGE uses significantly less memory. For 10M texts, it uses 2.6 GB compared to 32.7 GB for FB-100K (a 12.6x reduction). At 50M texts, FB-100K approaches the node's 192 GB RAM limit, while SURGE remains at ~8.7 GB.
- Time-to-First-Output (TTFO): SURGE provides a TTFO of ~3.6 seconds, regardless of dataset size, compared to FB-100K's linear scaling, which reaches over 20 minutes for 50M texts.
- IPC Amortization: SURGE reduces IPC calls from thousands (PBP) to ~100 (for 10M texts), leading to a 1.92x speedup over PBP on the benchmark workload.
- Model Generalization: The cost model's predictions hold true across models with a 15x parameter range (MiniLM, bge-base, E5-large), with prediction errors below 2%.
- I/O Latency Tolerance: Asynchronous I/O provides up to a 92% throughput benefit with high storage latency.
Limitations and Future Work
- Synthetic Data: While validated against production data characteristics, the primary evaluation uses synthetic text data. The authors note that linguistic diversity is less critical than text length for throughput measurement.
- Single-Node Deployment: The experiments were conducted on a single 4-GPU node. While the cost model extends to multi-node setups, the cross-node coordination (partition routing) is not addressed and is considered future work.
- Shared GPU Workloads: For shared GPU environments,
Bmaxwould need to be scaled down based on the available memory share. - Future Work:
- Adaptive threshold selection (
Bmin,Bmax) based on real-time partition statistics.
- Adaptive threshold selection (
- Reducing partition management overhead for extremely large numbers of partitions (e.g., >10,000).
- Testing with billion-parameter encoders to further validate compute intensity scaling.
- Exploring integration with continuous batching frameworks for online serving scenarios.
Summary updated