AI model arrangement method, device, electronic device and medium

Through the combination method of finite state machine and rule engine, the stability and reliability problems of AI model orchestration in complex data processing and multi-task scenarios are solved, and flexible and highly controllable AI model orchestration is achieved, which is suitable for complex applications. Business processes and high-concurrency scenarios.

CN117519850BActive Publication Date: 2024-10-29JIANGSU HOPERUN SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311795934.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-22
Publication Date
2024-10-29
Estimated Expiration
2043-12-22

AI Technical Summary

Technical Problem

Existing AI model orchestration methods cannot dynamically process complex and diverse data and adapt to different task scenarios, resulting in insufficient system stability and reliability, increasing development and maintenance complexity, reducing model interpretability, and causing processing problems in high concurrency scenarios. Delay.

Method used

Adopting a combination method of finite state machine and rule engine, by initializing and instantiating the finite state machine and rule engine, defining tasks, states and rules, processing external input data, dynamically routing execution results, and updating state machine status to achieve flexibility and controllability AI model orchestration.

Benefits of technology

It improves the flexibility, explainability and controllability of the system, enhances real-time decision-making capabilities, is suitable for complex business processes and high-concurrency scenarios, and improves the adaptability and fault tolerance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117519850B_ABST
    Figure CN117519850B_ABST
Patent Text Reader

Abstract

The present application discloses an AI model arrangement method, device, electronic device and medium, which relates to the field of artificial intelligence technology. The method includes: respectively initializing a finite state machine and a rule engine; respectively instantiating a finite state machine and a rule engine; receiving external input data; the rule engine executes rules according to the initialized configuration and sends the execution result to the finite state machine; the finite state machine executes corresponding state transitions and actions according to the initialized configuration and calls a specific AI model; and updating the state of the finite state machine according to the processing result of the AI ​​model. The present application has the effects of enhancing flexibility and interpretability, being highly controllable and manageable, and being able to make decisions and respond in real time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to an AI model compilation method, device, electronic device and medium. Background Art

[0002] AI model orchestration refers to the process of combining different AI models to achieve more complex tasks or improve overall performance. Model orchestration allows researchers and engineers to make full use of various models, algorithms, and data to achieve better performance and adaptability. Meet the needs of more powerful and versatile AI systems to cope with the growing complexity of data and tasks. Model integration, model fusion, and model stacking are currently common technologies and methods for AI model orchestration. The above methods are usually based on fixed rules and templates, and engineers hard-code to complete the model combination. This approach has the following disadvantages:

[0003] 1. Unable to dynamically process complex and diverse data, solve multimodal problems, or adapt to application scenarios of different tasks.

[0004] 2. Stability and reliability cannot be guaranteed.

[0005] 3. It involves the integration of multiple models, algorithms, and data sources, which increases the complexity of development, debugging, and maintenance.

[0006] 4. Model orchestration leads to more complex models, which reduces the interpretability of the models.

[0007] 5. The collaboration between different models may lead to more errors and problems, and the combination of models cannot be adjusted dynamically.

[0008] 6. Due to its bloated code structure, there is a significant delay in system processing and return in high concurrency scenarios.

[0009] These problems may make the system difficult to explain and maintain, increase the difficulty of development and maintenance, and may also cause integration errors and data inconsistencies.

[0010] Therefore, how to provide an AI model orchestration method is an urgent problem to be solved. Summary of the invention

[0011] In order to solve the above problems, the present application provides an AI model compilation method, device, electronic device and medium.

[0012] In a first aspect, the present application provides an AI model orchestration method, which is applied to an AI model orchestration system, wherein the system includes a rule engine and a finite state machine, and the method includes:

[0013] Initialize the finite state machine and rule engine respectively;

[0014] Instantiate the finite state machine and rule engine respectively;

[0015] Receive external input data;

[0016] The rule engine executes the rules according to the initialized configuration and sends the execution results to the finite state machine;

[0017] The finite state machine executes corresponding state transitions and actions according to the initialized configuration and calls a specific AI model;

[0018] According to the processing result of the AI ​​model, the state of the finite state machine is updated.

[0019] Optionally, the initialization method of the finite state machine includes:

