Cloud-native-based reinforcement learning pipeline method, system, device, and storage medium
By building a cloud-native-based reinforcement learning pipeline system, we solve the existing system development, debugging and deployment difficulties, achieve efficient distributed training and cloud-native deployment, improve the reliability and practicality of the system, and support multiple Machine-based large-scale training and inference.
Patent Information
- Application Number
- CN202210101566.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-27
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-01-27
AI Technical Summary
The existing reinforcement learning pipeline system has problems such as difficulty in development and debugging, difficulty in service deployment, excessive functional coupling, difficulty in adapting to new algorithms and new environments, high latency, and high operation and maintenance costs, and cannot effectively support full-process decision-making and analysis scenarios.
Adopt cloud-native methods to build a reinforcement learning pipeline system, including cloud-native storage systems, distributed frameworks, microservice paradigms, data serialization protocols, and visualization tools. By preprocessing data, interacting with reinforcement learning agents and environments, and building autonomous It has data sets, model inference services and log visualization to achieve full-process distributed training and cloud-native deployment.
It improves the reliability, simplicity and practicality of distributed training, loop operation and cloud native deployment in decision analysis scenarios, supports multi-machine large-scale training and inference, reduces operation and maintenance costs, and realizes the systematic construction of reinforcement learning pipelines. and management.
Smart Images

