Method and apparatus for providing artificial intelligence model swapping to support foundation models
Abstract
There is provided a method and apparatus for model selection for swapping between a first memory and a second memory. The method includes sorting models in a first list, the first list including models loaded in the first memory, wherein sorting is based at least in part on a least recently used (LRU) of each model. The method further includes removing duplicate models from a second list of models, the second list including models to be loaded into the first memory. The method further includes determining an eviction score of each of the models and selecting a model from the first list having a highest eviction score compared with other models in the first list. The method additionally includes swapping the selected model from the first memory to the second memory.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 12 · Forward citations: 0.
Claims (8)
- Claim 1Independent Claim
A method for model selection for swapping between a first memory and a second memory, the method comprising: sorting models in a first list, the first list including models loaded in the first memory, wherein sorting is based at least in part on a least recently used (LRU) of each model; removing duplicate models, if any, from within a second list of models, the second list including models to be loaded into the first memory; determining an eviction score of each of the models based at least in part on: a size of the particular model, a last time the particular model was used in the first list and an index position of the particular model in the second list; selecting a model from the first list having a highest eviction score compared with other models in the first list; and swapping the selected model from the first memory to the second memory.
- Claim 2Depends on #1
The method according to claim 1, wherein selecting includes: selecting one of the models from the first list with a first LRU; comparing the eviction score associated with the selected model with evictions scores of other models in the first list; upon determination that the eviction score associated with the selected model is highest, swapping the selected model from the first memory to the second memory.
- Claim 3Depends on #2
The method according to claim 2, wherein selecting includes: upon determination that the eviction score associated with the selected model is lower, selecting a second model from the first list with a subsequent LRU; comparing an eviction score associated with the selected second model with eviction scores of other models in the first list; upon determination that the eviction score associated with the selected second model is highest, swapping the selected second model from the first memory to the second memory.
- Claim 4Depends on #1
The method according to claim 1, wherein an equal weighting factor is applied to each of the size of the particular model, the last time the particular model was used in the first list and the index position of the particular model in the second list.
- Claim 5Depends on #4
The method according to claim 4, wherein the eviction score for a particular model is defined by: score = 100 last_used _time _in _L1 + 100 model_size + 100 sliding_window _length - index_position _in _L2 wherein: last_used_time_in_L1 is the time when the particular model was last used in the first list; model_size is the size of the particular model; sliding_window_length is the length of the second list; and index_position_in_L2 is the index position of the particular model in the second list.
- Claim 6Depends on #1
The method according to claim 1, wherein the first memory is a processor memory and the second memory is a host memory.
- Claim 7Depends on #1
The method according to claim 1, wherein the first memory is a host memory and the second memory is a disk memory.
- Claim 8Depends on #1
The method according to claim 1, wherein one or more of the models is a foundation model.
Technical Overview & Description
CROSS-REFERENCE TO RELATED APPLICATIONS This is the first application filed for the present invention. FIELD The present disclosure pertains to memory allocation and in particular to a method and apparatus for providing artificial intelligence (AI) model swapping to support foundation models. BACKGROUND As is known, graphic processing units (GPUs) are expensive in terms of both cost and operation. When compared to a computer processing unit (CPU), the use of GPUs is more expensive for cloud providers and thus it is desired that their use be shared efficiently. An AI workflow is a combination of multiple individual steps (or tasks) for execution and these individual steps can result in multiple inference calls to different AI models within each step. It would be understood that all of the AI models are not needed all the time. Requests are dynamic and thus AI model use can be dynamic. As such at a given time, not all of the AI models need to be loaded to the GPU as some AI models will be used less frequently than other AI models. Hosting unused AI models all the time can be considered to be a waste in terms of both cost as well as memory consumption. As such, swapping of AI models is required with memory resource and cost constraints. GPU memory is both expensive and limited in size. When multiple AI models are required for execution, they often exceed to total available GPU memory. So, to handle different AI models, swapping-out AI models that are not needed and swapping-in AI models that are needed for execution is performed. There are several swapping techniques that are in the prior art, for example Clockwork, FaaSwap, ModelMesh and Ray Serve Multiplex. Clockwork is a distributed model serving system. Clockwork uses a least recently used (LRU) method in order to determine which AI model should be loaded onto which GPUs based on how busy each GPU is and how long each AI model is expected to take to run and allocates models to the GPUs accordingly. FaaSwap is a ser
Cited By — Indexed Forward Citations (0 of 0 total)
No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.
References Cited — Backward Prior Art (12)
| Patent | Title | Year | Citations |
|---|
Non-Patent Literature (10)
- WO-2022148306 English Language Translation.
- Peng, Yaqiong, and Haocheng Peng.
- “
- InferFair: Towards QoS-aware scheduling for performance isolation guarantee in heterogeneous model serving systems.
- ”
- Future Generation Computer Systems 150 (2024): 10-20.
- Wu, Bingyang, Yinmin Zhong, Zili Zhang, Shengyu Liu, Fangyue Liu, Yuanhang Sun, Gang Huang, Xuanzhe Liu, and Xin Jin.
- “
- Fast distributed inference serving for large language models.
- ”