[0020] Task identification: Define the tasks that the AI ​​model orchestrates, including inputs, outputs, and required decision and processing steps;

[0021] State definition: defines the states of the finite state machine, each state corresponds to a different operating state of the system or AI model;

[0022] State transition definition: define the transition relationship between states;

[0023] State transition action / event: Determine the event or condition that triggers the state transition;

[0024] Action / event-driven loading: defines the actions or operations performed for each state transition;

[0025] Data initialization: Initialize the data structure of the finite state machine.

[0026] Optionally, the initialization method of the rule engine includes:

[0027] Rule definition: define rules, each rule corresponds to the operation that needs to be performed under specific conditions;

[0028] Rule storage: Store the defined rules in the rule engine;

[0029] Rule engine configuration: configure the rule engine, including setting the parameters of the rule engine, loading the decision table, and specifying the rule file;

[0030] Input-driven loading: Initialize the data source for the rule engine to access data.

[0031] Optionally, the steps of defining the rule specifically include:

[0032] Define conditions and trigger events: define conditions for different modal data types to trigger actions in the rule engine;

[0033] Create rule sets: Create corresponding rule sets for each modal data type. Each rule includes a set of conditions and actions.

[0034] Set rule priorities: Set priorities for rules for different modal data and assign weights and priorities to different conditions and actions in the rule engine.

[0035] Optionally, the steps of respectively instantiating the finite state machine and the rule engine specifically include:

[0036] Instantiate the finite state machine according to the task and create a specific state machine object;

[0037] Create engine objects, load rules, and initialize the runtime environment.

[0038] Optionally, the step of the rule engine sending the execution result to the finite state machine specifically includes:

[0039] The rule engine dynamically routes the execution results to different state machine states through different data pipelines.

[0040] Optionally, the method further includes:

[0041] Determine whether the AI ​​model orchestration is completed;

[0042] If not finished, continue to wait for receiving external input data according to the configuration of the finite state machine;

[0043] If it ends, close the rule engine instance and state machine instance, and clean up resources.

[0044] In a second aspect, the present application provides an AI model orchestration device, which is applied to an AI model orchestration system, wherein the system includes a rule engine and a finite state machine, and the device includes:

[0045] An initialization unit, used to initialize the finite state machine and the rule engine respectively;

[0046] An instantiation unit, used to instantiate the finite state machine and the rule engine respectively;

[0047] An input receiving unit, used for receiving external input data;

[0048] A rule engine unit, used for the rule engine to execute rules according to the initialized configuration and send the execution result to the finite state machine;

[0049] The state machine unit is used for the finite state machine to perform corresponding state transitions and actions according to the initialization configuration, call a specific AI model, and update the state of the finite state machine according to the processing results of the AI ​​model.

[0050] In a third aspect, the present application provides an electronic device, including:

[0051] one or more processors;

[0052] Memory;

[0053] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method as described in the first aspect.

[0054] In a fourth aspect, the present application provides a computer-readable storage medium, in which a program code is stored. The program code can be called by a processor to execute the method described in the first aspect.

[0055] In summary, the present application includes at least one of the following beneficial technical effects:

[0056] 1. Flexibility and interpretability: The rule engine provides flexible definition of logical rules and conditions, making it applicable to a variety of tasks. The finite state machine provides visualization and clear definition of states and state transitions, enhancing the interpretability of the system. This combination makes the orchestration easier to understand, modify, and adjust.

[0057] 2. Highly controllable and manageable: The rule engine allows users to customize rules and conditions to meet specific needs, while the finite state machine provides a clear state control and transition mechanism. This enhances the controllability and manageability of the system and helps to meet specific business logic and rules.

[0058] 3. Real-time decision and response: This combined approach makes real-time decision and immediate response possible, because both the rule engine and the finite state machine have the ability to quickly execute rules and state transitions. This makes it suitable for tasks that require fast response, such as intelligent control systems and real-time monitoring.

[0059] 4. Applicable to complex business processes: The orchestration method based on rule engine and finite state machine is particularly suitable for complex business processes and workflows. It can define multi-level rules and state transitions to meet complex business logic requirements.

