Inference service request processing method, electronic device, and computer-readable storage medium
By optimizing the key-value caching scheme through a pre-defined multi-level caching architecture and dynamic caching strategies, the problem of low inference performance in traditional schemes is solved, achieving more efficient inference service response and resource utilization.
Patent Information
- Application Number
- CN202510653181.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-20
- Publication Date
- 2026-11-20
AI Technical Summary
Existing key-value caching solutions have shortcomings in improving inference performance, particularly in terms of limitations of single-level caching, poor adaptability to hardware environments, low cache access efficiency, and lack of dynamic adjustment and optimization mechanisms, resulting in poor inference performance.
It adopts a pre-defined multi-level caching architecture, stores multiple vocabularies in a hierarchical manner according to the target cache configuration parameters, and utilizes the combined capabilities of GPU memory, CPU memory, local disk and remote storage, combined with the configuration controller to dynamically adjust the caching strategy, thereby optimizing cache access and management.
It significantly improves the performance and accuracy of inference services, shortens response time, increases memory utilization, and adapts to changes in different hardware environments, thereby enhancing the system's flexibility and portability.
Smart Images

Figure CN123138142A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of cloud computing, artificial intelligence, and large model technology. Specifically, it relates to a reasoning service request processing method, an electronic device, and a computer-readable storage medium. Background Technology
[0002] With the continuous advancement of artificial intelligence technology, large-scale pre-trained language models (LLMs) have become a key driving force for innovation in many industries. The construction of LLM inference services is generally accomplished using large model inference engines. Mainstream LLM inference services can be divided into two stages: the prefill stage and the decoding stage. The prefill stage processes user input, calculates the corresponding key-value (KV) pairs, and caches them in the key-value cache (KV cache), making it a computationally intensive task. The decoding stage generates output tokens step-by-step, retrieving the KV values corresponding to the preceding tokens from the KV cache for calculation each time, making it a memory-intensive task.
[0003] Currently, proposed KV Cache caching schemes focus on providing KV Cache sharing capabilities across request and inference engine instances, but they have significant shortcomings in improving inference performance.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This application provides an inference service request processing method, an electronic device, and a computer-readable storage medium to at least solve the technical problem of low inference performance in key-value caching schemes in related technologies.
[0006] According to one aspect of the embodiments of this application, a method for processing inference service requests is provided, comprising: obtaining an inference service request; determining key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture, wherein the preset multi-level caching architecture stores key-value caches corresponding to multiple lexical units hierarchically according to target cache configuration parameters, and the multiple lexical units are determined based on the inference service request; generating and predicting lexical data corresponding to the inference service request based on the key-value cache content; and generating an inference service response corresponding to the inference service request using the lexical data.
[0007] According to another aspect of the embodiments of this application, an inference service request processing method is also provided, including: obtaining initial cache configuration parameters; adjusting the initial cache configuration parameters according to the hardware environment of the inference server to obtain target cache configuration parameters; and transmitting the target cache configuration parameters to the inference server; wherein the inference server is used to determine the key-value cache content corresponding to the inference service request based on a preset multi-level cache architecture, generate and predict the terminology data corresponding to the inference service request based on the key-value cache content, and generate an inference service response corresponding to the inference service request using the terminology data, wherein the preset multi-level cache architecture stores the key-value cache corresponding to multiple terms hierarchically according to the target cache configuration parameters, and the multiple terms are determined according to the inference service request.
[0008] According to another aspect of the embodiments of this application, an inference service request processing method is also provided, comprising: obtaining an inference service request through a first application programming interface; and returning an inference service response through a second application programming interface; wherein the inference service response is generated in accordance with the above-described inference service request processing method.
[0009] According to another aspect of the embodiments of this application, an inference service request processing method is also provided, including: obtaining a currently input inference service request; responding to the inference service request and returning an inference service response; displaying the inference service response in a graphical user interface; wherein the inference service response is generated according to the above-described inference service request processing method.
[0010] According to another aspect of the embodiments of this application, an inference service request processing method is also provided, including: displaying an inference service request on the operation interface in response to an input instruction applied to the operation interface; and displaying an inference service response on the operation interface in response to a processing instruction applied to the operation interface; wherein the inference service response is generated according to the above-described inference service request processing method.
[0011] According to another aspect of the embodiments of this application, an inference service request processing system is also provided, including: a client for sending an inference service request; a server connected to the client for determining the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture, generating and predicting the lexical metadata corresponding to the inference service request based on the key-value cache content, and generating an inference service response corresponding to the inference service request using the lexical metadata, wherein the preset multi-level caching architecture stores the key-value cache corresponding to multiple lexicals hierarchically according to the target cache configuration parameters, and the multiple lexicals are determined according to the inference service request; the client is also used to output the inference service response.
[0012] According to another aspect of the embodiments of this application, an inference service request processing system is also provided, including: a configuration controller, configured to obtain initial cache configuration parameters, adjust the initial cache configuration parameters according to the hardware environment of the inference server to obtain target cache configuration parameters, and transmit the target cache configuration parameters to the inference server; and an inference server, configured to determine the key-value cache content corresponding to the inference service request based on a preset multi-level cache architecture, generate and predict the terminology data corresponding to the inference service request based on the key-value cache content, and generate the inference service response corresponding to the inference service request using the terminology data, wherein the preset multi-level cache architecture stores the key-value cache corresponding to multiple terms hierarchically according to the target cache configuration parameters, and the multiple terms are determined according to the inference service request.
[0013] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory storing an executable program; and a processor connected to the memory via a bus for running the program, wherein the program executes any of the above-described inference service request processing methods during runtime.
[0014] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored executable program, wherein, when the executable program is running, it controls the device where the computer-readable storage medium is located to execute any of the above-described inference service request processing methods.
[0015] According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements any of the above-described inference service request processing methods.
[0016] In this embodiment, an inference service request is obtained, and then the key-value cache content corresponding to the inference service request is determined based on a preset multi-level caching architecture. The preset multi-level caching architecture stores the key-value cache corresponding to multiple terms hierarchically according to the target cache configuration parameters. The multiple terms are determined based on the inference service request. Then, the term data corresponding to the inference service request is generated and predicted based on the key-value cache content. Finally, the inference service response corresponding to the inference service request is generated using the term data. This achieves the goal of effectively improving the inference performance of the inference service system, thereby shortening the inference response time, improving the inference service performance and inference accuracy, and improving the utilization of video memory. This solves the technical problem of low inference performance of key-value caching schemes in related technologies.
[0017] It is worth noting that the general description above and the detailed description that follow are merely for illustrative purposes and do not constitute a limitation on this application. Attached Figure Description
[0018] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0019] Figure 1 This is a schematic diagram illustrating an application scenario of a reasoning service request processing method according to an embodiment of this application;
[0020] Figure 2 This is a flowchart of a reasoning service request processing method according to an embodiment of this application;
[0021] Figure 3 This is a schematic diagram of the architecture of an adaptive multi-level key-value cache management system according to an embodiment of this application;
[0022] Figure 4 This is a flowchart illustrating the distribution and application of cache configuration in an adaptive multi-level key-value cache management system according to an embodiment of this application;
[0023] Figure 5 This is a flowchart of the inference service request processing according to an embodiment of this application;
[0024] Figure 6 This is a flowchart of a reasoning service request processing method according to an embodiment of this application;
[0025] Figure 7 This is a flowchart of a reasoning service request processing method according to an embodiment of this application;
[0026] Figure 8 This is a flowchart of a reasoning service request processing method according to an embodiment of this application;
[0027] Figure 9 This is a flowchart of a reasoning service request processing method according to an embodiment of this application;
[0028] Figure 10 This is a schematic diagram of the structure of a reasoning service request processing system according to an embodiment of this application;
[0029] Figure 11 This is a schematic diagram of the structure of another inference service request processing system according to an embodiment of this application;
[0030] Figure 12 This is a schematic diagram of the structure of a reasoning service request processing device according to an embodiment of this application;
[0031] Figure 13 This is a schematic diagram of another inference service request processing device according to an embodiment of this application;
[0032] Figure 14This is a schematic diagram of another inference service request processing device according to an embodiment of this application;
[0033] Figure 15 This is a schematic diagram of another inference service request processing device according to an embodiment of this application;
[0034] Figure 16 This is a schematic diagram of another inference service request processing device according to an embodiment of this application;
[0035] Figure 17 This is a structural block diagram of a computing device according to an embodiment of this application;
[0036] Figure 18 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0037] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0038] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0039] The technical solution provided in this application is mainly implemented using large-scale model technology. Here, "large-scale model" refers to a deep learning model with a massive number of parameters, typically containing hundreds of millions, tens of billions, hundreds of billions, trillions, or even tens of trillions of parameters. Large-scale models can also be called foundation models. They are pre-trained using large-scale unlabeled corpora to produce pre-trained models with hundreds of millions of parameters. Such models can adapt to a wide range of downstream tasks and have good generalization ability, such as Large Language Models (LLMs) and multi-modal pre-training models.
[0040] It should be noted that, in practical applications, large models can be fine-tuned using a small number of samples to adapt them to different tasks. For example, large models can be widely applied in Natural Language Processing (NLP), computer vision, and speech processing. Specifically, they can be applied to computer vision tasks such as Visual Question Answering (VQA), Image Captioning (IC), and Image Generation, as well as NLP tasks such as text-based sentiment classification, text summarization, and machine translation. Therefore, the main application scenarios for large models include, but are not limited to, digital assistants, intelligent robots, search, online education, office software, e-commerce, and intelligent design. In this embodiment, the explanation focuses on the inference service provided by the inference server proposed in this application within a model inference service scenario.
[0041] First, some nouns or terms that appear in the description of the embodiments of this application shall be interpreted as follows:
[0042] Key-Value Cache (KV Cache): In large model inference, KV Cache is an optimization technique primarily used to accelerate the computation process of the self-attention mechanism. In self-attention computation, each input token is transformed into three vectors: query (Q), key (K), and value (V). During computation, each query vector is multiplied by all key vectors to obtain weights. These weights are then used to weight and sum the value vectors to produce the output. For long sequences, this process is very time-consuming because the dot product with the key vectors of all previous tokens needs to be recalculated each time a new token is generated.
[0043] To reduce redundant computation, a KV Cache is introduced. During sequence generation, whenever a new token is predicted and added to the sequence, its key and value vectors are stored in the cache. When the self-attention of the next token needs to be calculated, the existing key and value vectors in the cache can be reused instead of being recalculated. Thus, each time only the dot product of the query for the newly added token and all the keys in the cache needs to be calculated, significantly reducing the computational load.
[0044] Input / Output Parallelization (I / O Parallelization): In computer systems, I / O parallelization refers to the simultaneous execution of computation operations and input / output (I / O) operations. By overlapping the execution times of these two operations, hardware resource utilization is maximized, thereby reducing the overall task time. In deep learning scenarios, this typically manifests as computation and I / O. Computation refers to the Graphics Processing Unit (GPU) performing tensor operations (such as key-value cache generation), while I / O refers to the Central Processing Unit (CPU) or dedicated hardware performing data loading (such as reading data from memory / disk / remote storage).
[0045] With the widespread application of Large Language Models (LLMs) across various industries, their inference performance and throughput have become key challenges. For building LLM inference services, the industry generally uses large model inference engines, which are high-performance inference systems specifically designed for LLMs. These engines achieve high throughput and low latency for large model inference services through algorithm optimization and resource scheduling mechanisms. Inference engines can utilize technologies such as memory management, continuous batch processing of inference requests, and distributed workloads to improve the efficiency of large model inference services.
[0046] The current mainstream LLM inference process can be divided into two stages:
[0047] 1. Prefill stage: Process user input, calculate the corresponding key-value value and cache it in the KV cache. This is a computationally intensive task.
[0048] 2. Decoding stage: Output tokens are generated step by step. Each time, the KV value corresponding to the preceding word is retrieved from the KV Cache for calculation. This is a memory-intensive task.
[0049] Because the two phases of the task are different in nature, if the inference engine schedules a batch of inference requests in the same workload, it will cause mutual interference, affecting performance and throughput. To solve this problem, the industry has proposed a prefill-decode separation architecture (PD separation architecture), which deploys the two phases of the task on different computing nodes. By decoupling the two phases of the task at the physical resource level, the system throughput and performance can be further improved.
[0050] Currently, a Language Model Cache (LM Cache) has been proposed. LM Cache is a key-value (KV) cache solution for Virtual Large Language Model (vLLM) inference engines. It supports storing KV cache data across different requests via CPU memory, local disk, and remote dictionary servers (Redis). Furthermore, a platform focused on deploying, managing, and scaling LLM inference solutions has been proposed. By providing a distributed KV cache runtime environment, it helps multiple inference engine instances share the cache across multiple inference requests.
[0051] It can be seen that traditional KV Cache caching solutions focus on providing KVCache sharing capabilities across request and inference engine instances, without considering how to fully leverage multi-level caching architectures, including GPU memory, CPU memory, local disk, and remote storage, to maximize KV Cache caching capabilities and adapt to diverse hardware environments. Furthermore, they do not offer intelligent prefetching or other features to enhance KV cache access optimization within a multi-level KV Cache management system.
[0052] The KV Cache caching schemes proposed in related technologies have the following drawbacks.
[0053] Defect 1: Single-level cache limitations. Traditional key-value cache schemes are limited to a single level of storage (such as CPU memory) and do not fully consider the comprehensive use of multi-level cache architectures (including GPU memory, CPU memory, local disk, and remote storage). This limitation leads to a decrease in cache hit rate, especially when processing latency-sensitive high-throughput tasks, resulting in low memory utilization.
[0054] Defect 2: Poor hardware environment adaptability. Traditional KV Cache caching solutions are difficult to adapt to diverse hardware environments. In particular, when the hardware configuration of the inference server changes, the cache management strategy and storage mode may need to be manually adjusted, which places high demands on the operation and maintenance personnel and also reduces the system's flexibility and portability.
[0055] Defect 3: Low cache access efficiency. Traditional KV cache solutions do not provide intelligent prefetching or other capabilities to improve KV cache access optimization within a multi-level KV cache management system; in other words, they lack an efficient cache prefetching mechanism. This results in low cache access efficiency when processing long sequences or complex inference requests, failing to effectively utilize the advantages of each level of cache, increasing inference latency, and leading to low inference performance.
[0056] Defect 4: Lack of dynamic adjustment and optimization mechanisms. Traditional KV Cache management solutions do not support dynamic configuration adjustments and cache optimization based on real-time workload and hardware performance changes, which may lead to a decrease in system performance when faced with sudden peak traffic.
[0057] To address the aforementioned deficiencies, no effective solution has been proposed prior to this application.
[0058] According to an embodiment of this application, a reasoning service request processing method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0059] Considering the large number of model parameters in large models and the limited computing resources of mobile terminals, the method provided in this application embodiment can be applied to, for example, Figure 1 The application scenarios shown are not limited to these. In, for example... Figure 1 In the application scenario shown, the large model is deployed on server 10. Server 10 can connect to one or more client devices 20 via a local area network (LAN), wide area network (WAN), internet connection, or other types of data network. These client devices 20 may include, but are not limited to, smartphones, tablets, laptops, PDAs, personal computers, smart home devices, and in-vehicle devices. Client devices 20 can interact with users through a graphical user interface to access the large model, thereby implementing the method provided in this embodiment.
[0060] In this embodiment, the system consisting of a client device and a server can perform the following steps: the client device performs steps such as obtaining an inference service request and sending the inference service request to the server; the server performs steps such as determining the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture, wherein the preset multi-level caching architecture stores the key-value cache corresponding to multiple terms hierarchically according to the target cache configuration parameters, the multiple terms are determined according to the inference service request, then the key-value cache content is used to generate and predict the term data corresponding to the inference service request, and finally the term data is used to generate the inference service response corresponding to the inference service request and return the inference service response to the client device. It should be noted that, provided that the operating resources of the client device can meet the deployment and operation conditions of the large model, this embodiment can be performed on the client device.
[0061] It should be noted that with the rapid development of high-performance computing units, the methods provided in this application embodiment can also be applied to model-in-machine systems in other application scenarios. In one optional embodiment, the model-in-machine system has multiple built-in models, and users can select one model to adjust as needed to obtain their own model. The high-performance computing unit built into the model-in-machine system can then directly call the adjusted model to execute the methods provided in this application embodiment. In another optional embodiment, the large model-in-machine system has a pre-trained model built-in, and the high-performance computing unit built into the model-in-machine system can then directly call that model to execute the methods provided in this application embodiment.
[0062] Furthermore, when users need to train their own models, they can upload their own datasets via the client. These datasets are then sent to the server, allowing the server to adjust the pre-trained model using the dataset to obtain the user's customized model, which can then be deployed to the production environment. To facilitate users' model adjustment needs, the server provides complete adjustment tools, development frameworks, and processes, supporting multiple adjustment strategies. This allows the adjusted model to better adapt to different application domains and achieve a high degree of customization.
[0063] Under the aforementioned operating environment, this application provides the following: Figure 2 The inference service request processing method is shown. Figure 2 This is a flowchart of a reasoning service request processing method according to an embodiment of this application. Figure 2 As shown, the method may include the following steps:
[0064] Step S21: Obtain the inference service request;
[0065] Step S22: Determine the key-value cache content corresponding to the inference service request based on the preset multi-level caching architecture. The preset multi-level caching architecture stores the key-value cache corresponding to multiple words in a hierarchical manner according to the target cache configuration parameters. The multiple words are determined based on the inference service request.
[0066] Step S23: Generate and predict the term metadata corresponding to the inference service request based on the key-value cache content;
[0067] Step S24: Use the term data to generate the inference service response corresponding to the inference service request.
[0068] In this embodiment, an inference service request is first obtained. This inference service request can be understood as a request sent by a user to an inference service system (or inference server) for the purpose of processing tasks such as Natural Language Processing (NLP), image recognition, and predictive analysis. For example, the inference service request includes input data that needs to be inferred, such as text, images, or videos; this is not limited to these examples.
[0069] For example, the inference service request may originate from various application scenarios, such as product search queries in e-commerce services, content recommendations in social networks, and risk assessments in financial services, etc., which are not limited here.
[0070] In this application, the inference service system first obtains the inference service request from the user, and then initiates the subsequent processing flow based on the inference service request.
[0071] Subsequently, the key-value cache content corresponding to the inference service request is determined based on a pre-defined multi-level caching architecture. This pre-defined multi-level caching architecture can be understood as a caching system organized according to a specific order and strategy, typically containing multiple storage levels, such as GPU memory, CPU memory, local disk, and remote storage. Each cache level has its specific performance characteristics. The pre-defined multi-level caching architecture of this application maximizes the advantages of each storage level. For example, GPU memory is suitable for storing the most frequently accessed data to achieve the fastest access speed; CPU memory and local disk provide slightly slower but larger storage space; while remote storage can accommodate massive amounts of data, although it has the highest access latency.
[0072] In this application, a multi-level caching architecture is pre-defined to store key-value caches corresponding to multiple tokens in a hierarchical manner according to the target cache configuration parameters. The target cache configuration parameters can be understood as parameters that are dynamically adjusted based on the hardware environment of the inference server and the requirements of the inference task, used to guide the implementation of the caching strategy, including the selection of cache levels, data placement, and replacement strategies.
[0073] For example, the target cache configuration parameters can be understood as the KVCache configuration parameters after being processed by the KVCache configuration controller. The target cache configuration parameters may include the enabled status of the cache level, data placement strategy, prefetch strategy, data compression and encryption options, capacity limit, etc., which are not limited here.
[0074] A token is a fundamental concept in natural language processing and text analysis, used to represent the smallest meaningful unit in text. When processing text sequences, the original text sequence is broken down into a series of tokens by a tokenizer; tokens are the basic units of input and output for the model. For example, a token can be a word, subword, character, or special symbol, even a space or punctuation mark; there are no restrictions here. It is understandable that during the inference process of a large model, when the model generates or predicts text, it is essentially processing a series of tokens.
[0075] Multiple lexical units are determined based on the inference service request. In LLM inference, the input data (i.e. the input data carried in the inference service request) is decomposed into a series of lexical units. Each lexical unit has its corresponding key-value cache data, such as word embedding.
[0076] Based on the target cache configuration parameters, the inference service system can strategically store the key-value caches corresponding to multiple terms in different layers of a pre-defined multi-level cache architecture. In other words, the inference service system can intelligently determine which term key-value pairs should be stored in which cache layer, thus achieving hierarchical storage of key-value caches corresponding to multiple terms. For example, frequently accessed term data may be preferentially stored in GPU memory, while less frequently accessed data may be moved to CPU memory or local disk, or even further migrated to remote storage.
[0077] Understandably, this stored procedure is dynamic, and the inference service system can continuously adjust the location of data based on factors such as the popularity of terms, the capacity of the cache level, and the current system load.
[0078] In this application, the inference service system will determine the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture. That is, it will check or retrieve data related to the inference service request in different storage levels, i.e., key-value pairs of words, according to the target cache configuration parameters.
[0079] Therefore, the pre-defined multi-level caching architecture in this application can significantly improve data access efficiency and storage space utilization efficiency. By searching and storing data in different levels of cache, the inference service system can quickly respond to inference service requests, reduce computation time, and intelligently manage storage resources to avoid resource waste. This is beneficial for handling large-scale data and high-concurrency inference service requests, thereby improving the overall service quality and performance of the inference service system.
[0080] Then, based on the key-value cache content, the lexical metadata corresponding to the inference service request is generated and predicted. Here, the lexical metadata corresponding to the inference service request can be understood as the intermediate or result data generated by the inference service system after processing the lexical units, which may include word embeddings, attention weights, etc., without limitation here.
[0081] In this application, the inference service system can generate and predict lexical metadata related to the inference service request based on key-value cache content obtained from a preset multi-level caching architecture. For example, if some or all of the lexical metadata contained in the inference service request exists in the preset multi-level caching architecture, the inference service system will directly use the key-value caches corresponding to these data, accelerating the model's inference process and avoiding reprocessing of the original data. If the lexical metadata contained in the inference service request does not exist in the preset multi-level caching architecture, the inference service system will perform calculations and hierarchically store the key-value caches corresponding to multiple lexical terms so that they can be reused in future inference service requests.
[0082] Therefore, generating and predicting corresponding lexical metadata based on key-value cache content greatly reduces the computational load during model inference, especially for computationally intensive tasks such as long text analysis or complex image recognition. This effectively improves inference speed and the inference efficiency of large-scale language models.
[0083] Finally, the inference service response corresponding to the inference service request is generated using the lexical metadata. The inference service response can be understood as the processing result of the inference service system on the inference service request, which may include prediction results, recommendation lists, risk assessment reports, etc., depending on the type of service requested; this is not limited here.
[0084] In this application, the inference service system utilizes generated lexical metadata to construct the inference service response. That is, it uses the lexical metadata as input, runs the corresponding inference algorithm or model, and generates the final response result. This significantly accelerates the execution speed of the inference service, provides immediate and accurate feedback to the user, and significantly improves the response speed, accuracy, and resource utilization efficiency of the inference service. Especially in scenarios with high real-time requirements, such as online customer service and real-time recommendation systems, it can significantly improve service quality.
[0085] In summary, the pre-defined multi-level caching architecture of this application stores key-value caches corresponding to multiple lexical units in a hierarchical manner according to the target cache configuration parameters. This allows the most frequently accessed or newly generated data to be stored in the video memory first, ensuring that hot data can be accessed quickly, thereby significantly improving the utilization of video memory.
[0086] Meanwhile, by adopting a pre-defined multi-level caching architecture, this application can quickly locate and obtain the word metadata required for inference, avoiding frequent read and write operations on redundant computing and storage devices. Especially when processing large amounts of data or data that is frequently accessed, it can greatly shorten the response time.
[0087] Furthermore, this application generates and predicts term metadata based on key-value cache content, directly utilizing existing information in the cache, avoiding redundant calculations, significantly reducing waiting time and computational overhead, and improving the overall performance and accuracy of inference.
[0088] Furthermore, the target cache configuration parameters of this application can be dynamically adjusted according to the actual hardware environment of the inference service system, ensuring that a suitable cache configuration can be found regardless of the hardware configuration of the inference service system, thereby maximizing the use of existing resources and adapting to different hardware configurations.
[0089] The reasoning service request processing method provided in this application embodiment can be applied, but is not limited to, to application scenarios involving reasoning services in fields such as e-commerce services, education services, legal services, medical services, conference services, social networking services, financial product services, logistics services, and navigation services.
[0090] By employing the embodiments of this application, an inference service request is obtained, and then the key-value cache content corresponding to the inference service request is determined based on a preset multi-level caching architecture. The preset multi-level caching architecture stores key-value caches corresponding to multiple terms hierarchically according to target cache configuration parameters. Multiple terms are determined based on the inference service request. Then, the terminology data corresponding to the inference service request is generated and predicted based on the key-value cache content. Finally, the inference service response corresponding to the inference service request is generated using the terminology data. This effectively improves the inference performance of the inference service system, thereby shortening the inference response time, improving inference service performance and inference accuracy, and simultaneously increasing the utilization of video memory. This solves the technical problem of low inference performance in key-value caching schemes in related technologies.
[0091] In one optional embodiment, the preset multi-level caching architecture includes: a video memory layer, a memory layer, a local disk layer, and a remote storage layer, wherein the video memory layer is set as a level 1 cache in the target cache configuration parameters, the memory layer is set as a level 2 cache in the target cache configuration parameters, the local disk layer is set as a level 3 cache in the target cache configuration parameters, and the remote storage layer is set as a storage area that is enabled on demand in the target cache configuration parameters.
[0092] In this embodiment, the preset multi-level caching architecture includes: a GPU memory layer, a memory layer, a local disk layer, and a remote storage layer. The GPU memory layer, or GPU video memory, is the highest-speed cache level in the preset multi-level caching architecture and is set as the first-level cache in the target cache configuration parameters. It is typically used to store frequently used or critical data (such as word embeddings and model weights). Due to the high bandwidth and low latency of GPU video memory, data stored at this level can be quickly accessed by the model, thereby significantly improving inference speed and response time.
[0093] The memory tier, also known as CPU memory, lies between the video memory tier and the local disk tier, and is configured as a level 2 cache in the target cache settings. Compared to the video memory tier, the memory tier typically has a larger capacity but a lower access speed. The memory tier can cache data and computation results with moderate access frequency, providing faster access speeds than the local disk, thus serving as a high-performance supplement when the video memory tier cannot hold all the necessary data.
[0094] The local disk tier, or local disk, uses physical disks such as solid-state drives (SSDs) or hard disk drives (HDDs) for data storage and is configured as a level 3 cache in the target cache settings. Although its access speed is much lower than that of video memory and RAM, it offers large storage capacity and lower cost, making it suitable for storing infrequently accessed or historical data. In a multi-level caching architecture, the local disk tier acts as deep storage, used to store data that is not frequently used but needs to be persisted.
[0095] The remote storage tier, also known as remote storage, is a storage area configured to be enabled on demand in the target cache configuration parameters. It typically refers to storage resources on the network, such as cloud storage or distributed file systems. This tier offers massive storage capacity but has the highest access latency. The remote storage tier is primarily used to store data that is rarely accessed or requires long-term archiving, and to provide additional storage space when local resources cannot meet the demand.
[0096] As can be seen, this application, by using the GPU memory layer as a first-level cache, can ensure high-speed access to frequently accessed data, significantly improving the performance of the inference service. Furthermore, the high bandwidth of the GPU memory reduces data waiting time, accelerating the model inference process.
[0097] Meanwhile, by using the memory layer and the local disk layer as second-level and third-level caches respectively, this application can intelligently move data between different layers according to the data access frequency and caching strategy, effectively balancing the needs of speed and storage capacity and avoiding resource waste.
[0098] Furthermore, this application, through the on-demand activation feature of the remote storage layer, allows the inference service system to dynamically expand when greater storage capacity is needed, meeting the demands of large data volumes or sudden surges in request processing. The dynamic expansion capability of the remote storage layer enhances the flexibility and adaptability of the inference service system.
[0099] In one alternative embodiment, the remote storage layer is mounted to the inference server using a persistent storage declaration approach, wherein the inference server is a container deployed in a container orchestration cluster.
[0100] In this embodiment, the container orchestration cluster (such as a Kubernetes cluster) is a cluster composed of multiple nodes used for the automatic deployment, management, and scaling of containerized applications. Container orchestration systems (such as Kubernetes) provide advanced features such as automatic replication of containers (Pods), load balancing, resource scheduling, and automated recovery.
[0101] A container (Pod) is a lightweight, portable software encapsulation unit that contains an application and its runtime environment, ensuring that applications run in a predictable manner across different platforms, improving application portability and scalability. An inference server, as part of a containerized deployment, runs in a container orchestration cluster; that is, an inference server can be a container, managed by a container orchestration system for resource allocation, service scaling, and fault recovery.
[0102] In container orchestration systems, persistent volume claims (PVCs) allow applications to request storage resources with specific characteristics. A persistent volume claim can include information such as storage size, access mode, and storage class, ensuring that data persists even after the container's lifecycle ends or the system fails.
[0103] In this application, the remote storage layer is mounted to the inference server using a persistent storage declaration method. This means the inference server can request and use network storage resources on demand, and these resources are persistent, ensuring data integrity even if the container restarts or fails. Therefore, data is not lost even if the inference server or container restarts, guaranteeing the continuity and consistency of the inference service. Furthermore, multiple inference servers can share the same remote storage resource, improving storage resource utilization.
[0104] In an optional embodiment, the inference service request processing method further includes the following method steps:
[0105] Step S25: Receive target cache configuration parameters from the configuration controller. The configuration controller is used to adjust the initial cache configuration parameters according to the hardware environment of the inference server to obtain the target cache configuration parameters. The initial cache configuration parameters are generated based on multiple key-value cache configuration description definitions. The multiple key-value cache configuration description definitions are used to describe the general parameter content and parameter rules from multiple dimensions.
[0106] In this embodiment, the configuration controller, also known as the KV Cache configuration controller, can be understood as a system component used to monitor changes in the hardware environment of the inference server and the request patterns of the inference service. The configuration controller adjusts the initial cache configuration parameters based on the hardware environment of the inference server to obtain the target cache configuration parameters. In other words, the configuration controller can dynamically adjust the cache configuration parameters based on the hardware environment of the inference server, ensuring that the caching strategy is both efficient and adaptable.
[0107] The initial cache configuration parameters are the cache configuration parameters set during the initialization or default state of the inference service system. That is, the unified configuration parameters generated by the KV Cache configuration controller. The initial cache configuration parameters are generated based on multiple key-value cache configuration description definitions (i.e., multiple KV Cache configuration description definitions).
[0108] Multiple key-value cache configuration descriptions define common parameters and rules from multiple dimensions. They can be understood as specifications or templates for setting cache behavior from different perspectives. For example, multiple key-value cache configuration descriptions may include the number of cache levels, the size of each cache level, data eviction policies, cache update mechanisms, data sharding strategies, etc., without limitation. Through these multi-dimensional descriptions, the inference service system can more finely control cache behavior to adapt to different data access patterns and performance requirements.
[0109] Understandably, the configuration controller monitors the inference server's hardware environment and current inference service request patterns, adjusts the initial cache configuration parameters, generates target cache configuration parameters that better suit actual operational needs, and sends the real-time updated target cache configuration parameters to the inference server. This dynamic adjustment of cache configuration parameters avoids mismatches between cache configuration and server capabilities, improving the overall system performance and stability.
[0110] In this application, the target cache configuration parameters are received from the configuration controller, that is, the inference server receives the latest target cache configuration parameters sent by the configuration controller. This ensures that the inference server can dynamically adjust its caching strategy in real time according to the latest hardware status and workload, thereby improving the response speed and processing efficiency of the inference service system.
[0111] Therefore, by dynamically adjusting cache configuration parameters to adapt to the hardware environment of the inference server, the inference service system can achieve better performance, reduce unnecessary data read and write operations, and accelerate inference service response time. Furthermore, the dynamic adjustment mechanism of the configuration controller increases the inference service system's adaptability to changes in the hardware environment and workload fluctuations, enabling the inference server to maintain efficient and stable operation under different conditions.
[0112] In one alternative embodiment, the multiple key-value cache configuration descriptions define one or more of the following:
[0113] Multi-level cache configuration, which is used to determine the cache levels included in the preset multi-level cache architecture, the technical parameters corresponding to the cache levels, and the functional characteristics corresponding to the cache levels;
[0114] Hybrid computing configuration, wherein the hybrid computing configuration is used to recalculate some of the word elements when the number of multiple word elements meets the preset numerical conditions;
[0115] The configuration is dynamically adjusted, which is used to determine multiple dynamic adjustment rules. Each dynamic adjustment rule includes dynamic adjustment conditions and corresponding execution actions.
[0116] In this application embodiment, the multiple key-value cache configuration descriptions include one or more of the following: multi-level cache configuration, hybrid computing configuration, and dynamic adjustment configuration.
[0117] The multi-level caching configuration determines the cache levels included in the preset multi-level caching architecture, the corresponding technical parameters of each cache level, and the functional characteristics of each cache level. The preset multi-level caching architecture includes a first-level cache (e.g., video memory), a second-level cache (memory memory), a third-level cache (local disk), and a remote storage layer. The technical parameters corresponding to each cache level include cache size, type (e.g., Least Recently Used (LRU) or Least Frequently Used (LFU) policies), data read / write speed, and data validity period, defining the behavior and performance of each cache level. The functional characteristics of each cache level refer to the specific functions provided by each cache level, such as fast reads, automatic data eviction, and data persistence; these characteristics depend on the location and purpose of the cache level.
[0118] As can be seen, each tier provides different levels of access speed and storage capacity based on the characteristics of its storage medium to optimize storage and access. Through multi-level caching configuration, it can be ensured that data is stored in the appropriate tier, while simultaneously achieving a balance between access speed and storage cost.
[0119] The hybrid computation configuration is used to recalculate a portion of the words when the number of multiple words meets a preset numerical condition. This can be understood as the inference service system recalculating a portion of the word data when the number of multiple words meets the preset numerical condition, thereby improving the accuracy and efficiency of the inference service. The preset numerical condition is a specific numerical threshold used to trigger the hybrid computation strategy, set according to actual circumstances. In this application, when the number of multiple words exceeds the preset value, the number of multiple words meets the preset numerical condition. For example, when the number of multiple words in the sequence is >512 words, 20% of the words are recalculated; this is not limited here.
[0120] It can be seen that as the number of lexical units increases, the efficiency of caching may decrease. By recalculating some lexical units, the cached data can be updated to ensure the accuracy and real-time performance of the data, while reducing unnecessary consumption of computing resources.
[0121] Dynamic adjustment configuration is used to determine multiple dynamic adjustment rules. Each dynamic adjustment rule includes dynamic adjustment conditions and corresponding execution actions. Dynamic adjustment rules represent a set of rules that allow the inference service system to automatically adjust cache configuration and computation strategies based on real-time changing conditions. Dynamic adjustment conditions are the specific conditions that trigger dynamic adjustment, which can be access frequency, system load, hardware state changes, etc., and are not limited here. Execution actions can be understood as the adjustment actions performed by the inference service system when the dynamic adjustment conditions are met, including but not limited to cache expansion, data recalculation, and data storage location adjustments, and are also not limited here.
[0122] For example, this application defines multiple rules, each containing a condition and an action. These rules are used to dynamically adjust the caching strategy based on the model's runtime environment. For instance, when the inference service system is using the GPU as the primary computing resource and detects that GPU memory usage exceeds 90%, the local disk caching layer is enabled, and the remote storage caching layer is disabled. That is, when GPU memory usage is high, the inference service system will take measures to alleviate GPU memory pressure. As another example, when the inference service system is running on the CPU and CPU memory usage exceeds 80%, the inference service system enables the remote storage caching layer and disables the local disk caching layer. That is, when CPU memory is scarce, the inference service system will enable the remote storage caching layer, utilizing the capacity of remote storage to store additional cached data. As yet another example, in hybrid mode, i.e., when both GPU and CPU are used for computation simultaneously, and memory usage exceeds 70%, both the local disk caching layer and the remote storage caching layer are enabled simultaneously.
[0123] As can be seen, this application allows the inference service system to automatically optimize caching strategies and computation processes based on real-time data access patterns, hardware resource status, and the nature of inference service requests. For example, when the inference service system detects a sudden increase in the access frequency of a certain term, it can move that term from the remote storage layer to the memory layer or the video memory layer to improve access speed.
[0124] Therefore, multi-level caching configuration ensures data is stored at appropriate levels, improving access speed and reducing latency, thus significantly enhancing the performance of the inference service. Hybrid computing configuration recalculates some terms when the data volume reaches a certain level, avoiding redundant calculations of the entire dataset, saving computing resources, and improving resource utilization efficiency. Dynamic configuration adjustment allows the inference service system to automatically adjust according to real-time conditions, enhancing its flexibility and adaptability, enabling timely responses to changing access patterns and hardware conditions, and ensuring service continuity and efficiency.
[0125] In an optional embodiment, the inference service request processing method further includes the following method steps:
[0126] Step S26: Obtain the key-value cache corresponding to multiple lexical units;
[0127] Step S27: Determine the target storage mode based on the target cache configuration parameters, wherein the target storage mode includes one of the following: local storage mode, remote storage mode, and hybrid storage mode;
[0128] Step S28: Store the key-value caches corresponding to multiple lexical units in a hierarchical manner according to the target storage mode.
[0129] In this embodiment of the application, the target storage mode includes one of the following: local storage mode, remote storage mode, and hybrid storage mode.
[0130] Local storage mode refers to storing data and cache on the inference server's own hardware resources, such as the GPU memory layer, RAM layer, and local disk layer. Local storage mode is suitable for frequently accessed data and latency-sensitive requests because it provides faster data access speeds.
[0131] Remote storage mode is used to describe storing data and cache on remote servers or storage devices over a network, such as a remote storage tier. While remote storage mode offers slower access speeds, it provides larger storage capacity and lower costs, making it suitable for storing large amounts of infrequently accessed historical data or non-hotspot portions of large models.
[0132] Hybrid storage combines the advantages of local and remote storage, meaning some data is stored locally while the rest is stored remotely. Hybrid storage ensures fast access to frequently accessed data while handling large amounts of infrequently accessed data, thus balancing performance and cost.
[0133] In this application, the inference service system retrieves key-value pair data corresponding to multiple terms in the inference service request from the cache. Then, it determines the storage strategy based on the target cache configuration parameters, specifically the target storage mode. The target storage mode includes local storage, remote storage, and hybrid storage modes. This means determining whether the data is stored locally, on a remote storage server, or in a hybrid mode where some data is stored locally and others remotely. Finally, the inference service system caches the retrieved key-value pairs in a pre-defined multi-level caching architecture according to the determined target storage mode. For example, frequently accessed data might be stored in a high-speed GPU memory layer or RAM layer, while historical data or data with low access frequency might be stored in a local disk layer or a remote storage layer.
[0134] Therefore, the local storage mode utilizes high-speed storage resources to improve access speed, while the remote storage mode uses low-cost remote storage resources to achieve large-capacity storage. The hybrid storage mode combines the advantages of both, automatically selecting the storage location based on data access frequency and importance, thus achieving efficient resource utilization. Simultaneously, by dynamically selecting the storage mode, the inference service system can flexibly balance cost and performance, avoiding the overuse of expensive local storage resources. This enables efficient management and access to term data, significantly improving the response speed and overall performance of the inference service, while controlling storage costs and ensuring system stability and scalability.
[0135] In an optional embodiment, in step S28, the key-value caches corresponding to multiple lexical units are hierarchically stored according to the target storage mode, including the following method steps:
[0136] Step S281: In response to the target storage mode being local storage mode, the key-value cache corresponding to multiple word elements is synchronously written to the local storage layer of the preset multi-level cache architecture, wherein the local storage layer includes: video memory layer, memory layer and local disk layer.
[0137] Step S282: In response to the target storage mode being remote storage mode, the key-value cache corresponding to multiple lexical units is synchronously or asynchronously remotely written to the remote storage layer of the preset multi-level cache architecture.
[0138] Step S283: In response to the target storage mode being a hybrid storage mode, the key-value cache corresponding to multiple words is synchronously written to the local storage layer, and the key-value cache corresponding to multiple words is synchronously or asynchronously remotely written to the remote storage layer.
[0139] In this embodiment, when storing key-value caches corresponding to multiple terms in a hierarchical manner according to the target storage mode, in response to the target storage mode being a local storage mode, the key-value caches corresponding to multiple terms are synchronously written to the local storage layer of the preset multi-level cache architecture. The local storage layer includes: a video memory layer, a memory layer, and a local disk layer. This can be understood as follows: when the target storage mode determines the local storage mode, the inference service system synchronously writes the multiple terms and their key-value cache data related to the inference service request to the local storage layer of the preset multi-level cache architecture of the inference server. For example, typically, the fastest video memory layer is written first; if the capacity is insufficient, the memory layer and local disk layer are written sequentially to ensure that the data is stored in the fastest available layer.
[0140] In response to the target storage mode being a remote storage mode, the key-value cache corresponding to multiple lexical units is synchronously or asynchronously written to the remote storage layer of the preset multi-level caching architecture. This can be understood as the inference service system synchronously or asynchronously writing the key-value cache data related to the lexical units to the remote storage layer when the target storage mode is determined to be a remote storage mode.
[0141] In the case of synchronous writing to the remote storage layer, after the inference service system initiates a write operation, it will wait until the write operation is complete before continuing to execute subsequent logic. This means that the processing of the current request will be paused until the remote storage confirms that the data has been successfully stored. This ensures data consistency and integrity.
[0142] In the case of asynchronous writes to the remote storage layer, after initiating a write operation, the inference service system does not wait for the write operation to complete, but immediately continues to execute subsequent logic or process other requests. This significantly improves the system's response speed and throughput, because even while a write operation to remote storage is in progress, the system can handle new requests or tasks, ensuring the continuity and performance of the inference service.
[0143] In response to the target storage mode being a hybrid storage mode, the key-value cache corresponding to multiple terms is synchronously written to the local storage layer, and synchronously or asynchronously written to the remote storage layer. This can be understood as follows: when the target storage mode is determined to be a hybrid storage mode, the inference service system synchronously writes frequently accessed term data to the local storage layer (video memory layer, memory layer, or local disk layer), while synchronously or asynchronously writing low-frequency or non-critical data to the remote storage layer. Thus, the local storage layer is responsible for fast access to hot data, while the remote storage layer handles the storage of large-capacity and low-frequency data, fully utilizing the characteristics of both local and remote storage to achieve a balance between performance optimization and cost control. Furthermore, the storage strategy in hybrid mode can be adjusted in real time according to data access patterns, ensuring high performance while adapting to large data volumes and diverse needs, improving the flexibility and adaptability of the entire system.
[0144] As can be seen, the inference service request processing method of this application can intelligently select the appropriate data storage location. Whether it is local storage for high performance, remote storage for cost-effectiveness, or hybrid storage that combines both, it can automatically adjust according to the target cache configuration parameters and current data access needs, ensuring the efficiency, reliability, and economy of the inference service. Therefore, it greatly improves the response speed of the inference service, while controlling storage costs and enhancing the overall system performance and user experience.
[0145] In an optional embodiment, step S22, determining the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture, includes the following method steps:
[0146] Step S221: Obtain the word sequence corresponding to the inference service request, wherein the word sequence includes: multiple words;
[0147] Step S222: In response to meeting the preset generation conditions, a bidirectional parallel key-value caching generation strategy is adopted to generate the key-value cache content corresponding to the word sequence.
[0148] In this embodiment of the application, the token sequence includes multiple tokens, that is, the token sequence is a sequence composed of multiple tokens arranged in a certain order.
[0149] The bidirectional parallel key-value cache generation strategy is an efficient cache filling strategy. It improves cache filling speed by simultaneously reading and processing data at both ends of the lexical sequence and utilizing parallel computing.
[0150] In this application, when determining the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture, the system can first obtain the lexical sequence corresponding to the inference service request. In response to meeting preset generation conditions, a bidirectional parallel key-value cache generation strategy is adopted to generate the key-value cache content corresponding to the lexical sequence. This can be understood as the inference service system first parsing the inference service request and extracting the lexical sequence constituting the request. Then, when the preset generation conditions are met, the inference service system initiates the bidirectional parallel key-value cache generation strategy. Simultaneously, utilizing different levels of the multi-level caching architecture, it calculates and loads the key-value cache of the lexical sequence from both ends of the sequence through parallel processing until the required cache content is fully generated.
[0151] Therefore, the bidirectional parallelization strategy significantly improves the generation speed of key-value cache content and reduces waiting time, which is especially important for processing long sequences or large amounts of data requests. Simultaneously, through parallel processing, the inference service system can more rationally utilize each layer of the multi-level cache architecture, reducing the bottleneck effect of a single cache layer and ensuring the efficiency of data generation and storage.
[0152] In one optional embodiment, satisfying the preset generation conditions includes: no word sequence is stored in the video memory layer, the memory layer, and the local disk layer, and a word sequence is stored in the remote storage layer.
[0153] In this embodiment, meeting the preset generation conditions can be understood as meaning that no token sequences are stored in the video memory layer, the memory layer, and the local disk layer, but a token sequence is stored in the remote storage layer. That is, when it is detected that no token sequences are stored in the video memory layer, the memory layer, and the local disk layer, but a token sequence is stored in the remote storage layer, the inference service system will start a bidirectional parallel key-value cache generation strategy to generate the key-value cache content corresponding to the token sequence.
[0154] This can be understood as follows: When an inference service request arrives, the inference service system first checks whether cached data for the corresponding token sequence exists in three local storage layers (video memory, main memory, and local disk). If no cached token sequence is found in any of these three layers, the inference service system further checks the remote storage layer. If the token sequence is stored in the remote storage layer, then the preset generation condition is met: the local cache is missing, but the remote storage contains the data. Afterward, the inference service system, based on a hybrid storage mode strategy, employs a bidirectional parallel key-value cache generation strategy to load data from the remote storage layer while simultaneously generating the required key-value content in the local cache to accelerate future request processing.
[0155] Therefore, data is only loaded from the remote storage layer when it is truly missing in the local cache and only when the data is contained in the remote storage, avoiding unnecessary data copying and redundant storage, and effectively saving local cache space.
[0156] In an optional embodiment, in step S222, a bidirectional parallel key-value cache generation strategy is adopted to generate key-value cache content corresponding to the lexical sequence, including the following method steps:
[0157] Step S2221: Starting from the first word in the word sequence, calculate the key-value cache corresponding to the beginning part of the word sequence in a forward manner, and starting from the last word in the word sequence, load the key-value cache corresponding to the end part of the word sequence from the remote storage layer in a backward manner, until the key-value cache content corresponding to the word sequence is generated.
[0158] In this embodiment of the application, when generating the key-value cache content corresponding to the word sequence using a bidirectional parallel key-value cache generation strategy, the key-value cache corresponding to the beginning part of the word sequence can be calculated forward starting from the first word of the word sequence, and the key-value cache corresponding to the end part of the word sequence can be loaded backward from the remote storage layer starting from the last word of the word sequence, until the key-value cache content corresponding to the word sequence is generated.
[0159] Forward computation can be understood as processing data step by step from the beginning of the lexical sequence backwards, calculating the corresponding key-value cache content. Specifically, the key-value cache corresponding to the beginning of the lexical sequence can be understood as the inference service system calculating backwards from the first lexical word, generating a data representation for each lexical word or its corresponding cached value. This data, which may be frequently accessed recently, is more suitable for rapid computation and storage in the video memory layer or main memory layer for high-speed processing of subsequent requests.
[0160] Reverse loading can be understood as starting from the end of the lexical sequence and working backwards, loading the corresponding key-value cache content from the remote storage layer into the local cache. Specifically, reverse loading the key-value cache corresponding to the end of the lexical sequence means that the inference service system starts from the last lexical element of the sequence and works backwards, loading the remaining lexical data from the remote storage layer. This data may not have been previously stored in the local cache due to low access frequency; therefore, remote loading supplements the local cache, ensuring that the key-value cache content for the entire lexical sequence is completely constructed.
[0161] Therefore, through bidirectional parallel processing, the inference service system can work simultaneously at the beginning and end of the sequence, reducing the time required for single-threaded processing. This efficiency advantage is particularly pronounced when processing long sequences. Furthermore, the initial terminology data, after forward computation, is stored in a local cache, especially in the GPU and system memory layers, enabling rapid response to subsequent similar or continuous inference service requests, reducing redundant computations and conserving computing resources. The final terminology data is retrieved from the remote storage layer via reverse loading, supplementing incomplete local cache entries while avoiding excessive consumption of remote storage resources, as remote loading only occurs when the local cache is insufficient.
[0162] In an optional embodiment, the inference service request processing method further includes the following method steps:
[0163] Step S29: Preload hotspot data into the memory layer, wherein the hotspot data is determined based on the access frequency of each word in multiple words.
[0164] In this embodiment, hotspot data can be understood as data that is frequently accessed or has a high number of recent accesses; that is, hotspot data is determined based on the access frequency of each word in a plurality of words. In the context of inference service request processing, hotspot data is usually related to the word sequence most frequently encountered in model inference.
[0165] In this application, frequently accessed data is pre-loaded into the memory layer, which significantly reduces the processing time for inference service requests. Since memory access speed far exceeds that of disk or remote storage, the inference service system can access this data almost instantaneously, greatly improving user experience and service quality. Furthermore, by retaining frequently accessed data in local memory, the need to retrieve data from remote storage is reduced, lowering the cost and latency of remote data transmission and improving the stability and efficiency of the entire inference service system.
[0166] In summary, this application addresses large language model inference scenarios by designing an adaptive multi-level KV cache management system. Through a four-level cache architecture (GPU memory, CPU memory, local disk, and remote storage), combined with dynamic recomputation and intelligent prefetching technologies, it achieves optimized GPU memory resources and improved inference performance. The inference service system of this application is deeply integrated into the model runtime engine, supporting hybrid, local, and remote operating modes to adapt to inference needs in different hardware environments.
[0167] Figure 3 This is a schematic diagram of the architecture of an adaptive multi-level key-value cache management system according to an embodiment of this application, as shown below. Figure 3 As shown, Figure 3 This includes the KV Cache Configuration Controller (KV Cache Configuration Controller), which is the central management component of the entire inference service system. It is responsible for receiving and processing KV Cache configuration description definitions (i.e., KV cache configuration description definitions, each of which sets specific parameters for different cache levels (such as GPU memory layer, CPU memory layer, local disk layer, and remote storage layer) and hybrid computing strategies, such as cache size, prefetching mechanism, encryption options, etc.), and dynamically adjusting the caching strategy according to the specification type (i.e., hardware environment) of the node where the inference engine is located during model runtime, in order to ensure that the caching strategy can optimally match the current hardware conditions.
[0168] Next, the KV Cache configuration controller passes the generated KV Cache configuration parameters (i.e., KV cache configuration parameters), such as cache hierarchy settings and prefetching strategies, to the inference server. These KV Cache configuration parameters guide the inference server on how to effectively use a multi-level caching architecture to store and load KV Cache data.
[0169] The inference server dynamically adjusts its caching behavior based on the KV Cache configuration parameters received from the KV Cache configuration controller, including using local disk cache (i.e., GPU memory, CPU memory, local disk) or remote cache for KV Cache storage and access, thereby ensuring high performance and resource optimization during the inference process.
[0170] As can be seen, this application centrally manages the KV Cache configuration through the KV Cache configuration controller, dynamically adjusts the caching strategy according to the hardware environment during model runtime, and passes the configuration parameters to the inference server to achieve efficient data caching and processing.
[0171] Right now, Figure 3This demonstrates the information flow and caching policy transmission between the KV Cache configuration controller and the inference server, showcasing how the inference service system dynamically adjusts the KV Cache management strategy according to different hardware environments and requirements to achieve high-performance and resource-optimized inference services. Figure 3 The architecture shown allows the inference service system to flexibly respond to various scenarios, maximizing the use of GPU, CPU, local disk and remote storage resources, thereby improving inference efficiency and reducing costs.
[0172] Figure 4 This is a flowchart illustrating the cache configuration distribution and application in an adaptive multi-level key-value cache management system according to an embodiment of this application, such as... Figure 4 As shown, the KV Cache configuration controller (i.e., KV cache configuration controller) is used to receive and parse all KVCache configuration description definitions (i.e., KV cache configuration description definitions), intelligently adjust the caching strategy according to the hardware specifications of the node where the current model is running, and generate and provide suitable cache configuration parameters to the inference server that supports adaptive multi-level caching.
[0173] Understandably, an inference server can be a single entity or a cluster of servers, flexibly adapting to different operating modes. The inference server receives cache configuration parameters from the KV Cache configuration controller, and the model runtime engine adjusts its own caching strategy and computation method according to the cache configuration parameters. The model runtime engine works closely with the cache data prefetcher, dynamic recalculator, and computation and network-aware loader to optimize computation and cache usage.
[0174] The cache data prefetcher is used to preload frequently accessed data into the CPU memory layer to reduce latency. In other words, the cache data prefetcher predicts what data might be needed and pulls it into the cache layer closer to the computing unit in advance, thereby speeding up data processing.
[0175] When the sequence length exceeds a certain threshold, the dynamic recalculator recalculates a portion of the key-value pairs according to a defined ratio. This reduces GPU memory consumption while maintaining inference accuracy. The newly generated key-value pairs are updated in GPU memory to reflect the latest inference request status. The dynamic recalculator works in conjunction with the compute and network-aware loader to optimize computation processes and resource usage.
[0176] The computation and network awareness loader employs a bidirectional parallel strategy for key-value cache generation. When the pre-filling task begins, it utilizes GPU computing power to generate a key-value cache forward from the first token in the sequence, while simultaneously loading remote cache data backward from the last token. This process continues until the two parts intersect at a certain point, completing the cache preparation for all tokens. The key-value cache data generated by the computation and network awareness loader is stored in GPU memory or CPU memory for use by the engine during model runtime.
[0177] Simultaneously, the inference server analyzes the cache configuration parameters passed from the KV Cache configuration controller to identify a caching strategy (local only, mixed mode, or remote only) that matches the current hardware environment and operating mode. Understandably, the identified caching strategy is applied to the inference server's cache management. For example, if the configuration specifies enabling local disk caching when GPU memory is low, the inference server will adjust its caching strategy accordingly, prioritizing the use of local disk storage for KV cache data. It can be seen that configuration mode matching is not static but dynamically adjusted based on real-time conditions. Therefore, even during inference service operation, if hardware status or requirements change, the inference server can promptly adjust its caching strategy to optimize performance and resource utilization.
[0178] In local-only mode, the inference server utilizes only local storage resources (GPU memory, CPU memory, and local disk) to perform caching operations, meaning it forces synchronous writes to local memory or the file system without any access to or communication with remote storage. In hybrid mode, the inference server utilizes both local and remote storage resources, dynamically selecting the most suitable caching level based on current resource availability and requirements. In remote-only mode, the inference server primarily relies on cached data provided by remote storage systems (distributed file storage systems or other distributed caching systems). Data writes are also performed according to configuration, and can be synchronous or asynchronous to adapt to the access performance and network conditions of remote storage.
[0179] Furthermore, by using the PVC function, remote file storage systems, such as distributed file storage systems or other distributed caching systems, can be dynamically mounted to Pods to provide additional caching storage capabilities. This decouples the direct association between storage and computing, enhancing the scalability of the inference service system and the flexibility of resource management.
[0180] See Figure 3 and Figure 4The inference service system contains multiple KV Cache configuration descriptions, which describe the specific parameters and rules of the KV Cache. The KV Cache configuration controller is one of the core components of the entire inference service system. It receives KV Cache configuration descriptions from different sources, parses and processes these descriptions, generates unified KV Cache configuration parameters, and dynamically adjusts the caching strategy based on the hardware environment during model runtime.
[0181] Dynamically adjusting the cache configuration based on the specifications of the node hosting the model runtime engine is a crucial decision point. The inference service system determines which cache configuration strategy to adopt based on the specifications of the node (virtual machine or physical machine) hosting the model runtime engine (e.g., CPU, GPU). This decision point allows the inference service system to flexibly adjust the cache configuration to adapt to the needs of different hardware environments.
[0182] Key-value cache (KV Cache) configuration parameters are passed to the inference servers. This means that the KV Cache configuration parameters processed by the KV Cache configuration controller are distributed to different inference servers. The inference service system supports multiple caching mechanisms, including local disk caching and remote caching, allowing users to select the appropriate caching strategy based on their needs; in other words, it supports multi-pathing.
[0183] After receiving the KV Cache configuration parameters, the inference server will perform corresponding caching operations based on these parameters. The inference service system supports multiple caching methods, including local disk caching and remote caching, allowing users to choose the appropriate caching strategy based on their actual needs.
[0184] Distributed file storage systems or distributed caching systems support synchronous or asynchronous remote writes based on configuration, allowing for flexible adjustments to data write strategies according to actual needs. Asynchronous write mechanisms can reduce the consumption of local computing resources, improving the overall system's response speed and processing capacity.
[0185] Using PVCs to mount remote file storage systems to Pods enables dynamic allocation and management of storage resources. By decoupling from the backend storage system through PVCs, it flexibly supports switching between different storage systems and dynamically expands storage capacity according to actual needs without manual intervention in storage system configuration. PVCs make the use of storage resources more flexible and efficient, allowing for dynamic expansion of storage capacity based on actual requirements.
[0186] Furthermore, considering that the computational cost of generating the KV cache increases with the distance between the token and the start of the sequence, while the data transmission cost is independent of the token position, this application maximizes the utilization of GPU computing power and network bandwidth through computational and I / O parallelization. This application proposes a computationally and network-aware KV cache loader that uses local computation and remote prefix cache data streams to generate the KV cache. Its core innovation lies in a bidirectional parallel KV cache generation strategy: upon receiving a pre-filling task, it immediately utilizes available GPU computing power to compute the KV cache forward from the first token. Simultaneously, it loads the remote prefix cache backward from the last token until the KV cache data for all tokens is ready. It also features a dynamically adaptive processing mechanism: short-distance tokens prioritize local computation for lower computational costs, while long-distance tokens prioritize remote cache transmission to avoid high computational overhead.
[0187] Specifically, the forward computation path starts from the first token in the sequence and uses GPU computing power to gradually generate KV cache (computation-intensive). The reverse loading path starts from the last token in the sequence and streams the pre-stored KV cache from remote storage via a high-speed network (I / O-intensive). Both processes occur simultaneously until they intersect at some point, at which point the KV caches for all tokens are ready.
[0188] The process of loading the KV Cache is as follows: Figure 5 As shown, Figure 5 This is a flowchart of the inference service request processing according to an embodiment of this application. When a user's inference service request enters the inference service system (i.e., a prompt word request enters), the inference server needs to process these inference service requests and generate corresponding inference results.
[0189] Furthermore, the inference service system first checks whether the GPU memory contains the key-value cache data for the specific token in the request (i.e., whether the GPU memory contains the token). If so, it directly proceeds to the encoding stage because the token's key-value data is ready and can be directly called for computation. If not, the inference service system will progressively check other cache levels based on the availability of local resources.
[0190] If the required token key-value data is not available in the GPU memory, the inference service system checks whether CPU memory caching is enabled (i.e., whether CPU memory is supported). If CPU memory is not supported, the inference service system will utilize the available GPU to compute the key-value data. If CPU memory is supported, the inference service system will continue to check whether the CPU memory contains the token's key-value data (i.e., whether the CPU memory includes the token). If the CPU memory includes the token, the key-value data is loaded directly from the CPU memory for subsequent processing. If the CPU memory does not contain the token, the inference service system will further check the support for local disk files or remote storage (i.e., whether local disk files are supported). If local disk files are supported, data is loaded from these levels; if local disk files are not supported, the key-value cache is recomputed directly on the GPU.
[0191] When determining whether a local disk file contains tokens, if local resources (GPU memory, CPU memory, local disk) contain the required token key-value data, the key-value pairs are loaded from the local disk. If none of the local resources contain the required token key-value data, the inference service system attempts to load data from a remote storage system to determine if remote storage is supported. If remote storage is not supported, the inference service system will utilize available GPUs to compute the key-value pairs. If remote storage is supported, it checks whether the remote storage contains tokens. If the remote storage does not contain tokens, the inference service system will utilize available GPUs to compute the key-value pairs. If the remote storage contains tokens, the computation and network awareness loader intervenes, performing forward computation starting from the first token and backward loading of the corresponding key-value data from the remote storage, until the key-value cache data for all tokens is ready.
[0192] In summary, this application provides an inference service optimization system based on adaptive multi-level caching, including:
[0193] 1) GPU memory layer, used to store key-value vectors and managed by the Least Recently Used (LRU) algorithm;
[0194] 2) CPU memory layer, used to prefetch hot data and store it in memory;
[0195] 3) Local disk layer, used to store large amounts of cached data, supports encryption;
[0196] 4) Remote storage layer, used for remote data storage of distributed file systems, enabled as needed.
[0197] This application also introduces a dynamic recalculation mechanism, which intelligently merges cached content with newly generated content, reducing video memory consumption through partial recalculation. Specifically, the dynamic recalculation module is used to regenerate a portion of the content according to a basic recalculation ratio when the sequence exceeds a preset threshold.
[0198] This application also implements intelligent prefetching technology, which preloads hot data into the CPU memory layer to reduce latency. Specifically, the intelligent prefetching module is used to preload hot data into the CPU memory layer to reduce latency.
[0199] The KV Cache configuration controller in this application is used to centrally manage KV Cache configuration, parse and process configuration descriptions, and generate unified configuration parameters. The dynamic adjustment decision point in this application is used to flexibly adjust the cache configuration strategy according to the node specification type where the model runtime engine resides.
[0200] The inference service system of this application supports multiple caching mechanisms, including local disk caching and remote caching, allowing for the selection of appropriate caching strategies based on actual needs. The multi-path support module supports various caching mechanisms, including local disk caching and remote caching, enabling the selection of suitable caching strategies according to specific requirements. This application also implements a hybrid computing strategy, intelligently fusing cached content with newly generated content to improve overall performance. The hybrid computing strategy module intelligently fuses cached content with newly generated content, reducing GPU memory consumption through partial recalculation.
[0201] Furthermore, upon receiving the KV Cache configuration parameters, the inference server of this application performs corresponding caching operations based on these parameters, achieving efficient data caching and processing. The inference service system of this application is deeply integrated into the model runtime engine, supporting hybrid / local / remote operating modes to adapt to inference needs in different hardware environments.
[0202] Experiments show that the inference service system proposed in this application can reduce the initial token latency by 2.2-3.3 times, increase the inference throughput by 2.8-5 times, and support storing the KV cache in a low-speed, high-capacity device, hiding the access latency through the computation-transmission pipeline.
[0203] Therefore, this application designs an adaptive four-level caching architecture, including GPU memory, CPU memory, local disk, and remote storage, which can dynamically adjust the caching strategy according to the hardware environment during model runtime. Furthermore, each caching level in this application has specific technical parameters and functional characteristics; for example, the GPU memory layer uses the LRU algorithm for management, and the CPU memory layer supports a prefetch mechanism. In addition, this application proposes a computationally and network-aware KV cache loader that utilizes local computation and remote prefix cache data streams to generate KV caches. Its core innovation lies in the bidirectional parallel KV cache generation strategy and the dynamically adaptive processing mechanism, prioritizing local computation for short-distance tokens and prioritizing the use of remote caches for long-distance token transmission.
[0204] It is easy to understand that the beneficial effects of the reasoning service request processing method provided in this application include the following points.
[0205] Beneficial effects (1): Through the four-level cache architecture (GPU memory, CPU memory, local disk, remote storage), the inference service system of this application can intelligently allocate and utilize various storage resources, reduce the GPU memory usage, improve the memory utilization efficiency and overall resource utilization, and reduce latency.
[0206] Beneficial effects (2): This application supports three operating modes: hybrid, local, and remote. It can automatically adjust the caching strategy according to the hardware specifications (GPU, CPU, hybrid) of the node where the inference server is located, flexibly enable or disable specific caching levels, reduce the burden on maintenance personnel, and improve the adaptability and portability of the system.
[0207] Beneficial effects (3): This application introduces intelligent prefetching technology and computation and network-aware KV cache loader. Through forward computation and reverse loading strategies, it effectively utilizes GPU computing power and network bandwidth. Combined with dynamic adaptive processing mechanism, it prioritizes local computation to process short-distance tokens and prioritizes remote cache to transmit long-distance tokens, thereby significantly improving cache access efficiency, reducing inference latency for long sequences and complex requests, and improving overall inference performance.
[0208] Beneficial effect (4): The solution of this application provides a dynamic adjustment strategy module, which can dynamically adjust the cache configuration and management strategy according to the specification type of the node where the engine is located during model runtime and the real-time resource usage. Through preset rules and actions, the system can automatically switch between local disk cache and remote cache, thereby ensuring that the system still maintains high efficiency when facing sudden traffic peaks and avoiding performance degradation caused by improper cache configuration or unreasonable resource allocation.
[0209] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the 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.
[0210] Furthermore, it should be noted that, for the sake of simplicity, the aforementioned method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Secondly, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0211] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, they can also be implemented by hardware. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0212] According to embodiments of this application, the following are also provided: Figure 6 The above describes a method for handling inference service requests. Figure 6 This is a flowchart of a reasoning service request processing method according to an embodiment of this application, such as... Figure 6 As shown, the method includes:
[0213] Step S61: Obtain initial cache configuration parameters;
[0214] Step S62: Adjust the initial cache configuration parameters according to the hardware environment of the inference server to obtain the target cache configuration parameters;
[0215] Step S63: Pass the target cache configuration parameters to the inference server; wherein, the inference server is used to determine the key-value cache content corresponding to the inference service request based on the preset multi-level cache architecture, generate and predict the word metadata corresponding to the inference service request based on the key-value cache content, and generate the inference service response corresponding to the inference service request using the word metadata. The preset multi-level cache architecture stores the key-value cache corresponding to multiple words in a hierarchical manner according to the target cache configuration parameters, and the multiple words are determined based on the inference service request.
[0216] In this embodiment, the configuration controller first obtains a set of initial cache configuration parameters. These parameters are set based on preset standards for the model's operating environment and include general rules about the cache architecture, such as a multi-level cache configuration description definition, which defines the hierarchical relationship, technical parameters, and functional characteristics of the multi-level cache architecture.
[0217] Then, the configuration controller will adjust the obtained initial cache configuration parameters based on the actual hardware environment of the inference server. This may involve analyzing the hardware specifications of the inference server, such as memory size, disk type, network bandwidth, etc., to determine the optimal configuration of the multi-level cache architecture. For example, adjusting the size of each level of cache, read and write strategies, data synchronization mechanisms, etc., to ensure that the cache architecture can make full use of existing hardware resources and improve data processing speed and storage efficiency.
[0218] Finally, the adjusted target cache configuration parameters are passed to the inference server by the configuration controller. Upon receiving these parameters, the inference server will reconfigure its multi-level caching architecture to adapt to and optimize subsequent inference service request processing.
[0219] For details, please refer to the description of the foregoing embodiments, which will not be repeated here.
[0220] The reasoning service request processing method provided in this application embodiment can be applied, but is not limited to, to application scenarios involving reasoning services in fields such as e-commerce services, education services, legal services, medical services, conference services, social networking services, financial product services, logistics services, and navigation services.
[0221] By adopting the embodiments of this application, initial cache configuration parameters are obtained, and then adjusted according to the hardware environment of the inference server to obtain target cache configuration parameters. These target cache configuration parameters are then transmitted to the inference server. The inference server determines the key-value cache content corresponding to the inference service request based on a preset multi-level cache architecture, generates and predicts the terminology data corresponding to the inference service request based on the key-value cache content, and generates the inference service response corresponding to the inference service request using the terminology data. The preset multi-level cache architecture stores the key-value cache corresponding to multiple terms hierarchically according to the target cache configuration parameters. Multiple terms are determined based on the inference service request, thereby effectively improving the inference performance of the inference service system. This achieves the technical effects of shortening inference response time, improving inference service performance and inference accuracy, and simultaneously improving the utilization of video memory, thus solving the technical problem of low inference performance in key-value caching schemes in related technologies.
[0222] In an optional embodiment, step S61, obtaining the initial cache configuration parameters, includes the following method steps:
[0223] Step S611: Obtain multiple key-value cache configuration description definitions, wherein the multiple key-value cache configuration description definitions are used to describe the general parameter content and parameter rules from multiple dimensions;
[0224] Step S612: Generate initial cache configuration parameters based on multiple key-value cache configuration descriptions.
[0225] In this embodiment, when obtaining initial cache configuration parameters, a set of key-value cache configuration description definitions can be obtained first. These definitions involve multiple dimensions, including but not limited to cache hierarchy design, data read / write rules, cache capacity, cache expiration time, and data update strategies, providing a foundation for subsequently generating initial cache configuration parameters. Then, based on the obtained multiple key-value cache configuration description definitions, a set of initial cache configuration parameters is generated to guide the configuration and initialization work of the cache system during the startup phase, ensuring that the cache can store and retrieve data according to preset rules and structures.
[0226] Therefore, by establishing a cache configuration framework based on description definitions, not only is guidance provided for cache initialization, but also the foundation is laid for subsequent performance optimization and dynamic adjustment, enabling the cache architecture to better adapt to various application scenarios and hardware conditions, thereby improving the overall data processing capability and response speed.
[0227] It should be noted that the preferred implementation of this embodiment can be found in the relevant descriptions in the embodiments, and will not be repeated here.
[0228] According to embodiments of this application, the following are also provided: Figure 7This illustrates a method for handling inference service requests. Figure 7 This is a flowchart of a reasoning service request processing method according to an embodiment of this application, such as... Figure 7 As shown, the method includes:
[0229] Step S71: Obtain the inference service request through the first application programming interface;
[0230] Step S72: Return the inference service response through the second application programming interface; wherein the inference service response is generated according to the inference service request processing method described above.
[0231] The first Application Programming Interface (API) and the second API described above can be the same API or different APIs. In an optional embodiment, the interface parameters in the first and second APIs may include, but are not limited to: global interface identifier, interface signing key, interface timestamp, interface request identifier, system call credential identifier, etc. The first API can use GET or POST as the interface request method to obtain the file processing request. The second API can use JSON format to return the file processing response.
[0232] In this embodiment, a reasoning service request can be understood as an application sent by a client to the reasoning service system, aiming to obtain results regarding a reasoning task. The reasoning task can be an application of various intelligent models such as text analysis, image recognition, and speech understanding. The reasoning service request generally includes a specific description of the data or problem to be processed.
[0233] An inference service response can be understood as the inference service system's reply to an inference service request, including the analysis results, prediction results, or other types of service outputs of the requested data. The generation of the response follows the inference service request processing method described above, namely, utilizing a multi-level caching architecture to improve processing efficiency and data access speed, ultimately generating accurate keyword metadata and constructing the inference service response accordingly.
[0234] For details, please refer to the description of the foregoing embodiments, which will not be repeated here.
[0235] The reasoning service request processing method provided in this application embodiment can be applied, but is not limited to, to application scenarios involving reasoning services in fields such as e-commerce services, education services, legal services, medical services, conference services, social networking services, financial product services, logistics services, and navigation services.
[0236] By adopting the embodiments of this application, an inference service request is obtained through a first application programming interface (API), and an inference service response is returned through a second API. The inference service response is generated according to the inference service request processing method described above, thereby effectively improving the inference performance of the inference service system. This achieves the technical effects of shortening the inference response time, improving the inference service performance and inference accuracy, and improving the utilization of video memory. In this way, it solves the technical problem of low inference performance of key-value caching schemes in related technologies.
[0237] It should be noted that the preferred implementation of this embodiment can be found in the relevant descriptions in the embodiments, and will not be repeated here.
[0238] According to embodiments of this application, the following are also provided: Figure 8 This illustrates a method for handling inference service requests. Figure 8 This is a flowchart of a reasoning service request processing method according to an embodiment of this application, such as... Figure 8 As shown, the method includes:
[0239] Step S81: Obtain the current input inference service request;
[0240] Step S82: In response to the inference service request, return the inference service response;
[0241] Step S83: Display the inference service response within the graphical user interface; wherein the inference service response is generated according to the inference service request processing method described above.
[0242] In this embodiment, an inference service request can be understood as a request from a user that instructs the inference service system to perform a specific inference task, such as text understanding, image recognition, or other AI-based decision-making tasks. An inference service request typically includes necessary input data and parameters so that the system can understand and execute the corresponding service.
[0243] The inference service response can be understood as feedback on the execution result of the inference task generated according to the inference service request processing method. The response may include parsing results, prediction conclusions, decision suggestions, etc., depending on the type of service requested.
[0244] A graphical user interface (GUI) is a visual interface through which a user interacts with a computer system. It typically includes elements such as buttons, menus, text boxes, and images, used to input commands and display results.
[0245] For details, please refer to the description of the foregoing embodiments, which will not be repeated here.
[0246] The reasoning service request processing method provided in this application embodiment can be applied, but is not limited to, to application scenarios involving reasoning services in fields such as e-commerce services, education services, legal services, medical services, conference services, social networking services, financial product services, logistics services, and navigation services.
[0247] By employing the embodiments of this application, the currently input inference service request is obtained, and then an inference service response is returned in response to the inference service request. The inference service response is then displayed in the graphical user interface. The inference service response is generated according to the inference service request processing method described above, thereby effectively improving the inference performance of the inference service system. This achieves the technical effects of shortening the inference response time, improving the inference service performance and inference accuracy, and improving the utilization of video memory. In this way, the technical problem of low inference performance of key-value caching schemes in related technologies is solved.
[0248] It should be noted that the preferred implementation of this embodiment can be found in the relevant descriptions in the embodiments, and will not be repeated here.
[0249] According to embodiments of this application, the following are also provided: Figure 9 This illustrates a method for handling inference service requests. Figure 9 This is a flowchart of a reasoning service request processing method according to an embodiment of this application, such as... Figure 9 As shown, the method includes:
[0250] Step S91: In response to the input command applied to the operation interface, display the inference service request on the operation interface.
[0251] Step S92: In response to the processing command applied to the operation interface, display the inference service response on the operation interface; wherein the inference service response is generated according to the inference service request processing method described above.
[0252] In this embodiment of the application, the user interface is the interface through which the user interacts with the system. It is usually on the client device, such as a smartphone, tablet, or computer, and can be a graphical user interface that provides user input elements such as buttons and text boxes.
[0253] Input commands can be understood as actions triggered by the user on the user interface, such as clicking a button, entering text, or selecting an option. These commands instruct the system to perform the corresponding operations or services.
[0254] An inference service request can be understood as a request issued by a user or system, asking the system to perform inference tasks, such as text analysis or image recognition. The request contains the data and parameters required to perform the task.
[0255] Processing instructions can be understood as instructions further input by the user after the user triggers the inference service request, instructing the system to start processing the request and execute the inference task.
[0256] The inference service response can be understood as the result or feedback generated by the system according to the inference service request processing method, which includes the output data of the inference task, such as analysis results and prediction conclusions.
[0257] For details, please refer to the description of the foregoing embodiments, which will not be repeated here.
[0258] The reasoning service request processing method provided in this application embodiment can be applied, but is not limited to, to application scenarios involving reasoning services in fields such as e-commerce services, education services, legal services, medical services, conference services, social networking services, financial product services, logistics services, and navigation services.
[0259] By adopting the embodiments of this application, inference service requests are displayed on the operation interface in response to input commands applied to the operation interface, and inference service responses are displayed on the operation interface in response to processing commands applied to the operation interface. The inference service responses are generated according to the above-described inference service request processing method, thereby effectively improving the inference performance of the inference service system. This achieves the technical effects of shortening inference response time, improving inference service performance and inference accuracy, and improving the utilization of video memory, thus solving the technical problem of low inference performance of key-value caching schemes in related technologies.
[0260] It should be noted that the preferred implementation of this embodiment can be found in the relevant descriptions in the embodiments, and will not be repeated here.
[0261] According to embodiments of this application, the following are also provided: Figure 10 The example shown is a reasoning service request processing system. Figure 10 This is a schematic diagram of the structure of a reasoning service request processing system according to an embodiment of this application, such as... Figure 10 As shown, the system includes:
[0262] The client is used to send inference service requests;
[0263] The server connects to the client and is used to determine the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture, generate and predict the word data corresponding to the inference service request based on the key-value cache content, and generate the inference service response corresponding to the inference service request using the word data. The preset multi-level caching architecture stores the key-value cache corresponding to multiple words in a hierarchical manner according to the target cache configuration parameters, and the multiple words are determined based on the inference service request.
[0264] The client is also used to output inference service responses.
[0265] In this embodiment of the application, the inference service request processing system includes a client and a server. The inference service request processing system is used to execute the inference service request processing method provided in this application. For details, please refer to the description of the foregoing embodiments, which will not be repeated here.
[0266] The reasoning service request processing method provided in this application embodiment can be applied, but is not limited to, to application scenarios involving reasoning services in fields such as e-commerce services, education services, legal services, medical services, conference services, social networking services, financial product services, logistics services, and navigation services.
[0267] By employing the embodiments of this application, the inference service request processing system effectively improves the inference performance of the inference service system, thereby achieving the technical effects of shortening the inference response time, improving the performance and accuracy of inference services, and increasing the utilization of video memory. This solves the technical problem of low inference performance in key-value caching schemes in related technologies.
[0268] It should be noted that the preferred implementation of this embodiment can be found in the relevant descriptions in the embodiments, and will not be repeated here.
[0269] According to embodiments of this application, the following are also provided: Figure 11 The example shown is a reasoning service request processing system. Figure 11 This is a schematic diagram of the structure of another inference service request processing system according to an embodiment of this application, such as... Figure 11 As shown, the system includes:
[0270] Configure the controller to obtain the initial cache configuration parameters, adjust the initial cache configuration parameters according to the hardware environment of the inference server to obtain the target cache configuration parameters, and pass the target cache configuration parameters to the inference server.
[0271] The inference server is used to determine the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture, generate and predict the term data corresponding to the inference service request based on the key-value cache content, and generate the inference service response corresponding to the inference service request using the term data. The preset multi-level caching architecture stores the key-value cache corresponding to multiple terms in a hierarchical manner according to the target cache configuration parameters, and the multiple terms are determined based on the inference service request.
[0272] In this embodiment of the application, the inference service request processing system includes a configuration controller and an inference server. The inference service request processing system is used to execute the inference service request processing method provided in this application. For details, please refer to the description of the foregoing embodiments, which will not be repeated here.
[0273] The reasoning service request processing method provided in this application embodiment can be applied, but is not limited to, to application scenarios involving reasoning services in fields such as e-commerce services, education services, legal services, medical services, conference services, social networking services, financial product services, logistics services, and navigation services.
[0274] By employing the embodiments of this application, the inference service request processing system effectively improves the inference performance of the inference service system, thereby achieving the technical effects of shortening the inference response time, improving the performance and accuracy of inference services, and increasing the utilization of video memory. This solves the technical problem of low inference performance in key-value caching schemes in related technologies.
[0275] It should be noted that the preferred implementation of this embodiment can be found in the relevant descriptions in the embodiments, and will not be repeated here.
[0276] According to an embodiment of this application, an apparatus embodiment for implementing the above-described inference service request processing method is also provided. Figure 12 This is a schematic diagram of the structure of a reasoning service request processing device according to an embodiment of this application, as shown below. Figure 12 As shown, the device includes:
[0277] The first acquisition module 1201 is used to acquire inference service requests;
[0278] The first determining module 1202 is used to determine the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture. The preset multi-level caching architecture stores the key-value cache corresponding to multiple words in a hierarchical manner according to the target cache configuration parameters. The multiple words are determined according to the inference service request.
[0279] The first prediction module 1203 is used to generate and predict the word metadata corresponding to the inference service request based on the key-value cache content.
[0280] The first generation module 1204 is used to generate the reasoning service response corresponding to the reasoning service request using the term data.
[0281] Optionally, the preset multi-level caching architecture includes: a video memory layer, a memory layer, a local disk layer, and a remote storage layer. The video memory layer is set as a level 1 cache in the target cache configuration parameters, the memory layer is set as a level 2 cache in the target cache configuration parameters, the local disk layer is set as a level 3 cache in the target cache configuration parameters, and the remote storage layer is set as a storage area that is enabled on demand in the target cache configuration parameters.
[0282] Optionally, the remote storage layer is mounted to the inference server using persistent storage declaration, where the inference server is a container deployed in a container orchestration cluster.
[0283] Optionally, the device further includes a receiving module for receiving target cache configuration parameters from a configuration controller, wherein the configuration controller adjusts the initial cache configuration parameters according to the hardware environment of the inference server to obtain the target cache configuration parameters, the initial cache configuration parameters being generated based on multiple key-value cache configuration description definitions, and the multiple key-value cache configuration description definitions being used to describe common parameter content and parameter rules from multiple dimensions.
[0284] Optionally, the multiple key-value cache configuration descriptions define one or more of the following: multi-level cache configuration, wherein the multi-level cache configuration is used to determine the cache levels included in the preset multi-level cache architecture, the technical parameters corresponding to the cache levels, and the functional characteristics corresponding to the cache levels; hybrid computation configuration, wherein the hybrid computation configuration is used to recalculate some of the multiple words when the number of multiple words meets the preset numerical conditions; dynamic adjustment configuration, wherein the dynamic adjustment configuration is used to determine multiple dynamic adjustment rules, and each of the multiple dynamic adjustment rules includes dynamic adjustment conditions and the execution actions corresponding to the dynamic adjustment conditions.
[0285] Optionally, the device further includes: a caching module for acquiring key-value caches corresponding to multiple lexical units; determining a target storage mode based on target cache configuration parameters, wherein the target storage mode includes one of the following: local storage mode, remote storage mode, and hybrid storage mode; and performing hierarchical storage of the key-value caches corresponding to multiple lexical units according to the target storage mode.
[0286] Optionally, the aforementioned caching module is further configured to: in response to the target storage mode being a local storage mode, synchronously write the key-value cache corresponding to multiple words to the local storage layer of a preset multi-level caching architecture, wherein the local storage layer includes: a video memory layer, a memory layer, and a local disk layer; in response to the target storage mode being a remote storage mode, synchronously or asynchronously write the key-value cache corresponding to multiple words to the remote storage layer of the preset multi-level caching architecture; in response to the target storage mode being a hybrid storage mode, synchronously write the key-value cache corresponding to multiple words to the local storage layer, and synchronously or asynchronously write the key-value cache corresponding to multiple words to the remote storage layer.
[0287] Optionally, the first determining module 1202 is further configured to: obtain the lexical sequence corresponding to the inference service request, wherein the lexical sequence includes: multiple lexical units; and, in response to meeting the preset generation conditions, adopt a bidirectional parallel key-value cache generation strategy to generate the key-value cache content corresponding to the lexical sequence.
[0288] Optionally, the preset generation conditions include: no word sequences are stored in the video memory layer, the memory layer, and the local disk layer, but word sequences are stored in the remote storage layer.
[0289] Optionally, the first determining module 1202 is further configured to: start from the first lexical in the lexical sequence, calculate the key-value cache corresponding to the starting part of the lexical sequence in a forward direction, and start from the last lexical in the lexical sequence, load the key-value cache corresponding to the last part of the lexical sequence from the remote storage layer in a reverse direction, until the key-value cache content corresponding to the lexical sequence is generated.
[0290] Optionally, the device further includes a loading module for preloading hotspot data into the memory layer, wherein the hotspot data is determined based on the access frequency of each word in a plurality of words.
[0291] By employing the embodiments of this application, an inference service request is obtained, and then the key-value cache content corresponding to the inference service request is determined based on a preset multi-level caching architecture. The preset multi-level caching architecture stores key-value caches corresponding to multiple terms hierarchically according to target cache configuration parameters. Multiple terms are determined based on the inference service request. Then, the terminology data corresponding to the inference service request is generated and predicted based on the key-value cache content. Finally, the inference service response corresponding to the inference service request is generated using the terminology data. This effectively improves the inference performance of the inference service system, thereby shortening the inference response time, improving inference service performance and inference accuracy, and simultaneously increasing the utilization of video memory. This solves the technical problem of low inference performance in key-value caching schemes in related technologies.
[0292] It should be noted that the first acquisition module 1201, the first determination module 1202, the first prediction module 1203, and the first generation module 1204 mentioned above correspond to steps S21 to S24 in the embodiments. The four modules and their corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the above embodiments. It should be noted that the above modules or units can be hardware or software components stored in memory and processed by one or more processors, and the above modules can also run in the server 10 provided in the embodiments.
[0293] According to an embodiment of this application, another apparatus embodiment for implementing the above-described inference service request processing method is also provided. Figure 13 This is a schematic diagram of another inference service request processing device according to an embodiment of this application, such as... Figure 13 As shown, the device includes:
[0294] The second acquisition module 1301 is used to acquire the initial cache configuration parameters;
[0295] The adjustment module 1302 is used to adjust the initial cache configuration parameters according to the hardware environment of the inference server to obtain the target cache configuration parameters;
[0296] The transmission module 1303 is used to transmit the target cache configuration parameters to the inference server. The inference server is used to determine the key-value cache content corresponding to the inference service request based on the preset multi-level cache architecture, generate and predict the word metadata corresponding to the inference service request based on the key-value cache content, and generate the inference service response corresponding to the inference service request using the word metadata. The preset multi-level cache architecture stores the key-value cache corresponding to multiple words in a hierarchical manner according to the target cache configuration parameters. The multiple words are determined based on the inference service request.
[0297] Optionally, the second acquisition module 1301 is further configured to: acquire multiple key-value cache configuration description definitions, wherein the multiple key-value cache configuration description definitions are used to describe general parameter content and parameter rules from multiple dimensions; and generate initial cache configuration parameters based on the multiple key-value cache configuration description definitions.
[0298] By adopting the embodiments of this application, initial cache configuration parameters are obtained, and then adjusted according to the hardware environment of the inference server to obtain target cache configuration parameters. These target cache configuration parameters are then transmitted to the inference server. The inference server determines the key-value cache content corresponding to the inference service request based on a preset multi-level cache architecture, generates and predicts the terminology data corresponding to the inference service request based on the key-value cache content, and generates the inference service response corresponding to the inference service request using the terminology data. The preset multi-level cache architecture stores the key-value cache corresponding to multiple terms hierarchically according to the target cache configuration parameters. Multiple terms are determined based on the inference service request, thereby effectively improving the inference performance of the inference service system. This achieves the technical effects of shortening inference response time, improving inference service performance and inference accuracy, and simultaneously improving the utilization of video memory, thus solving the technical problem of low inference performance in key-value caching schemes in related technologies.
[0299] It should be noted that the second acquisition module 1301, adjustment module 1302, and transmission module 1303 mentioned above correspond to steps S61 to S63 in the embodiments. The three modules and their corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the above embodiments. It should be noted that the above modules or units can be hardware or software components stored in memory and processed by one or more processors. The above modules can also run in the server 10 provided in the embodiments.
[0300] According to an embodiment of this application, another apparatus embodiment for implementing the above-described inference service request processing method is also provided. Figure 14 This is a schematic diagram of another inference service request processing device according to an embodiment of this application, such as... Figure 14 As shown, the device includes:
[0301] The third acquisition module 1401 is used to acquire inference service requests through the first application programming interface;
[0302] The first return module 1402 is used to return an inference service response through the second application programming interface; wherein the inference service response is generated according to the inference service request processing method described above.
[0303] By adopting the embodiments of this application, an inference service request is obtained through a first application programming interface (API), and an inference service response is returned through a second API. The inference service response is generated according to the inference service request processing method described above, thereby effectively improving the inference performance of the inference service system. This achieves the technical effects of shortening the inference response time, improving the inference service performance and inference accuracy, and improving the utilization of video memory. In this way, it solves the technical problem of low inference performance of key-value caching schemes in related technologies.
[0304] It should be noted that the third acquisition module 1401 and the first return module 1402 mentioned above correspond to steps S71 and S72 in the embodiments. The two modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the above embodiments. It should be noted that the above modules or units can be hardware components or software components stored in memory and processed by one or more processors. The above modules can also run in the server 10 provided in the embodiments.
[0305] According to an embodiment of this application, another apparatus embodiment for implementing the above-described inference service request processing method is also provided. Figure 15 This is a schematic diagram of another inference service request processing device according to an embodiment of this application, such as... Figure 15 As shown, the device includes:
[0306] The fourth acquisition module 1501 is used to acquire the current input inference service request;
[0307] The second return module 1502 is used to respond to the inference service request and return the inference service response;
[0308] The display module 1503 is used to display the inference service response within the graphical user interface; wherein the inference service response is generated according to the inference service request processing method described above.
[0309] By employing the embodiments of this application, the currently input inference service request is obtained, and then an inference service response is returned in response to the inference service request. The inference service response is then displayed in the graphical user interface. The inference service response is generated according to the inference service request processing method described above, thereby effectively improving the inference performance of the inference service system. This achieves the technical effects of shortening the inference response time, improving the inference service performance and inference accuracy, and improving the utilization of video memory. In this way, the technical problem of low inference performance of key-value caching schemes in related technologies is solved.
[0310] It should be noted that the fourth acquisition module 1501, the second return module 1502, and the display module 1503 mentioned above correspond to steps S81 to S83 in the embodiments. The three modules and their corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the above embodiments. It should be noted that the above modules or units can be hardware or software components stored in memory and processed by one or more processors. The above modules can also run in the server 10 provided in the embodiments.
[0311] According to an embodiment of this application, another apparatus embodiment for implementing the above-described inference service request processing method is also provided. Figure 16 This is a schematic diagram of another inference service request processing device according to an embodiment of this application, such as... Figure 16 As shown, the device includes:
[0312] The first display module 1601 is used to respond to input commands applied to the operation interface and display the inference service request on the operation interface.
[0313] The second display module 1602 is used to respond to processing instructions applied to the operation interface and display the inference service response on the operation interface; wherein the inference service response is generated according to the inference service request processing method described above.
[0314] By adopting the embodiments of this application, inference service requests are displayed on the operation interface in response to input commands applied to the operation interface, and inference service responses are displayed on the operation interface in response to processing commands applied to the operation interface. The inference service responses are generated according to the above-described inference service request processing method, thereby effectively improving the inference performance of the inference service system. This achieves the technical effects of shortening inference response time, improving inference service performance and inference accuracy, and improving the utilization of video memory, thus solving the technical problem of low inference performance of key-value caching schemes in related technologies.
[0315] It should be noted that the first display module 1601 and the second display module 1602 mentioned above correspond to steps S91 and S92 in the embodiments. The two modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the above embodiments. It should be noted that the above modules or units can be hardware components or software components stored in memory and processed by one or more processors. The above modules can also run in the server 10 provided in the embodiments.
[0316] It should be noted that the preferred implementation schemes involved in the above embodiments of this application are the same as the schemes, application scenarios and implementation processes provided in the embodiments, but are not limited to the schemes provided in the embodiments.
[0317] Embodiments of this application may provide a computing device. Figure 17 This is a structural block diagram of a computing device according to an embodiment of this application. Figure 17 As shown, the computing device A may include one or more ( Figure 17 (Only one is shown) processor 1702, memory 1704, memory controller, and peripheral interface, wherein the peripheral interface may connect to radio frequency module, audio module, display screen, etc., which are not limited here.
[0318] The aforementioned computing device A can be understood as an integrated smart terminal, including but not limited to servers, desktop computers, PCs (Personal Computers), all-in-one model machines, etc., and the computing device may have the model described in the above embodiments of this application pre-installed.
[0319] Specifically, computing device A can pre-install various types of models, including but not limited to models in natural language processing, visual processing, speech processing, code processing, and multimodal task processing, thus providing diverse model selection. In different product forms, computing device A can support one or more model usage methods, including but not limited to model training, model invocation, model fine-tuning, model deployment, model inference, and application. In some product forms, computing device A also supports model management, including but not limited to multi-type model management (supporting the management of discriminative, generative, and other model types), model version control (supporting the control of different model versions), and model evaluation (evaluating model performance and effectiveness based on model evaluation tools). In other product forms, computing device A can also create applications based on models, providing API calling capabilities, allowing models to be called into created applications through API interfaces, and providing application management tools for application management and monitoring.
[0320] Furthermore, the computing device A can also include data management (supporting the creation and management of model tuning datasets), a training center (providing abundant training resources to help users learn and master AI technology), and basic control capabilities (providing enterprise-level basic control capabilities to ensure the security and efficient operation of the system). Through the above functions, it provides a comprehensive and integrated device for AI development, training, deployment, and application.
[0321] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the methods in the above embodiments. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0322] The processor can invoke an executable program stored in memory via a transmission device to execute the method described in any of the above embodiments.
[0323] Those skilled in the art will understand that, Figure 17 The structure shown is for illustrative purposes only; computing device A can also be a smartphone, tablet, PDA, mobile internet device (MID), PAD, or other terminal device. Figure 17 This does not limit the structure of the aforementioned computing device. For example, computing device A may also include components that are more advanced than those described above. Figure 17 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same as the Figure 17 The different configurations shown.
[0324] Embodiments of this application may provide an electronic device. Figure 18 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 18 As shown, the electronic device may include: an input / output device 182; a memory 184; and a processor 186, wherein the processor 186 is connected to the input / output device 182 and the memory 184 via a bus 188.
[0325] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the methods in the above embodiments. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0326] The processor can invoke an executable program stored in memory via a transmission device to execute the method described in any of the above embodiments.
[0327] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0328] Embodiments of this application also provide a computer-readable storage medium. Optionally, in this embodiment, the aforementioned computer-readable storage medium can be used to store the program code executed by the inference service request processing method provided in the above embodiments.
[0329] Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0330] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements any of the above-described inference service request processing methods.
[0331] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0332] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0333] The units described as separate components may or may not be physically separate. 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 units can be selected to achieve the purpose of this embodiment according to actual needs.
[0334] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0335] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0336] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for processing inference service requests, characterized in that, include: Request inference service; The key-value cache content corresponding to the inference service request is determined based on a preset multi-level caching architecture, wherein the preset multi-level caching architecture stores the key-value cache corresponding to multiple words in a hierarchical manner according to the target cache configuration parameters, and the multiple words are determined according to the inference service request; Generate and predict the terminology data corresponding to the inference service request based on the key-value cache content; The inference service response corresponding to the inference service request is generated using the terminology data.
2. The reasoning service request processing method according to claim 1, characterized in that, The preset multi-level caching architecture includes: a video memory layer, a memory layer, a local disk layer, and a remote storage layer. The video memory layer is set as a level 1 cache in the target cache configuration parameters, the memory layer is set as a level 2 cache in the target cache configuration parameters, the local disk layer is set as a level 3 cache in the target cache configuration parameters, and the remote storage layer is set as an on-demand storage area in the target cache configuration parameters.
3. The reasoning service request processing method according to claim 2, characterized in that, The remote storage layer is mounted to the inference server using a persistent storage declaration method, wherein the inference server is a container deployed in a container orchestration cluster.
4. The reasoning service request processing method according to claim 1, characterized in that, The inference service request processing method further includes: The system receives the target cache configuration parameters from the configuration controller, wherein the configuration controller is used to adjust the initial cache configuration parameters according to the hardware environment of the inference server to obtain the target cache configuration parameters. The initial cache configuration parameters are generated based on multiple key-value cache configuration description definitions, which are used to describe common parameter content and parameter rules from multiple dimensions.
5. The reasoning service request processing method according to claim 4, characterized in that, The multiple key-value cache configuration descriptions define one or more of the following: Multi-level cache configuration, wherein the multi-level cache configuration is used to determine the cache levels included in the preset multi-level cache architecture, the technical parameters corresponding to the cache levels, and the functional characteristics corresponding to the cache levels; A hybrid computing configuration is used to recalculate some of the multiple word elements when the number of multiple word elements meets a preset numerical condition. The configuration is dynamically adjusted, wherein the dynamic adjustment configuration is used to determine multiple dynamic adjustment rules, each of which includes a dynamic adjustment condition and an execution action corresponding to the dynamic adjustment condition.
6. The reasoning service request processing method according to claim 1, characterized in that, The inference service request processing method further includes: Retrieve the key-value cache corresponding to the multiple lexical units; The target storage mode is determined based on the target cache configuration parameters, wherein the target storage mode includes one of the following: local storage mode, remote storage mode, and hybrid storage mode; The key-value caches corresponding to the multiple lexical units are stored hierarchically according to the target storage mode.
7. The reasoning service request processing method according to claim 6, characterized in that, Hierarchical storage of the key-value cache corresponding to the multiple lexical units according to the target storage mode includes: In response to the target storage mode being the local storage mode, the key-value cache corresponding to the multiple lexical units is synchronously written to the local storage layer of the preset multi-level cache architecture, wherein the local storage layer includes: a video memory layer, a memory layer, and a local disk layer; In response to the target storage mode being the remote storage mode, the key-value cache corresponding to the multiple lexical units is synchronously or asynchronously remotely written to the remote storage layer of the preset multi-level cache architecture; In response to the target storage mode being the hybrid storage mode, the key-value cache corresponding to the plurality of lexical units is synchronously written to the local storage layer, and the key-value cache corresponding to the plurality of lexical units is synchronously or asynchronously remotely written to the remote storage layer.
8. The reasoning service request processing method according to claim 2, characterized in that, Based on a preset multi-level caching architecture, the key-value cache content corresponding to the inference service request includes: Obtain the lexical sequence corresponding to the inference service request, wherein the lexical sequence includes: the plurality of lexical units; In response to meeting the preset generation conditions, a bidirectional parallel key-value caching generation strategy is adopted to generate the key-value cache content corresponding to the word sequence.
9. The reasoning service request processing method according to claim 8, characterized in that, The preset generation conditions include: The lexical sequence is not stored in the video memory layer, the main memory layer, or the local disk layer, but it is stored in the remote storage layer.
10. The reasoning service request processing method according to claim 8, characterized in that, The key-value cache content corresponding to the lexical sequence is generated using the bidirectional parallelized key-value cache generation strategy, including: Starting from the first lexical unit of the lexical sequence, the key-value cache corresponding to the beginning part of the lexical sequence is calculated in a forward manner, and starting from the last lexical unit of the lexical sequence, the key-value cache corresponding to the end part of the lexical sequence is loaded in reverse from the remote storage layer, until the key-value cache content corresponding to the lexical sequence is generated.
11. The reasoning service request processing method according to claim 2, characterized in that, The inference service request processing method further includes: Hotspot data is preloaded into the memory layer, wherein the hotspot data is determined based on the access frequency of each word in the plurality of words.
12. A method for processing inference service requests, characterized in that, include: Get the initial cache configuration parameters; The initial cache configuration parameters are adjusted based on the hardware environment of the inference server to obtain the target cache configuration parameters; The target cache configuration parameters are passed to the inference server; The inference server is configured to determine the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture, generate and predict the lexical data corresponding to the inference service request based on the key-value cache content, and generate the inference service response corresponding to the inference service request using the lexical data. The preset multi-level caching architecture stores the key-value cache corresponding to multiple lexicals hierarchically according to the target cache configuration parameters, and the multiple lexicals are determined based on the inference service request.
13. The reasoning service request processing method according to claim 12, characterized in that, Obtaining the initial cache configuration parameters includes: Obtain multiple key-value cache configuration description definitions, wherein the multiple key-value cache configuration description definitions are used to describe common parameter content and parameter rules from multiple dimensions; The initial cache configuration parameters are generated based on the multiple key-value cache configuration descriptions.
14. A method for processing inference service requests, characterized in that, include: Obtain the inference service request through the first application programming interface; The inference service response is returned via the second application programming interface; The inference service response is generated according to the inference service request processing method described in any one of claims 1 to 13.
15. A method for processing inference service requests, characterized in that, include: Get the inference service request for the current input; In response to the inference service request, return an inference service response; The inference service response is displayed within the graphical user interface; The inference service response is generated according to the inference service request processing method described in any one of claims 1 to 13.
16. A method for processing inference service requests, characterized in that, include: In response to input commands applied to the user interface, display an inference service request on the user interface; In response to the processing instructions applied to the operation interface, the inference service response is displayed on the operation interface; The inference service response is generated according to the inference service request processing method described in any one of claims 1 to 13.
17. A reasoning service request processing system, characterized in that, include: The client is used to send inference service requests; The server, connected to the client, is configured to determine the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture, generate and predict the lexical data corresponding to the inference service request based on the key-value cache content, and generate the inference service response corresponding to the inference service request using the lexical data. The preset multi-level caching architecture stores the key-value cache corresponding to multiple lexical elements in a hierarchical manner according to the target cache configuration parameters, and the multiple lexical elements are determined based on the inference service request. The client is also used to output the inference service response.
18. A reasoning service request processing system, characterized in that, include: The configuration controller is used to obtain initial cache configuration parameters, adjust the initial cache configuration parameters according to the hardware environment of the inference server to obtain target cache configuration parameters, and transmit the target cache configuration parameters to the inference server. The inference server is configured to determine the key-value cache content corresponding to the inference service request based on a preset multi-level caching architecture, generate and predict the lexical data corresponding to the inference service request based on the key-value cache content, and generate the inference service response corresponding to the inference service request using the lexical data. The preset multi-level caching architecture stores the key-value cache corresponding to multiple lexicals hierarchically according to the target cache configuration parameters, and the multiple lexicals are determined based on the inference service request.
19. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, executes the inference service request processing method according to any one of claims 1 to 16.
20. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device containing the computer-readable storage medium to perform the inference service request processing method according to any one of claims 1 to 16.
21. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the inference service request processing method according to any one of claims 1 to 16.
