WO2025181574A1 - 存储方法、设备、存储介质及程序产品 - Google Patents

存储方法、设备、存储介质及程序产品

Info

Publication number
WO2025181574A1
WO2025181574A1 PCT/IB2025/050597 IB2025050597W WO2025181574A1 WO 2025181574 A1 WO2025181574 A1 WO 2025181574A1 IB 2025050597 W IB2025050597 W IB 2025050597W WO 2025181574 A1 WO2025181574 A1 WO 2025181574A1
Authority
WO
WIPO (PCT)
Prior art keywords
data block
target
key
value vector
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/IB2025/050597
Other languages
English (en)
French (fr)
Inventor
王楠
资彦义
庞张灯
周鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cloud Intelligence Singapore Holding Pvt Ltd
Original Assignee
Cloud Intelligence Singapore Holding Pvt Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Cloud Intelligence Singapore Holding Pvt Ltd filed Critical Cloud Intelligence Singapore Holding Pvt Ltd
Publication of WO2025181574A1 publication Critical patent/WO2025181574A1/zh
Anticipated expiration legal-status Critical
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0662Virtualisation aspects
    • G06F3/0665Virtualisation aspects at area level, e.g. provisioning of virtual or logical volumes
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks

Definitions

  • the embodiments of the present disclosure relate to the field of computer technology, and more particularly to a storage method, device, storage medium, and program product.
  • K-V cache (key-value cache) is an important technology for optimizing model reasoning performance.
  • Model reasoning refers to reasoning and outputting response information based on given input information.
  • K-V is the vector calculated from the input information during the model reasoning process and used for reasoning operations. Taking the input information as input text as an example, model reasoning performs reasoning operations based on the K-V of each token (the smallest unit that the model can process, which can be a word or character, etc.) in the input text to obtain and output the response text.
  • model reasoning requires multiple rounds of reasoning operations, each round is a time step. Under normal circumstances, the model only outputs one token when reasoning at each time step.
  • the K-V of the token output at the current time step is spliced with the K-V of the historical output tokens to infer the token of the next time step until the reasoning ends.
  • a key-value cache stores the key-value of the current time step. The next time step can directly read the stored result without recalculation. Since key-value storage occupies a large amount of memory, in order to reduce memory waste, the memory is usually divided into multiple data blocks. Each data block can store the key-value of a certain number of tokens. Since the data blocks do not need to be continuous in the memory space, memory waste can be greatly reduced.
  • the model usually performs task reasoning for multiple pending requests simultaneously. Different data blocks are allocated for K-V storage for different pending requests. In the traditional solution, data blocks are allocated to multiple pending requests in sequence. For example, the first data block is allocated to the first pending request, and the second data block adjacent to the data block is allocated to the second pending request.
  • this implementation method results in low memory access efficiency and poor storage effect.
  • the embodiments of the present disclosure provide a storage method, device, storage medium and program product to solve the problem in related technologies that key-value vectors are stored in a cross-discrete manner in physical space, which affects memory access efficiency.
  • the present disclosure provides a storage method, comprising: determining a plurality of virtual partitions divided into a first memory.
  • the method includes: a first virtual grouping and a plurality of data blocks corresponding to the plurality of virtual groupings; searching for a first data block most recently allocated to a target request to be stored for a target key-value vector processed by the model; the first data block being located in a first virtual grouping; storing the target key-value vector in the first data block if the first data block meets the storage requirement; allocating the second data block to the target request and storing the target key-value vector in the second data block if the first data block does not meet the storage requirement and a second data block adjacent to the first data block is free; and finding a second virtual grouping whose first data block is free if the second data block is already allocated, allocating the first data block of the second virtual grouping to the target request and storing the target key-value vector in the first data block of the second virtual grouping.
  • the present disclosure provides a computing device comprising a plurality of memories and a plurality of processors; the plurality of memories provide a first memory and a second memory; the first memory and the second memory are used to store a key-value vector; wherein the plurality of memories store one or more computer program instructions for the first processor to call and execute, so as to implement the storage method as described in the first aspect.
  • the present disclosure provides a computer-readable storage medium storing a computer program, wherein the computer program is executed by a computer to implement the storage method as described in the first aspect.
  • the present disclosure provides a computer program product storing a computer program, wherein the computer program is executed by a computer to implement the storage method described in the first aspect.
  • multiple virtual groups divided into a first memory and multiple data blocks corresponding to the multiple virtual groups can be determined.
  • the first data block most recently allocated to the target request can be searched, wherein the first data block is located in the first virtual group. If the first data block meets the storage requirement, the target key-value vector can be stored in the first data block. If the first data block does not meet the storage requirement and a second data block adjacent to the first data block is free, the second data block can be allocated to the target request and the target key-value vector can be stored in the second data block.
  • a second virtual group with a free first data block can be searched, the first data block of the second virtual group can be allocated to the target request, and the target key-value vector can be stored in the first data block of the second virtual group.
  • the second virtual group with an idle first data block is found and allocated to the target request to store the target key-value vector, ensuring that the key-value vectors of the same request are stored as much as possible in the same virtual group, reducing the cross-storage of key-value vectors of different requests in physical space, thereby improving the continuity of key-value vector storage and further improving memory access efficiency.
  • FIG1 shows a schematic diagram of a structure of an embodiment of data block division provided by the present disclosure
  • FIG2 shows a schematic diagram of a system architecture according to an embodiment of the present disclosure
  • FIG3 shows a flow chart of an embodiment of a storage method provided by the present disclosure
  • FIG4 shows a schematic diagram of the structure of an embodiment of virtual grouping and data block division provided by the present disclosure
  • FIG5 shows a flow chart of another embodiment of a storage method provided by the present disclosure
  • FIG6 shows a schematic structural diagram of an embodiment of a storage device provided by the present disclosure
  • Figure 7 shows a schematic diagram of the structure of an embodiment of a computing device provided by the present disclosure.
  • the k-v corresponding to different pending requests are stored in a cross-discrete manner in physical space, and the data blocks corresponding to the k-v stored for the same pending request are discontinuous. Therefore, when reasoning about a pending request and reading the k-v stored for the pending request, multiple read operations are required for multiple discontinuous data blocks, resulting in low memory access efficiency.
  • multiple virtual groups divided into the first memory and multiple data blocks corresponding to the multiple virtual groups are determined; for the target key-value vector to be stored for the target request processed by the model, the first data block most recently allocated to the target request is found; the first data block is located in the first virtual group; if the first data block meets the storage requirement, the target key-value vector is stored in the first data block; if the first data block does not meet the storage requirement and the second data block adjacent to the first data block is idle, the second data block is allocated to the target request, and the target key-value vector is stored in the second data block; if the second data block has been allocated, a second virtual group whose first data block is idle is found, and the first data block of the second virtual group is allocated to the target request, and the target key-value vector is stored in the first data block of the second virtual group.
  • the second virtual group with the first data block free is found and allocated to the target request to store the target key value vector, ensuring that the key value vector of the same request is stored as much as possible in the same virtual group, reducing the cross storage of key value vectors of different requests in the physical space, thereby improving the continuity of key value vector storage and further improving memory access efficiency.
  • the technical solution of the embodiment of the present disclosure can be applied to the system architecture shown in FIG2 , which may include at least one client 201 and a server 202.
  • Each client 201 is connected to the server 202 via a network.
  • Each client 201 can send a request to the server 202 via the network, so that the server 202 performs reasoning based on the request using a model and feeds back the reasoning result to the client 201.
  • the client 201 may be a browser, an APP (Application), a web application such as an H5 (HyperText Markup Languages, version 5) application, a light application (also known as a mini-program, a lightweight application), or a cloud application.
  • the client may be deployed in an electronic device and may rely on the device to run or on certain apps in the device to run.
  • the electronic device may have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, a tablet computer, or a personal computer.
  • the server 202 may include servers that provide various services, such as servers that process requests sent by the client 201, servers that train models, etc. It should be noted that the server can be implemented as a distributed server cluster consisting of multiple servers, or as a single server.
  • the server can also be a server of a distributed system, or a server integrated with a blockchain.
  • the server can also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.
  • user-specific personal data can be used in the scenarios described herein within the scope permitted by applicable laws and regulations of the country where the user is located (for example, with the user's explicit consent, effective notification to the user, etc.).
  • the user information including but not limited to user device information, user personal information, etc.
  • data including but not limited to data used for analysis, stored data, displayed data, etc.
  • the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
  • FIG3 is a flow chart of an embodiment of a storage method provided by an embodiment of the present disclosure.
  • the technical solution of this embodiment can be executed by the server, and the method may include the following steps.
  • [34] 301 Determine a plurality of virtual groups divided into the first memory and a plurality of data blocks corresponding to the plurality of virtual groups.
  • the server can be deployed in a computing device, which can include multiple processors, such as a GPU (graphics processing unit), a CPU (central processing unit), etc.
  • a GPU graphics processing unit
  • CPU central processing unit
  • the technical solution of this embodiment can be executed by a GPU, and the first memory can be the video memory of the GPU.
  • the server can pre-divide the first memory into multiple virtual groups and multiple virtual groups corresponding to the multiple Figure 4 shows a diagram of virtual grouping and data block division.
  • the size and number of virtual packets, as well as the size and number of data blocks, can be set according to actual needs, or there may be other determination methods, which will be explained in subsequent embodiments.
  • [38] 302 For the target key-value vector to be stored for the target request processed by the model, find the first data block most recently allocated to the target request, where the first data block is located in the first virtual group.
  • the model involved in the embodiments of the present disclosure can be implemented as a large model (also called a foundation model).
  • a large model refers to a machine learning model with a large number of parameters and a complex structure. It can process massive amounts of data and complete various complex tasks, such as natural language processing, computer vision, and speech recognition. It is an AI (artificial intelligence) model.
  • the large model can be implemented using a large language model (LLM) or a multimodal large model (MLM). This disclosure does not limit this.
  • the model can process one or more requests.
  • the key-value vector can be stored according to the scheme of the embodiment of the present disclosure.
  • the target request refers to any request, and the target key-value vector can refer to any key-value vector.
  • the request can include initial input data, that is, prompt.
  • Prompt is a form of input that can include a specific task or instruction that the model is expected to perform, which is used to prompt or guide the model to give an expected output, indicating what action the model should take or what output it should generate when performing a specific task.
  • the target key-value vector can be a key-value vector calculated from any text unit obtained by segmenting the prompt in the pre-filling phase. Of course, it can also be a key-value vector calculated from any text unit output at each time step in the decoding phase.
  • the model inference process can be mainly divided into two stages: the pre-filling phase (i.e., the phase in which the first text unit is generated based on the prompt) and the decoding phase (the phase in which the second and subsequent text units are generated).
  • the text unit in the embodiments of the present disclosure can be, for example, a token (the smallest unit that the model can process, such as a word or character).
  • the data block most recently allocated to the target request can be searched.
  • the first data block can be referred to as the first data block, and the first data block is located in the first virtual group.
  • the first data block most recently allocated to the target request can refer to the first data block allocated to the target request in the previous time step, that is, the first data block that stores the key-value vector to be stored for the target request in the previous time step.
  • searching for the first data block most recently allocated to the target request may include: for the target key value vector to be stored for the target request, when the target key value vector is generated in the pre-filling stage based on the text unit included in the target request, allocating data blocks in at least one virtual group to the target request, and storing the target key value vector in the data blocks in at least one virtual group in sequence; when the target key value vector is generated in the decoding stage based on the text unit produced at any time step, searching for the first data block most recently allocated to the target request.
  • the target key vector is generated based on the text units included in the target request. That is, the current time step is the initial time step, and no data blocks have been allocated to the target request before this time step.
  • the target request can be allocated data blocks in at least one virtual group, and the target key vector can be sequentially stored in the data blocks in at least one virtual group. There are many ways to implement this.
  • a data block in at least one virtual group can be randomly selected from the first memory and assigned to the target request.
  • An idle virtual group may indicate that the data blocks in the virtual group are not allocated to any request and do not store any key-value vectors for any request. If the result of the determination is yes, at least one data block in the idle virtual group, or at least one data block in an idle virtual group, may be allocated to the target request, thereby sequentially storing the target key-value vectors in the allocated data blocks. If the result of the determination is no, at least one data block in a virtual group with an idle data block, or at least one data block in a virtual group with an idle data block, may be allocated to the target request.
  • the target key vector is generated based on the text units produced at any time step, that is, the current time step is any time step after the initial time step, and the data block has been allocated to the target request in the previous time step. At this time, the first data block most recently allocated to the target request can be found.
  • [50] 303 Check whether the first data block meets the storage requirements. If the first data block meets the storage requirements, execute the operation of step 304; otherwise, execute the operation of step 305.
  • the storage requirement may include, for example, that there is storage space for the first data block, or that the first data block does not reach a storage capacity threshold, etc., and may be set according to actual needs.
  • the target key-value vector can be stored in the first data block, thereby realizing continuous storage of the key-value vector in the data block.
  • [54] 305 Check whether the second data block adjacent to the first data block is free. If the second data block is free, execute the operation of step 306; if the second data block is allocated, execute the operation of step 307.
  • the target key-value vector cannot be stored in the first data block.
  • the next data block adjacent to the first data block can be detected, which can be called the second data block for the sake of convenience, to see whether it is free.
  • the free data block can indicate that the data block is not allocated to any request and does not store any key-value vector of any request.
  • [57] 306 Allocate a second data block to the target request, and store the target key-value vector in the second data block.
  • the second data block can be allocated to the target request, and the target key-value vector can be stored in the second data block.
  • [59] 307 Find a second virtual group with an idle first data block, allocate the first data block of the second virtual group to the target request, and store the target key-value vector in the first data block of the second virtual group.
  • the second data block When the second data block has been allocated, it indicates that the second data block has been allocated to other requests. At this time, in order to reduce the cross-storage of key-value vectors of different requests in space, a second virtual grouping in which the first data block is idle can be found, and the first data block in the second virtual grouping can be allocated to the target request, and the target key-value vector can be stored in the first data block of the second virtual grouping.
  • the storage information of the target key-value vector can also be recorded in the block table.
  • the storage information of the target key-value vector may include the identification information of the stored data block, the identification information of the virtual group in which the data block is located, and the identification information of the corresponding target request.
  • the record information in the block table may include the identification information of the virtual group corresponding to each target request, the identification information of the data block in the virtual group, and the number of text units stored in the data block.
  • the first data block most recently allocated by the target request can be determined based on the record information in the block table, and it can be judged whether the first data block meets the storage requirements and whether the second data block is idle, thereby improving the judgment efficiency.
  • the first memory is divided into multiple virtual groups and the multiple virtual groups correspond to
  • the first data block most recently allocated to the target request can be searched, where the first data block is located in a first virtual group. If the first data block meets the storage requirement, the target key-value vector can be stored in the first data block. If the first data block does not meet the storage requirement and a second data block adjacent to the first data block is free, the second data block can be allocated to the target request, and the target key-value vector can be stored in the second data block.
  • a second virtual group with a free first data block can be searched, the first data block of the second virtual group can be allocated to the target request, and the target key-value vector can be stored in the first data block of the second virtual group.
  • the target request can store the target key vector by finding a second virtual group with an empty first data block. This ensures that key vectors of the same request are stored in the same virtual group as much as possible, reduces the cross-storage of key vectors of different requests in physical space, thereby improving the continuity of key vector storage and further enhancing memory access efficiency.
  • the above method may include: using the virtual group size, the number of virtual groups, the data block size, the number of data blocks and the maximum number of request processing as multiple hyperparameters corresponding to the model; finding candidate parameter value combinations of the multiple hyperparameters; using test samples to evaluate the model set according to the candidate parameter value combination, and if the model evaluation result meets the performance requirements, using the candidate parameter value combination as the target parameter value combination; dividing the first memory into multiple virtual groups and multiple data blocks corresponding to the multiple virtual groups according to the target virtual group size, target number of virtual groups, target data block size and target number of data blocks determined in the target parameter value combination.
  • the maximum number of request processing can refer to the number of target requests that the model can process simultaneously. When the number of requests received exceeds the maximum number of request processing, the excess requests can be placed in the request pool and wait for processing.
  • the maximum number of text units that the model can process can be pre-set based on the actual application scenario.
  • the utilization rate of the first memory during full load operation can be set based on the actual application scenario. For example, it can be set to 95%.
  • the size of the first memory is multiplied by the utilization rate of the first memory to obtain the available first memory size.
  • the maximum number of text units does not exceed the available first memory size.
  • the number of text units can be set to 1024, for example.
  • the product of the virtual group size and the number of virtual groups is calculated, and the result obtained can be consistent with the maximum text unit processing number, and the product of the data block size and the number of data blocks is calculated.
  • the calculation result can also be consistent with the maximum number of text units processed.
  • multiple historical requests can be obtained and the maximum number of requests processed can be multiplied by the average number of historical requests.
  • the calculation result can also be consistent with the maximum number of requests processed. In this way, multiple candidate parameter value combinations of hyperparameters can be obtained.
  • the test samples are used to evaluate the model set according to the candidate parameter value combination. If the model evaluation result meets the performance requirements, the candidate parameter value combination is used as the target parameter value combination, and multiple virtual groups and data blocks are divided accordingly.
  • the size of the data block can be set to 16, for example, indicating that the key-value vectors corresponding to 16 text units can be stored.
  • the size of the virtual group can be set to 8, for example, indicating that it can include 8 data blocks, and so on.
  • using the test sample to evaluate the model set according to the candidate parameter value combination may include: inserting the test sample into the model set according to the candidate parameter value combination to obtain a prediction result; and determining the model evaluation result based on the difference information between the prediction result and the expected result.
  • the size and number of virtual groups and data blocks are determined to divide the first memory, thereby improving the rationality of the virtual grouping and data block settings and further reducing the waste of resources in the first memory.
  • the above virtual grouping and data block division information can be recorded in the block table.
  • the historical key-value vector stored in the data block corresponding to the target request can be transferred to the second memory, and the data block corresponding to the target request can be cleared. Then, the first data block in the cleared third virtual group can be allocated to the target request and the target key-value vector can be stored in the first data block in the third virtual group.
  • the second memory and the first memory correspond to different processors.
  • the second memory may be a CPU memory. When there is no second virtual group with a free first data block in the first memory, all historical key-value vectors of the target request stored in the first memory before the current time step may be transferred to the second memory, and the corresponding data blocks may be cleared.
  • the cleared data blocks include a third virtual group with a free first data block
  • the first data block in the third virtual group may be allocated to the target request, and the target key-value vector may be stored in the first data block in the third virtual group, thereby improving the continuity of key-value vector storage.
  • the historical key-value vector of the stored target request is transferred to the second memory for storage, and the corresponding data block is cleared for continuing to store the key-value vector in the current time step and subsequent time steps. This ensures the continuity of the key-value vector storage on the basis of realizing the storage of the target key-value vector.
  • the record information of the target request in the block table can be updated based on the storage information of the target key-value vector.
  • a free data block can be randomly selected and allocated to the target request, and the target key value vector can be stored in the free data block.
  • the target key-value vector can be stored in the first memory, and there is no need to transfer the stored historical key-value vectors between different memories, which avoids resource consumption and improves memory access efficiency.
  • a free data block is randomly selected and allocated to the target request.
  • the use of data blocks in the first memory may be combined to determine whether there are free data blocks.
  • randomly selecting a free data block to allocate to the target request and storing the target key value vector in the free data block may include: when the search result of the second virtual group is empty and the data blocks in the first memory meet the use condition, randomly selecting a free data block to allocate to the target request and storing the target key value vector in the free data block.
  • the usage condition may include, for example, that the usage rate of the data blocks in the first memory is lower than a usage rate threshold, which may be, for example, 99%, and may be set according to actual needs.
  • the usage rate may be determined based on the ratio of the number of allocated data blocks in the first memory to the number of divided data blocks.
  • the usage condition may also include that the remaining rate of the data blocks in the first memory is higher than a remaining rate threshold, which may be, for example, 1%.
  • the remaining rate may be determined based on the difference between the value 1 and the ratio of the number of allocated data blocks in the first memory to the number of divided data blocks.
  • other usage conditions can be set according to actual needs, and this disclosure does not limit this.
  • the historical key-value vector stored in the data block corresponding to the target request can be transferred to the second memory, and the data block corresponding to the target request can be cleared. Then, the first data block in the cleared third virtual group is allocated to the target request, and the target key-value vector is stored in the first data block in the third virtual group.
  • the cleared data blocks may include a third virtual group whose first data block is free. If the determination result is yes, the first data block in the third virtual group may be allocated to the target request, and the target key-value vector may be stored in the first data block in the third virtual group to improve the continuity of the key-value vector storage. If the determination result is no, a cleared data block may be randomly selected and allocated to the target request, and the target key-value vector may be stored in the data block.
  • the stored historical key-value vector of the target request is transferred to the second memory for storage, and the corresponding data block is cleared to continue storing the key-value vector in the current time step and subsequent time steps, thereby realizing the storage of the key-value vector.
  • the target key-value vector may not be stored, and the target key-value vector is used to be recalculated based on its corresponding text unit when reasoning is performed at the next time step.
  • the target key-value vector that is not stored in the current time step cannot be directly obtained from the memory in the next time step. It needs to be recalculated according to its corresponding text unit when reasoning in the next time step to achieve Considering the computational resource consumption and impact on model inference efficiency caused by recalculating the key-value vector, infinite recalculation can be avoided.
  • not storing the target key-value vector may include: when the search result of the second virtual group is empty and the data block in the first memory does not meet the usage condition, if the recalculated number of text units is less than a predetermined value, not storing the target key-value vector.
  • the method may further include: if the number of recalculated text units reaches a predetermined value, transferring the historical key-value vector stored in the data block corresponding to the target request to the second memory, and clearing the data block corresponding to the target request. Thereafter, allocating the first data block in the cleared third virtual group to the target request, and storing the target key-value vector in the first data block in the third virtual group.
  • the setting of this predetermined value can be used to balance the resource consumption caused by recalculating the key-value vector and the impact on the model inference efficiency, as well as the resource consumption caused by transferring the historical key-value vector between different memories and the impact on the memory access efficiency.
  • it can be set to 4, 5, etc., which can be determined according to the actual application scenario.
  • the target key-value vector is not stored, so that it is recalculated according to its corresponding text unit when reasoning is performed in the next time step.
  • the number of recalculated text units reaches the predetermined value, the historical key-value vector stored in the data block corresponding to the target request is transferred to the second memory, and the data block corresponding to the target request is cleared, and the first data block in the cleared third virtual grouping is allocated to the target request, and the target key-value vector is stored in the first data block in the third virtual grouping.
  • One or more of the above embodiments provide a storage method for key-value vectors.
  • the following describes the process of model reasoning based on the stored key-value vectors.
  • the above method may further include: calculating a target key-value vector corresponding to a text unit generated by a target request at a previous time step; reading a historical key-value vector corresponding to the target request from the first memory and/or the second memory; concatenating the target key-value vector with the historical key-value vector to generate an input vector for the current time step; and using a model to generate a text unit corresponding to the current time step based on the input vector.
  • the target key corresponding to the text unit generated at the previous time step can be calculated
  • the target request is generated by generating a value vector and reading the historical key-value vector from the first memory and/or the second memory that stores the historical key-value vector corresponding to the target request.
  • the historical key-value vector is concatenated with the target key-value vector calculated at the current time step to obtain the input vector of the model at the current time step.
  • the input vector is then input into the model to infer the text unit corresponding to the current time step.
  • reading the historical key-value vector corresponding to the target request from the first memory and/or the second memory may include: reading the historical key-value vector corresponding to the target request from the first memory and/or the second memory according to the record message of the target request in the block table.
  • the above process provides a model inference process that does not require recalculation of key-value vectors.
  • the above method may further include: determining whether there is at least one text unit that needs to be recalculated; if so, calculating at least one key-value vector corresponding to the at least one text unit.
  • splicing the target key value vector with the historical key value vector to generate the input vector of the current time step may include: splicing the target key value vector, at least one key value vector and the historical key value vector to generate the input vector of the current time step.
  • At the current time step when it is determined that there is at least one text unit to be recalculated, at least one key-value vector corresponding to the at least one text unit and a target key-value vector corresponding to the text unit generated at the previous time step can be calculated, and the historical key-value vector corresponding to the target request is read from the first memory and/or the second memory storing the historical key-value vector.
  • the read historical key-value vector is concatenated with at least one key-value vector corresponding to the at least one text unit recalculated at the current time step and the target key-value vector corresponding to the text unit generated at the previous time step calculated at the current time step, to obtain the input vector of the model in the current time step, and the input vector is input into the model to infer the text unit corresponding to the current time step.
  • Figure 5 shows a schematic diagram of the process of allocating data blocks and storing key-value vectors, which may include the following steps.
  • [108] 500 Pre-dividing the first memory into a plurality of virtual groups and a plurality of data blocks corresponding to the plurality of virtual groups, and recording them in a block table.
  • [110] 502 At any time step after the initial time step, the following steps are executed in a loop until the target request processing is completed. [111] 5020: Find the first data block most recently allocated by the target request, where the first data block is located in the first virtual group.
  • [112] 5021 Check whether the first data block meets the storage requirements. If the first data block meets the storage requirements, execute the operation of step 5022; otherwise, execute the operation of step 5023.
  • [113] 5022 Store the target key-value vector into the first data block.
  • [114] 5023 Check whether the second data block adjacent to the first data block is free. If the second data block is free, execute the operation of step 5024; if the second data block has been allocated, execute the operation of step 5025.
  • [115] 5024 Allocate a second data block to the target request, and store the target key-value vector in the second data block.
  • [116] 5025 Check whether there is a second virtual group with the first data block free. If so, execute the operation of step 5026; otherwise, execute the operation of step 5027.
  • [117] 5026 Allocate the first data block of the second virtual group to the target request, and store the target key-value vector in the first data block of the second virtual group.
  • [118] 5027 Check whether the data block meets the usage conditions. If so, execute the operation of step 5028; otherwise, execute the operation of step 5029.
  • [119] 5028 Randomly select a free data block to allocate to the target request, and store the target key-value vector into the free data block.
  • [120] 5029 Determine whether the number of recalculated text units is less than a predetermined value. If so, execute the operation of step 5030; otherwise, execute the operation of step 5031.
  • [122] 5031 Transfer the historical key-value vector stored in the data block corresponding to the target request to the second memory, clear the corresponding data block, assign the first data block in the cleared third virtual group to the target request, and store the target key-value vector in the first data block in the third virtual group.
  • the target key-value vector is not stored, so that it can be recalculated based on its corresponding text units during inference at the next time step. If the number of recalculated text units reaches the predetermined value, the historical key-value vector stored in the data block corresponding to the target request is transferred to the second memory, the data block corresponding to the target request is cleared, and the first data block in the cleared third virtual grouping is allocated to the target request, and the target key-value vector is stored in the first data block of the third virtual grouping.
  • This method achieves a balance between the resource consumption and impact on model inference efficiency caused by recalculating key-value vectors, and the resource consumption and impact on memory access efficiency caused by transferring historical key-value vectors between different memories, thereby achieving optimal key-value vector storage, calculation, memory access, and model inference performance.
  • FIG6 it is a schematic structural diagram of an embodiment of a storage device provided by the present disclosure, and the device may include the following modules.
  • a first determining module 601 is used to determine a plurality of virtual groups divided from a first memory and a plurality of data blocks corresponding to the plurality of virtual groups.
  • a search module 602 is configured to search for a first data block most recently allocated to a target key-value vector to be stored for a target request processed by the model; the first data block is located in a first virtual group.
  • a second storage module 604 is configured to allocate the second data block to the target request and store the target key-value vector in the second data block when the first data block does not meet the storage requirement and a second data block adjacent to the first data block is free.
  • a third storage module 605 when the second data block has been allocated, searches for a second virtual group whose first data block is free, allocates the first data block of the second virtual group to the target request, and stores the target key-value vector in the first data block of the second virtual group.
  • the search module 602 may include: an allocation unit, for a target key value vector to be stored in a target request, when the target key value vector is generated in a pre-filling phase based on text units included in the target request, for allocating data blocks in at least one virtual group to the target request, and storing the target key value vector in the data blocks in the at least one virtual group in sequence; a search unit, for When the vector is generated during the decoding phase based on the text units produced at any time step, it is used to find the first data block most recently allocated to the target request.
  • the device may further include: a fourth storage module, which is used to randomly select an idle data block to allocate to the target request when the search result of the second virtual group is empty, and store the target key value vector in the idle data block.
  • a fourth storage module which is used to randomly select an idle data block to allocate to the target request when the search result of the second virtual group is empty, and store the target key value vector in the idle data block.
  • the fourth storage module can be used to randomly select an idle data block to allocate to the target request and store the target key value vector in the idle data block when the search result of the second virtual group is empty and the data block in the first memory meets the usage condition.
  • the device may also include: a second determination module, which is used to not store the target key-value vector when the search result of the second virtual group is empty and the data block in the first memory does not meet the usage condition; the target key-value vector is used to be recalculated according to its corresponding text unit when reasoning is performed in the next time step.
  • a second determination module which is used to not store the target key-value vector when the search result of the second virtual group is empty and the data block in the first memory does not meet the usage condition
  • the target key-value vector is used to be recalculated according to its corresponding text unit when reasoning is performed in the next time step.
  • the second determination module may be configured to not store the target key-value vector if the recalculated number of text units is less than a predetermined value when the search result of the second virtual group is empty and the data block in the first memory does not meet the usage condition.
  • the device may also include: a transfer module, which is used to transfer the historical key-value vector stored in the data block corresponding to the target request to the second memory and clear the data block corresponding to the target request if the number of recalculated text units reaches the predetermined value; the second memory and the first memory correspond to different processors; and a fifth storage module, which is used to assign the first data block in the cleared third virtual group to the target request and store the target key-value vector in the first data block in the third virtual group.
  • a transfer module which is used to transfer the historical key-value vector stored in the data block corresponding to the target request to the second memory and clear the data block corresponding to the target request if the number of recalculated text units reaches the predetermined value
  • the second memory and the first memory correspond to different processors
  • a fifth storage module which is used to assign the first data block in the cleared third virtual group to the target request and store the target key-value vector in the first data block in the third virtual group.
  • the device may further include: a third determination module for using the virtual group size, data block size, number of data blocks and maximum request processing number as multiple hyperparameters corresponding to the model; a search module for finding candidate parameter value combinations of the multiple hyperparameters; an evaluation module for using test samples to perform model evaluation on the model set according to the candidate parameter value combination, and when the model evaluation result meets the performance requirements, using the candidate parameter value combination as the target parameter value combination; a partitioning module for partitioning the first memory into multiple virtual groups and multiple data blocks corresponding to the multiple virtual groups according to the target virtual group size, target data block size and target number of data blocks determined in the target parameter value combination.
  • a third determination module for using the virtual group size, data block size, number of data blocks and maximum request processing number as multiple hyperparameters corresponding to the model
  • a search module for finding candidate parameter value combinations of the multiple hyperparameters
  • an evaluation module for using test samples to perform model evaluation on the model set according to the candidate parameter value combination, and when the model evaluation result meets the performance requirements, using
  • the evaluation module can be specifically used to input the test sample into the model set according to the candidate parameter value combination to obtain a prediction result; and determine the model evaluation result based on the difference information between the prediction result and the expected result.
  • the device may further include: an update module for updating the record information of the target request in the block table according to the storage information of the target key-value vector.
  • the device may further include: a first calculation module, used to calculate the target key-value vector corresponding to the text unit generated by the target request in the previous time step; a reading module, used to read the historical key-value vector corresponding to the target request from the first memory and/or the second memory; a first generation module, used to concatenate the target key-value vector and the historical key-value vector to generate an input vector for the current time step; and a second generation module, used to generate the text unit corresponding to the current time step based on the input vector using the model.
  • a first calculation module used to calculate the target key-value vector corresponding to the text unit generated by the target request in the previous time step
  • a reading module used to read the historical key-value vector corresponding to the target request from the first memory and/or the second memory
  • a first generation module used to concatenate the target key-value vector and the historical key-value vector to generate an input vector for the current time step
  • a second generation module used to generate the text unit corresponding to the current time step
  • the reading module can be specifically used to read the historical key-value vector corresponding to the target request from the first memory and/or the second memory based on the record message of the target request in the block table.
  • the device may further include: a judgment module for judging whether there is at least one text unit to be recalculated; a second calculation module for calculating at least one key-value vector corresponding to the at least one text unit when the result of the judgment module is yes; a first generation module, which can be specifically used to splice the target key-value vector, the at least one key-value vector and the historical key-value vector to generate a powder input vector of the current time step.
  • the device may include at least multiple memories and multiple processors.
  • the multiple memories provide a first memory 701 and a second memory 702, and the first memory and the second memory may be used to store key-value vectors.
  • the multiple processors may include a first processor 703 and a second processor 704.
  • the first processor 703 may be, for example, a GPU, and the first memory may be the corresponding video memory of the GPU.
  • the second processor 704 may be, for example, a CPU, and the second memory may be the corresponding memory of the CPU.
  • the multiple memories store one or more computer program instructions for the first processor 703 to call and execute, so as to implement the storage method shown in Figure 3 or Figure 5.
  • the above-mentioned computing device may also include other components, such as input/output interfaces, communication components, etc.
  • the input/output interface provides an interface between the processing component and the peripheral interface module, which may be an output device, an input device, etc.
  • the communication component is configured to facilitate wired or wireless communication between the computing device and other devices.
  • the computing device mentioned above may be a physical device or an elastic computing host provided by a cloud computing platform. It may be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device.
  • the processor may be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), or other modern processors.
  • ASICs application-specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA Field programmable gate array
  • controller microcontroller
  • microprocessor microprocessor or other electronic components are used to execute the above method.
  • the memory is configured to store various types of data to support operations at the terminal.
  • the memory may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EPROM erasable programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic memory flash memory
  • flash memory magnetic disk
  • magnetic disk magnetic disk
  • optical disk optical disk
  • the display may be an electroluminescent (EL) element, a liquid crystal display or a microdisplay having a similar structure, or a direct retinal display or a similar laser scanning display.
  • EL electroluminescent
  • the present disclosure also provides a computer-readable storage medium storing a computer program.
  • the computer program When the computer program is executed by a computer, the storage method shown in FIG3 or FIG5 can be implemented.
  • the computer-readable medium can be included in the computing device described in the above embodiment; or it can exist independently without being incorporated into the computing device.
  • Computer-readable storage media may be, for example, but not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof.
  • the embodiment of the present disclosure also provides a computer program product, which includes a computer program carried on a computer-readable storage medium, and when the computer program is executed by a computer, it can implement the storage method shown in Figure 3 or Figure 5.
  • the computer program may be downloaded and installed from a network and/or installed from a removable medium.
  • the various functions defined in the system of the present disclosure are performed.
  • the device embodiments described above are merely illustrative.
  • the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those skilled in the art can understand and implement the present invention without inventive effort.
  • each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course by hardware.
  • the above technical solution in essence, or the part that contributes to the relevant technology, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, a magnetic disk, or an optical disk. , etc., including several instructions for enabling a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the embodiments or certain parts of the embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本公开提供一种存储方法、设备、存储介质及程序产品。确定第一内存划分的多个虚拟分组及其分别对应的多个数据块;针对模型处理的目标请求待存储的目标键值向量,查找目标请求最近分配的第一数据块,其位于第一虚拟分组;当第一数据块满足存储要求,将目标键值向量存储至第一数据块;当未满足存储要求且第一数据块相邻的第二数据块空闲,将第二数据块分配给目标请求并将目标键值向量存储;第二数据块已分配时,寻找第一个数据块空闲的第二虚拟分组,将第二虚拟分组的第一个数据块分配给目标请求并存储目标键值向量。