[0060] 5. Scalability: This combination approach can be relatively easily expanded to adapt to new rules and states, as well as to handle more complex tasks and scenarios. This increases the adaptability and scalability of the system.

[0061] 6. Fault handling and fault tolerance: The finite state machine provides clear control over the system state and a fault handling mechanism, while the rule engine can be used to define rules for dealing with different faults or abnormal situations. This makes the system more fault-tolerant and can better handle abnormal situations and fault recovery. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 It is a method flow chart of the AI ​​model orchestration method provided in an embodiment of the present application.

[0063] Figure 2 It is a logical diagram for implementing the AI ​​model orchestration method provided in the embodiment of the present application.

[0064] Figure 3 It is a functional module block diagram of the AI ​​model orchestration device provided in an embodiment of the present application.

[0065] Figure 4 This is a structural block diagram of an electronic device for executing the AI ​​model orchestration method according to an embodiment of the present application.

[0066] Figure 5 It is a structural block diagram of a computer-readable storage medium for storing or carrying program codes for implementing the AI ​​model orchestration method according to an embodiment of the present application.

[0067] Reference numerals:

[0068] Initialization unit 110; instantiation unit 120; input receiving unit 130; rule engine unit 140; state machine unit 150; electronic device 300; processor 310; memory 320; computer readable storage medium 400; program code 410. DETAILED DESCRIPTION

[0069] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0070] In the description of the embodiments of the present application, words such as "illustrative", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "illustrative", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "illustrative", "for example" or "for example" is intended to present related concepts in a specific way.

[0071] In the description of the embodiments of the present application, unless otherwise stated, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0072] The AI ​​model orchestration method provided in the embodiment of the present invention is applied to the AI ​​model orchestration system, which can create a system with flexibility, adaptability and strong decision-making ability through the integration of finite state machine and rule engine. This combination is particularly suitable for applications that require dynamic state management and complex rules, and can provide more control and decision-making capabilities while maintaining the maintainability and transparency of the system.

[0073] The AI ​​model arrangement method provided by the embodiment of the present invention is described in detail below. Figure 1 As shown, the method includes:

[0074] Step S101, respectively initialize the finite state machine and the rule engine.

[0075] Through the initialization steps, the configuration of the finite state machine and the rule engine is completed, and it is ensured that they can perform related operations in the correct running state later. For the finite state machine and the rule engine, the initialization actions are performed separately.

[0076] Specifically, the initialization method of the finite state machine includes:

[0077] Task identification: Define the tasks that the AI ​​model orchestrates, including inputs, outputs, and required decision and processing steps;

[0078] State definition: defines the states of the finite state machine, each state corresponds to a different operating state of the system or AI model;

[0079] State transition definition: define the transition relationship between states;

[0080] State transition action / event: Determine the event or condition that triggers the state transition;

[0081] Action / event-driven loading: defines the actions or operations performed for each state transition;

[0082] Data initialization: Initialize the data structure of the finite state machine.

[0083] Finite state machines are directly related to the specific arrangement of AI models, so it is necessary to define the tasks of AI model arrangement and clarify the input and output of the tasks. It is also necessary to clarify the decisions that need to be executed during the task and the corresponding processing steps.

[0084] The basic elements of a finite state machine mainly include: States: specific situations or behaviors that a system or program may be in. Transitions: conditions for going from one state to another, usually based on input judgment conditions. Actions: operations or behaviors performed during state transitions. During the initialization process, the states of the finite state machine must first be matched to the different operating states of the AI ​​model orchestration system or the AI ​​model. Then, based on the changing conditions between the different operating states of the AI ​​model orchestration system or the AI ​​model, the transition relationship between the states of the finite state machine is defined, that is, how the system responds to input or conditional triggers in different states is determined. Based on the determination of the transition relationship, the events or conditions that trigger state transitions are determined, and the actions or operations performed are defined for each state transition. Finally, data is transferred between states or internal states are maintained to ensure that the data structure of the state machine is properly initialized.

[0085] The above is the initialization process of the finite state machine.

[0086] The initialization method of the rule engine includes:

[0087] Rule definition: define rules, each rule corresponds to the operation that needs to be performed under specific conditions;

[0088] Rule storage: Store the defined rules in the rule engine;

