Multi-Model Single-Engine GPU Inference with Lossless Parameter Switching
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing AI model deployment methods face challenges in efficiently switching between multiple parameter sets without degrading throughput and latency, particularly when dealing with dynamic input configurations, as they often require reloading model weights or relaunching engines, leading to significant time overhead and inefficient resource utilization.
Innovation Solution
A multi-model single-engine (MMSE) system that allows for lossless switching between multiple model parameter sets by using a single engine to accommodate all parameter sets, where model parameters are selected internally based on inputs, and custom kernels are used to support fast switching of weights by accessing pre-loaded weights in GPU memory, eliminating the need for frequent data movement and initialization.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If multiple inference engines are generated and model weights are reloaded on-the-fly according to input, then model switching capability is achieved, but throughput decreases and latency increases by orders of magnitude
Solution Approach 1:
The patent merges multiple model weight sets into a single inference engine by loading all weight sets into GPU memory simultaneously. The engine maintains multiple parameter sets and switches between them using parameter pointers without reloading weights or reinitializing the engine, thus combining the functionality of multiple engines into one while avoiding the overhead of frequent data movement and kernel relaunching.
Solution Approach 2:
The patent performs preliminary action by pre-loading all model weight sets into GPU memory before inference begins. This allows the engine to have immediate access to all parameter sets without needing to reload them during switching operations, eliminating the time overhead associated with weight reloading and kernel relaunching that would otherwise occur with each model switch.
2Adaptability or versatility
If model weights are reloaded on-the-fly according to input categories, then dynamic model switching is achieved, but time overhead increases significantly due to frequent data movement and kernel launching
Solution Approach 1:
The patent combines multiple model weight sets into a single GPU memory space and uses parameter pointers to switch between them. This merging approach eliminates the need for frequent data movement between CPU and GPU memory, as all weight sets are already resident in GPU memory. The switching operation becomes a simple pointer update rather than a costly data reload operation.
Solution Approach 2:
The patent creates virtual copies of model parameters through pointer references rather than physical weight reloading. Each parameter set is referenced through a pointer that can be switched instantly without copying or moving actual weight data. This virtual copying mechanism allows rapid model switching while avoiding the time overhead of actual data movement and kernel relaunching.
3Speed
If multiple sets of weight parameters are loaded into GPU memory, then fast switching between parameter sets is enabled, but memory consumption increases
Solution Approach 1:
The patent merges multiple model weight sets into a single contiguous memory allocation in GPU memory. Instead of maintaining separate memory spaces for each model, all parameter sets are combined into one unified memory region that can be accessed and switched between efficiently. This reduces the overhead of multiple memory allocations and improves memory utilization while enabling fast switching through pointer manipulation.
4Productivity
If a single engine is used to accommodate all parameter sets, then resource utilization is maximized and memory waste is reduced, but the complexity of managing multiple parameter sets increases
Solution Approach 1:
The patent introduces parameter pointers as intermediaries between the inference engine and multiple weight sets in memory. These pointers act as mediators that manage the complexity of handling multiple parameter sets by providing a simple, unified interface for switching. The engine itself remains unchanged, while the pointers handle the complexity of parameter set selection and switching, thus reducing the perceived complexity for the engine while maintaining efficient resource utilization.
Data Source
AI summary
A method for processing data in a multi-mode single-engine system, an apparatus, and a non-transitory computer-readable storage medium are provided. In the method, a graphic processing engine receives a first input query. Further, the graphic processing engine obtains a first set of model parameters by switching between multiple sets of model parameters based on the first input query. Moreover, the graphic processing engine infers a first output for the first input query based on the first set of parameters.