Description

存储方法、 设备、 存储介质及程序产品 技术领域
[01]本公开实施例涉及计算机技术领域, 尤其涉及一种存储方法、 设备、 存储介质及程 序产品。 背景技术
[02] k-v cache( key-value cache, 键值向量缓存)是目前实现模型推理性能优化的一项重 要技术, 模型推理指的是基于给定的输入信息, 推理并输出答复信息。 k-v是模型推理 过程中从输入信息中所计算获得的向量并用以推理运算, 以输入信息为输入文本为例, 模型推理是根据输入文本中每个 token(指模型能够处理的最小单元, 可以是词或字符 等)的 k-v来执行推理操作, 获得并粉出答复文本。 实际应用中, 模型推理需要经过多 轮推理操作, 每一轮也即为一个时间步, 通常情况下, 模型在每个时间步进行推理时只 输出一个 token, 当前时间步输出 token的 k-v, 与历史输出 tokens的 k-v进行拼接, 用 以推理获得下一个时间步的 token, 直至推理结束。
[03]为了降低计算量, 提高推理效率, k-v cache也即是将当前时间步的 k-v进行存储, 下一个时间步直接读取存储结果即可,无需再重新计算。由于 k-v存储占用的内存较大, 为了减少内存浪费,通常将内存划分为多个数据块,每个数据块可以存储一定数量 token 的 k-v, 由于数据块不需要在内存空间中连续, 可以极大地减少内存浪费。
[04]在实际应用中, 模型通常会同时执行多个待处理请求的任务推理, 对于不同的待处 理请求, 会分配不同的数据块来进行 k-v存储。 传统方案中, 是为多个待处理请求依次 分配数据块, 例如将第一个数据块分配给第一个待处理请求, 将与该数据块相邻的第二 个数据块分配给第二个待处理请求。 但是, 这种实现方式导致访存效率较低, 存储效果 不佳。 发明内客
[05]本公开实施例提供一种存储方法、 设备、 存储介质及程序产品, 用以解决相关技术 中键值向量在物理空间上的存储交叉离散, 影响访存效率的问题。
[06]第一方面, 本公开提供了一种存储方法, 包括: 确定第一内存划分出的多个虚拟分 组以及所述多个虚拟分组分别对应的多个数据块;针对模型处理的目标请求待存储的目 标键值向量, 查找所述目标请求最近分配的第一数据块; 所述第一数据块位于第一虚拟 分组中; 在所述第一数据块满足存储要求的情况下, 将所述目标键值向量存储至所述第 一数据块中;在所述第一数据块未满足存储要求且所述第一数据块相邻的第二数据块空 闲情况下, 将所述第二数据块分配给所述目标请求, 及将所述目标键值向量存储至所述 第二数据块中; 在所述第二数据块已分配情况下, 寻找第一个数据块空闲的第二虚拟分 组, 并将所述第二虚拟分组的第一个数据块分配给所述目标请求, 及将所述目标键值向 量存储至所述第二虚拟分组的第一个数据块中。
[07]第二方面, 本公开提供了一种计算设备, 包括多个存储器及多个处理器; 所述多个 存储器提供第一内存以及第二内存;所述第一内存以及所述第二内存用以存储键值向量; 其中, 所述多个存储器存储一条或多条计算机程序指令供第一处理器调用执行, 以实现 如第一方面所述的存储方法。
[08]第三方面, 本公开提供了一种计算机可读存储介质, 存储有计算机程序, 所述计算 机程序被计算机执行以实现如第一方面所述的存储方法。
[09]第四方面, 本公开提供了一种计算机程序产品, 存储有计算机程序, 所述计算机程 序被计算机执行以实现如第一方面所述的存储方法。
[10]本公开实施例中, 可以确定第一内存划分出的多个虚拟分组以及多个虚拟分组分别 对应的多个数据块, 针对模型处理的目标请求待存储的目标键值向量, 可以查找该目标 请求最近分配的第一数据块, 其中, 该第一数据块位于第一虚拟分组中。 在第一数据块 满足存储要求的情况下, 可以将目标键值向量存储在第一数据块中; 在第一数据块未满 足存储要求且第一数据块相邻的第二数据块空闲的情况下,可以将第二数据块分配给该 目标请求, 并将目标键值向量存储在第二数据块中; 在第一数据块未满足存储要求且第 二数据块已分配的情况下, 可以寻找第一个数据块空闲的第二虚拟分组, 并将第二虚拟 分组的第一个数据块分配给该目标请求, 以及将目标键值向量存储在该第二虚拟分组的 第一个数据块中。 通过划分多个虚拟分组, 在目标请求最近分配的第一虚拟分组中的第 一数据块不满足存储要求,且与之相邻的第二数据块也已经分配给其它目标请求的情况 下,寻找第一个数据块空闲的第二虚拟分组并将其分配给目标请求来进行目标键值向量 的存储, 保证同一虚拟分组中尽量存储同一请求的键值向量, 降低了不同请求的键值向 量在物理空间上的交叉存储,由此提高了键值向量存储的连续性,进而提高了访存效率。
[11]本公开的这些方面或其他方面在以下实施例的描述中会更加简明易懂。 附图说明
[12]为了更清楚地说明本公开实施例或相关技术中的技术方案, 下面将对实施例或相关 技术描述中所需要使用的附图作一简单地介绍, 显而易见地, 下面描述中的附图是本公 开的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可 以根据这些附图获得其他的附图。
[13]图 1示出了本公开提供的一种数据块划分一个实施例的结构示意图;
[14]图 2示出了本公开提供的一种系统架构一个实施例的结构示意图;
[15]图 3示出了本公开提供的一种存储方法一个实施例的流程图;
[16]图 4示出了本公开提供的一种虚拟分组及数据块划分一个实施例的结构示意图;
[17]图 5示出了本公开提供的一种存储方法另一个实施例的流程图;
[18]图 6示出了本公开提供的一种存储装置一个实施例的结构示意图;
[19]图 7示出了本公开提供的一种计算设备一个实施例的结构示意图。 具体实施方式
[20]为了使本技术领域的人员更好地理解本公开方案, 下面将结合本公开实施例中的附 图, 对本公开实施例中的技术方案进行清楚、 完整地描述。
[21]在本公开的说明书和权利要求书及上述附图中的描述的一些流程中, 包含了按照特 定顺序出现的多个操作, 但是应该清楚了解, 这些操作可以不按照其在本文中出现的顺 序来执行或并行执行,操作的序号如 101、 102等,仅仅是用于区分开各个不同的操作, 序号本身不代表任何的执行顺序。 另外, 这些流程可以包括更多或更少的操作, 并且这 些操作可以按顺序执行或并行执行。 需要说明的是, 本文中的 “第一” 、 “第二” 等描 述,是用于区分不同的消息、设备、模块等, 不代表先后顺序,也不限定 “第一 ”和 “第 二” 是不同的类型。
[22]本公开的技术方案适用于计算机技术领域。 在传统方案中, 对于模型所执行推理任 务的多个不同的待处理请求, 通常是为每个待处理请求依次分配数据块, 参考图 1所示 的数据块划分及 k-v ( key- value, 键值向量)的存储示意图, 例如, 将数据块 1和数据 块 2分配给请求 1来存储请求 1的键值向量, 以及将数据块 3分配给请求 2来存储请求 2的键值向量, 当数据块 2的存储容量达到阈值时, 将数据块 4分配给请求 1来继续存 储请求 1的键值向量, 以及当数据块 3的存储容量达到阈值时, 将数据块 5分配给请求 2来继续存储请求 2的键值向量, 依次执行直至针对多个待处理请求的推理结束。
[23]由此可知, 上述实现方式中, 不同待处理请求所对应的 k-v在物理空间上的存储是 交叉离散的, 同一待处理请求所存储的 k-v对应的数据块是不连续的。 因此, 在针对某 一待处理请求进行推理,读取该待处理请求所存储的 k-v时,对于多个不连续的数据块, 需要进行多次读取操作, 访存效率较低。
[24]为了解决上述技术问题, 发明人提出了本公开的技术方案, 在本公开实施例中, 确 定第一内存划分出的多个虚拟分组以及所述多个虚拟分组分别对应的多个数据块;针对 模型处理的目标请求待存储的目标键值向量,查找所述目标请求最近分配的第一数据块; 所述第一数据块位于第一虚拟分组中; 在所述第一数据块满足存储要求的情况下, 将所 述目标键值向量存储至所述第一数据块中;在所述第一数据块未满足存储要求且所述第 一数据块相邻的第二数据块空闲情况下, 将所述第二数据块分配给所述目标请求, 及将 所述目标键值向量存储至所述第二数据块中; 在所述第二数据块已分配情况下, 寻找第 一个数据块空闲的第二虚拟分组,并将所述第二虚拟分组的第一个数据块分配给所述目 标请求, 及将所述目标键值向量存储至所述第二虚拟分组的第一个数据块中。
[25]本公开实施例中, 通过划分多个虚拟分组, 在目标请求最近分配的第一虚拟分组中 的第一数据块不满足存储要求,且与之相邻的第二数据块也已经分配给其它目标请求的 情况下,寻找第一个数据块空闲的第二虚拟分组并将其分配给目标请求来进行目标键值 向量的存储, 保证同一虚拟分组中尽量存储同一请求的键值向量, 降低了不同请求的键 值向量在物理空间上的交叉存储, 由此提高了键值向量存储的连续性, 进而提高了访存 效率。
[26]下面将结合本公开实施例中的附图, 对本公开实施例中的技术方案进行清楚、 完整 地描述, 显然, 所描述的实施例仅仅是本公开一部分实施例, 而不是全部的实施例。 基 于本公开中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他 实施例, 都属于本公开保护的范围。
[27]本公开实施例的技术方案可以应用于如图 2所示的系统架构中, 该系统架构可以包 括至少一个客户端 201和服务端 202。 每个客户端 201与服务端 202之间通过网络建立 连接, 每个客户端 201通过网络可以向服务端 202发送请求, 以由服务端 202基于请求 利用模型进行推理, 并将推理结果反馈给客户端 201。 [28]其中, 客户端 201 可以为浏览器、 APP( Application, 应用程序) 、 或网页应用如 H5 ( HyperText Markup Languages , 超文本标记语言第 5版)应用、 或轻应用 (也被称 为小程序, 一种轻量级应用程序)或云应用等, 客户端可以部署在电子设备中, 需要依 赖设备运行或者设备中的某些 app而运行等。 电子设备例如可以具有显示屏并支持信息 浏览等, 如可以是个人移动终端如手机、 平板电脑、 个人计算机等。
[29]服务端 202可以包括提供各种服务的服务器, 例如对客户端 201发送的请求进行处 理的服务器、 对模型进行训练的服务器等。 需要说明的是, 服务端可以实现成多个服务 器组成的分布式服务器集群, 也可以实现成单个服务器。 服务器也可以为分布式系统的 服务器, 或者是结合了区块链的服务器。 服务器也可以是云服务器, 或者是带人工智能 技术的智能云计算服务器或智能云主机。
[30]需要说明的是, 本公开实施例中可能会涉及到对用户数据的使用, 在实际应用中, 可以在符合所在国的适用法律法规要求的情况下(例如, 用户明确同意, 对用户切实通 知,等),在适用法律法规允许的范围内在本文描述的方案中使用用户特定的个人数据。
[31]需要说明的是, 本公开所涉及的用户信息(包括但不限于用户设备信息、 用户个人 信息等)和数据(包括但不限于用于分析的数据、 存储的数据、 展示的数据等) , 均为 经用户授权或者经过各方充分授权的信息和数据, 并且相关数据的收集、使用和处理需 要遵守相关国家和地区的相关法律法规和标准, 并提供有相应的操作入口, 供用户选择 授权或者拒绝。
[32]需要说明的是, 本公开实施例的技术方案适用于网络虚拟环境中, 所描述的用户一 般是指 “虚拟用户” , 真实用户可以通过注册方式在服务端中注册用户账号, 以获得在 网络环境中的用户身份。
[33]图 3为本公开实施例提供的一种存储方法一个实施例的流程图, 本实施例的技术方 案可以由服务端执行, 该方法可以包括以下几个步骤。
[34] 301:确定第一内存划分出的多个虚拟分组以及多个虚拟分组分别对应的多个数据块。
[35]在实际应用中, 服务端可以部署在计算设备中, 计算设备中可以包括多个处理器, 该多个处理器例如包括 GPU ( graphics processing unit, 图形处理器) 、 CPU( central processing unit, 计算机处理器)等。 为了提高运算效率, 本实施例的技术方案可以是由 GPU 执行等, 第一内存可以为 GPU的显存。
[36]服务端可以预先将第一内存划分为多个虚拟分组以及多个虚拟分组分别对应的多个 数据块。 如图 4所示, 示出了一种虚拟分组及数据块的划分示意图。
[37]其中, 虚拟分组的大小和数量, 以及数据块的大小和数量可以根据实际需求进行设 置, 也可以有其他的确定方式, 将在后续实施例进行说明。
[38] 302:针对模型处理的目标请求待存储的目标键值向量,查找目标请求最近分配的第 一数据块, 第一数据块位于第一虚拟分组中。
[39]可选的, 本公开实施例中所涉及的模型可以实现为大模型(Large Model, 也称基础 模型, 即 Foundation Model) , 大模型是指具有大量参数和复杂结构的机器学习模型, 能够处理海量数据,完成各种复杂的任务,如自然语言处理、计算机视觉、语音识别等, 是一种 AI( Artificial Intelligence,人工智能)模型。大模型可以采用大语言模型(英文: Large Language Model ,简称: LLM)或者多模态大模型(英文: Multimodal Large Model, 简称: MLM) 实现等。 本公开对此不进行限定。
[40]实际应用中, 模型可以处理一个或多个请求。 针对任一请求, 都可以按照本公开实 施例的方案来进行键值向量的存储, 目标请求也即是指任一个请求, 目标键值向量可以 指任一个键值向量。其中,请求中可以包括初始输入数据,也即 prompt(提示词) , prompt 是一种粉入形式, 可以包括希望模型执行的特定任务或指令, 用来提示或引导模型给出 符合预期的输出, 指示模型在执行特定任务时应该采取什么行动或生成什么输出。
[41]目标键值向量可以是在预填充阶段将 prompt进行切分获得的任一个文本单元计算 获得的键值向量, 当然, 也可以是解码阶段每个时间步所输出的任一个文本单元计算获 得的键值向量。 模型推理流程主要可以分为两个阶段: 预填充阶段(也即基于 prompt 生成第一个文本单元的阶段)以及解码阶段(生成第二个文本单元及后续文本单元的阶 段) 。 本公开实施例中的文本单元例如可以是指 token(指模型能够处理的最小单元, 可以是词或字符等) 。
[42]针对目标请求待处理的目标键值向量, 可以查找目标请求最近分配的数据块, 为了 便于描述, 可以称为第一数据块, 第一数据块位于第一虚拟分组中。 其中, 目标请求最 近分配的第一数据块可以指上一时间步为目标请求分配的第一数据块, 即存储上一时间 步中目标请求待存储的键值向量的第一数据块。
[43]可以理解的是, 在存在目标请求最近分配的第一数据块的情况下, 也即是上一时间 步为目标请求分配第一数据块的情况下, 可以执行上述查找第一数据块的操作, 而在不 存在目标请求最近分配的第一数据块的情况下, 如当前时间步为初始时间步的情况下, 可以执行为目标请求分配第一数据块的操作。
[44]因此, 可选的, 针对模型处理的目标请求待存储的目标键值向量, 查找目标请求最 近分配的第一数据块可以包括: 针对目标请求待存储的目标键值向量, 在目标键值向量 为预填充阶段基于目标请求中所包括文本单元而生成的情况下,为目标请求分配至少一 个虚拟分组中的数据块, 并将目标键值向量依次存储至至少一个虚拟分组中的数据块中 ; 在目标键值向量为解码阶段基于任意时间步产出的文本单元而生成的情况下,查找目标 请求最近分配的第一数据块。
[45]其中, 在预填充阶段, 目标键值向量基于目标请求中所包括文本单元而生成, 也即 是当前时间步为初始时间步, 在此之前并未为目标请求分配数据块。 此时, 可以为该目 标请求分配至少一个虚拟分组中的数据块,并将目标键值向量依次存储至至少一个虚拟 分组中的数据块中, 可以有多种实现方式。
[46]作为一种可选的实现方式, 可以从第一内存中随机选择至少一个虚拟分组中的数据 块, 分配至该目标请求。
[47]作为另一种可选的实现方式, 可以优先判断第一内存中是否存在空闲虚拟分组。 其 中, 空闲虚拟分组可以表明该虚拟分组中的数据块未分配给任何请求, 也未存储有任何 请求的键值向量。 若判断结果为是, 可以将空闲虚拟分组中的至少一个数据块, 或者至 少一个空闲虚拟分组中的数据块分配至目标请求,从而将目标键值向量依次存储至分配 的数据块中。若判断结果为否,可以将存在空闲数据块的虚拟分组中的至少一个数据块, 或者至少一个存在空闲数据块的虚拟分组中的数据块分配至该目标请求。
[48]通过在初始时间步优先选择空闲虚拟分组中的数据块分配给该目标请求, 极大程度 地降低了与其它请求的键值向量共同在同一虚拟分组的数据块中的交叉存储,提高了键 值向量存储的连续性, 进而提高了访存效率。
[49]在预填充阶段之后的解码阶段, 目标键值向量基于任意时间步产出的文本单元而生 成, 也即是当前时间步为初始时间步之后的任意时间步, 在上一时间步已经为目标请求 分配了数据块。 此时, 可以查找目标请求最近分配的第一数据块。
[50] 303: 检测第一数据块是否满足存储要求。 若第一数据块满足存储要求, 执行步骤 304的操作, 否则, 执行步骤 305的操作。
[51]该存储要求例如可以包括第一数据块存在存储空间, 或者第一数据块未达到存储容 量阈值等等, 可以根据实际需求进行设置。 [52] 304: 将目标键值向量存储至第一数据块中。
[53]当第一数据块满足存储要求时, 可以将目标键值向量存储在第一数据块中, 从而实 现键值向量在数据块中的连续存储。
[54] 305: 检测第一数据块相邻的第二数据块是否空闲。 若第二数据块空闲, 执行步骤 306的操作, 若第二数据块已分配, 执行步骤 307的操作。
[55]当第一数据块不满足存储要求时,无法将目标键值向量存储在第一数据块中,此时, 可以检测与第一数据块相邻的下一个数据块, 为了便于描述, 可以称为第二数据块, 是 否空闲。
[56]其中, 空闲数据块可以表明该数据块未分配给任何请求, 也未存储有任何请求的键 值向量。
[57] 306: 将第二数据块分配给目标请求, 及将目标键值向量存储至第二数据块中。
[58]当第二数据块空闲时, 可以将该第二数据块分配给该目标请求, 并将目标键值向量 存储在第二数据块中。
[59] 307:寻找第一个数据块空闲的第二虚拟分组,并将第二虚拟分组的第一个数据块分 配给目标请求, 及将目标键值向量存储至第二虚拟分组的第一个数据块中。
[60]当第二数据块已分配时, 表明该第二数据块已分配至其它请求, 此时, 为了降低不 同请求的键值向量在空间中的交叉存储, 可以寻找第一个数据块空闲的第二虚拟分组, 并将第二虚拟分组中的第一个数据块分配给该目标请求,以及将目标键值向量存储在该 第二虚拟分组的第一个数据块中。
[61]实际应用中, 在将目标请求待存储的目标键值向量存储在数据块中之后, 还可以将 目标键值向量的存储信息记录在块表中。
[62]其中, 目标键值向量的存储信息可以包括存储的数据块的标识信息、 数据块所在的 虚拟分组的标识信息、 以及对应的目标请求的标识信息等等。 块表中的记录信息可以包 括各目标请求所对应的虚拟分组的标识信息、 虚拟分组中数据块的标识信息、 以及数据 块中存储的文本单元数量等等。
[63]可选的, 可以才艮据块表中的记录信息, 来确定目标请求最近分配的第一数据块, 以 及进行第一数据块是否满足存储要求, 第二数据块是否空闲的判断, 提高判断效率。
[64]本实施例中, 可以确定第一内存划分出的多个虚拟分组以及多个虚拟分组分别对应 的多个数据块, 针对模型处理的目标请求待存储的目标键值向量, 可以查找该目标请求 最近分配的第一数据块, 其中, 该第一数据块位于第一虚拟分组中。 在第一数据块满足 存储要求的情况下, 可以将目标键值向量存储在第一数据块中; 在第一数据块未满足存 储要求且第一数据块相邻的第二数据块空闲的情况下,可以将第二数据块分配给该目标 请求, 并将目标键值向量存储在第二数据块中; 在第一数据块未满足存储要求且第二数 据块已分配的情况下, 可以寻找第一个数据块空闲的第二虚拟分组, 并将第二虚拟分组 的第一个数据块分配给该目标请求, 以及将目标键值向量存储在该第二虚拟分组的第一 个数据块中。 通过划分多个虚拟分组, 在目标请求最近分配的第一虚拟分组中的第一数 据块不满足存储要求, 且与之相邻的第二数据块也已经分配给其它目标请求的情况下, 寻找第一个数据块空闲的第二虚拟分组并将其分配给目标请求来进行目标键值向量的 存储, 保证同一虚拟分组中尽量存储同一请求的键值向量, 降低了不同请求的键值向量 在物理空间上的交叉存储, 由此提高了键值向量存储的连续性, 进而提高了访存效率。
[65]下面对虚拟分组以及数据块的预划分过程进行说明。
[66]在一些实施例中, 上述方法可以包括: 将虚拟分组大小、 虚拟分组数量、 数据块大 小、 数据块数量及最大请求处理数量作为模型对应的多个超参数; 寻找多个超参数的候 选参数值组合; 利用测试样本, 对按照候选参数值组合设置的模型进行模型评估, 并在 模型评估结果满足性能要求的情况下, 将候选参数值组合作为目标参数值组合; 按照目 标参数值组合中所确定的目标虚拟分组大小、 目标虚拟分组数量、 目标数据块大小、 目 标数据块数量,将第一内存划分为多个虚拟分组以及多个虚拟分组分别对应的多个数据 块。
[67]其中, 最大请求处理数量可以指模型能够同时处理的目标请求的数量, 当接收到的 请求数量超出该最大请求处理数量时, 可以将超出数量的请求放入请求池等待处理。
[68]具体的, 在寻找多个超参数的候选参数值组合时, 可以优先才艮据实际应用场景预先 设置模型能够处理的最大文本单元数量。 为了提高最大文本单元数量设置的合理性, 可 以根据实际应用场景设置在满负载运行时第一内存的利用率, 例如可以设置为 95%, 将 第一内存的大小与该第一内存的利用率进行乘积计算, 可以获得可用的第一内存大小, 该最大文本单元数量不超过该可用的第一内存大小, 该文本单元数量例如可以设置为 1024等等。
[69]进一步的, 将虚拟分组大小与虚拟分组数量进行乘积计算, 获得的计算结果可以与 该最大文本单元处理数量一致, 以及将数据块大小与数据块数量进行乘积计算, 获得的 计算结果也可以与该最大文本单元处理数量一致, 以及可以获取多个历史请求, 将最大 请求处理数量与历史请求的平均数量进行乘积计算,获得的计算结果也可以与最大请求 处理数量一致, 由此可以获得多个超参数的候选参数值组合。
[70]之后, 利用测试样本, 对按照候选参数值组合设置的模型进行模型评估, 在模型评 估结果满足性能要求的情况下, 将候选参数值组合作为目标参数值组合, 并由此进行多 个虚拟分组及数据块的划分, 该数据块的大小例如可以设置为 16, 表明可以存储 16个 文本单元所对应的键值向量, 虚拟分组的大小例如可以设置为 8, 表明可以包括 8个数 据块等等。
[71]通过划分虚拟分组,实现数据块大小的合理设置,能够减少数据块内部的存储浪费, 进一步减少内存浪费, 并且能够在此基础上, 降低不同请求的键值向量在物理空间上的 交叉存储, 提高键值向量存储的连续性, 提高访存效率。
[72]可选的,利用测试样本,对按照候选参数值组合设置的模型进行模型评估可以包括: 将测试样本粉入按照候选参数值组合设置的模型, 获得预测结果; 根据预测结果与期望 结果的差异信息, 确定模型评估结果。
[73]通过进行超参数搜索, 确定虚拟分组及数据块的大小和数量, 来进行第一内存的划 分, 提高了虚拟分组及数据块设置的合理性, 进一步降低了第一内存的资源浪费。
[74]可选的, 可以将上述虚拟分组及数据块的划分信息记录在块表中。
[75]下面继续对分配阶段, 数据块的分配及键值向量的存储过程进行说明。
[76]可以理解的是, 实际应用中, 在寻找第一个数据块空闲的第二虚拟分组时, 当第二 虚拟分组的寻找结果不为空,也即是第一内存中存在第一个数据块空闲的第二虚拟分组 时, 可以将该第二虚拟分组的第一个数据块分配给该目标请求, 并将目标键值向量存储 在该第二虚拟分组的第一个数据块中。 其中, 第一内存中可能存在多个第一个数据块空 闲的第二虚拟分组, 可以从中任选一个第一个数据块空闲的第二虚拟分组来分配, 不进 行限制。
[77]当第二虚拟分组的寻找结果为空时, 表明第一内存中不存在第一个数据块空闲的第 二虚拟分组, 此时, 可以有多种实现方式。
[78]作为一种可选的实现方式, 可以将目标请求对应数据块中已存储的历史键值向量转 移至第二内存中, 并清空该目标请求对应数据块, 再将已清空的第三虚拟分组中的第一 个数据块分配给该目标请札并将目标键值向量存储至第三虚拟分组中的第一个数据块。 [79]其中,第二内存与第一内存对应不同处理器。可选的,第二内存可以为 CPU的内存。 当第一内存中不存在第一个数据块空闲的第二虚拟分组时, 可以将当前时间步之前, 第 一内存中已存储的该目标请求的历史键值向量全部转移至第二内存中,并清空对应的数 据块。 之后, 可以在清空的数据块中包括第一个数据块空闲的第三虚拟分组的情况下, 将该第三虚拟分组中的第一个数据块分配给该目标请求,并将目标键值向量存储在该第 三虚拟分组中的第一个数据块中, 以提高键值向量存储的连续性。
[80]通过在第一内存中不存在第一个数据块空闲的第二虚拟分组时, 将已存储的目标请 求的历史键值向量转移至第二内存进行存储,并清空对应的数据块以用于在当前时间步 及后续时间步继续存储键值向量, 能够在实现对目标键值向量存储的基础上, 确保键值 向量存储的连续性。
[81]可选的,还可以根据目标键值向量的存储信息,更新目标请求在块表中的记录信息。
[82]作为第一内存中不存在第一个数据块空闲的第二虚拟分组的另一种可选的实现方式, 可以随机选择空闲数据块分配给目标请求, 并将目标键值向量存储至空闲数据块中。
[83]通过随机选择空闲数据块, 能够实现目标键值向量在第一内存中的存储, 并且无需 将已存储的历史键值向量在不同内存之间进行转移, 避免造成资源消耗, 也提升了访存 效率。
[84]当然, 是在第一内存中存在空闲数据块的情况下, 随机选择空闲数据块分配给目标 请求。 可选的, 可以根据块表中的记录信息, 来确定是否存在第一个数据块空闲的第二 虚拟分组, 以及是否存在空闲数据块。
[85]或者, 还可以结合第一内存中数据块的使用情况, 来确定是否存在空闲数据块。 在 一些实施例中, 在第二虚拟分组的寻找结果为空的情况下, 随机选择空闲数据块分配给 目标请求, 并将目标键值向量存储至空闲数据块中可以包括: 在第二虚拟分组的寻找结 果为空且第一内存中的数据块满足使用条件的情况下, 随机选择空闲数据块分配给目标 请求, 并将目标键值向量存储至空闲数据块中。
[86]该使用条件例如可以包括第一内存中数据块的使用率低于使用率阈值, 该使用率阈 值例如可以为 99%, 可以根据实际需求进行设置。 其中, 使用率可以基于第一内存中已 分配的数据块数量与划分出的数据块数量的比值确定。 或者, 该使用条件还可以包括第 一内存中数据块的剩余率高于剩余率阈值, 该剩余率阈值例如可以为 1%。 剩余率可以 基于数值 1与第一内存中已分配数据块数量及划分出数据块数量的比值的差值确定。除 此之外, 还可以根据实际需求设置其它使用条件, 本公开对此不进行限制。
[87]当第一内存中不存在第一个数据块空闲的第二虚拟分组, 且第一内存中的数据块满 足使用条件时, 表明第一内存中存在空闲数据块, 此时可以随机选择空闲数据块分配给 该目标请求, 并将目标键值向量存储在该空闲数据块中。
[88]当第一内存中不存在第一个数据块空闲的第二虚拟分组, 且第一内存中的数据不满 足使用条件时, 表明第一内存中不存在空闲数据块, 第一内存中不存在存储该目标键值 向量的空间, 此时可以有多种实现方式。
[89]作为一种可选的实现方式, 可以将目标请求对应数据块中已存储的历史键值向量转 移至第二内存中, 并清空该目标请求对应数据块, 再将已清空的第三虚拟分组中的第一 个数据块分配给该目标请求,并将目标键值向量存储至第三虚拟分组中的第一个数据块。
[90]当第一内存中不存在存储该目标键值向量的空间时, 可以将当前时间步之前, 第一 内存中已存储的该目标请求的历史键值向量全部转移至第二内存中,并清空对应的数据 块。 之后, 可以随机选择清空的数据块分配给该目标请求, 并将目标键值向量存储至该 数据块中。
[91]或者, 可以优先判断清空的数据块中是否包括第一个数据块空闲的第三虚拟分组。 若判断结果为是, 可以将该第三虚拟分组中的第一个数据块分配给该目标请求, 并将目 标键值向量存储在该第三虚拟分组中的第一个数据块中,以提高键值向量存储的连续性。 若判断结果为否, 可以随机选择清空的数据块分配给该目标请求, 并将目标键值向量存 储在该数据块中。
[92]通过在第一内存中不存在该目标键值向量的存储空间时, 将已存储的目标请求的历 史键值向量转移至第二内存进行存储,并清空对应的数据块以用于在当前时间步及后续 时间步继续存储键值向量, 实现了对键值向量的存储。
[93]作为第一内存中不存在存储该目标键值向量的空间的另一种可选的实现方式, 可以 不存储目标键值向量,该目标键值向量用以在下一个时间步进行推理时根据其对应的文 本单元进行重新计算。
[94]通过不存储目标键值向量,无需将已存储的历史键值向量在不同内存之间进行转移, 避免造成资源消耗, 也提升了访存效率。
[95]此时, 对于当前时间步未进行存储的目标键值向量, 在下一个时间步无法直接从内 存中获取, 需要在下一个时间步进行推理时根据其对应的文本单元进行重新计算, 来实 现模型推理。 考虑到重新计算键值向量所带来的计算资源消耗, 以及对模型推理效率的 影响, 可以避免无限进行重新计算。
[96]因此, 在一些实施例中, 在第二虚拟分组的寻找结果为空且第一内存中的数据块未 满足使用条件的情况下, 不存储目标键值向量可以包括: 在第二虚拟分组的寻找结果为 空且第一内存中的数据块未满足使用条件的情况下,若重新计算文本单元数量小于预定 数值, 不存储目标键值向量。
[97]进一步的, 该方法还可以包括: 若重新计算文本单元数量达到预定数值, 将目标请 求对应数据块中已存储的历史键值向量转移至第二内存中,并清空目标请求对应数据块。 之后, 将已清空的第三虚拟分组中的第一个数据块分配给目标请求, 并将目标键值向量 存储至第三虚拟分组中的第一个数据块。
[98]该预定数值的设置, 可以用于平衡重新计算键值向量所带来的资源消耗与对模型推 理效率的影响, 以及在不同内存之间转移历史键值向量所带来的资源消耗与对访存效率 的影响, 例如可以设置为 4, 5等等, 可以根据实际应用场景进行确定。
[99]通过设置预定数值, 在第一内存中不存在第一个数据块空闲的第二虚拟分组, 数据 块也不满足使用条件, 重新计算文本单元数量也小于预定数值的情况下, 不存储该目标 键值向量, 以在下一个时间步进行推理时根据其对应的文本单元进行重新计算, 而在重 新计算文本单元数量达到预定数值的情况下,将目标请求对应数据块中已存储的历史键 值向量转移至第二内存中, 并清空目标请求对应数据块, 以及将已清空的第三虚拟分组 中的第一个数据块分配给目标请求,并将目标键值向量存储至第三虚拟分组中的第一个 数据块, 能够实现重新计算键值向量所带来的资源消耗与对模型推理效率的影响, 以及 在不同内存之间转移历史键值向量所带来的资源消耗与对访存效率的影响之间的平衡, 实现较佳程度的键值向量的存储、 计算、 访存、 以及模型推理效果。
[100]上述一个或多个实施例给出了针对键值向量的存储方法, 下面对基于存储的键值 向量进行模型推理的过程进行说明。
[101]在一些实施例中, 上述方法还可以包括: 计算目标请求在上一个时间步生成的文 本单元所对应的目标键值向量;从第一内存和 /或第二内存中读取目标请求对应的历史键 值向量; 将目标键值向量与历史键值向量进行拼接生成当前时间步的输入向量; 利用模 型基于输入向量生成当前时间步对应的文本单元。
[102]具体的, 在当前时间步, 可以计算上一个时间步生成的文本单元所对应的目标键 值向量,并从存储有该目标请求对应的历史键值向量的第一内存和 /或第二内存中,读取 该历史键值向量,将读取的历史键值向量与当前时间步计算的目标键值向量进行拼接后, 获得当前时间步中模型的输入向量, 并将该输入向量输入模型, 推理获得当前时间步对 应的文本单元。
[103]可选的,从第 —内存和/或第二内存中读取目标请求对应的历史键值向量可以包括: 根据目标请求在块表中的记录消息,从第一内存和 /或第二内存中读取目标请求对应的历 史键值向量。
[104]上述过程给出了无需重新计算键值向量的模型推理过程, 根据前述实施例的内容 可知, 存在涉及重新计算键值向量的情况。 因此, 在一些实施例中, 上述方法还可以包 括: 判断是否存在重新计算的至少一个文本单元; 若是, 计算至少一个文本单元对应的 至少一个键值向量。
[105]此时, 将目标键值向量与历史键值向量进行拼接生成当前时间步的输入向量可以 包括: 将目标键值向量、 至少一个键值向量与历史键值向量进行拼接生成当前时间步的 输入向量。
[106]具体的, 在当前时间步, 判定存在重新计算的至少一个文本单元的情况下, 可以 计算至少一个文本单元对应的至少一个键值向量, 以及上一个时间步生成的文本单元所 对应的目标键值向量,并从存储有该目标请求对应的历史键值向量的第一内存和 /或第二 内存中, 读取该历史键值向量, 将读取的历史键值向量与当前时间步重新计算的至少一 个文本单元对应的至少一个键值向量,以及当前时间步计算的在上一个时间步生成的文 本单元所对应的目标键值向量进行拼接后, 获得当前时间步中模型的输入向量, 并将该 输入向量输入模型, 推理获得当前时间步对应的文本单元。
[107]为了便于理解, 在实际应用场景中, 图 5 示出了针对数据块进行分配以及键值向 量进行存储的流程示意图, 可以包括以下几个步骤。
[108] 500: 将第一内存预先划分出多个虚拟分组以及多个虚拟分组分别对应的多个数据 块, 并记录在块表中。
[109] 501: 初始时间步, 将第一内存中至少一个空闲虚拟分组的数据块分配给该目标请 求。
[110] 502: 初始时间步后的任一时间步, 按照如下步骤循环执行, 直至目标请求处理结 束。 [111] 5020: 查找目标请求最近分配的第一数据块, 第一数据块位于第一虚拟分组中。
[112] 5021 : 检测第一数据块是否满足存储要求。 若第一数据块满足存储要求, 执行步 骤 5022的操作, 否则, 执行步骤 5023的操作。
[113] 5022: 将目标键值向量存储至第一数据块中。
[114] 5023: 检测第一数据块相邻的第二数据块是否空闲。 若第二数据块空闲, 执行步 骤 5024的操作, 若第二数据块已分配, 执行步骤 5025的操作。
[115] 5024: 将第二数据块分配给目标请求, 及将目标键值向量存储至第二数据块中。
[116] 5025: 检测是否存在第一个数据块空闲的第二虚拟分组。 若存在, 执行步骤 5026 的操作, 否则, 执行步骤 5027的操作。
[117] 5026: 将第二虚拟分组的第一个数据块分配给目标请求, 及将目标键值向量存储 至第二虚拟分组的第一个数据块中。
[118] 5027: 检测数据块是否满足使用条件。 若满足, 执行步骤 5028的操作, 否则, 执 行步骤 5029的操作。
[119] 5028: 随机选择空闲数据块分配给目标请求, 及将目标键值向量存储至空闲数据 块中。
[120] 5029: 判断重新计算文本单元数量是否小于预定数值。 若小于, 执行步骤 5030的 操作, 否则, 执行步骤 5031的操作。
[121] 5030: 不存储目标键值向量。
[122] 5031 : 将目标请求对应数据块中已存储的历史键值向量转移至第二内存中, 清空 对应数据块, 将已清空的第三虚拟分组中的第一个数据块分配给目标请求, 并将目标键 值向量存储至第三虚拟分组中的第一个数据块。
[123]本实施例中,步骤 500-502, 以及 5020-5031的具体实施方式在图 3实施例中已有 相应描述, 此处不再进行赘述。
[124]本实施例中, 通过划分多个虚拟分组, 实现数据块大小的合理设置, 能够减少数 据块内部的存储浪费, 进一步减少内存浪费。 并且在此基础上, 在目标请求最近分配的 第一虚拟分组中的第一数据块不满足存储要求,且与之相邻的第二数据块也已经分配给 其它目标请求的情况下,寻找第一个数据块空闲的第二虚拟分组并将其分配给目标请求 来进行目标键值向量的存储, 保证同一虚拟分组中尽量存储同一请求的键值向量, 降低 了不同请求的键值向量在物理空间上的交叉存储, 由此提高了键值向量存储的连续性, 进而提高了访存效率, 进一步的, 通过设置预定数值, 在第一内存中不存在第一个数据 块空闲的第二虚拟分组, 数据块也不满足使用条件, 重新计算文本单元数量也小于预定 数值的情况下, 不存储该目标键值向量, 以在下一个时间步进行推理时根据其对应的文 本单元进行重新计算, 而在重新计算文本单元数量达到预定数值的情况下, 将目标请求 对应数据块中已存储的历史键值向量转移至第二内存中, 并清空目标请求对应数据块, 以及将已清空的第三虚拟分组中的第一个数据块分配给目标请求,并将目标键值向量存 储至第三虚拟分组中的第一个数据块,能够实现重新计算键值向量所带来的资源消耗与 对模型推理效率的影响, 以及在不同内存之间转移历史键值向量所带来的资源消耗与对 访存效率的影响之间的平衡, 实现较佳程度的键值向量的存储、 计算、 访存、 以及模型 推理效果。
[125]如图 6所示, 为本公开提供的一种存储装置一个实施例的结构示意图, 该装置可 以包括以下几个模块。
[126]第一确定模块 601 ,用于确定第一内存划分出的多个虚拟分组以及所述多个虚拟分 组分别对应的多个数据块 O
[127]查找模块 602, 用于针对模型处理的目标请求待存储的目标键值向量, 查找所述目 标请求最近分配的第一数据块; 所述第一数据块位于第一虚拟分组中。
[128]第一存储模块 603 ,在所述第一数据块满足存储要求的情况下, 用于将所述目标键 值向量存储至所述第一数据块中。
[129]第二存储模块 604,在所述第一数据块未满足存储要求且所述第一数据块相邻的第 二数据块空闲情况下, 用于将所述第二数据块分配给所述目标请求, 及将所述目标键值 向量存储至所述第二数据块中。
[130]第三存储模块 605,在所述第二数据块已分配情况下, 寻找第一个数据块空闲的第 二虚拟分组, 用于将所述第二虚拟分组的第一个数据块分配给所述目标请求, 及将所述 目标键值向量存储至所述第二虚拟分组的第一个数据块中。
[131]在一些实施例中, 查找模块 602可以包括: 分配单元, 针对目标请求待存储的目 标键值向量,在所述目标键值向量为预填充阶段基于所述目标请求中所包括文本单元而 生成的情况下, 用于为所述目标请求分配至少一个虚拟分组中的数据块, 并将所述目标 键值向量依次存储至所述至少一个虚拟分组中的数据块中; 查找单元, 在所述目标键值 向量为解码阶段基于任意时间步产出的文本单元而生成的情况下,用于查找所述目标请 求最近分配的第一数据块。
[132]在一些实施例中, 该装置还可以包括: 第四存储模块, 在所述第二虚拟分组的寻 找结果为空的情况下, 用于随机选择空闲数据块分配给所述目标请求, 并将所述目标键 值向量存储至所述空闲数据块中。
[133]在一些实施例中, 第四存储模块, 具体可以在所述第二虚拟分组的寻找结果为空 且所述第一内存中的数据块满足使用条件的情况下,用于随机选择空闲数据块分配给所 述目标请求, 并将所述目标键值向量存储至所述空闲数据块中。
[134]该装置还可以包括: 第二确定模块, 在所述第二虚拟分组的寻找结果为空且所述 第一内存中的数据块未满足使用条件的情况下, 用于不存储所述目标键值向量; 所述目 标键值向量用以在下一个时间步进行推理时根据其对应的文本单元进行重新计算。
[135]在一些实施例中, 第二确定模块, 具体可以在所述第二虚拟分组的寻找结果为空 且所述第一内存中的数据块未满足使用条件的情况下,若重新计算文本单元数量小于预 定数值, 用于不存储所述目标键值向量。
[136]该装置还可以包括: 转移模块, 若重新计算文本单元数量达到所述预定数值, 用 于将所述目标请求对应数据块中已存储的历史键值向量转移至第二内存中, 并清空所述 目标请求对应数据块; 所述第二内存与所述第一内存对应不同处理器; 第五存储模块, 用于将已清空的第三虚拟分组中的第一个数据块分配给所述目标请求,并将所述目标键 值向量存储至所述第三虚拟分组中的第一个数据块。
[137]在一些实施例中, 该装置还可以包括: 第三确定模块, 用于将虚拟分组大小、 数 据块大小、 数据块数量及最大请求处理数量作为模型对应的多个超参数; 寻找模块, 用 于寻找所述多个超参数的候选参数值组合; 评估模块, 用于利用测试样本, 对按照所述 候选参数值组合设置的所述模型进行模型评估,并在模型评估结果满足性能要求的情况 下, 将所述候选参数值组合作为目标参数值组合; 划分模块, 用于按照所述目标参数值 组合中所确定的目标虚拟分组大小、 目标数据块大小、 目标数据块数量, 将所述第一内 存划分为多个虚拟分组以及所述多个虚拟分组分别对应的多个数据块。
[138]在一些实施例中, 评估模块, 具体可以用于将测试样本输入按照所述候选参数值 组合设置的所述模型, 获得预测结果; 根据所述预测结果与期望结果的差异信息, 确定 模型评估结果。 [139]在一些实施例中, 该装置还可以包括: 更新模块, 用于方艮据所述目标键值向量的 存储信息, 更新所述目标请求在块表中的记录信息。
[140]在一些实施例中, 该装置还可以包括: 第一计算模块, 用于计算所述目标请求在 上一个时间步生成的文本单元所对应的所述目标键值向量; 读取模块, 用于从所述第一 内存和 /或第二内存中读取所述目标请求对应的历史键值向量; 第一生成模块,用于将所 述目标键值向量与所述历史键值向量进行拼接生成当前时间步的输入向量; 第二生成模 块, 用于利用所述模型基于所述输入向量生成当前时间步对应的文本单元。
[141]在一些实施例中, 读取模块, 具体可以用于根据所述目标请求在块表中的记录消 息, 从所述第一内存和 /或第二内存中读取所述目标请求对应的历史键值向量。
[142]在一些实施例中, 该装置还可以包括: 判断模块, 用于判断是否存在重新计算的 至少一个文本单元; 第二计算模块, 在判断模块结果为是的情况下, 用于计算所述至少 一个文本单元对应的至少一个键值向量; 第一生成模块, 具体可以用于将所述目标键值 向量、所述至少一个键值向量与所述历史键值向量进行拼接生成当前时间步的粉入向量。
[143]如图 7所示, 为本公开提供的一种计算设备一个实施例的结构示意图, 该设备可 以包括至少多个存储器及多个处理器;多个存储器提供第一内存 701以及第二内存 702, 第一内存以及第二内存可以用以存储键值向量。多个处理器可以包括第一处理器 703以 及第二处理器 704, 实际应用中, 第一处理器 703例如以为 GPU, 第一内存可以是 GPU 对应显存, 第二处理器 704例如可以是 CPU, 第二内存为 CPU对应内存。
[144]其中, 多个存储器存储一条或多条计算机程序指令供第一处理器 703调用执行, 以实现如图 3或图 5所示的存储方法。
[145]当然,上述计算设备必然还可以包括其他部件,例如输入 /输出接口、通信组件等。
[146]输入 /输出接口为处理组件和外围接口模块之间提供接口, 上述外围接口模块可以 是输出设备、 输入设备等。 通信组件被配置为便于计算设备和其他设备之间有线或无线 方式的通信等。
[147]需要说明的是, 上述计算设备可以为物理设备或者云计算平台提供的弹性计算主 机等。 其可以实现成多个服务器或终端设备组成的分布式集群, 也可以实现成单个服务 器或单个终端设备。
[148]上述一个或多个实施例中,处理器可以为一个或多个应用专用集成电路( ASIC)、 数字信号处理器(DSP)、 数字信号处理设备(DSPD)、 可编程逻辑器件(PLD)、 现 场可编程门阵列 (FPGA) 、 控制器、 微控制器、 微处理器或其他电子元件实现, 用于 执行上述方法。
[149]存储器被配置为存储各种类型的数据以支持在终端的操作。 存储器可以由任何类 型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器( SRAM) , 电可擦除可编程只读存储器(EEPROM) , 可擦除可编程只读存储器(EPROM) , 可 编程只读存储器(PROM) , 只读存储器(ROM) , 磁存储器, 快闪存储器, 磁盘或光 盘。
[150]显示器可以为电致发光(EL)元件、 液晶显示器或具有类似结构的微型显示器、 或者视网膜可直接显示或类似的激光扫描式显示器。
[151]本公开实施例还提供了一种计算机可读存储介质, 存储有计算机程序, 该计算机 程序被计算机执行时可以实现图 3或图 5所示的存储方法。该计算机可读介质可以是上 述实施例中描述的计算设备中所包含的; 也可以是单独存在, 而未装配入计算设备中。
[152]计算机可读存储介质例如可以是但不限于电、 磁、 光、 电磁、 红外线、 或半导体 的系统、 装置或器件, 或者任意以上的组合等。
[153]本公开实施例还提供了一种计算机程序产品, 其包括承载在计算机可读存储介质 上的计算机程序, 该计算机程序被计算机执行时可以实现图 3或图 5所示的存储方法。
[154]在这样的实施例中, 计算机程序可以是从网络上被下载和安装, 和/或从可拆卸介 质被安装。 在该计算机程序被处理器执行时, 执行本公开的系统中限定的各种功能。
[155]所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统, 装置和单元的具体工作过程, 可以参考前述方法实施例中的对应过程, 在此不再赘述。
[156]以上所描述的装置实施例仅仅是示意性的, 其中所述作为分离部件说明的单元可 以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单 元, 即可以位于一个地方, 或者也可以分布到多个网络单元上。 可以根据实际的需要选 择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出 创造性的劳动的情况下, 即可以理解并实施。
[157]通过以上的实施方式的描述, 本领域的技术人员可以清 ■楚地了解到各实施方式可 借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解, 上述技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出 来, 该计算机软件产品可以存储在计算机可读存储介质中, 如 ROM/RAM、 磁碟、 光盘 等, 包括若干指令用以使得一台计算机设备(可以是个人计算机, 服务器, 或者网络设 备等)执行冬个实施例或者实施例的某些部分所述的方法。
[158]最后应说明的是: 以上实施例仅用以说明本公开的技术方案, 而非对其限制; 尽 管参照前述实施例对本公开进行了详细的说明, 本领域的普通技术人员应当理解: 其依 然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同 替换; 而这些修改或者替换, 并不使相应技术方案的本质脱离本公开各实施例技术方案 的精神和范围。