[0089] Rule engine configuration: configure the rule engine, including setting the parameters of the rule engine, loading the decision table, and specifying the rule file;

[0090] Input-driven loading: Initialize the data source for the rule engine to access data. The data source includes databases, files, or APIs.

[0091] The steps of rule definition include:

[0092] Define conditions and trigger events: define conditions for different modal data types to trigger actions in the rule engine;

[0093] Create rule sets: Create corresponding rule sets for each modal data type. Each rule includes a set of conditions and actions.

[0094] Set rule priorities: Set priorities for rules for different modal data and assign weights and priorities to different conditions and actions in the rule engine.

[0095] External input data is usually multimodal data, so it is necessary to define corresponding trigger conditions for different modal data types. On the basis of defining the trigger conditions, a corresponding rule set is created for each modal data type. The rule set includes at least one rule, and each rule includes a set of conditions and operations. These rules can be rules for one type of modal data or cross-modal rules. Therefore, the conditions included in the rules can be trigger conditions corresponding to one type of modal data or for multiple different modal data types, that is, some conditions may require multiple modal data to cooperate in triggering. Based on the requirements of reasonable decision-making, it is also necessary to consider setting priorities for rules for different modal data, and assigning weights and priorities to different conditions and operations in the rule engine.

[0096] As a preferred implementation, it is also necessary to consider the handling of abnormal situations, and consider the handling method when no rule matches the input data. The method that can be adopted is to create a default rule to handle the unmatched situation, or provide a message to the user for feedback. This ensures that the rule engine is fault-tolerant and can handle incomplete matches or abnormal data.

[0097] On the basis of the above, it is also necessary to monitor and log the rule engine. During the operation of the rule engine, monitor the execution of rules and record the results of the execution. This helps with troubleshooting, performance analysis and rule optimization.

[0098] Through the above process, the initialization of the finite state machine and the rule engine is completed respectively. The following steps explain how to transfer the model during the AI ​​model orchestration process.

[0099] Step S102, instantiate the finite state machine and the rule engine respectively.

[0100] The specific operations are: instantiate the finite state machine according to the task, create a specific state machine object to generate a state machine instance; create an engine object, load rules, initialize the runtime environment, and generate a rule engine instance.

[0101] After instantiation, the state machine and rule engine are started. This is to set the finite state machine to the initial state and start the state machine. After the state machine is started, it will wait for events or inputs and execute corresponding state transitions and actions according to the defined state transition rules.

[0102] At the same time, the rule engine is started to be in an available state, including preheating the rule engine to improve the performance of rule execution.

[0103] Step S103, receiving external input data.

[0104] External input data is input in the form of multimodal data. Multimodal data refers to data that contains multiple different modes or forms. These data may involve text, images, audio, video and other types.

[0105] Step S104: the rule engine executes the rules according to the initialized configuration and sends the execution results to the finite state machine.

[0106] Based on the input data, the rule engine performs corresponding rule matching and operations according to the definition in the initialization process, and then determines the corresponding finite state machine state and sends the execution result data to the corresponding finite state machine.

[0107] Specifically, the rule engine dynamically routes the execution results to different state machine states through different data pipelines.

[0108] Step S105: The finite state machine executes corresponding state transitions and actions according to the initialized configuration and calls a specific AI model.

[0109] The execution result is used as the input / event of the finite state machine, and the corresponding state transition and action are performed according to the initialized configuration. This process involves calling each specific AI model. The state machine decides to call a specific AI model based on the configured state flow information and the information returned by the rule engine. The data is input into the called AI model, and the processing result of the AI ​​model is obtained.

[0110] Step S106, updating the state of the finite state machine according to the processing result of the AI ​​model.

[0111] Update the state of the finite state machine to reflect the new state of the system or model, according to the model logic.

[0112] After executing step S106, it is determined whether the AI ​​model arrangement is completed;

[0113] If it is not ended, according to the configuration of the finite state machine, continue to wait for receiving external input data; that is, jump to step S103, and during the execution of the entire AI model orchestration task, steps S103-S106 will be repeated multiple times.

