Interactive statement processing method based on target generative pre-training (GPT) model
By using the target generative pre-trained GPT model in the interactive system to analyze the intention of the user's interactive sentences and generate transformed interactive sentences, it solves the problem of the existing system's inability to accurately identify the user's implicit intentions and improves the interaction effect and intelligence.
Patent Information
- Application Number
- PCT/CN2024/088406
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-20
- Filing Date
- 2024-04-17
- Publication Date
- 2024-10-24
AI Technical Summary
The existing interactive system directly processes the interactive sentences input by the user, resulting in poor interaction effects, inability to accurately identify the user's implicit intentions, and lack of natural and considerate interaction methods and continuous interaction capabilities.
The goal-based generative pre-training GPT model is used to determine the domain of interactive sentences through the domain classification model, and when it does not belong to the preset domain, it parses the intent information, generates transformed interactive sentences for interactive processing, and improves the system's ability to understand and respond to user intentions. .
It improves the interactive system's ability to understand interactive sentences, achieves a more natural and considerate interaction method, enhances the system's intelligence and continuous interaction capabilities, and solves the problem of poor interaction effects.
Smart Images

Figure CN2024088406_24102024_PF_FP_ABST
Abstract
Description
Processing method of interactive sentences based on target-generated pre-trained GPT model
[0001] This disclosure claims priority to a Chinese patent application filed with the Patent Office of China on April 20, 2023, with application number 202310428886.9 and invention name “Method for processing interactive sentences based on target-generative pre-trained GPT model,” the entire contents of which are incorporated by reference into this disclosure. Technical Field
[0002] The present disclosure relates to the field of smart home technology, and more specifically, to a method and apparatus, system, storage medium, and electronic device for processing interactive statements based on a target-generative pre-trained GPT model. Background Art
[0003] With the advent of smart life, more and more users like to interact with interactive systems using interactive statements. However, in the existing methods, the interactive system interacts directly based on the interactive statements input by the user. However, in some cases, the interactive system cannot correctly recognize the user's interactive statements, and thus cannot make a correct response to the user's interactive statements.
[0004] In the related technologies, the interactive system directly processes the interaction according to the interactive statements, resulting in poor interaction effects. Currently, no effective solution has been proposed.
[0005] Therefore, it is necessary to improve the related technology to overcome the above-mentioned defects in the related technology.
[0006] Summary of the Invention
[0007] The embodiments of the present disclosure provide a method and device for processing interactive sentences based on a target-generative pre-trained GPT model, a storage medium, and an electronic device, so as to at least solve the problem that the interactive system directly performs interactive processing based on the interactive sentences, resulting in poor interactive effects.
[0008] According to one aspect of an embodiment of the present disclosure, a method for processing interaction sentences based on a target-generative pre-trained GPT model is provided, comprising: determining a domain classification result of an input original interaction sentence through a domain classification model, and determining whether the original interaction sentence belongs to a preset domain based on the domain classification result; when it is determined that the original interaction sentence does not belong to the preset domain, parsing the intent information of the original interaction sentence in the preset domain through the target-generative pre-trained GPT model, and generating a transformed interaction sentence according to the intent information; and performing interaction processing according to the transformed interaction sentence.
[0009] According to another aspect of an embodiment of the present disclosure, a device for processing interaction statements based on a target-generative pre-trained GPT model is also provided, including: a determination module, configured to determine the domain classification result of an input original interaction statement through a domain classification model, and determine whether the original interaction statement belongs to a preset domain based on the domain classification result; a generation module, configured to parse the intention information of the original interaction statement in the preset domain through the target-generative pre-trained GPT model when it is determined that the original interaction statement does not belong to the preset domain, and generate a transformed interaction statement based on the intention information; an interaction module, configured to perform interaction processing based on the transformed interaction statement.
[0010] According to another aspect of the embodiments of the present disclosure, a system for processing interactive statements based on a target-generative pre-trained GPT model is provided, including: a domain classification model, configured to perform domain classification on an input original interactive statement, and determine whether the original interactive statement belongs to a preset domain; a target-generative pre-trained GPT model, configured to parse the intention information of the original interactive statement in the preset domain when the original interactive statement does not belong to the preset domain, and generate a transformed interactive statement based on the intention information; and a dialogue engine, configured to perform interactive processing based on the transformed interactive statement.
[0011] According to another aspect of the embodiments of the present disclosure, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned method for processing interactive statements based on the target generative pre-trained GPT model at runtime.
[0012] According to another aspect of the embodiments of the present disclosure, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method for processing interactive statements based on the target generative pre-trained GPT model through the computer program.
[0013] According to another aspect of the embodiments of the present disclosure, a computer program product is also provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and the computer program is configured to execute the above-mentioned method for processing interactive statements based on the target generative pre-trained GPT model at runtime.
[0014] The present disclosure, when it is determined through the domain classification model that the original interaction sentence does not belong to the preset domain, uses the target generative pre-trained GPT model to parse the intention information of the original interaction sentence in the preset domain, and generates a transformed interaction sentence based on the intention information, and then performs interaction processing based on the transformed interaction sentence. The above technical solution enables the interaction system to mine the user's implicit intention, improves the interaction system's ability to understand the input interaction sentence, and then the interaction system can accurately respond accordingly, improve the interaction effect, and solve the problem that the interaction system directly performs interaction processing based on the interaction sentence, resulting in poor interaction effect. In addition, because the interaction system can mine the user's implicit intention and has a stronger ability to understand the interaction sentence, the interaction system can achieve a more natural and considerate interaction method based on the user's intention, and improve the intelligence of the interaction system; and because the interaction system more accurately identifies the user's implicit intention, the interaction system can actively continue or guide new topics, and then the interaction system has the ability to conduct continuous dialogue like between people, which makes the interaction experience in the field of human-computer interaction have a qualitative leap. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, are intended to explain the principles of the present disclosure.
[0016] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0017] FIG1 is a schematic diagram of a hardware environment for a method for processing interactive sentences based on a target-generated pre-trained GPT model according to an embodiment of the present disclosure;
[0018] FIG2 is a flowchart of a method for processing interactive sentences based on a target-generated pre-trained GPT model according to an embodiment of the present disclosure;
[0019] FIG3 is an overall framework diagram (I) of a method for processing interactive sentences based on a target-generative pre-trained GPT model according to an embodiment of the present disclosure;
[0020] FIG4( a ) is a schematic diagram of a preset domain according to an embodiment of the present disclosure;
[0021] FIG4( b ) is a schematic diagram of another preset area according to an embodiment of the present disclosure;
[0022] FIG5 is a schematic diagram of a process for generating a transformation interaction statement according to an embodiment of the present disclosure;
[0023] FIG6 is a schematic diagram of another process of generating a transformation interaction statement according to an embodiment of the present disclosure;
[0024] FIG7 is an overall framework diagram (II) of a method for processing interactive sentences based on a target-generated pre-trained GPT model according to an embodiment of the present disclosure;
[0025] FIG8 is a framework diagram of reinforcement learning according to an embodiment of the present disclosure;
[0026] FIG9 is a structural block diagram of a device for processing interactive sentences based on a target-generated pre-trained GPT model according to an embodiment of the present disclosure;
[0027] FIG10 is a structural block diagram of a system for processing interactive statements based on a target-generated pre-trained GPT model according to an embodiment of the present disclosure;
[0028] FIG11 is a structural block diagram of an optional electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the embodiments described are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present disclosure.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are set to distinguish similar objects, and are not necessarily set to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] According to one aspect of the embodiments of the present disclosure, a method for processing interactive sentences based on a target-generated pre-trained GPT model is provided. The method for processing interactive sentences based on the target-generated pre-trained GPT model should be widely set to smart home (Smart Home), smart home, smart home device ecology, smart home (IntelligenceHouse) ecology and other whole-house intelligent digital control application scenarios. Optionally, in this embodiment, the above-mentioned method for processing interactive sentences based on the target-generated pre-trained GPT model can be set to a hardware environment composed of a terminal device 102 and a server 104 as shown in Figure 1. As shown in Figure 1, the server 104 is connected to the terminal device 102 via a network, and can be set to provide services (such as application services, etc.) for the terminal or a client installed on the terminal, a database can be set on the server or independently of the server, and it is set to provide data storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server, and it is set to provide data computing services for the server 104.
[0032] The aforementioned network may include, but is not limited to, at least one of the following: a wired network and a wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: a wide area network, a metropolitan area network, and a local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity) and Bluetooth. The terminal device 102 may be, but is not limited to, a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing machine, a smart dishwasher, a smart projection device, a smart TV, a smart clothes drying rack, smart curtains, smart audio and video, a smart socket, a smart speaker, a smart fresh air device, smart kitchen and bathroom equipment, smart bathroom equipment, a smart sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purifier, a smart steamer, a smart microwave oven, a smart kitchen treasure, a smart purifier, a smart water dispenser, a smart door lock, etc.
[0033] To solve the above problems, a method for processing interactive sentences based on a target-generative pre-trained GPT model is provided in this embodiment, including but not limited to application in an interactive system (the interactive system includes but is not limited to being deployed in the above-mentioned terminal device 102). FIG2 is a flowchart of the method for processing interactive sentences based on a target-generative pre-trained GPT model according to an embodiment of the present disclosure. The process includes the following steps:
[0034] Step S202: determining a domain classification result of the input original interaction sentence through a domain classification model, and determining whether the original interaction sentence belongs to a preset domain based on the domain classification result;
[0035] As an optional example, the domain classification model is set to determine whether the original interaction statement belongs to the preset domain, that is, the domain classification model implements a binary classification, and the domain classification result is that the original interaction statement belongs to the preset domain or the original interaction statement does not belong to the preset domain.
[0036] As an optional example, the preset domain is the domain in which the interactive system is located (for example, the smart home domain, the smart car system domain, etc.). In some embodiments, the interactive system is a system for processing interactive statements based on a target-generative pre-trained GPT model, and the interactive system includes a dialogue engine.
[0037] In an exemplary embodiment, after the above step S202, the method further includes: when it is determined based on the field classification result that the original interaction statement belongs to the preset field, using the original interaction statement to perform interaction processing.
[0038] It should be noted that if the original interaction sentence itself belongs to the preset domain, the interactive system can accurately determine the user's intention and can accurately respond based on the original interaction sentence without inputting the original interaction sentence into the target GPT model.
[0039] Step S204: If it is determined that the original interaction sentence does not belong to the preset domain, the target generative pre-trained GPT model is used to parse the intention information of the original interaction sentence in the preset domain, and a transformed interaction sentence is generated according to the intention information;
[0040] As an optional example, the above-mentioned target-generative pre-trained GPT model is a GPT model corresponding to a preset domain, and then the target GPT model corresponding to the preset domain is used to parse the intent information of the original interaction sentence in the preset domain, and generate a transformed interaction sentence based on the intent information, which can improve the interactive system's ability to understand the original interaction sentence.
[0041] As an optional example, the existing general GPT model (including but not limited to the GPT4 model provided by Microsoft Azure Open AI, the Text-to-Text Transfer Transformer (T5) model and other conversational general large-scale text pre-training models) or the manufacturer's independently developed large-scale text pre-training model (a model trained using a large amount of data collected by the manufacturer's R&D personnel) can be fine-tuned to obtain the target GPT model corresponding to the preset field.
[0042] As an optional example, the target generative pre-training GPT (Generative Pre-Training) model can perform grammatical correction processing on the original interaction sentences in a preset domain to obtain weakly generalized sentences, or it can perform semantic expansion processing on the original interaction sentences in a preset domain to obtain strongly generalized sentences.
[0043] In an exemplary embodiment, after the above step S202, it also includes: when it is determined based on the field classification result that the original interaction statement belongs to the preset field, the intention information of the original interaction statement in the preset field is parsed through the target generative pre-trained GPT model, and a transformed interaction statement is generated according to the intention information.
[0044] It should be noted that in order to further improve the interactive system's ability to understand the original interactive sentences, when the original interactive sentences belong to a preset field, the target generative pre-trained GPT model can be used to parse the intention information of the original interactive sentences in the preset field, and generate transformed interactive sentences based on the intention information.
[0045] Step S206: performing interaction processing according to the transformed interaction statement.
[0046] In an exemplary embodiment, the above step S206 may be implemented in the following manner: when it is determined that the transformed interaction statement does not belong to the preset domain, the original interaction statement is used for interaction processing.
[0047] It should be noted that if the transformed interaction statement does not belong to the preset domain, it means that the interaction system cannot recognize the intention of the original interaction statement in the preset domain through the target GPT model. Then, based on the user's original expression, the interaction system directly uses the original interaction statement for interaction processing.
[0048] In an exemplary embodiment, the above step S206 may also be implemented in the following manner: when it is determined that the transformed interaction statement belongs to the preset domain, the transformed interaction statement is used to perform interaction processing.
[0049] It should be noted that if the transformed interaction statement belongs to the preset domain, it means that the target GPT model has identified the intention of the original interaction statement in the preset domain. In order to improve the interaction effect, the interactive system uses the transformed interaction statement for interaction processing.
[0050] It should be noted that, in the embodiment of the present disclosure, the domain classification model for determining whether the original interaction statement belongs to the preset domain and the domain classification model for determining whether the transformed interaction statement belongs to the preset domain can be, for example, the same domain classification model. For better understanding, the following is a specific description in conjunction with Figure 3. The original interaction statement is classified by a domain classifier (equivalent to the above-mentioned domain classification model) to obtain a domain classification result, and whether the original interaction statement belongs to the preset domain is determined based on the domain classification result. When it is determined that the original interaction statement belongs to the preset domain, the original interaction statement is directly input into the dialogue engine (the dialogue engine is located in the interactive system). When it is determined that the original interaction statement does not belong to the preset domain, the original interaction statement is input into the target GPT model to obtain the transformed interaction statement output by the target GPT model, and the domain classifier is continued to be used to perform domain classification on the transformed interaction statement. If the transformed interaction statement belongs to the preset domain, the transformed interaction statement is input into the dialogue engine. If the transformed interaction statement does not belong to the preset domain, the original interaction statement is input into the dialogue engine.
[0051] It should be noted that the interactive systems in related technologies that directly process interactions based on the user's original interactive statements have the following main problems:
[0052] 1. Lack of humanization: Current human-computer interaction systems simply search existing knowledge bases to understand user intent. However, when faced with complex, real-time, and deeply subjective interactive statements, they struggle to deeply understand user intent and effectively respond to user interactions.
[0053] 2. Lack of continuous interaction capabilities: Current human-computer interaction systems are unable to actively continue or guide new topics, making it impossible for current human-computer interaction systems to interact continuously like humans do;
[0054] 3. Low accuracy and low level of intelligence: The current human-computer interaction system is unable to tap into the user's implicit intentions, and is therefore unable to accurately understand the user's interaction statements, and is unable to achieve a natural and considerate interaction method.
[0055] In response to the above problems, the embodiment of the present disclosure uses the above steps to parse the intention information of the original interaction sentence in the preset domain through the target generative pre-trained GPT model when the domain classification model determines that the original interaction sentence does not belong to the preset domain, and generates a transformed interaction sentence based on the intention information, and then performs interaction processing based on the transformed interaction sentence. The above technical solution enables the interaction system to mine the user's implicit intention, improves the interaction system's ability to understand the input interaction sentence, and then the interaction system can accurately respond accordingly, solving the problem that the interaction system directly performs interaction processing based on the interaction sentence, resulting in poor interaction effect. In addition, because the interaction system can mine the user's implicit intention and has a stronger ability to understand the interaction sentence, the interaction system can achieve a more natural and intimate interaction method based on the user's intention, and improve the intelligence of the interaction system; and because the interaction system more accurately identifies the user's implicit intention, the interaction system can actively continue or guide new topics, and then the interaction system has the ability to conduct continuous dialogue like between people, which makes the interaction experience in the field of human-computer interaction have a qualitative leap.
[0056] In an exemplary embodiment, the preset domain includes N layers of sub-domains having a hierarchical relationship.
[0057] For a better understanding, as an optional example, as shown in Figure 4(a), when N is 3 and there are no parallel sub-domains in each layer, the N-layer sub-domains are: smart home domain (first layer), air conditioning domain (second layer), and temperature control domain (third layer). It should be noted that one sub-domain corresponds to one GPT model, and the next layer domain is the sub-domain of the corresponding previous layer domain.
[0058] As an optional example, when the preset domain includes N layers of sub-domains with a hierarchical relationship and there are no parallel sub-domains in each layer, the domain classification model corresponding to each layer of sub-domain is used to determine whether the interaction statement belongs to each layer of sub-domain. For example, the domain classification model corresponding to the air-conditioning domain is used to determine whether the interaction statement belongs to the air-conditioning domain, and the domain classification model corresponding to the temperature control domain is used to determine whether the interaction statement belongs to the temperature control domain.
[0059] As an optional example, as shown in Figure 4(b), when N is 3 and there are parallel sub-fields in each layer, the N-layer sub-fields are: smart home field (first layer), air conditioning field (second layer), refrigerator field (second layer), temperature control field (third layer)...freezing field (third layer)...
[0060] As an optional example, when the preset domain includes N hierarchical sub-domains, and each layer includes parallel sub-domains, whether the interaction statement belongs to each sub-domain is determined by the domain classification model corresponding to each sub-domain in each layer. For example, whether the interaction statement belongs to the air conditioning domain is determined by the domain classification model corresponding to the air conditioning domain, and whether the interaction statement belongs to the refrigerator domain is determined by the domain classification model corresponding to the refrigerator domain.
[0061] In some embodiments, the domain classification model corresponding to the air conditioning domain is different from the domain classification model corresponding to the refrigerator domain. The domain classification model corresponding to the air conditioning domain is only configured to determine whether the interaction statement belongs to the air conditioning domain, and the domain classification model corresponding to the refrigerator domain is only configured to determine whether the interaction statement belongs to the refrigerator domain. In an exemplary embodiment, the preset domain includes N layers of sub-domains with a hierarchical relationship, and each layer of the N layers of sub-domains corresponds to at least one GPT model, where N is a positive integer. The above step S204 is implemented by the following steps S11-S12:
[0062] Step S11: Processing the interaction sentence output by the preset layer or the original interaction sentence according to the GPT model corresponding to the sub-domain of the current layer to obtain the interaction sentence output by the current layer, wherein, when the current layer is the first layer, the interaction sentence output by the preset layer is the original interaction sentence;
[0063] As an optional example, when the current layer is the first layer, the original interaction sentence is processed according to the GPT model corresponding to the first layer sub-domain to obtain the interaction sentence output by the current layer. When the current layer is not the first layer, the interaction sentence output by the preset layer is processed according to the GPT model corresponding to the current layer sub-domain to obtain the interaction sentence output by the current layer.
[0064] As an optional example, the preset layer is the previous layer of the current branch, or any layer of other branches (including previous layers and subsequent layers). On a branch, each subsequent layer of sub-fields is a sub-field of any previous layer of sub-fields. For example, the smart home field (first layer), the air conditioning field (second layer), and the temperature control field (third layer) are one branch; the smart home field (first layer), the refrigerator field (second layer), and the freezing field (third layer) are another branch.
[0065] Step S12: Determine the transformed interaction statement according to the interaction statement output by the current layer and the level corresponding to the current layer.
[0066] In this embodiment, more refined and targeted corpus generalization is performed for the smart home field and its subcategories, so that after the interactive system obtains the user's interactive sentences, it can generalize layer by layer, thereby understanding the user's intentions at a deeper level, and then providing users with personalized recommendations and services, thereby improving the naturalness, convenience, and accuracy of user language interactions in the home field.
[0067] In an exemplary embodiment, the above step S12 includes step S121 and step S122:
[0068] Step S121: When the interaction sentence output by the current layer does not belong to the sub-domain of the current layer and the current layer is not the first layer, determining the interaction sentence output by the preset layer as the transformed interaction sentence, wherein the interaction sentence output by the preset layer belongs to the sub-domain of the preset layer;
[0069] It should be noted that if the interaction sentence output by the GPT model corresponding to the current layer does not belong to the corresponding sub-domain of the current layer, it means that the GPT model corresponding to the current layer has failed to generalize the interaction sentence output by the GPT model corresponding to the preset layer (generalization failure means that the intention of the interaction sentence output by the preset layer in the sub-domain of the current layer is not recognized), and the next layer of generalization will not be continued. Since the current layer is not the first layer, it means that the interaction sentence output by the preset layer belongs to the sub-domain of the preset layer, and the interaction sentence output by the preset layer is determined as the transformed interaction sentence.
[0070] For a better understanding, as an optional example, as shown in Figure 4(a), assuming that the current layer sub-domain is the air-conditioning domain, if the interaction statement output by the GPT model corresponding to the current layer sub-domain does not belong to the air-conditioning domain, the interaction statement output by the GPT model corresponding to the preset layer sub-domain (the GPT model corresponding to the smart home domain) is determined as the transformed interaction statement, wherein the interaction statement output by the GPT model corresponding to the preset layer (the GPT model corresponding to the smart home domain) belongs to the smart home domain.
[0071] Step S122: When the interaction statement output by the current layer belongs to the sub-domain of the current layer and the current layer is not the Nth layer, the next layer is obtained as the current layer, and the operation of processing the interaction statement output by the preset layer or the original interaction statement according to the GPT model corresponding to the sub-domain of the current layer to obtain the interaction statement output by the current layer is continued until the transformed interaction statement is obtained.
[0072] It should be noted that if the interaction sentence output by the current layer belongs to the sub-domain of the current layer, it means that the GPT model corresponding to the current layer has successfully generalized the interaction sentence output by the GPT model corresponding to the preset layer or the original interaction sentence (generalization failure means that the intention of the interaction sentence output by the preset layer or the original interaction sentence in the sub-domain of the current layer is not recognized). Since the current layer is not the Nth layer, it is necessary to continue to generalize the interaction sentence output by the current layer, obtain the next layer as the current layer, and continue to process the interaction sentence output by the preset layer or the original interaction sentence according to the GPT model corresponding to the sub-domain of the current layer to obtain the interaction sentence output by the current layer, until the transformed interaction sentence is obtained.
[0073] For a better understanding, as an optional example, as shown in Figure 4(a), assuming that the current layer sub-domain is the smart home domain, if the interaction statement output by the GPT model corresponding to the current layer sub-domain belongs to the smart home domain, the interaction statement output by the GPT model corresponding to the current layer sub-domain (the GPT model corresponding to the smart home domain) is input into the GPT model corresponding to the next layer sub-domain (the GPT model corresponding to the air-conditioning domain), and the GPT model corresponding to the next layer sub-domain is continued to be used to process the interaction statement output by the preset layer (the interaction statement output by the GPT model corresponding to the smart home domain) until the transformed interaction statement is obtained.
[0074] In an exemplary embodiment, the above step S12 further includes steps S123 and S124:
[0075] Step S123: if the interaction sentence output by the current layer does not belong to the sub-domain of the current layer and the current layer is the first layer, determining the interaction sentence output by the current layer as the transformed interaction sentence;
[0076] It should be noted that if the interaction sentence output by the GPT model corresponding to the current layer does not belong to the corresponding sub-domain of the current layer, it means that the GPT model corresponding to the current layer has failed to generalize the original interaction sentence (generalization failure means that the intention of the original interaction sentence in the current layer sub-domain has not been identified), and the next layer of generalization will not be continued. Since the current layer is the first layer, the interaction sentence output by the current layer is determined to be the transformed interaction sentence.
[0077] As an optional example, as shown in Figure 4(a), assuming that the current layer sub-domain is the smart home domain, if the interaction statement output by the GPT model corresponding to the current layer does not belong to the smart home domain, the interaction statement output by the GPT model corresponding to the preset layer (the GPT model corresponding to the smart home domain) is determined as the transformed interaction statement.
[0078] Step S124: When the interactive sentence output by the current layer belongs to the sub-domain of the current layer and the current layer is the Nth layer, the interactive sentence output by the current layer is determined as the transformed interactive sentence.
[0079] It should be noted that if the interaction sentence output by the current layer belongs to the sub-domain of the current layer, it means that the GPT model corresponding to the current layer has successfully generalized the interaction sentence output by the GPT model corresponding to the preset layer or the original interaction sentence (generalization failure indicates that the intention of the interaction sentence output by the preset layer or the original interaction sentence in the sub-domain of the current layer is not recognized). Since the current layer is already the Nth layer, there is no next layer to continue generalization, and the interaction sentence output by the current layer is determined to be a transformed interaction sentence.
[0080] It should be noted that the above steps S121-S124 are for determining how to transform the interactive statements in different situations, and there is no specific order of execution between the above steps S121-S124.
[0081] In an exemplary embodiment, the method further includes: determining whether the interactive statement output by the current layer belongs to the sub-domain of the current layer through a domain classification model corresponding to the current layer.
[0082] As an optional example, when there is only one current layer sub-domain in the current layer, the domain classification model corresponding to the current layer sub-domain is used to determine whether the interactive statement output by the GPT model corresponding to the current layer sub-domain belongs to the current layer sub-domain.
[0083] As an optional example, when there are multiple parallel current layer sub-domains in the current layer, the domain classification model corresponding to each current layer sub-domain is used to determine whether the interactive statement output by the GPT model corresponding to each current layer sub-domain itself belongs to each current layer sub-domain. For example, as shown in Figure 4(b), when the current layer is the second layer, the current layer includes at least the parallel air-conditioning domain and refrigerator domain. Then, the domain classification model corresponding to the air-conditioning domain is used to determine whether the interactive statement output by the GPT model corresponding to the air-conditioning domain belongs to the air-conditioning domain, and the domain classification model corresponding to the refrigerator domain is used to determine whether the interactive statement output by the GPT model corresponding to the refrigerator domain belongs to the refrigerator domain.
[0084] In an exemplary embodiment, the above-mentioned step S11 includes step S111: when the N-layer sub-field includes N sub-fields, and the i-th sub-field in the N sub-fields is a sub-field of the i-1-th sub-field, the i-th GPT model corresponding to the i-th sub-field is used to parse the intention information of the i-1-th interaction statement or the original interaction statement in the i-th sub-field to generate the i-th interaction statement, wherein the i-1-th interaction statement is obtained according to the i-1-th GPT model corresponding to the i-1-th sub-field. It should be noted that i is a positive integer less than or equal to N.
[0085] As an optional example, when the current layer is the i-th layer and i is 1, the first GPT model corresponding to the first sub-field is used to parse the intention information of the original interaction statement in the first sub-field to generate the first interaction statement. When the current layer is the i-th layer and i is not 1, the i-th GPT model corresponding to the i-th sub-field is used to parse the intention information of the i-1th interaction statement output by the i-1th GPT model corresponding to the i-1th sub-field in the i-1th sub-field to generate the i-th interaction statement. The current layer is the i-th layer and the preset layer is the i-1th layer.
[0086] It should be noted that only when the first interaction statement output by the first GPT model corresponding to the first sub-domain belongs to the first sub-domain, the second GPT model corresponding to the second sub-domain is used to parse the intent information of the first interaction statement in the second sub-domain to generate the second interaction statement. If the first interaction statement does not belong to the first sub-domain, the first interaction statement is directly determined as the transformed interaction statement.
[0087] It should be noted that, when i is not 1 and the i-1th interaction statement output by the i-1th GPT model corresponding to the i-1th sub-field belongs to the i-1th sub-field, the i-1th GPT model corresponding to the i-1th sub-field is used to parse the intention information of the i-1th interaction statement in the i-sub-field to generate the i-th interaction statement, and the domain classification model corresponding to the i-th sub-field is used to determine whether the i-th interaction statement belongs to the i-th sub-field. When the i-th interaction statement does not belong to the i-th sub-field, the i-1th interaction statement is determined as a transformed interaction statement; when the i-th interaction statement belongs to the interaction statement of the i-th field and i is equal to N, the i-th interaction statement is determined to be a transformed interaction statement. When the i-th interaction statement belongs to the interaction statement of the i-th field and i is less than N, the value of i is increased by 1, and the operation of parsing the intention information of the i-1th interaction statement in the i-sub-field through the i-th GPT model corresponding to the i-th sub-field to generate the i-th interaction statement is continued until a transformed interaction statement is obtained.
[0088] For a better understanding, the following is a specific explanation in conjunction with Figure 3. When the N-layer sub-domains include domain 1, domain 2, domain 3, domain 4... in Figure 3, the original interaction statement is processed by the GPT model GPT1 corresponding to domain 1 to obtain the first interaction statement. When the first interaction statement does not belong to domain 1, the first interaction statement is determined to be a transformed interaction statement. When the first interaction statement belongs to domain 1, the first interaction statement is processed by the GPT model GPT2 corresponding to domain 2 to obtain the second interaction statement. When the second interaction statement does not belong to domain 2, the first interaction statement is determined to be a transformed interaction statement. The sentence (i.e., the previous interaction sentence of the second interaction sentence) is determined as the transformed interaction sentence. When the second interaction sentence belongs to domain 2, the second interaction sentence is processed by the GPT model GPT3 corresponding to domain 3 to obtain the third interaction sentence. When the third interaction sentence does not belong to domain 3, the second interaction sentence (i.e., the previous interaction sentence of the third interaction sentence) is determined as the transformed interaction sentence. When the third interaction sentence belongs to domain 3, the third interaction sentence is processed by the GPT model GPT4 corresponding to domain 4 to obtain the fourth interaction sentence, and so on, until the transformed interaction sentence is obtained.
[0089] As an optional example, when the current layer is the i-th layer and i is 1, the first GPT model corresponding to the first sub-field is used to parse the intention information of the original interaction statement in the first sub-field to generate the first interaction statement. When the current layer is the i+k-th layer and i is not 1, the i+k-th GPT model corresponding to the i+k-th sub-field is used to parse the intention information of the i-1-th interaction statement output by the i-1-th GPT model corresponding to the i-1-th sub-field in the i+k-th sub-field to generate the i-th interaction statement, wherein the i-1-th interaction statement belongs to the i-1-th sub-field, the i-1-th interaction statement belongs to the i+k-1-th sub-field, and the i-1-th interaction statement does not belong to the i+k-th sub-field, k is a positive integer greater than or equal to 0, i+k<=N, the current layer is the i+k-th layer, and the preset layer is the i-1-th layer.
[0090] For better understanding, the following is a specific explanation in conjunction with Figure 5. When the N-layer sub-domains include domain 1, domain 2, domain 3, domain P... in Figure 5, the original interaction statement is processed by the GPT model GPT1 corresponding to domain 1 to obtain the first interaction statement; when the first interaction statement does not belong to domain 1, the first interaction statement is determined as a transformed interaction statement; when the first interaction statement belongs to domain 1 and does not belong to domain 2, the first interaction statement is processed by the GPT model GPT2 corresponding to domain 2 to obtain the second interaction statement; when the first interaction statement belongs to domain 1 and belongs to domain 2, it is necessary to find domain P from the N-layer domain (the first interaction statement belongs to domain P-1 and does not belong to domain P, P is a positive integer greater than or equal to 2 and less than or equal to N), and the first interaction statement is processed by the GPT model GPTP corresponding to domain P to obtain the second interaction statement, and so on, until the transformed interaction statement is obtained.
[0091] That is to say, only when the interaction sentence output by the previous layer does not belong to the sub-domain of the current layer, the GPT model corresponding to the sub-domain of the current layer is used to process the interaction sentence output by the previous layer.
[0092] In an exemplary embodiment, when the above-mentioned step S11 includes step S111, the above-mentioned step S12 also includes: when the i-th interaction statement belongs to the interaction statement of the i-th sub-field, the i-th interaction statement belongs to the interaction statement of the i+k-th sub-field, and the i-th interaction statement does not belong to the interaction statement of the i+k+1-th sub-field, the i-th interaction statement is obtained as the interaction statement output by the preset layer, the i+k+1-th layer is obtained as the current layer, and the operation of processing the interaction statement output by the preset layer or the original interaction statement according to the GPT model corresponding to the sub-field of the current layer to obtain the interaction statement output by the current layer is continued until the transformed interaction statement is obtained, wherein k is a natural number, i+k<N.
[0093] It should be noted that if the i-th interaction statement already belongs to the interaction statement of the i+1-th sub-field, there is no need to process the i-th interaction statement through the GPT model corresponding to the i+1-th sub-field. It is necessary to find the i+k+1-th sub-field from the N sub-fields with a hierarchical relationship (the i-th interaction statement belongs to the interaction statement of the i+k-th sub-field, but does not belong to the interaction statement of the i+k+1-th sub-field), determine the i+k+1-th layer as the current layer, and process the i-th interaction statement through the GPT model corresponding to the i+k+1-th sub-field to obtain the i+1-th interaction statement, and determine whether a transformed interaction statement is obtained. If no transformed interaction statement is obtained, continue to perform corresponding operations based on the same logic until a transformed interaction statement is obtained.
[0094] In an exemplary embodiment, the above step S11 includes steps S112-S113:
[0095] Step S112: In the case where the N-layer sub-domains include N groups of domains, the i-th group of domains in the N groups of domains is a sub-domain of the i-1th group of domains, each domain in the same group of domains belongs to the same level, and each group of domains corresponds to a group of GPT models, the intention information of the i-1th interaction statement or the original interaction statement in the sub-domain corresponding to the i-th sub-group domain is parsed by each GPT model in the i-th sub-group GPT model corresponding to the i-th sub-group domain to obtain the i-th group of interaction statements, wherein the i-1th interaction statement is the interaction statement generated by the i-1th current GPT model in the i-1th sub-group GPT model, the i-1th current GPT model is the GPT model corresponding to the i-1th current domain in the i-1th group of domains, and the i-th sub-group domain is the sub-domain of the i-1th current domain in the i-1th group of domains;
[0096] Step S113: Select the i-th interaction statement from the i-th group of interaction statements, wherein the i-th interaction statement is the interaction statement generated by the i-th current GPT model in the i-th subgroup GPT model, the i-th current GPT model is the GPT model corresponding to the i-th current field in the i-th subgroup field, the current layer is the i-th layer, and the preset layer is the i-1-th layer.
[0097] It should be noted that each layer in the N layers has a set of domains, and the N-layer sub-domains include N groups of domains. Each domain in each group of domains corresponds to a GPT model, and each group of domains in the N groups of domains corresponds to a group of GPT models. It should be noted that when i is equal to 1, the i-1th interaction statement is the original interaction statement, and there is no i-1th sub-group GPT model, i-1th current GPT model, i-1th group of domains, and i-1th current domain.
[0098] In an exemplary embodiment, when the above-mentioned step S11 includes steps S112-S113, the above-mentioned step S12 includes: when the i-th interaction statement does not belong to the interaction statement of the i-th current domain and i is equal to 1, determining the i-1-th interaction statement as the transformed interaction statement; when the i-th interaction statement belongs to the interaction statement of the i-th current domain and i is not equal to N, adding 1 to the value of i, and continuing to perform the operation of processing the interaction statement output by the preset layer or the original interaction statement according to the GPT model corresponding to the current layer sub-domain to obtain the interaction statement output by the current layer until the transformed interaction statement is obtained; when the i-th interaction statement belongs to the interaction statement of the i-th current domain and i is equal to N, determining the i-1-th interaction statement as the transformed interaction statement.
[0099] In an exemplary embodiment, whether the i-th interaction statement belongs to the i-th current domain is determined by the i-th current domain classification model corresponding to the i-th current domain.
[0100] In order to better understand the situation that the above-mentioned N-layer sub-fields include N groups of fields, the following is a specific explanation in conjunction with Figure 6. As shown in Figure 6, the N-layer sub-fields include: the first group of fields (fields corresponding to GPT1), the second group of fields (fields corresponding to GPT2-1, fields corresponding to GPT2-2...), the third group of fields (fields corresponding to GPT3-1, fields corresponding to GPT3-2, fields corresponding to GPT3-3, fields corresponding to GPT3-4...), the fourth group of fields (fields corresponding to GPT4-1, fields corresponding to GPT4-2, fields corresponding to GPT4-3, fields corresponding to GPT4-4...)...
[0101] The first subgroup domain (the domain corresponding to GPT1) is used to parse the intent information of the original interaction sentence in the first subgroup domain (the domain corresponding to GPT1) using the first subgroup GPT model (GPT1), obtaining the first group of interaction sentences and selecting the first interaction sentence from the first group of interaction sentences. The first current GPT model is GPT1, the domain corresponding to GPT1 is the first current domain, and the second subgroup domain is the subdomain of the first current domain (the domain corresponding to GPT1) in the second group of domains (the domain corresponding to GPT2-1, the domain corresponding to GPT2-2, etc.).
[0102] When the first interactive sentence does not belong to the first current domain, the first interactive sentence is determined as a transformed interactive sentence.
[0103] In the case where the first interaction statement belongs to the first current domain, the intent information of the first interaction statement in the sub-domain corresponding to the second sub-group domain is parsed by each GPT model in the second sub-group GPT model (GPT2-1, GPT2-2...) corresponding to the second sub-group domain (the domain corresponding to GPT2-1, the domain corresponding to GPT2-2...), thereby obtaining the second group of interaction statements. Specifically, GPT2-1 parses the intent information of the first interaction statement in the domain corresponding to GPT2-1 to obtain the interaction statement output by GPT2-1, and GPT2-2 parses the intent information of the first interaction statement in the domain corresponding to GPT2-2 to obtain the interaction statement output by GPT2-2... thereby obtaining the second group of interaction statements, and selecting the second interaction statement from the second group of interaction statements. If the second interaction statement is the interaction statement output by GPT2-1 after parsing the intention information of the first interaction statement in the field corresponding to GPT2-1, the second current GPT model is GPT2-1, the field corresponding to GPT2-1 is the second current field, and the third sub-group field is the sub-field of the second current field (the field corresponding to GPT2-1) in the third group of fields (the field corresponding to GPT3-1, the field corresponding to GPT3-2...).
[0104] When the second interactive sentence does not belong to the second current domain, the first interactive sentence is determined as a transformed interactive sentence.
[0105] In the case where the second interaction statement belongs to the second current domain, the intent information of the second interaction statement in the sub-domain corresponding to the third sub-group domain is parsed by each GPT model in the third sub-group GPT model (GPT3-1, GPT3-2...) corresponding to the third sub-group domain (the domain corresponding to GPT3-1, the domain corresponding to GPT3-2...), thereby obtaining the third group of interaction statements. Specifically, GPT3-1 parses the intent information of the second interaction statement in the domain corresponding to GPT3-1 to obtain the interaction statement output by GPT3-1, and GPT3-2 parses the intent information of the second interaction statement in the domain corresponding to GPT3-2 to obtain the interaction statement output by GPT3-2... thereby obtaining the third group of interaction statements, and selecting the third interaction statement from the third group of interaction statements. If the third interaction statement is the interaction statement output by GPT3-1 after parsing the intention information of the second interaction statement in the field corresponding to GPT3-1, the third current GPT model is GPT3-1, the field corresponding to GPT3-1 is the third current field, and the fourth sub-group field is the sub-field of the third current field (the field corresponding to GPT3-1) in the fourth group of fields (the field corresponding to GPT4-1, the field corresponding to GPT4-2...).
[0106] If the third interactive statement does not belong to the third current domain, the second interactive statement is determined as a transformed interactive statement. If the third interactive statement belongs to the third current domain, the third interactive statement is processed using the above principle.
[0107] In an exemplary embodiment, the above-mentioned selecting the i-th interaction statement in the i-th group of interaction statements includes: selecting the interaction statement with the highest confidence in the i-th group of interaction statements to obtain the i-th interaction statement, wherein the confidence of each interaction statement in the i-th group of interaction statements is the confidence generated by the corresponding GPT model in the i-th sub-group GPT model based on the intention information of the parsed i-1-th interaction statement in the corresponding field in the i-th sub-group field.
[0108] In an exemplary embodiment, before parsing the intent information of the original interaction statement in the preset domain by the target generative pre-trained GPT model and determining the transformation of the interaction statement according to the intent information, the method further includes steps S21-S22:
[0109] Step S21: Obtain M GPT models corresponding to the N-layer sub-domains, where M is a positive integer greater than or equal to N;
[0110] As an optional example, when the N-layer sub-domain includes N sub-domains, M=N; when the N-layer sub-domain includes N groups of domains, M>N.
[0111] In an exemplary embodiment, the above step S21 can be implemented in the following manner:
[0112] Obtain the j-th GPT model among the M GPT models by the following method 1 or method 2, where j is a positive integer greater than or equal to 1 and less than or equal to M:
[0113] Method 1: Obtain a first general GPT model, wherein the first general GPT model is a model trained using first predetermined data; train the first general GPT model using the jth set of training data corresponding to the jth field to obtain a jth GPT model corresponding to the jth field;
[0114] It should be noted that the first general GPT model is a general GPT model trained using a large amount of data acquired by itself.
[0115] Method 2: Send the jth group of training data corresponding to the jth field to the designated platform by calling the designated interface of the designated platform; obtain the jth GPT model corresponding to the jth field obtained by training the second general GPT model using the jth group of training data on the designated platform, wherein the second general GPT model is a model trained by the designated platform using the second predetermined data.
[0116] It should be noted that the second general GPT model is a general GPT model obtained by a third-party platform through a large amount of data training.
[0117] It should be noted that, as shown in Figure 3, the GPT model corresponding to the preset domain can be obtained in two ways, namely, the first general GPT model can be trained using the data with annotations of the preset domain to obtain the GPT model corresponding to the preset domain, or the data with annotations of the preset domain can be sent to a third-party platform, and then the third-party platform trains the second general GPT model based on the data with annotations of the preset domain. By calling the relevant interface of the third-party platform, the GPT model corresponding to the preset domain trained by the third-party platform can be used.
[0118] Step S22: deploy the M GPT models in a distributed manner in corresponding servers.
[0119] In an exemplary embodiment, the GPT model obtained by method 1 among the M GPT models can be deployed on any server, and the GPT model obtained by method 2 among the M GPT models needs to be deployed on a server corresponding to a third-party platform, such as an Azure server.
[0120] It should be noted that before the above step S204, it is necessary to pre-train a target generative pre-trained GPT model. Specifically, the general GPT model can be trained using sample data of non-preset fields with preset field annotations to obtain a target generative pre-trained GPT model.
[0121] In an exemplary embodiment, before step S204, a supervised learning algorithm may be used to train the general GPT model, wherein the general GPT model is trained for the i-th round through the following steps S31-S36:
[0122] Step S31: Inputting the i-th sample interaction sentence in the non-preset domain in the training sample set into the general GPT model obtained by the i-1th round of training, wherein the i-th sample interaction sentence corresponds to the preset i-th first-type annotated interaction sentence and the i-th second-type annotated interaction sentence;
[0123] As an optional example, the i-th sample interaction sentence may be “I want to turn on the control”, the first type of labeled interaction sentence may be “I want to turn on the air conditioner”, and the second type of labeled interaction sentence may be “I want to turn on the fan”.
[0124] As an optional example, the context information corresponding to the i-th sample interaction statement can also be input into the general GPT model obtained by the i-1th round of training.
[0125] Step S32: performing grammatical error correction processing on the i-th sample interaction sentence using the general GPT model obtained by the i-1th round of training to obtain the i-th group of first-type candidate interaction sentences, and determining the i-th first-type candidate interaction sentence in the i-th group of first-type candidate interaction sentences;
[0126] It should be noted that the i-th group of first-type candidate interaction sentences includes multiple first-type candidate interaction sentences obtained by performing grammatical correction processing on the i-th sample interaction sentence. It should be noted that grammatical correction includes but is not limited to: synonym replacement, near-synonymous replacement, word order adjustment, etc.
[0127] In an exemplary embodiment, performing the grammatical error correction process on the i-th sample interaction sentence using the general GPT model obtained by the i-1th round of training to obtain the i-th group of first-type candidate interaction sentences includes: performing the grammatical error correction process on the i-th sample interaction sentence using the general GPT model obtained by the i-1th round of training to obtain the i-th group of first-type candidate interaction sentences and the corresponding i-th group of confidence scores;
[0128] Determining the i-th first type candidate interaction statement in the i-th group of first type candidate interaction statements includes: selecting the first type candidate interaction statement with the highest confidence in the i-th group of first type candidate interaction statements to obtain the i-th first type candidate interaction statement.
[0129] Step S33: performing semantic expansion processing on the i-th sample interaction statement using the general GPT model obtained by the i-1th round of training to obtain the i-th group of second-type candidate interaction statements, and determining the i-th second-type candidate interaction statement in the i-th group of second-type candidate interaction statements;
[0130] It should be noted that the i-th group of second-type candidate interaction statements includes multiple second-type candidate interaction statements obtained by performing semantic expansion processing on the i-th sample interaction statement.
[0131] Step S34: determining a target loss value for the i-th round of training based on the i-th first-type labeled interaction statement, the i-th first-type candidate interaction statement, the i-th second-type labeled interaction statement, and the i-th second-type candidate interaction statement;
[0132] As an optional example, the first loss value of the i-th first-type labeled interaction statement and the i-th first-type candidate interaction statement can be calculated, and the second loss value of the i-th second-type labeled interaction statement and the i-th second-type candidate interaction statement can be calculated, and then the target loss value of the i-th round of training can be determined based on the first loss value and the second loss value.
[0133] Step S35: If the target loss value of the i-th round of training does not meet the preset training cutoff condition, adjust the parameters of the general GPT model obtained by the i-1-th round of training to determine the general GPT model obtained by the i-th round of training;
[0134] Step S36: When the target loss value of the i-th round of training meets the preset training cutoff condition, the training is terminated.
[0135] It should be noted that when the training ends, the general GPT model at the end of the training is determined as the target GPT model.
[0136] In an exemplary embodiment, feature design can be performed to guide the training of a general GPT model, and then the general GPT model can be fine-tuned using sample data from non-preset domains with preset domain annotations to obtain a target generative pre-trained GPT model, wherein the algorithms used in the fine-tuning process include but are not limited to a sorting algorithm model and a PPO criterion.
[0137] Feature design can be understood as when training the general GPT model, its input includes: sample interaction sentences and context information corresponding to the sample interaction sentences, and its output includes: transformed interaction sentences and label information corresponding to the transformed interaction sentences, wherein the label information is used to indicate whether the transformed interaction sentence is a first-type transformed interaction sentence or a second-type transformed interaction sentence, wherein the first-type transformed interaction sentence is a sentence obtained by performing grammatical correction processing on the sample interaction sentence (weak generalization sentence), and the second-type transformed interaction sentence is a sentence obtained by performing semantic expansion processing on the sample interaction sentence (strong generalization sentence).
[0138] In an exemplary embodiment, before the above step S204, the general domain classification model and the general GPT model can also be jointly trained using supervised learning to obtain a domain classification model corresponding to the preset domain and a target generative pre-trained GPT model. Optionally, the general domain classification model and the general GPT model can be jointly trained for the i-th round through the following steps S41-S49:
[0139] Step S41: Input the i-th sample interaction sentence of the non-preset domain in the training sample set into the general GPT model obtained by the i-1th round of training, wherein the i-th sample interaction sentence corresponds to the preset i-th first-type labeled interaction sentence, the i-th second-type labeled interaction sentence, and the i-th actual domain;
[0140] Step S42: performing the grammatical error correction process on the i-th sample interaction sentence using the general GPT model obtained by the i-1th round of training to obtain the i-th group of first-type candidate interaction sentences, and determining the i-th first-type candidate interaction sentence in the i-th group of first-type candidate interaction sentences;
[0141] Step S43: performing the semantic expansion process on the i-th sample interaction statement using the general GPT model obtained by the i-1th round of training to obtain the i-th group of second-type candidate interaction statements, and determining the i-th second-type candidate interaction statement in the i-th group of second-type candidate interaction statements;
[0142] Step S44: determining a first target loss value for the i-th round of training based on the i-th first-type labeled interaction statement, the i-th first-type candidate interaction statement, the i-th second-type labeled interaction statement, and the i-th second-type candidate interaction statement;
[0143] Step S45: inputting the i-th sample interaction sentence into the general domain classification model obtained by the i-1th round of training, and performing domain classification processing on the i-th sample interaction sentence using the general domain classification model obtained by the i-1th round of training to obtain the i-th predicted domain;
[0144] Step S46: determining a second target loss value for the i-th round of training based on the i-th predicted domain and the i-th actual domain;
[0145] Step S47: determining a target loss value for the i-th round of training according to the first target loss value for the i-th round of training and the second target loss value for the i-th round of training;
[0146] Step S48: When the target loss value of the i-th round of training does not meet the preset training cutoff condition, the parameters of the general GPT model obtained by the i-1-th round of training and the parameters of the general domain classification model obtained by the i-1-th round of training are adjusted to determine the general GPT model obtained by the i-th round of training and the general domain classification model obtained by the i-th round of training;
[0147] As an optional example, the preset training termination condition includes at least one of the following: the target loss value converges or the target loss value is less than a first preset threshold. In other embodiments, the preset training termination condition may also be determined based on the number of training rounds, for example, the preset training termination condition is satisfied when the number of training rounds is greater than a second preset threshold.
[0148] Step S49: When the target loss value of the i-th round of training meets the preset training cutoff condition, the training is terminated.
[0149] It should be noted that the interactive statements of the preset field can be used to train the general field classification model to obtain the field classification model corresponding to the preset field. For example, the interactive statements corresponding to the air-conditioning field can be used to train the general field classification model to obtain the field classification model corresponding to the air-conditioning field; the interactive statements corresponding to the refrigerator field can be used to train the general field classification model to obtain the field classification model corresponding to the refrigerator field.
[0150] In an exemplary embodiment, the above step S204 includes the following steps S51-S53:
[0151] Step S51: using the target GPT model, performing grammatical error correction processing on the original interaction sentence according to the intention information to obtain a set of first-type candidate interaction sentences;
[0152] It should be noted that a set of first-type candidate interaction sentences is the result of the target GPT model weakly generalizing the original interaction sentences.
[0153] It should be noted that recognition errors often occur during voice recognition. For example, when the user says "I want to turn on the air conditioner", when the original interaction sentence is obtained through voice recognition, it is recognized as "I want to turn on the control". Therefore, the target GPT model in the smart home field can perform weak generalization on the original interaction sentence and generate a transformed interaction sentence "I want to turn on the air conditioner".
[0154] Step S52: using the target GPT model, semantically expanding the original interaction statement according to the intention information to obtain a set of second-type candidate interaction statements;
[0155] It should be noted that the second type of candidate interaction sentences is the result of the target GPT model's strong generalization of the original interaction sentences. For example, if the original interaction sentence is "I'm sweating all over," the target GPT model in the smart home domain can perform strong generalization processing on the original interaction sentence to generate transformed interaction sentences such as "I'm hot, turn on the air conditioner," "I'm hot, turn on the fan," or "Turn on the water heater."
[0156] Step S53: Determine a transformed interaction statement from the group of first-type candidate interaction statements and the group of second-type candidate interaction statements.
[0157] As an optional example, if the original interaction statement is generalized using the target GPT model, there is both a group of candidate interaction statements of the first type (i.e., weak generalization statements) and a group of candidate interaction statements of the second type (i.e., strong generalization statements), then it is necessary to determine the interaction statement with the highest confidence from the group of candidate interaction statements of the first type as the transformed interaction statement.
[0158] In an exemplary embodiment, the above-mentioned step S206 also includes: when the transformed interaction statement belongs to the preset domain and the transformed interaction statement is determined to be an interaction statement in the group of first-type candidate interaction statements through the label information of the transformed interaction statement, executing the operation corresponding to the transformed interaction statement; when the transformed interaction statement belongs to the preset domain and the transformed interaction statement is determined to be an interaction statement in the group of second-type candidate interaction statements through the label information of the transformed interaction statement, entering the inquiry process.
[0159] It should be noted that if the transformation interaction statement generated by the target GPT model is a first-type transformation interaction statement (i.e., a weak generalization statement), the interactive system can directly execute the operation corresponding to the transformation interaction statement; if the transformation interaction statement generated by the target GPT model is a second-type transformation interaction statement (i.e., a strong generalization statement), and the second-type transformation interaction statement is a statement obtained by semantically expanding the original interaction statement, in order to avoid semantic expansion errors, it is necessary to enter the fuzzy intention inquiry process, ask the user whether the generated transformation interaction statement is correct, and then perform corresponding processing based on the user's reply statement.
[0160] In this embodiment, the above technical solution is adopted to further improve the interaction effect of the interactive system.
[0161] Obviously, the embodiments described above are only part of the embodiments of the present disclosure, rather than all the embodiments. In order to better understand the above method, the above process is described below in conjunction with the embodiments, but it is not intended to limit the technical solutions of the embodiments of the present disclosure. Specifically:
[0162] In an optional embodiment, in intelligent interactive systems, accurately understanding user intent often requires a significant amount of prior knowledge to build a language model. Using a Generative Pre-Training (GPT) model as the system's prior knowledge language model often yields a language model with greater corpus generalization capabilities. However, general GPT models are generally not applicable to specific domains.
[0163] Therefore, the present disclosure generates a characteristic GPT model for the smart home field through supervised learning of smart home field labeled data based on the general GPT model, calls the model in the form of domain logic allocation, and applies it to the existing smart home interaction system, thereby improving the system's generalization ability to understand user language. The present disclosure constructs an intelligent interaction system and reinforcement learning mechanism based on the GPT generalization model. By coupling the general GPT model with fine-tuning data, a characteristic GPT model is generated, and coupled with the original interaction engine in the form of domain classifier coupling. At the same time, the user's original input and domain classifier results, as well as the characteristic GPT generalization results, can also be used as self-learning training data to perform an enhanced learning mechanism. During the interaction process, data for enhanced learning is accumulated to achieve the purpose of model self-learning.
[0164] In one exemplary embodiment, the GPT3 playground provided by Microsoft Azure Open AI can be used to fine-tune the homeGPT (i.e., the target GPT model for the smart home domain) with smart home characteristics through in-context learning model self-learning training. Optionally, queries with unified intent from existing generalized data can be used as "prompt" and "completion" to generate a personalized GPT and deploy it on an Azure server.
[0165] It should be noted that after the characteristic GPT (such as homeGPT) is generated and deployed on the Azure server, the characteristic GPT model can be used. Optionally, in order to better understand how to use the characteristic GPT model, the following is a specific explanation in conjunction with Figure 7. As shown in Figure 7, the user's original query (query request, that is, the original interaction statement in the previous text) input by the user is first domain-classified. If the domain classification result is the smart home domain, the user's original query is directly input into the dialogue engine, and the dialogue engine directly parses and interacts with the user's original query; if the classification result is a non-smart home domain, a generalized query (that is, the transformed interaction statement in the previous text) is generated through smart home GPT generalization, and the generalized query is again domain-classified; if the secondary classification result is the smart home domain, the generalized query is input into the dialogue engine, and the dialogue engine parses and interacts with the generalized query. If the secondary classification result is a non-smart home domain, the user's original query is input into the dialogue engine, and the dialogue engine parses and interacts with the user's original query.
[0166] For a better understanding, the following is a specific explanation based on the scenario. If a smart home user queries: "I am sweating" (the query is the user's description of his or her own situation in an ordinary life scenario), the interactive system will use homeGPT to identify that the user may want to turn on the water heater. The interactive system will then convert the user's intention into user intention analysis in the intelligent interactive dialogue system, and according to the product design, ask the user, such as "Do you need help turning on the water heater?" If the user replies "yes", the device control command will be issued to turn on the water heater bound to the user's home account.
[0167] In an exemplary embodiment, as shown in FIG8 , the user's original query, generalized query, and domain classification results (domain classification results include the domain classification results of the original query and the domain classification results of the generalized query) can be used as training data for self-learning to perform an enhanced learning mechanism. During the interaction process, data for enhanced learning is accumulated to achieve the purpose of model self-learning.
[0168] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present disclosure.
[0169] In this embodiment, a device for processing interactive statements based on a target-generated pre-trained GPT model is also provided. The device is configured to implement the above-mentioned embodiments and preferred implementations, and those that have been described will not be repeated. As used below, the term "module" may be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0170] FIG9 is a structural block diagram of a device for processing interactive statements based on a target-generated pre-trained GPT model according to an embodiment of the present disclosure, the device comprising:
[0171] A determination module 92 is configured to determine a domain classification result of an input original interaction statement through a domain classification model, and determine whether the original interaction statement belongs to a preset domain based on the domain classification result;
[0172] The generation module 94 is configured to, when it is determined that the original interaction statement does not belong to the preset domain, parse the intent information of the original interaction statement in the preset domain through the target generative pre-trained GPT model, and generate a transformed interaction statement based on the intent information;
[0173] The interaction module 96 is configured to perform interaction processing according to the transformed interaction statement.
[0174] The above-mentioned device, when it is determined through the domain classification model that the original interaction sentence does not belong to the preset domain, analyzes the intention information of the original interaction sentence in the preset domain through the target generative pre-trained GPT model, and generates a transformed interaction sentence based on the intention information, and then performs interaction processing based on the transformed interaction sentence. The above-mentioned technical solution enables the interaction system to mine the user's implicit intention, improves the interaction system's ability to understand the input interaction sentence, and then the interaction system can accurately respond accordingly, solving the problem that the interaction system directly processes the interaction based on the interaction sentence, resulting in poor interaction effect. In addition, because the interaction system can mine the user's implicit intention and has a stronger understanding of the interaction sentence, the interaction system can achieve a more natural and intimate interaction method based on the user's intention, and improve the intelligence of the interaction system; and because the interaction system more accurately identifies the user's implicit intention, the interaction system can actively continue or guide new topics, and then the interaction system has the ability to conduct continuous dialogue like between people, which makes the interaction experience in the field of human-computer interaction have a qualitative leap.
[0175] In an exemplary embodiment, the interaction module 96 is further configured to use the original interaction statement to perform interaction processing when it is determined based on the field classification result that the original interaction statement belongs to the preset field.
[0176] In an exemplary embodiment, the interaction module 96 is further configured to use the original interaction statement to perform interaction processing when it is determined that the transformed interaction statement does not belong to the preset domain.
[0177] In an exemplary embodiment, the interaction module 96 is further configured to use the transformed interaction statement to perform interaction processing when it is determined that the transformed interaction statement belongs to the preset domain.
[0178] In an exemplary embodiment, the generation module 94 is further configured to include N layers of sub-fields with a hierarchical relationship in the preset field, and each layer of the N layers of sub-fields corresponds to at least one GPT model. When N is a positive integer, the interaction statement output by the preset layer or the original interaction statement is processed according to the GPT model corresponding to the current layer sub-field to obtain the interaction statement output by the current layer, wherein, when the current layer is the first layer, the interaction statement output by the preset layer is the original interaction statement; the transformed interaction statement is determined according to the interaction statement output by the current layer and the hierarchy corresponding to the current layer.
[0179] In an exemplary embodiment, the generation module 94 is also configured to, when the interaction statement output by the current layer does not belong to the sub-domain of the current layer and the current layer is not the first layer, determine the interaction statement output by the preset layer as the transformed interaction statement, wherein the interaction statement output by the preset layer belongs to the sub-domain of the preset layer; when the interaction statement output by the current layer belongs to the sub-domain of the current layer and the current layer is not the Nth layer, obtain the next layer as the current layer, and continue to execute the operation of processing the interaction statement output by the preset layer or the original interaction statement according to the GPT model corresponding to the sub-domain of the current layer to obtain the interaction statement output by the current layer, until the transformed interaction statement is obtained.
[0180] In an exemplary embodiment, the generation module 94 is further configured to determine the interaction statement output by the current layer as the transformed interaction statement when the interaction statement output by the current layer does not belong to the sub-domain of the current layer and the current layer is the first layer; and to determine the interaction statement output by the current layer as the transformed interaction statement when the interaction statement output by the current layer belongs to the sub-domain of the current layer and the current layer is the Nth layer.
[0181] In an exemplary embodiment, the determination module 92 is further configured to determine whether the interaction statement output by the current layer belongs to the sub-domain of the current layer through the domain classification model corresponding to the current layer.
[0182] In an exemplary embodiment, the generation module 94 is further configured to parse the intention information of the i-1th interaction statement or the original interaction statement in the i-1th sub-field through the i-th GPT model corresponding to the i-1th sub-field, when the N-layer sub-field includes N sub-fields and the i-th sub-field among the N sub-fields is a sub-field of the i-1th sub-field, to generate the i-th interaction statement, wherein the i-1th interaction statement is obtained according to the i-1th GPT model corresponding to the i-1th sub-field, the current layer is the i-th layer, and the preset layer is the i-1th layer.
[0183] In an exemplary embodiment, the generation module 94 is also configured to obtain the i-th interaction statement as the interaction statement output by the preset layer, obtain the i+k+1-th layer as the current layer, and continue to execute the operation of processing the interaction statement output by the preset layer or the original interaction statement according to the GPT model corresponding to the sub-field of the current layer to obtain the interaction statement output by the current layer, when the i-th interaction statement belongs to the interaction statement of the i-th sub-field, the i-th interaction statement belongs to the interaction statement of the i+k-th sub-field, and the i-th interaction statement does not belong to the interaction statement of the i+k+1-th sub-field, until the transformed interaction statement is obtained, wherein k is a natural number, i+k<N.
[0184] In an exemplary embodiment, the generation module 94 is further configured to parse the intention information of the i-1th interaction statement or the original interaction statement in the sub-domain corresponding to the i-th sub-group domain by each GPT model in the i-th sub-group GPT model corresponding to the i-th sub-group domain, to obtain the i-th group interaction statement, wherein the i-1th interaction statement is the i-1th interaction statement in the i-1th sub-group GPT model. an interaction statement generated by an i-1th current GPT model, the i-1th current GPT model is the GPT model corresponding to the i-1th current field in the i-1th group of fields, and the i-th sub-group field is the sub-field of the i-1th current field in the i-th group of fields; an i-th interaction statement is selected from the i-th group of interaction statements, wherein the i-th interaction statement is the interaction statement generated by the i-th current GPT model in the i-th sub-group GPT model, the i-th current GPT model is the GPT model corresponding to the i-th current field in the i-th sub-group field, the current layer is the i-th layer, and the preset layer is the i-1-th layer.
[0185] In an exemplary embodiment, the generation module 94 is further configured to, when the i-th interaction statement does not belong to the interaction statement of the i-th current domain, determine the i-1-th interaction statement as the transformed interaction statement; when the i-th interaction statement belongs to the interaction statement of the i-th current domain and i is less than N, add 1 to the value of i, and continue to perform the operation of processing the interaction statement output by the preset layer or the original interaction statement according to the GPT model corresponding to the current layer sub-domain to obtain the interaction statement output by the current layer until the transformed interaction statement is obtained; when the i-th interaction statement belongs to the interaction statement of the i-th current domain and i is equal to N, determine the i-th interaction statement as the transformed interaction statement.
[0186] In an exemplary embodiment, the generation module 94 is further configured to select the interaction statement with the highest confidence from the i-th group of interaction statements to obtain the i-th interaction statement, wherein the confidence of each interaction statement in the i-th group of interaction statements is the confidence generated by the corresponding GPT model in the i-th sub-group GPT model based on the intention information of the parsed i-1-th interaction statement in the corresponding field in the i-th sub-group field.
[0187] In an exemplary embodiment, the determination module 92 is further configured to determine whether the i-th interaction statement belongs to the i-th current domain by using the i-th current domain classification model corresponding to the i-th current domain.
[0188] In an exemplary embodiment, the above-mentioned device also includes: a deployment module, which is configured to obtain M GPT models corresponding to the N-layer sub-domains before parsing the intention information of the original interaction statement in the preset domain through the target generative pre-trained GPT model and determining the transformed interaction statement based on the intention information, wherein M is a positive integer greater than or equal to N; and distribute the M GPT models in the corresponding servers.
[0189] In an exemplary embodiment, the above-mentioned device also includes: a deployment module, which is configured to obtain the M GPT models corresponding to the N-layer sub-fields in the following manner: obtaining the j-th GPT model among the M GPT models in one of the following manners, wherein j is a positive integer greater than or equal to 1 and less than or equal to M: obtaining a first general GPT model, wherein the first general GPT model is a model trained using first predetermined data; training the first general GPT model using the j-th group of training data corresponding to the j-th field to obtain the j-th GPT model corresponding to the j-th field; sending the j-th group of training data corresponding to the j-th field to the designated platform by calling the designated interface of the designated platform; obtaining the j-th GPT model corresponding to the j-th field obtained by training the second general GPT model using the j-th group of training data by the designated platform, wherein the second general GPT model is a model trained by the designated platform using the second predetermined data.
[0190] In an exemplary embodiment, the above-mentioned device also includes: a first training module, which is configured to perform the i-th round of training on the general GPT model through the following steps before parsing the intention information of the original interaction sentence in the preset domain through the target generative pre-trained GPT model and generating a transformed interaction sentence according to the intention information: inputting the i-th sample interaction sentence of the non-preset domain in the training sample set into the general GPT model obtained by the i-1-th round of training, wherein the i-th sample interaction sentence corresponds to the preset i-th first type labeled interaction sentence and the i-th second type labeled interaction sentence; performing grammatical error correction processing on the i-th sample interaction sentence through the general GPT model obtained by the i-1-th round of training to obtain the i-th group of first type candidate interaction sentences, and determining the i-th first type in the i-th group of first type candidate interaction sentences. candidate interaction sentences; performing semantic expansion processing on the i-th sample interaction sentence through the universal GPT model obtained by the i-1-th round of training to obtain the i-th group of second-type candidate interaction sentences, and determining the i-th second-type candidate interaction sentence in the i-th group of second-type candidate interaction sentences; determining the target loss value of the i-th round of training according to the i-th first-type labeled interaction sentence, the i-th first-type candidate interaction sentence, the i-th second-type labeled interaction sentence and the i-th second-type candidate interaction sentence; when the target loss value of the i-th round of training does not meet the preset training cutoff condition, adjusting the parameters in the universal GPT model obtained by the i-1-th round of training to determine the universal GPT model obtained by the i-th round of training; when the target loss value of the i-th round of training meets the preset training cutoff condition, ending the training.
[0191] In an exemplary embodiment, the first training module is further configured to perform the grammatical correction processing on the i-th sample interaction statement through the general GPT model obtained by the i-1-th round of training to obtain the i-th group of first-type candidate interaction statements: perform the grammatical correction processing on the i-th sample interaction statement through the general GPT model obtained by the i-1-th round of training to obtain the i-th group of first-type candidate interaction statements and the corresponding i-th group of confidences; determine the i-th first-type candidate interaction statement in the i-th group of first-type candidate interaction statements in the following manner: select the first-type candidate interaction statement with the highest confidence among the i-th group of first-type candidate interaction statements to obtain the i-th first-type candidate interaction statement.
[0192] In an exemplary embodiment, the above-mentioned device also includes: a second training module, which is configured to perform the i-th round of joint training on the general domain classification model and the general GPT model by the following steps before parsing the intention information of the original interaction sentence in the preset domain through the target generative pre-trained GPT model and generating the transformed interaction sentence according to the intention information: inputting the i-th sample interaction sentence of the non-preset domain in the training sample set into the general GPT model obtained by the i-1-th round of training, wherein the i-th sample interaction sentence corresponds to the preset i-th first type labeled interaction sentence, the i-th The second type of labeled interaction statement, the i-th actual field; the general GPT model obtained by the i-1th round of training performs the grammatical error correction processing on the i-th sample interaction statement to obtain the i-th group of first type candidate interaction statements, and determines the i-th first type candidate interaction statement in the i-th group of first type candidate interaction statements; the general GPT model obtained by the i-1th round of training performs the semantic expansion processing on the i-th sample interaction statement to obtain the i-th group of second type candidate interaction statements, and determines the i-th second type candidate interaction statement in the i-th group of second type candidate interaction statements ; Determine the first target loss value of the i-th round of training based on the i-th first type labeled interaction sentence, the i-th first type candidate interaction sentence, the i-th second type labeled interaction sentence and the i-th second type candidate interaction sentence; Input the i-th sample interaction sentence into the general domain classification model obtained by the i-1-th round of training, and perform domain classification processing on the i-th sample interaction sentence through the general domain classification model obtained by the i-1-th round of training to obtain the i-th predicted domain; Determine the second target loss value of the i-th round of training based on the i-th predicted domain and the i-th actual domain loss value; determining the target loss value of the i-th round of training according to the first target loss value of the i-th round of training and the second target loss value of the i-th round of training; when the target loss value of the i-th round of training does not meet the preset training cutoff condition, adjusting the parameters in the general GPT model obtained in the i-1-th round of training and the parameters in the general domain classification model obtained in the i-1-th round of training to determine the general GPT model obtained in the i-th round of training and the general domain classification model obtained in the i-th round of training; when the target loss value of the i-th round of training meets the preset training cutoff condition, ending the training.
[0193] In an exemplary embodiment, the generation module 94 is further configured to perform grammatical error correction processing on the original interaction statements according to the intention information through the target GPT model to obtain a group of first-type candidate interaction statements; perform semantic expansion processing on the original interaction statements according to the intention information through the target GPT model to obtain a group of second-type candidate interaction statements; and determine the transformed interaction statements from the group of first-type candidate interaction statements and the group of second-type candidate interaction statements.
[0194] In an exemplary embodiment, the interaction module 96 is further configured to execute an operation corresponding to the transformed interaction statement when the transformed interaction statement belongs to the preset domain and is determined to be an interaction statement in the group of first-type candidate interaction statements through the label information of the transformed interaction statement; and to enter an inquiry process when the transformed interaction statement belongs to the preset domain and is determined to be an interaction statement in the group of second-type candidate interaction statements through the label information of the transformed interaction statement.
[0195] FIG10 is a structural block diagram of a system for processing interactive statements based on a target-generated pre-trained GPT model according to an embodiment of the present disclosure, the system comprising:
[0196] The domain classification model 102 is configured to perform domain classification on the input original interaction sentence to determine whether the original interaction sentence belongs to a preset domain;
[0197] The target-generative pre-trained GPT model 104 is configured to parse the intention information of the original interaction sentence in the preset domain when the original interaction sentence does not belong to the preset domain, and generate a transformed interaction sentence according to the intention information;
[0198] The dialogue engine 106 is configured to perform interaction processing according to the transformed interaction sentences.
[0199] The above-mentioned system, when it is determined through the domain classification model that the original interaction sentence does not belong to the preset domain, uses the target generative pre-trained GPT model to parse the intent information of the original interaction sentence in the preset domain, and generates a transformed interaction sentence based on the intent information, and then performs interaction processing based on the transformed interaction sentence. The above-mentioned technical solution enables the interaction system to mine the user's implicit intention, improves the interaction system's ability to understand the input interaction sentence, and then the interaction system can accurately respond accordingly, solving the problem that the interaction system directly processes the interaction based on the interaction sentence, resulting in poor interaction effect. In addition, because the interaction system can mine the user's implicit intention and has a stronger understanding of the interaction sentence, the interaction system can achieve a more natural and intimate interaction method based on the user's intention, and improve the intelligence of the interaction system; and because the interaction system more accurately identifies the user's implicit intention, the interaction system can actively continue or guide new topics, and then the interaction system has the ability to conduct continuous dialogue like between people, which makes the interaction experience in the field of human-computer interaction a qualitative leap.
[0200] An embodiment of the present disclosure further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.
[0201] Optionally, in this embodiment, the storage medium may be configured to store a computer program configured to perform the following steps:
[0202] S1, determining a domain classification result of an input original interaction statement through a domain classification model, and determining whether the original interaction statement belongs to a preset domain based on the domain classification result;
[0203] S2, when it is determined that the original interaction sentence does not belong to the preset domain, parsing the intent information of the original interaction sentence in the preset domain through the target generative pre-trained GPT model, and generating a transformed interaction sentence according to the intent information;
[0204] S3, performing interaction processing according to the transformed interaction statement.
[0205] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0206] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.
[0207] An embodiment of the present disclosure further provides an electronic device, as shown in FIG11 , which includes a memory 1102 and a processor 1104 . The memory 1102 stores a computer program, and the processor 1104 is configured to execute the steps of any of the above method embodiments through the computer program.
[0208] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0209] Optionally, in this embodiment, the processor 1104 may be configured to execute the following steps through a computer program:
[0210] S1, determining a domain classification result of an input original interaction statement through a domain classification model, and determining whether the original interaction statement belongs to a preset domain based on the domain classification result;
[0211] S2, when it is determined that the original interaction sentence does not belong to the preset domain, parsing the intent information of the original interaction sentence in the preset domain through the target generative pre-trained GPT model, and generating a transformed interaction sentence according to the intent information;
[0212] S3, performing interaction processing according to the transformed interaction statement.
[0213] Alternatively, those skilled in the art will appreciate that the structure shown in FIG11 is merely illustrative, and the electronic device may also be a smartphone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile internet device (MID), a PAD, or other terminal device. FIG11 does not limit the structure of the electronic device. For example, the electronic device may include more or fewer components (such as a network interface, etc.) than those shown in FIG11, or may have a configuration different from that shown in FIG11.
[0214] The memory 1102 can be used to store software programs and modules, such as program instructions / modules corresponding to the method and apparatus for processing interactive statements based on a target-generative pre-trained GPT model in the embodiments of the present invention. The processor 1104 executes the software programs and modules stored in the memory 1102 to perform various functional applications and data processing, thereby implementing the aforementioned method for processing interactive statements based on a target-generative pre-trained GPT model. The memory 1102 may include a high-speed random access memory (RAM) and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1102 may further include a memory remotely located relative to the processor 1104, and these remote memories may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. As an example, as shown in FIG11 , the memory 1102 may include, but is not limited to, the determination module 92, the generation module 94, and the interaction module 96 of the apparatus for processing interactive statements based on a target-generative pre-trained GPT model. In addition, it may also include but is not limited to other module units in the above-mentioned semantic conversion device, which will not be repeated in this example.
[0215] Optionally, the transmission device 1106 is configured to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one embodiment, the transmission device 1106 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one embodiment, the transmission device 1106 is a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.
[0216] In addition, the electronic device further includes: a display 1108 and a connection bus 1110 for connecting various module components in the electronic device.
[0217] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0218] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.
[0219] Obviously, those skilled in the art should understand that the modules or steps of the present disclosure described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present disclosure is not limited to any particular combination of hardware and software.
[0220] The above is only a preferred embodiment of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present disclosure. These improvements and modifications should also be regarded as within the scope of protection of the present disclosure.
Claims
1. A method for processing interactive sentences based on a target-generated pre-trained GPT model, comprising: Determine a domain classification result of the input original interaction sentence through a domain classification model, and determine whether the original interaction sentence belongs to a preset domain based on the domain classification result; When it is determined that the original interaction sentence does not belong to the preset domain, the intention information of the original interaction sentence in the preset domain is parsed through the target generative pre-trained GPT model, and a transformed interaction sentence is generated according to the intention information; Interaction processing is performed according to the transformed interaction statement.
2. The method according to claim 1, wherein: The method further comprises: In the case where it is determined based on the field classification result that the original interaction sentence belongs to the preset field, the original interaction sentence is used for interaction processing.
3. The method according to claim 1, wherein: The performing interactive processing according to the transformed interactive statement includes: In the case where it is determined that the transformed interaction statement does not belong to the preset domain, the original interaction statement is used for interaction processing.
4. The method according to claim 1, wherein: The performing interactive processing according to the transformed interactive statement includes: In the case where it is determined that the transformed interaction statement belongs to the preset domain, the transformed interaction statement is used for interaction processing.
5. The method according to any one of claims 1 to 4, wherein: The preset domain includes N layers of sub-domains with a hierarchical relationship, each layer of the N layers of sub-domains corresponds to at least one GPT model, N is a positive integer, and the target generative pre-trained GPT model is used to parse the intention information of the original interaction sentence in the preset domain, and the transformed interaction sentence is determined according to the intention information, including: According to the GPT model corresponding to the sub-domain of the current layer, the interactive sentence output by the preset layer or the original The interactive sentence is processed to obtain the interactive sentence output by the current layer, wherein, when the current layer is the first layer, the interactive sentence output by the preset layer is the original interactive sentence; The transformed interaction statement is determined according to the interaction statement output by the current layer and the level corresponding to the current layer.
6. The method according to claim 5, wherein: The step of determining the transformed interaction statement according to the interaction statement output by the current layer and the level corresponding to the current layer includes: When the interaction sentence output by the current layer does not belong to the sub-domain of the current layer and the current layer is not the first layer, determining the interaction sentence output by the preset layer as the transformed interaction sentence, wherein the interaction sentence output by the preset layer belongs to the sub-domain of the preset layer; When the interaction sentence output by the current layer belongs to the sub-domain of the current layer and the current layer is not the Nth layer, the next layer is obtained as the current layer, and the operation of processing the interaction sentence output by the preset layer or the original interaction sentence according to the GPT model corresponding to the sub-domain of the current layer to obtain the interaction sentence output by the current layer is continued until the transformed interaction sentence is obtained.
7. The method according to claim 5, wherein: The step of determining the transformed interaction statement according to the interaction statement output by the current layer and the level corresponding to the current layer includes: When the interaction sentence output by the current layer does not belong to the sub-domain of the current layer and the current layer is the first layer, determining the interaction sentence output by the current layer as the transformed interaction sentence; When the interaction sentence output by the current layer belongs to the sub-domain of the current layer and the current layer is the Nth layer, the interaction sentence output by the current layer is determined as the transformed interaction sentence.
8. The method according to claim 6 or 7, wherein: The method further comprises: Determine whether the interactive statement output by the current layer belongs to the sub-domain of the current layer through the domain classification model corresponding to the current layer.
9. The method according to claim 5, wherein: The processing of the interaction sentence output by the preset layer or the original interaction sentence according to the GPT model corresponding to the sub-domain of the current layer to obtain the interaction sentence output by the current layer includes: In the case that the N-layer sub-fields include N sub-fields, and the i-th sub-field among the N sub-fields is a sub-field of the i-1-th sub-field, the i-1-th interaction statement or the intention information of the original interaction statement in the i-1-th sub-field is parsed by the i-th GPT model corresponding to the i-th sub-field to generate the i-th interaction statement, wherein the i-1-th interaction statement is obtained according to the i-1-th GPT model corresponding to the i-1-th sub-field, the current layer is the i-th layer, and the preset layer is the i-1-th layer.
10. The method according to claim 9, wherein: The step of determining the transformed interaction statement according to the interaction statement output by the current layer and the level corresponding to the current layer includes: In the case that the i-th interaction statement belongs to the interaction statement of the i-th sub-field, the i-th interaction statement belongs to the interaction statement of the i+k-th sub-field, and the i-th interaction statement does not belong to the interaction statement of the i+k+1-th sub-field, the i-th interaction statement is obtained as the interaction statement output by the preset layer, the i+k+1-th layer is obtained as the current layer, and the operation of processing the interaction statement output by the preset layer or the original interaction statement according to the GPT model corresponding to the sub-field of the current layer to obtain the interaction statement output by the current layer is continued until the transformed interaction statement is obtained, wherein k is a natural number, i+k<N.
11. The method according to claim 5, wherein: The processing of the interaction sentence output by the preset layer or the original interaction sentence according to the GPT model corresponding to the sub-domain of the current layer to obtain the interaction sentence output by the current layer includes: In the case where the N-layer sub-domains include N groups of domains, the i-th group of domains in the N groups of domains is a sub-domain of the i-1th group of domains, each domain in the same group of domains belongs to the same level, and each group of domains corresponds to a group of GPT models, the intention information of the i-1th interaction statement or the original interaction statement on the sub-domain corresponding to the i-th sub-group domain is parsed by each GPT model in the i-th sub-group GPT model corresponding to the i-th sub-group domain to obtain the i-th group of interaction statements, wherein the i-1th interaction statement is an interaction statement generated by the i-1th current GPT model in the i-1th sub-group GPT model, the i-1th current GPT model is a GPT model corresponding to the i-1th current domain in the i-1th group of domains, and the i-th sub-group domain is a sub-domain of the i-1th current domain in the i-1th group of domains; Select the i-th interactive sentence in the i-th group of interactive sentences, wherein the i-th interactive sentence The sentence is an interactive sentence generated by the i-th current GPT model in the i-th sub-group GPT model, the i-th current GPT model is the GPT model corresponding to the i-th current field in the i-th sub-group field, the current layer is the i-th layer, and the preset layer is the i-1-th layer.
12. The method according to claim 11, wherein: The step of determining the transformed interaction statement according to the interaction statement output by the current layer and the level corresponding to the current layer includes: When the i-th interaction statement does not belong to the interaction statement of the i-th current domain and i is equal to 1, determining the i-th interaction statement as the transformed interaction statement; When the i-th interaction statement does not belong to the interaction statement of the i-th current domain and i is not equal to 1, determining the i-1-th interaction statement as the transformed interaction statement; When the i-th interaction statement belongs to the interaction statement of the i-th current domain and i is less than N, the value of i is increased by 1, and the operation of processing the interaction statement output by the preset layer or the original interaction statement according to the GPT model corresponding to the sub-domain of the current layer to obtain the interaction statement output by the current layer is continued until the transformed interaction statement is obtained; When the i-th interaction sentence belongs to the interaction sentence of the i-th current domain and i is equal to N, the i-th interaction sentence is determined as the transformed interaction sentence.
13. The method according to claim 11, wherein: Selecting the i-th interaction statement in the i-th group of interaction statements includes: Select the interaction statement with the highest confidence from the i-th group of interaction statements to obtain the i-th interaction statement, wherein the confidence of each interaction statement in the i-th group of interaction statements is the confidence generated by the corresponding GPT model in the i-th sub-group GPT model based on the intention information of the i-1-th interaction statement parsed in the corresponding field in the i-th sub-group field.
14. The method according to claim 12, wherein: The method further comprises: Whether the i-th interaction statement belongs to the i-th current domain is determined by the i-th current domain classification model corresponding to the i-th current domain.
15. The method according to claim 5, wherein: Before parsing the intention information of the original interaction sentence in the preset domain through the target generative pre-trained GPT model and determining the transformation of the interaction sentence according to the intention information, the method further includes: Obtain M GPT models corresponding to the N-layer sub-domains, where M is a positive integer greater than or equal to N; The M GPT models are distributed and deployed in corresponding servers.
16. The method according to claim 15, wherein: Obtaining M GPT models corresponding to the N-layer sub-domains, including: The j-th GPT model among the M GPT models is obtained by one of the following methods, wherein j is a positive integer greater than or equal to 1 and less than or equal to M: Obtaining a first general GPT model, wherein the first general GPT model is a model trained using first predetermined data; training the first general GPT model using a j-th group of training data corresponding to a j-th field to obtain a j-th GPT model corresponding to the j-th field; The jth group of training data corresponding to the jth field is sent to the designated platform by calling the designated interface of the designated platform; the jth GPT model corresponding to the jth field is obtained by training the second general GPT model using the jth group of training data on the designated platform, wherein the second general GPT model is a model trained by the designated platform using second predetermined data.
17. The method according to claim 1, wherein: Before parsing the intention information of the original interaction sentence in the preset domain through the target generative pre-trained GPT model and generating a transformed interaction sentence according to the intention information, the method further includes: The general GPT model is trained for round i by following the steps below: Inputting the i-th sample interaction sentence of the non-preset domain in the training sample set into the general GPT model obtained by the i-1th round of training, wherein the i-th sample interaction sentence corresponds to the preset i-th first type annotated interaction sentence and the i-th second type annotated interaction sentence; The general GPT model obtained by the i-1th round of training performs grammatical error correction on the i-th sample interaction sentence to obtain the i-th group of first-type candidate interaction sentences, and Determine the i-th first type candidate interaction sentence from the type candidate interaction sentences; Performing semantic expansion processing on the i-th sample interaction sentence through the general GPT model obtained by the i-1-th round of training to obtain the i-th group of second-type candidate interaction sentences, and determining the i-th second-type candidate interaction sentence in the i-th group of second-type candidate interaction sentences; According to the i-th first type annotated interaction sentence, the i-th first type candidate interaction sentence, the i-th second type annotated interaction sentence and the i-th second type candidate interaction sentence, Determine the target loss value for the i-th round of training; When the target loss value of the i-th round of training does not meet the preset training cutoff condition, adjusting the parameters of the general GPT model obtained by the i-1-th round of training to determine the general GPT model obtained by the i-th round of training; When the target loss value of the i-th round of training meets the preset training cutoff condition, the training is terminated.
18. The method according to claim 17, wherein: The general GPT model obtained through the i-1th round of training performs the grammatical error correction processing on the i-th sample interaction sentence to obtain the i-th group of first-type candidate interaction sentences, including: performing the grammatical error correction processing on the i-th sample interaction sentence through the general GPT model obtained through the i-1th round of training to obtain the i-th group of first-type candidate interaction sentences and the corresponding i-th group of confidences; Determining the i-th first type candidate interaction statement in the i-th group of first type candidate interaction statements includes: selecting the first type candidate interaction statement with the highest confidence in the i-th group of first type candidate interaction statements to obtain the i-th first type candidate interaction statement.
19. The method according to claim 1, wherein: Before parsing the intention information of the original interaction sentence in the preset domain through the target generative pre-trained GPT model and generating a transformed interaction sentence according to the intention information, the method further includes: The general domain classification model and the general GPT model are jointly trained for the i-th round through the following steps: the i-th sample interaction sentence of the non-preset domain in the training sample set is input into the i-1-th round training In the general GPT model obtained by training, the i-th sample interaction sentence corresponds to the preset i-th first type labeled interaction sentence, the i-th second type labeled interaction sentence, and the i-th actual field; Performing grammatical error correction processing on the i-th sample interaction sentence by using the general GPT model obtained by the i-1th round of training to obtain the i-th group of first-type candidate interaction sentences, and determining the i-th first-type candidate interaction sentence in the i-th group of first-type candidate interaction sentences; Performing semantic expansion processing on the i-th sample interaction sentence through the general GPT model obtained by the i-1-th round of training to obtain the i-th group of second-type candidate interaction sentences, and determining the i-th second-type candidate interaction sentence in the i-th group of second-type candidate interaction sentences; Determine a first target loss value for an i-th round of training according to the i-th first-type labeled interaction sentence, the i-th first-type candidate interaction sentence, the i-th second-type labeled interaction sentence, and the i-th second-type candidate interaction sentence; Inputting the i-th sample interaction sentence into the general domain classification model obtained by the i-1th round of training, and performing domain classification processing on the i-th sample interaction sentence by the general domain classification model obtained by the i-1th round of training to obtain the i-th predicted domain; Determining a second target loss value of the i-th round of training according to the i-th predicted domain and the i-th actual domain; Determining a target loss value for the i-th round of training according to the first target loss value for the i-th round of training and the second target loss value for the i-th round of training; When the target loss value of the i-th round of training does not meet the preset training cutoff condition, adjusting the parameters in the general GPT model obtained in the i-1th round of training and the parameters in the general domain classification model obtained in the i-1th round of training to determine the general GPT model obtained in the i-th round of training and the general domain classification model obtained in the i-th round of training; When the target loss value of the i-th round of training meets the preset training cutoff condition, the training is terminated.
20. The method according to claim 1, wherein: Parsing the intention information of the original interaction sentence in the preset domain through the target generation pre-trained GPT model, and generating a transformed interaction sentence according to the intention information, including: By using the target generative pre-trained GPT model, the original interaction sentence is subjected to grammatical error correction processing according to the intention information to obtain a set of first type candidate interaction sentences; By using the target generative pre-trained GPT model, the original interaction sentence is semantically expanded according to the intention information to obtain a set of second-type candidate interaction sentences; A transformed interaction sentence is determined from the set of first-type candidate interaction sentences and the set of second-type candidate interaction sentences.
21. The method according to claim 20, wherein: Performing interactive processing according to the transformed interactive statement includes: In a case where the transformed interaction statement belongs to the preset domain and the transformed interaction statement is determined to be an interaction statement in the group of first-type candidate interaction statements through label information of the transformed interaction statement, executing an operation corresponding to the transformed interaction statement; In the case that the transformed interaction statement belongs to the preset domain and it is determined through the label information of the transformed interaction statement that the transformed interaction statement is an interaction statement in the group of second type candidate interaction statements, the inquiry process is entered.
22. A processing device for interactive sentences based on a target-generated pre-trained GPT model, comprising: A determination module is configured to determine a domain classification result of an input original interaction sentence through a domain classification model, and determine whether the original interaction sentence belongs to a preset domain based on the domain classification result; A generation module is configured to parse the intention information of the original interaction sentence in the preset domain through a target generative pre-trained GPT model when it is determined that the original interaction sentence does not belong to the preset domain, and generate a transformed interaction sentence according to the intention information; The interaction module is configured to perform interaction processing according to the transformed interaction statement.
23. A system for processing interactive sentences based on a target-generated pre-trained GPT model, comprising: A domain classification model is configured to perform domain classification on the input original interaction sentence to determine whether the original interaction sentence belongs to a preset domain; The target-generated pre-trained GPT model is configured to parse the intention information of the original interaction sentence in the preset domain when the original interaction sentence does not belong to the preset domain, and generate a transformed interaction sentence according to the intention information; The dialogue engine is configured to perform interaction processing according to the transformed interaction sentences.
24. A computer-readable storage medium, the computer-readable storage medium comprising a stored program, wherein: When the program is executed, the method according to any one of claims 1 to 21 is executed.
25. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the method according to any one of claims 1 to 21 through the computer program.
Citation Information
Patent Citations
Intelligent question answering method, device and intelligent terminal
CN109063152A
Intention identification method and device
CN109492079A
Dialogue interaction intention identification method and device
CN112100368A
Domain and intention hierarchical joint classification method and device, equipment and storage medium
CN112597310A
Dialogue response method and system, electronic equipment and storage medium
CN115203393A