Claims

权利要求书
1、 一种存储方法, 包括: 确定第一内存划分出的多个虚拟分组以及所述多个虚拟分组分别对应的多个数据 块; 针对模型处理的目标请求待存储的目标键值向量,查找所述目标请求最近分配的第 一数据块; 所述第一数据块位于第一虚拟分组中; 在所述第一数据块满足存储要求的情况下,将所述目标键值向量存储至所述第一数 据块中; 在所述第一数据块未满足存储要求且所述第一数据块相邻的第二数据块空闲情况 下, 将所述第二数据块分配给所述目标请求, 及将所述目标键值向量存储至所述第二数 据块中; 在所述第二数据块已分配情况下, 寻找第一个数据块空闲的第二虚拟分组, 并将所 述第二虚拟分组的第一个数据块分配给所述目标请求,及将所述目标键值向量存储至所 述第二虚拟分组的第一个数据块中。
2、 根据权利要求 1所述的方法, 其中, 所述针对模型处理的目标请求待存储的目 标键值向量, 查找所述目标请求最近分配的第一数据块包括: 针对目标请求待存储的目标键值向量,在所述目标键值向量为预填充阶段基于所述 目标请求中所包括文本单元而生成的情况下,为所述目标请求分配至少一个虚拟分组中 的数据块, 并将所述目标键值向量依次存储至所述至少一个虚拟分组中的数据块中; 在所述目标键值向量为解码阶段基于任意时间步产出的文本单元而生成的情况下, 查找所述目标请求最近分配的第一数据块。
3、 根据权利要求 1所述的方法, 还包括: 在所述第二虚拟分组的寻找结果为空的情况下,随机选择空闲数据块分配给所述目 标请求, 并将所述目标键值向量存储至所述空闲数据块中。
4、 根据权利要求 3所述的方法, 其中, 所述在所述第二虚拟分组的寻找结果为空 的情况下, 随机选择空闲数据块分配给所述目标请求, 并将所述目标键值向量存储至所 述空闲数据块中包括: 在所述第二虚拟分组的寻找结果为空且所述第一内存中的数据块满足使用条件的 情况下, 随机选择空闲数据块分配给所述目标请求, 并将所述目标键值向量存储至所述 空闲数据块中; 所述方法还包括: 在所述第二虚拟分组的寻找结果为空且所述第一内存中的数据块未满足使用条件 的情况下, 不存储所述目标键值向量; 所述目标键值向量用以在下一个时间步进行推理 时根据其对应的文本单元进行重新计算。
5、 根据权利要求 4所述的方法, 其中, 所述在所述第二虚拟分组的寻找结果为空 且所述第一内存中的数据块未满足使用条件的情况下, 不存储所述目标键值向量包括: 在所述第二虚拟分组的寻找结果为空且所述第一内存中的数据块未满足使用条件 的情况下, 若重新计算文本单元数量小于预定数值, 不存储所述目标键值向量; 所述方法还包括: 若重新计算文本单元数量达到所述预定数值,将所述目标请求对应数据块中已存储 的历史键值向量转移至第二内存中, 并清空所述目标请求对应数据块; 所述第二内存与 所述第一内存对应不同处理器; 将已清空的第三虚拟分组中的第一个数据块分配给所述目标请求,并将所述目标键 值向量存储至所述第三虚拟分组中的第一个数据块。
6、 根据权利要求 1所述的方法, 还包括: 将虚拟分组大小、 数据块大小、数据块数量及最大请求处理数量作为模型对应的多 个超参数; 寻找所述多个超参数的候选参数值组合; 利用测试样本, 对按照所述候选参数值组合设置的所述模型进行模型评估, 并在模 型评估结果满足性能要求的情况下, 将所述候选参数值组合作为目标参数值组合; 按照所述目标参数值组合中所确定的目标虚拟分组大小、 目标数据块大小、 目标数 据块数量,将所述第一内存划分为多个虚拟分组以及所述多个虚拟分组分别对应的多个 数据块。
7、 根据权利要求 6所述的方法, 其中, 所述利用测试样本, 对按照所述候选参数 值组合设置的所述模型进行模型评估包括: 将测试样本输入按照所述候选参数值组合设置的所述模型, 获得预测结果; 根据所述预测结果与期望结果的差异信息, 确定模型评估结果。
8、 根据权利要求 5所述的方法, 还包括: 根据所述目标键值向量的存储信息, 更新所述目标请求在块表中的记录信息。
9、 根据权利要求 5所述的方法, 还包括: 计算所述目标请求在上一个时间步生成的文本单元所对应的所述目标键值向量; 从所述第一内存和 /或第二内存中读取所述目标请求对应的历史键值向量; 将所述目标键值向量与所述历史键值向量进行拼接生成当前时间步的输入向量; 利用所述模型基于所述输入向量生成当前时间步对应的文本单元。
10、根据权利要求 9所述的方法, 其中, 所述从所述第一内存和 /或第二内存中读取 所述目标请求对应的历史键值向量包括: 根据所述目标请求在块表中的记录消息 ,从所述第一内存和 /或第二内存中读取所述 目标请求对应的历史键值向量。
11、 根据权利要求 9所述的方法, 还包括: 判断是否存在重新计算的至少一个文本单元; 若是, 计算所述至少一个文本单元对应的至少一个键值向量; 所述将所述目标键值向量与所述历史键值向量进行拼接生成当前时间步的输入向 量包括: 将所述目标键值向量、所述至少一个键值向量与所述历史键值向量进行拼接生成当 前时间步的输入向量。
12、 一种计算设备, 包括多个存储器及多个处理器; 其中, 所述多个存储器提供第 一内存以及第二内存; 所述第一内存以及所述第二内存用以存储键值向量; 其中, 所述多个存储器存储一条或多条计算机程序指令供第一处理器调用执行, 以 实现如权利要求 1~11任一项所述的存储方法。
13、 一种计算机可读存储介质, 存储有计算机程序, 其中, 所述计算机程序被计算 机执行以实现如权利要求 1~11任一项所述的存储方法。
14、 一种计算机程序产品, 存储有计算机程序, 其中, 所述计算机程序被计算机执 行以实现如权利要求 1~ 11任一项所述的存储方法。
PCT/IB2025/050597 2024-02-26 2025-01-21 存储方法、设备、存储介质及程序产品 Pending WO2025181574A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202410211951.7 2024-02-26
CN202410211951.7A CN120540578A (zh) 2024-02-26 2024-02-26 存储方法、设备、存储介质及程序产品