[0114] If the task is completed, close the rule engine instance and state machine instance, and clean up resources. At the end of the model orchestration process, ensure that the rule engine instance and state machine instance are closed and necessary resource cleanup is performed to release resources and ensure system stability.

[0115] Figure 2The specific implementation logic of the AI ​​model orchestration method provided by an embodiment of the present invention is shown. When an external trigger is generated, the finite state machine determines that the state machine switches between different states based on the current state and the input event. For input events, a corresponding event memory is set to store input events. Specific business rules are stored in the rule memory of the rule engine. The input event and the business rules are matched by the matcher to perform specific operations.

[0116] The following is an AI model arrangement case for a large language model to illustrate the AI ​​model arrangement method of this embodiment:

[0117] 1. First, for the processing of multimodal data, create corresponding processing modules (different AI models) for each modality (image, voice, text) to handle different types of input, including:

[0118] a. Image processing module (image AI model):

[0119] Use image processing techniques, such as convolutional neural networks, to extract features, classify, or perform other analyses on images.

[0120] Generate processing results for image data, such as classification labels, object detection boxes, key features, etc.

[0121] b. Voice processing module (voice AI model):

[0122] Use speech processing technologies (such as natural language processing or audio processing algorithms) to process speech for text conversion, sentiment analysis, etc.

[0123] Generate processing results of speech data, such as text transcription, sentiment analysis results, etc.

[0124] c. Text processing module (text AI model):

[0125] Use natural language processing techniques to perform word segmentation, entity recognition, sentiment analysis, or other text analysis tasks on text.

[0126] Generate processing results for text data, such as keyword extraction, sentiment analysis results, etc.

[0127] 2. Design rule engine:

[0128] a. Define conditions and trigger events:

[0129] Define conditions for different modality data types to trigger actions in the rules engine.

[0130] b. Create a rule set:

[0131] Create a corresponding rule set for each modal data type. Each rule set should include a set of conditions and actions. Consider cross-modal rules, as some conditions may require data from multiple modalities to be triggered.

[0132] c. Set the priority of the rule:

[0133] Consider setting priorities for rules for different modal data. Assign weights and priorities to different conditions and actions in the rule engine to ensure reasonable decisions.

[0134] d. Improve exception handling:

[0135] Consider what to do when no rule matches the input data. You can create a default rule to handle the non-matching case or provide a message to the user. Make sure the rule engine is fault-tolerant and can handle incomplete matches or anomalous data.

[0136] e. Integrate the rule engine into the system.

[0137] f. Test and verify the rules engine:

[0138] Test the rules engine on real data to verify that it correctly triggers actions based on a variety of conditions and data types.

[0139] Simulation testing is performed to simulate input scenarios of different modal data types to ensure that the rule engine can adapt to various scenarios.

[0140] g. Update and maintain the rules engine:

[0141] The rule engine is updated regularly to adapt to new tasks, data, or requirements. The rule engine's rule collection is maintained to ensure that it remains accurate and applicable.

[0142] 3. Create a finite state machine:

[0143] a. Define the tasks and operations for each state, corresponding to different data processing programs and AI models.

[0144] b. Create state transition rules to describe the transition conditions from one state to another. This is where you can directly access the rule set of the rule engine.

[0145] c. Design the relationship between states, consider the relationship between states and the transition path. Determine the topology of the finite state machine to ensure smooth migration and logical correctness between states.

[0146] d. Integrate finite state machines into the system.

[0147] e. Start the state machine instance to ensure that the system can pass different modal data to the state machine and execute corresponding state transitions and tasks.

[0148] f. Test and Validate: Test the state machine on real data to ensure it handles multimodal data as expected.

[0149] Test cases are executed against input data of various modalities, both normal and abnormal conditions, to verify the robustness and correctness of the state machine.

[0150] In summary, the AI ​​model orchestration method provided in this embodiment effectively solves the following pain points:

[0151] 1. Flexibility and interpretability: The rule engine provides flexible definition of logical rules and conditions, making it applicable to a variety of tasks. The finite state machine provides visualization and clear definition of states and state transitions, enhancing the interpretability of the system. This combination makes the orchestration easier to understand, modify, and adjust.