Figure CN114429210B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of reinforcement learning and relates to a cloud-native-based reinforcement learning pipeline method, system, device and storage medium. Background Art
[0002] With the continuous maturity of cloud-native technology and the continuous advancement of artificial intelligence technology, cloud-native applications have exploded like mushrooms after a spring rain. At the same time, decision-making intelligence has entered an era of rapid development. Reinforcement learning algorithms have transformed from small workshops to large-scale process forms, increasing the application scenarios of decision-making intelligence and releasing the potential value of emerging fields.
[0003] For AI applications, machine learning systems can be represented as end-to-end pipeline systems. End-to-end systems are based on a large number of data samples and models, directly connecting input and output. Pipeline systems are not just serial systems, but can also be distributed, parallel, and cyclic systems. AIOps can help AI applications quickly connect upstream and downstream, quickly deploy and conduct experiments, and has received widespread attention. After years of development and evolution, machine learning pipelines have become relatively mature, but there are still many problems with reinforcement learning pipelines.
[0004] Traditional reinforcement learning applications are mostly represented as point-to-point expert systems, consisting of specific simulation environments and matching reinforcement learning algorithms. The specific simulation environments have different requirements for the configuration and composition of the operating environment, and there is no unified access standard. It is difficult to develop and debug reinforcement learning algorithms, access new algorithms, and deploy services. The typical pipeline processing flow design has multiple stages, including various types of data storage, data preprocessing, feature engineering, algorithm selection, model storage, model deployment, etc. For reinforcement learning applications, there are several more stages, including the operation of reinforcement learning simulation environments, trajectory data caching, real-time viewing of operation results, and the need for simulation environments and algorithms to run and interact cyclically. In addition, service deployment is either local or distributed between local and cloud, facing the problems of elastic scaling difficulties and service migration difficulties. Therefore, it is necessary to study efficient, distributed, cloud-native reinforcement learning pipelines to support full-process decision analysis scenarios.
[0005] In view of the above requirements, the existing related work support is not perfect enough. SparkML pipeline is implemented based on Spark computing engine. It needs to convert data into RDD form before computing. You can use the machine learning algorithm in the built-in mllib library, or you can build various modules of data analysis tasks by yourself. There is less support for reinforcement learning. Ray, a distributed computing framework, implements Tune hyperparameter search library, RLlib reinforcement learning library, RaySGD distributed training library, and Serve elastic service library in its upper layer. Compared with SparkML, the framework is more complete and suitable for newcomers. It adapts to more mainstream reinforcement learning algorithms, but the framework has too many functional couplings and the encapsulation is too cumbersome. It is difficult to adapt to new algorithms and new environments. The framework itself does not connect the entire reinforcement learning process to form a complete pipeline system. The reinforcement learning library Tianshou is simple, modular, and has flexible interfaces, but it is only used as a reinforcement learning algorithm library. The workload of upstream and downstream services and cloud native deployment is large, and distributed adaptation needs to be implemented by itself. Apache Airflow has a relatively complete pipeline support, supports long-term task execution, has good process visualization, and can ensure that events are not lost and states are persistent. However, it is described in the form of a Python DAG directed acyclic graph, lacks loop capabilities, and has high latency and high operation and maintenance costs. In addition, other reinforcement learning pipeline systems are too focused on specific problems and cannot complete general decision analysis scenarios well. Summary of the invention
[0006] The purpose of the present invention is to solve the problems in the prior art and provide a cloud-native based reinforcement learning pipeline method, system, device and storage medium, which can improve the reliability, simplicity and practicality of distributed training, loop operation and cloud-native deployment in decision analysis scenarios by constructing a reinforcement learning pipeline.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] A cloud-native reinforcement learning pipeline method, including:
[0009] Build a cloud-native storage system based on the system framework and data serialization protocol;
[0010] Preprocess the original data set and store the preprocessed data set in the cloud native storage system;
[0011] Build reinforcement learning environment and reinforcement learning agent based on distributed framework;
[0012] Start the reinforcement learning agent to interact with the reinforcement learning environment, generate trajectory data, store it in the trajectory cache pool, build a reinforcement learning dataset, call the trajectory data in the trajectory cache pool, and update the reinforcement learning agent model;
[0013] Save the updated reinforcement learning agent model to the cloud-native storage system and build a model inference service;
[0014] Based on the training logs during the training process, visualization tools are applied to build log visualization microservices to provide real-time feedback on the agent training results and save the final results to the cloud-native storage system.
[0015] A further improvement of the present invention is:
[0016] Based on the system framework and data serialization protocol, a cloud-native storage system is built, specifically:
[0017] Based on Golang as the programming language, using the microservice framework Go-microv2, the web framework Gin, the RPC framework GRPC and the data serialization protocol Protobuf, it is written in the microservice paradigm to build a cloud-native storage system.
[0018] Preprocessing of the original data set includes:
[0019] Perform data cleaning, feature extraction, and feature indicator data analysis on the original data set, support exporting data in several formats, and then re-enter the cloud-native storage system for the processed data.
[0020] The reinforcement learning agent interacts with the reinforcement learning environment, calls the trajectory data in the trajectory cache pool, and updates the reinforcement learning agent model. Specifically:
[0021] Run several reinforcement learning environments to collect trajectory data and store it in the trajectory cache pool. The reinforcement learning agent is divided into the reinforcement learning agent Actor network and the reinforcement learning agent Learner network. The Learner network in the reinforcement learning agent samples data from the trajectory cache pool, updates the model parameters, and synchronizes the updated model parameters to the Actor network in the reinforcement learning agent. Each reinforcement learning agent Actor network interacts with several reinforcement learning environments.
[0022] Construct your own dataset for reinforcement learning. Specifically, set a scheduled task to regularly persist the trajectory data in the trajectory cache pool and store it in the memory cache database and cloud native storage system to form your own dataset for reinforcement learning.
[0023] It also includes the previous round of reinforcement learning’s own data set. The trajectory data in the previous round of reinforcement learning’s own data set is directly sent to the reinforcement learning stage for algorithm model training without starting the reinforcement learning environment.
[0024] Save the updated reinforcement learning agent model to the cloud-native storage system and build a model inference service. Specifically, develop a model inference service based on the RayServe framework of FastAPI and access the inference service by calling the API.
[0025] Based on the training logs during the training process, visualization tools are applied to build log visualization microservices to provide real-time feedback on the agent training results and save the final results to the cloud native storage system. Specifically:
[0026] Use the TensorBoard visualization tool to specify the training log output directory, update the training process in real time, and grasp the training change data; at the same time, after the training is completed, package and compress the training log output directory and upload it to the cloud native storage system for storage.
[0027] A cloud-native reinforcement learning pipeline system, including:
[0028] A first building module, wherein the first building module builds a cloud native storage system based on a system framework and a data serialization protocol;
[0029] A preprocessing module, which is used to preprocess the original data set and store the preprocessed data set in a cloud native storage system;
[0030] A second building module, wherein the second building module builds a reinforcement learning environment and a reinforcement learning agent based on a distributed framework;
[0031] An interaction module, which is used to start the interaction between the reinforcement learning agent and the reinforcement learning environment, generate trajectory data, store it in the trajectory cache pool, build a reinforcement learning data set, call the trajectory data in the trajectory cache pool, and update the reinforcement learning agent model;
[0032] An inference module, which is used to save the updated reinforcement learning agent model to a cloud-native storage system and build a model inference service;
[0033] A visualization module, which applies visualization tools based on the training logs during the training process, builds a log visualization microservice, provides real-time feedback on the agent training results, and saves the final results to a cloud-native storage system.
[0034] A terminal device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0035] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0036] Compared with the prior art, the present invention has the following beneficial effects:
[0037] The present invention preprocesses the original data set, exports data in several formats, and couples the reinforcement learning agent and the reinforcement learning environment to meet the interaction process of the reinforcement learning agent and the reinforcement learning environment. At the same time, they are distributedly packaged and can be expanded to multiple machines for large-scale training and reasoning. In addition, the reinforcement learning agent is updated by constructing its own data set for reinforcement learning, thereby improving the availability and reliability of the service. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0039] Figure 1 This is a flow chart of a cloud-native-based reinforcement learning pipeline method according to an embodiment of the present invention;
[0040] Figure 2 Schematic diagram of the overall framework of the cloud-native-based reinforcement learning pipeline method of an embodiment of the present invention;
[0041] Figure 3 An interactive schematic diagram of the steps of the reinforcement learning algorithm according to an embodiment of the present invention;
[0042] Figure 4 Schematic diagram of the overall structure of the cloud native storage system according to an embodiment of the present invention;
[0043] Figure 5 A schematic diagram of the execution flow of the cloud native storage system according to an embodiment of the present invention;
[0044] Figure 6 This is a structural diagram of a cloud-native reinforcement learning pipeline system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0046] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0048] In the description of the embodiments of the present invention, it should be noted that if the terms "upper", "lower", "horizontal", "inner", etc. indicate an orientation or positional relationship based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the product of the invention is usually placed when in use, it is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0049] In addition, if the term "horizontal" appears, it does not mean that the component must be absolutely horizontal, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical", which does not mean that the structure must be completely horizontal, but can be slightly tilted.
[0050] In the description of the embodiments of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal connection of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0051] The present invention is further described in detail below in conjunction with the accompanying drawings:
[0052] See also Figure 1 and Figure 2 The present invention discloses a cloud-native-based reinforcement learning pipeline method, comprising:
[0053] S101 builds a cloud-native storage system based on the system framework and data serialization protocol.
[0054] Based on Golang as the programming language, using the microservice framework Go-micro v2, the Web framework Gin, the RPC framework GRPC, and the data serialization protocol Protobuf, it is written in the microservice paradigm to build a cloud native storage system to ensure the high availability and high reliability of the system. The API interface is provided for access through the API gateway. The user management service is used to isolate user resources throughout the entire pipeline process. The user upload and download service is used for user data storage and download. The asynchronous upload, breakpoint resumption, and second upload functions are implemented for the file upload process, and the deployment of private cloud Ceph cluster storage and public cloud Alibaba Cloud OSS storage that meet the Amazon S3 object storage interface standard is realized.
[0055] S102: pre-process the original data set and store the pre-processed data set in a cloud native storage system.
[0056] Data preprocessing and feature engineering: Perform data cleaning, feature extraction, feature conversion and other operations on the original data set, normalize the data into a format that can be read by the reinforcement learning environment, such as csv, npy, etc., or directly send the trajectory data in the previous round of reinforcement learning's own data set to the reinforcement learning stage for algorithm model training without starting the reinforcement learning environment. According to the classification of reinforcement learning algorithms, there are Model-Base algorithms that require prior knowledge and Model-Free algorithms without data, so this step is optional. Encapsulate the data processing environment and scripts in Dockerfile, build a Docker image, and start the container to execute this step. The final processed data will be stored in the cloud native storage system through the API.
[0057] S103, builds reinforcement learning environment and reinforcement learning agent based on distributed framework.
[0058] Reinforcement learning stage: Use a distributed framework to encapsulate the reinforcement learning environment and the reinforcement learning agent as stateful tasks. The reinforcement learning environment can be encapsulated as a stateful task using the Ray framework to decouple the reinforcement learning environment from the reinforcement learning agent. In the pipeline, use the RayWorkflows framework to implement a cyclic interaction between the reinforcement learning environment and the reinforcement learning agent.
[0059] S104, start the reinforcement learning agent to interact with the reinforcement learning environment, generate trajectory data, store it in the trajectory cache pool, and build a reinforcement learning data set; call the trajectory data in the trajectory cache pool to update the reinforcement learning agent model.
[0060] Start several reinforcement learning environments to collect trajectory data, which will be collected into a unified memory data structure, namely the trajectory cache pool.
[0061] See also Figure 3 The Actor network in the reinforcement learning agent interacts with the reinforcement learning environment. It is responsible for selecting and returning actions from the action space after passing through the network model according to the state space of the environment. It is set that after every 40 rounds of interaction, the Learner network in the reinforcement learning agent samples data from the trajectory cache pool, calculates the loss, performs gradient descent, updates the model parameters, and synchronizes the updated model parameters to the Actor network in the reinforcement learning agent, and continues to interact with the environment until the set specific reward threshold is reached or the number of execution rounds ends.
[0062] Set up scheduled tasks to periodically persist the trajectory data in the trajectory cache pool and store it in the memory cache database and cloud native storage system to form a reinforcement learning dataset. Specifically:
[0063] The data in the trajectory cache pool will be synchronized regularly through the Celery scheduled task. Every 100 rounds of interaction, the data will be cached in the memory storage system Redis. Every 1000 rounds of interaction, the data will be packaged and compressed and uploaded to the cloud native storage system. After uploading the trajectory data to the storage cluster, the data can be constructed into a reinforcement learning data set. Without starting the reinforcement learning environment, model training and updates can also be performed based on the trajectory data to fine-tune the model.
[0064] The reinforcement learning environment can adapt to the OpenAIGym standard environment or a custom simulation environment, all of which are encapsulated in a Docker container. The reinforcement learning algorithm is mainly based on the deep reinforcement learning algorithm, so it involves neural network model training, which requires GPU computing support. NVIDIA's built-in Docker container is used for training, and the CPU version of the ordinary container is used for reasoning after the model is deployed. The entire reinforcement learning stage is based on Docker containerization, so multiple training can be started simultaneously, and finally the optimal model is selected as the final model based on the accuracy of the model.
[0065] S105, save the updated reinforcement learning agent model to the cloud native storage system and build a model reasoning service.
[0066] Model storage and deployment: The trained final model is saved to the local and cloud-native storage systems. At the same time, the model inference service is developed based on the RayServe framework of FastAPI and accessed by calling the API interface. The service supports microservice deployment and can be elastically expanded and reduced according to the access traffic.
[0067] S106, based on the training logs during the training process, applies visualization tools, builds log visualization microservices, provides real-time feedback on the agent training results, and saves the final results to the cloud native storage system.
[0068] Result storage and visualization: Use the TensorBoard visualization tool to specify the training log output directory, update the training process in real time, and grasp the training change data; at the same time, after the training is completed, package and compress the training log output directory and upload it to the cloud native storage system for storage.
[0069] Cloud native storage system: The cloud native storage system runs through the entire process of the reinforcement learning pipeline and is responsible for the storage of raw data, storage of preprocessed data, storage of data in the reinforcement learning trajectory cache pool, storage of algorithm models, and storage of training results and logs.
[0070] See also Figure 4, a six-layer design is designed from the bottom up. The first layer is Kubernetes and Docker based on cloud native technology, and all services and storage components are built on it; the second layer is to build a distributed object storage component, which is divided into private cloud and public cloud according to users' considerations for data security. Private cloud Ceph distributed object storage is built in Docker, which can make full use of the computing power on the storage nodes, calculate the storage location of each file when storing each data, and try to distribute the data evenly. Multi-copy isolated storage, built-in Hash algorithm, will not have single point failure problems, theoretically, nodes can be added and capacity can be expanded infinitely, and scalability is strong. At the same time, some data with low data security requirements can be stored on the public cloud OSS, and OSS can ensure the storage and efficient access of massive data. The third layer is the storage components that the system depends on, including the database MySQL, the cache database Redis, and the message queue RabbitMQ, all of which are deployed through Docker. MySQL is used to store the metadata of the file, and Redis is used to store the block metadata of the file. After the complete upload or breakpoint resuming is completed, the relevant information is deleted. RabbitMQ is used to implement asynchronous processing of the upload process, and the upload tasks are stored in the queue. Uploading one by one reduces the pressure of uploading massive data. It is also used as a queue for Celery scheduled tasks. The fourth layer is the service registration and discovery center Consul, which is used for microservice registration and node acquisition. Each microservice will register in this center. The fifth layer is the services provided, including user management services and file storage services. The user management service provides user registration and login functions, satisfies user authentication, and isolates data of different users. The file storage service provides upload and download interfaces. The sixth layer is the microservice gateway APIGW layer. As a microservice, it is developed using the Gin framework and provides an API interface to the outside. At the same time, it authenticates, limits and fuses the access to the API to reduce the probability of downtime of the backend service and maximizes availability and reliability.
[0071] See also Figure 5, the storage system user or the pipeline user logs in to the cloud native storage system, obtains the token as their own access credential, accesses the system through the API interface and the token credential, and obtains the actual running node of the microservice through the API gateway and the microservice registration and discovery center Consul. If you want to upload a file, you will access the upload service cluster, first upload the file to the local file system, and store the file's metadata in the MySQL database, divide the file into blocks according to the file size, and store the file block metadata in Redis, and then push the task of uploading the file to the cloud storage to the message queue RabbitMQ. The Worker actually responsible for uploading accepts the task in the queue for processing, updates the file metadata in the MySQL database and the file block metadata in Redis, and then calls the private cloud Ceph cluster or the public cloud Alibaba Cloud OSS object storage service that meets the AmazonS3 interface standard according to the data security selection, finally uploads the file, and then deletes the original local uploaded file and deletes the file block metadata in Redis to ensure the effective space in the Redis cluster of the local disk. If you want to download a file, after querying the file metadata through the MySQL database, you can directly access the storage service, that is, the private cloud Ceph cluster or the public cloud Alibaba Cloud OSS object storage service, obtain the file download link, and download the file.
[0072] The present invention implements a prototype system based on some existing reinforcement learning environments and algorithms. The reinforcement learning environment selects the OpenAI GymAtari environment without prior data, i.e., no data preprocessing and feature engineering steps, and the custom cloud computing resource scheduling environment CloudSimPy, which requires prior data, i.e., data preprocessing and feature engineering steps. The reinforcement learning algorithm selects the mainstream Deep Q Network (DQN), Policy Gradient (PG), Actor Critic (AC), Proximal Policy Optimization (PPO) four algorithms for experimental testing. The network model is developed using the Pytorch framework. The entire cloud-native-based reinforcement learning pipeline runs smoothly, and one-click start can visualize the observation and operation training process. The data is saved in the cloud-native storage system accurately and timely. Table 1 shows the pipeline operation results of different reinforcement learning algorithms and two reinforcement learning environments. As can be seen from the table, the present invention achieves the expected purpose of full-process management by using mainstream deep reinforcement learning algorithms in classic environments and custom environments. In summary, the experimental results prove the effectiveness of the present invention for the systematic construction and management of reinforcement learning pipelines, and verify the beneficial effects of the present invention.
[0073] Table 1 Statistics of the results of running the present invention on mainstream deep reinforcement learning algorithms based on classic environments and custom environments
[0074]
[0075] A cloud-native reinforcement learning pipeline method, including:
[0076] The main pipeline system is used to reasonably combine the pipeline process and reinforcement learning applications to achieve RLOps. Python is used as the programming language and the Ray Workflows tool is used to complete pipeline development. From input to output, it includes data preprocessing and feature engineering, reinforcement learning stage, model storage and deployment, result storage and visualization, as well as exception handling and distributed data storage throughout the entire process. In the pipeline, each step is provided as a microservice. At the same time, the completion of the microservice in the previous pipeline will trigger the next microservice to continue execution until the model inference service deployment and TensorBoard visualization service are started.
[0077] The cloud-native storage system, which is independent of the main pipeline system, runs through the entire process of the reinforcement learning pipeline and is responsible for the storage of raw data, pre-processed data, data in the reinforcement learning trajectory cache pool, algorithm model storage, training results, and logs. Using Golang as the programming language, the system is developed using the microservice framework Go-micro v2, the web framework Gin, the RPC framework GRPC, and the data serialization protocol Protobuf. It is written in the microservice paradigm to ensure the high availability and reliability of the system. The API gateway provides API interface access. The user management service is used for user resource isolation throughout the entire pipeline process. The user upload and download service is used for user data storage and download. The asynchronous upload, breakpoint resume, and second upload functions are implemented for the file upload process, and the deployment of private cloud Ceph cluster storage and public cloud Alibaba Cloud OSS storage that meet the Amazon S3 object storage interface standard is realized.
[0078] This paper takes the reinforcement learning pipeline as the research object, builds and runs applications with cloud native technology, gives full play to the elasticity and distributed advantages of cloud native technology, and builds a complete and general cloud native-based reinforcement learning pipeline, which has the following advantages:
[0079] First, we designed data preprocessing and feature engineering steps to meet the needs of Model-Base algorithms with prior data and Model-Free algorithms without data, and provided users with an API for data processing and feature engineering, supporting multiple formats. We proposed using trajectory data as the original data set for reinforcement learning on the Model-Free algorithm to accelerate the training of deep reinforcement learning models.
[0080] Second, we designed steps that can be run cyclically in the pipeline to decouple the reinforcement learning agent and the reinforcement learning environment, satisfy the interaction process between the reinforcement learning agent and the reinforcement learning environment, and at the same time, they are distributedly packaged separately, which can be expanded to multiple machines for large-scale training and reasoning.
[0081] Third, a cloud-native storage system was designed to meet the customized storage needs of private and public clouds, ensure data security, achieve resource isolation of user data, and provide asynchronous processing, instant upload, and breakpoint resume functions for file uploads. The API interface is managed through the API gateway, and authentication, circuit breaker, and current limiting functions are added to ensure high availability and reliability of the service.
[0082] Furthermore, through Python language development, the emerging framework RayWorkflows is used to implement the cyclic operation steps in the pipeline, control the continuous operation of the pipeline, complete the interaction process between the reinforcement learning environment and the reinforcement learning agent, and decouple them from each other, so that the reinforcement learning environment continuously collects trajectory data and the reinforcement learning agent continuously trains the model until the set goal is achieved. Encapsulating the trajectory data into a reinforcement learning data set reduces the huge consumption of start-stop resources in the environment, and the model can be trained based on the original trajectory data.
[0083] Furthermore, by microservice-izing each step of the pipeline, simplifying the complex, decentralizing governance, ensuring loose coupling between services and high cohesion within services, services can be independently built, deployed, and upgraded, achieving local updates, improving system fault tolerance, and reducing the probability of overall system crashes. A heterogeneous system of algorithm pipelines and data can be realized, which is cloud-based and elastic, manageable, and observable.
[0084] Furthermore, the cloud-native storage system was developed through the compiled Golang language and the related microservice framework Go-microv2, the web framework Gin, and the service registration and discovery center Consul, which met the requirements of high cohesion and low coupling of the system, guaranteed performance, and high concurrency of the interface. Within the system, the communication between components adopts the efficient RPC method, using the cross-platform and cross-language Protobuf data serialization protocol, which has faster serialization efficiency, smaller size, and greater security.
[0085] Furthermore, all components of the pipeline run in containers. Storage components, such as database MySQL, cache database Redis, message queue RabbitMQ, private cloud object storage cluster Ceph, service registration and discovery center Consul, etc., involve data state changes, and directly use Docker images to start and stop containers. The remaining pipeline steps, user management services, file upload and download services, and API gateway services are all orchestrated and elastically deployed through Kubernetes to achieve flexible expansion and contraction.
[0086] See also Figure 6 The present invention discloses a cloud-native-based reinforcement learning pipeline system, comprising:
[0087] A first building module, wherein the first building module builds a cloud native storage system based on a system framework and a data serialization protocol;
[0088] A preprocessing module, which is used to preprocess the original data set and store the preprocessed data set in a cloud native storage system;
[0089] A second building module, wherein the second building module builds a reinforcement learning environment and a reinforcement learning agent based on a distributed framework;
[0090] An interaction module, which is used to start the interaction between the reinforcement learning agent and the reinforcement learning environment, generate trajectory data, store it in the trajectory cache pool, build a reinforcement learning data set, call the trajectory data in the trajectory cache pool, and update the reinforcement learning agent model;
[0091] An inference module, which is used to save the updated reinforcement learning agent model to a cloud-native storage system and build a model inference service;
[0092] A visualization module, which applies visualization tools based on the training logs during the training process, builds a log visualization microservice, provides real-time feedback on the agent training results, and saves the final results to a cloud-native storage system.
[0093] A terminal device is provided in one embodiment of the present invention. The terminal device of this embodiment includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor executes the computer program, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0094] The computer program may be divided into one or more modules / units, and the one or more modules / units are stored in the memory and executed by the processor to accomplish the present invention.
[0095] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0096] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0097] The memory may be used to store the computer programs and / or modules, and the processor implements various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory.
[0098] If the module / unit integrated in the terminal device is implemented in the form of 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 present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0099] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A cloud-native reinforcement learning pipeline method, characterized in that: include: Build a cloud-native storage system based on the system framework and data serialization protocol; Preprocess the original data set and store the preprocessed data set in the cloud native storage system; Build reinforcement learning environment and reinforcement learning agent based on distributed framework; Start the reinforcement learning agent to interact with the reinforcement learning environment, generate trajectory data, store it in the trajectory cache pool, build a reinforcement learning dataset, call the trajectory data in the trajectory cache pool, and update the reinforcement learning agent model; Save the updated reinforcement learning agent model to the cloud-native storage system and build a model inference service; Based on the training logs during the training process, visualization tools are applied to build log visualization microservices to provide real-time feedback on the agent training results and save the final results to the cloud-native storage system.
2. The cloud-native based reinforcement learning pipeline method according to claim 1, characterized in that: The cloud native storage system is constructed based on the system framework and data serialization protocol, specifically: Based on Golang as the programming language, using the microservice framework Go-microv2, the web framework Gin, the RPC framework GRPC and the data serialization protocol Protobuf, it is written in the microservice paradigm to build a cloud-native storage system.
3. The cloud-native based reinforcement learning pipeline method according to claim 1, characterized in that: The preprocessing of the original data set includes: Perform data cleaning, feature extraction, and feature indicator data analysis on the original data set, support exporting data in several formats, and then re-enter the cloud-native storage system for the processed data.
4. The cloud-native based reinforcement learning pipeline method according to claim 1, characterized in that: The reinforcement learning agent interacts with the reinforcement learning environment, calls the trajectory data of the trajectory buffer pool, and updates the reinforcement learning agent model, specifically: Run several reinforcement learning environments to collect trajectory data and store it in the trajectory cache pool. The reinforcement learning agent is divided into the reinforcement learning agent Actor network and the reinforcement learning agent Learner network. The Learner network in the reinforcement learning agent samples data from the trajectory cache pool, updates the model parameters, and synchronizes the updated model parameters to the Actor network in the reinforcement learning agent. Each reinforcement learning agent Actor network interacts with several reinforcement learning environments.
5. The cloud-native based reinforcement learning pipeline method according to claim 1, characterized in that: The construction of the reinforcement learning own data set specifically includes: setting a scheduled task, regularly persisting the trajectory data in the trajectory cache pool, storing it in the memory cache database and the cloud native storage system, and forming the reinforcement learning own data set.
6. The cloud-native based reinforcement learning pipeline method according to claim 5, characterized in that: It also includes the previous round of reinforcement learning’s own data set. The trajectory data in the previous round of reinforcement learning’s own data set is directly sent to the reinforcement learning stage for algorithm model training without starting the reinforcement learning environment.
7. The cloud-native based reinforcement learning pipeline method according to claim 1, characterized in that: The updated reinforcement learning agent model is saved in the cloud native storage system, and a model inference service is constructed, specifically: a model inference service is developed based on the RayServe framework of FastAPI, and the inference service is accessed by calling an API; Based on the training logs in the training process, visualization tools are applied to build log visualization microservices, real-time feedback of agent training results is provided, and the final results are saved to the cloud native storage system. Specifically: Use the TensorBoard visualization tool to specify the training log output directory, update the training process in real time, and grasp the training change data; at the same time, after the training is completed, package and compress the training log output directory and upload it to the cloud native storage system for storage.
8. A cloud-native reinforcement learning pipeline system, characterized in that: include: A first building module, wherein the first building module builds a cloud native storage system based on a system framework and a data serialization protocol; A preprocessing module, which is used to preprocess the original data set and store the preprocessed data set in a cloud native storage system; A second building module, wherein the second building module builds a reinforcement learning environment and a reinforcement learning agent based on a distributed framework; An interaction module, which is used to start the interaction between the reinforcement learning agent and the reinforcement learning environment, generate trajectory data, store it in the trajectory cache pool, build a reinforcement learning data set, call the trajectory data in the trajectory cache pool, and update the reinforcement learning agent model; An inference module, which is used to save the updated reinforcement learning agent model to a cloud-native storage system and build a model inference service; A visualization module, which applies visualization tools based on the training logs during the training process, builds a log visualization microservice, provides real-time feedback on the agent training results, and saves the final results to a cloud-native storage system.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