Publications (1)

Publication Number Publication Date
WO2025181574A1 true WO2025181574A1 (zh) 2025-09-04

Family

ID=96788182

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/IB2025/050597 Pending WO2025181574A1 (zh) 2024-02-26 2025-01-21 存储方法、设备、存储介质及程序产品

Country Status (2)

Country Link
CN (1) CN120540578A (zh)
WO (1) WO2025181574A1 (zh)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117472591A (zh) * 2023-12-27 2024-01-30 北京壁仞科技开发有限公司 用于数据计算的方法、电子设备和存储介质
CN118466837A (zh) * 2024-05-13 2024-08-09 北京苹芯科技有限公司 一种用于缓存键值向量对的方法及芯片

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117472591A (zh) * 2023-12-27 2024-01-30 北京壁仞科技开发有限公司 用于数据计算的方法、电子设备和存储介质
CN118466837A (zh) * 2024-05-13 2024-08-09 北京苹芯科技有限公司 一种用于缓存键值向量对的方法及芯片

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KWON W. ET AL.: "Efficient Memory Management for Large Language Model Serving with PagedAttention", SOSP '23: PROCEEDINGS OF THE 29TH SYMPOSIUM ON OPERATING SYSTEMS PRINCIPLES, 23 October 2023 (2023-10-23), pages 611 - 626, XP059423991, [retrieved on 20250506], DOI: 10.1145/3600006.3613165 *
LIN BIN, ZHANG CHEN, PENG TAO, ZHAO HANYU, XIAO WENCONG, SUN MINMIN, LIU ANMIN, ZHANG ZHIPENG, LI LANBO, QIU XIAFEI, SHEN LI, JI Z: "Infinite-LLM: Efficient LLM Service for Long Context with DistAttention and Distributed KVCache", ARXIV:2401.02669V1, CORNELL UNIVERSITY LIBRARY, ARXIV.ORG, 5 January 2024 (2024-01-05), XP093352124, Retrieved from the Internet <URL:https://arxiv.org/abs/2401.02669v1> DOI: 10.48550/arXiv.2401.02669 *