[0152] 2. Highly controllable and manageable: The rule engine allows users to customize rules and conditions to meet specific needs, while the finite state machine provides a clear state control and transition mechanism. This enhances the controllability and manageability of the system and helps to meet specific business logic and rules.

[0153] 3. Real-time decision and response: This combined approach makes real-time decision and immediate response possible, because both the rule engine and the finite state machine have the ability to quickly execute rules and state transitions. This makes it suitable for tasks that require fast response, such as intelligent control systems and real-time monitoring.

[0154] 4. Applicable to complex business processes: The orchestration method based on rule engine and finite state machine is particularly suitable for complex business processes and workflows. It can define multi-level rules and state transitions to meet complex business logic requirements.

[0155] 5. Scalability: This combination approach can be relatively easily expanded to adapt to new rules and states, as well as to handle more complex tasks and scenarios. This increases the adaptability and scalability of the system.

[0156] 6. Fault handling and fault tolerance: The finite state machine provides clear control over the system state and a fault handling mechanism, while the rule engine can be used to define rules for dealing with different faults or abnormal situations. This makes the system more fault-tolerant and can better handle abnormal situations and fault recovery.

[0157] like Figure 3 As shown, the AI ​​model arrangement device provided by the embodiment of the present invention is applied to the AI ​​model arrangement system, the system includes a rule engine and a finite state machine, and the device includes:

[0158] An initialization unit 110, used to initialize the finite state machine and the rule engine respectively;

[0159] An instantiation unit 120, used to instantiate the finite state machine and the rule engine respectively;

[0160] An input receiving unit 130, used for receiving external input data;

[0161] A rule engine unit 140, configured for the rule engine to execute rules according to the initialized configuration and send the execution result to the finite state machine;

[0162] The state machine unit 150 is used for the finite state machine to perform corresponding state transitions and actions according to the initialized configuration, call a specific AI model, and update the state of the finite state machine according to the processing result of the AI ​​model.

[0163] The AI ​​model orchestration device provided in an embodiment of the present invention is used to implement the above-mentioned AI model orchestration method, so the specific implementation method is the same as the above-mentioned method and will not be repeated here.

[0164] like Figure 4 As shown, a structural block diagram of an electronic device 300 provided in an embodiment of the present invention. The electronic device 300 may be an electronic device 300 capable of running applications, such as a smart phone, a tablet computer, an e-book, etc. The electronic device 300 in the present application may include one or more of the following components: a processor 310, a memory 320, and one or more applications, wherein the one or more applications may be stored in the memory 320 and configured to be executed by one or more processors 310, and the one or more programs are configured to execute the method described in the aforementioned method embodiment.

[0165] The processor 310 may include one or more processing cores. The processor 310 uses various interfaces and lines to connect various parts of the entire electronic device 300, and executes various functions and processes data of the electronic device 300 by running or executing instructions, programs, code sets or instruction sets stored in the memory 320, and calling data stored in the memory 320. Optionally, the processor 310 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 310 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 310, but may be implemented separately through a communication chip.

[0166] The memory 320 may include a random access memory (RAM) or a read-only memory (ROM). The memory 320 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 320 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data created by the terminal during use (such as a phone book, audio and video data, chat record data), etc.

[0167] like Figure 5 FIG. 4 is a block diagram of a computer-readable storage medium 400 provided in an embodiment of the present invention. The computer-readable storage medium stores program code 410, which can be called by a processor to execute the method described in the above method embodiment.

[0168] The computer-readable storage medium 400 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium 400 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 400 has storage space for program codes 410 for executing any method steps in the above method. These program codes 410 may be read from or written to one or more computer program products. The program codes 410 may be compressed, for example, in a suitable form.

[0169] In several embodiments disclosed in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a module, a program segment or a part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0170] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0171] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0172] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure.