Also Published As

Publication number Publication date
CN120540578A (zh) 2025-08-26

Similar Documents

Publication Publication Date Title
JP6876806B2 (ja) ブロックチェーンコンセンサス形成の方法およびデバイス
CN108595268B (zh) 一种基于MapReduce的数据分配方法、装置及计算机可读存储介质
CN111901249A (zh) 业务限流方法、装置、设备及存储介质
EP3652691A1 (en) Method, apparatus, and electronic device for processing consensus requests in a blockchain consensus network
CN111723112B (zh) 数据任务执行方法、装置、电子设备及存储介质
CN113419792A (zh) 一种事件处理方法、装置、终端设备和存储介质
CN112347394A (zh) 网页信息的获取方法、装置、计算机设备和存储介质
WO2020263418A1 (en) Managing workloads of a deep neural network processor
CN111309805B (zh) 数据库的数据读写方法及装置
CN114490039A (zh) Cpu负载均衡的网卡流量二次分派方法、系统、设备及介质
CN111985634B (zh) 神经网络的运算方法、装置、计算机设备及存储介质
WO2016101748A1 (zh) 一种网络连接的缓存方法和装置
CN115080143B (zh) 页面资源预加载方法、装置、设备及存储介质
CN118034822A (zh) 页面处理方法、装置、设备和存储介质
CN120218241A (zh) 大语言模型的推理方法、装置、电子设备及介质
CN118885488A (zh) 基于哈希表的多层嵌入表更新方法、装置、设备及介质
CN118796801A (zh) 数据迁移方法、装置及电子设备
CN120540578A (zh) 存储方法、设备、存储介质及程序产品
CN111988195B (zh) 用于分组测试的应答方案确定方法、装置、设备及介质
CN120216102B (zh) 微服务优化方法、装置、介质和电子设备
CN111737298A (zh) 基于分布式存储的缓存数据管控方法及装置
CN116303666B (zh) 数据查询方法、装置和分布式数据管理系统
CN117395239B (zh) 基于区块链智能合约的web服务选择方法、设备及介质
CN105468603A (zh) 数据选择方法及装置
CN114385628B (zh) 数据处理方法和装置、电子设备、存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 25761757

Country of ref document: EP

Kind code of ref document: A1