[0173] This application is intended to cover any variation, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art not described in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. An AI model arrangement method, characterized in that: Applied to an AI model orchestration system, the system includes a rule engine and a finite state machine, and the method includes: Initialize the finite state machine and rule engine respectively; Instantiate the finite state machine and rule engine respectively; Receiving external input data; the external input data is input in the form of multimodal data, and the multimodal data includes text, image, audio and video; The rule engine executes the rules according to the initialized configuration and sends the execution results to the finite state machine; The finite state machine executes corresponding state transitions and actions according to the initialized configuration and calls a specific AI model; According to the processing result of the AI ​​model, the state of the finite state machine is updated; The steps of respectively instantiating the finite state machine and the rule engine specifically include: Instantiate the finite state machine according to the task and create a specific state machine object; Create engine objects, load rules, and initialize the runtime environment; The initialization method of the finite state machine includes: Task identification: Define the tasks that the AI ​​model orchestrates, including inputs, outputs, and required decision and processing steps; State definition: defines the states of the finite state machine, each state corresponds to a different operating state of the system or AI model; State transition definition: define the transition relationship between states; State transition action / event: Determine the event or condition that triggers the state transition; Action / event-driven loading: defines the actions or operations performed for each state transition; Data initialization: Initialize the data structure of the finite state machine; The initialization method of the rule engine includes: Rule definition: define rules, each rule corresponds to the operation that needs to be performed under specific conditions; Rule storage: Store the defined rules in the rule engine; Rule engine configuration: configure the rule engine, including setting the parameters of the rule engine, loading the decision table, and specifying the rule file; Input-driven loading: Initialize the data source for the rule engine to access data; The steps defined by the rule specifically include: Define conditions and trigger events: define conditions for different modal data types to trigger actions in the rule engine; Create rule sets: Create corresponding rule sets for each modal data type. Each rule includes a set of conditions and actions. Set rule priorities: Set priorities for rules for different modal data and assign weights and priorities to different conditions and actions in the rule engine.

2. The AI ​​model arrangement method according to claim 1, characterized in that: The step of sending the execution result of the rule engine to the finite state machine specifically includes: The rule engine dynamically routes the execution results to different state machine states through different data pipelines.

3. The AI ​​model arrangement method according to any one of claims 1-2, characterized in that: The method further comprises: Determine whether the AI ​​model orchestration is completed; If not finished, continue to wait for receiving external input data according to the configuration of the finite state machine; If it ends, close the rule engine instance and state machine instance, and clean up resources.

4. An AI model arrangement device, characterized in that: Applied to an AI model orchestration system, the system includes a rule engine and a finite state machine, and the device includes: An initialization unit, used to initialize the finite state machine and the rule engine respectively; the initialization of the finite state machine includes: defining the tasks of the AI ​​model orchestration, including input, output, and required decision and processing steps; defining the states of the finite state machine, each state corresponding to a different operating state of the system or AI model; defining the conversion relationship between states; determining the events or conditions that trigger the state transition; defining the actions or operations performed by each state transition; and initializing the data structure of the finite state machine; The initialization of the rule engine includes: defining rules, each rule corresponds to the operation that needs to be performed under specific conditions; storing the defined rules in the rule engine; configuring the rule engine, including setting the parameters of the rule engine, loading the decision table, and specifying the rule file; initializing the data source for the rule engine to access data; The defined rules, each rule corresponding to the operation to be performed under specific conditions, specifically include: defining conditions for different modal data types to trigger operations in the rule engine; creating a corresponding rule set for each modal data type, each rule including a set of conditions and operations; setting priorities for rules of different modal data, and assigning weights and priorities to different conditions and operations in the rule engine; An instantiation unit, used to instantiate the finite state machine and the rule engine respectively; An input receiving unit, used to receive external input data; the external input data is input in the form of multimodal data, and the multimodal data includes text, image, audio and video; A rule engine unit, used for the rule engine to execute rules according to the initialized configuration and send the execution result to the finite state machine; A state machine unit, used for the finite state machine to perform corresponding state transitions and actions according to the initialization configuration, call a specific AI model; and update the state of the finite state machine according to the processing result of the AI ​​model; The steps of respectively instantiating the finite state machine and the rule engine specifically include: Instantiate the finite state machine according to the task and create a specific state machine object; Create engine objects, load rules, and initialize the runtime environment.

5. An electronic device, characterized in that: include: one or more processors; Memory; One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, and the program code can be called by a processor to execute the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Terminal access state monitoring method, device and system, electronic equipment and medium

    CN114363202A

  • Event-driven software system and method based on finite-state machine and rule engine

    CN116775170A