Neural network system, method and device for multiple rounds of dialogues and storage medium
By introducing a turn-based parameter selection expert neural network into the neural network system, the insufficient accuracy of large language models in specific domain tasks and the flexibility problem of traditional multi-turn probing methods are solved, achieving high-precision and stable semantic parsing in complex dialogue environments.
Patent Information
- Application Number
- CN202511519214.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-01-30
AI Technical Summary
Large language models suffer from insufficient accuracy and stability when dealing with specific domain tasks, such as metaphor recognition, complex context parsing, and task instruction decomposition. Furthermore, traditional multi-turn questioning methods lack flexibility in adapting to complex and ever-changing dialogue environments, resulting in low recognition accuracy.
A neural network system is employed, comprising a first neural network layer, a hybrid expert network layer, and a second neural network layer. The routing layer selects an expert neural network for processing based on the dialogue turn parameters, and the results are combined in the hybrid expert network layer to enhance the semantic parsing capability of the dialogue system.
It significantly improves the understanding accuracy and processing stability in deep questioning scenarios, and can maintain sufficient semantic parsing capabilities when facing complex tasks, adapting to the complexity and changes of multi-turn dialogues.
Smart Images

Figure CN121436048A_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of deep learning technology, and more particularly to a neural network system for multi-turn dialogue, a training method for a neural network system for multi-turn dialogue, a multi-turn dialogue method, an electronic device, and a computer-readable storage medium. Background Technology
[0002] With the widespread application of Large Language Models (LLMs) in natural language processing, traditional rule-based or small-scale machine learning models for dialogue understanding and semantic recognition are gradually being replaced. Although LLMs demonstrate strong capabilities in semantic understanding and generation, their accuracy and stability remain somewhat insufficient when handling specific domain tasks, such as metaphor recognition, complex context parsing, and task instruction decomposition. They are prone to misjudgments and biases in ambiguous expressions, cross-cultural contexts, or deep dependencies.
[0003] To compensate for the above shortcomings, related technologies typically employ a multi-round questioning approach, which involves setting fixed question templates and follow-up strategies based on initial clues to guide the model to gradually focus on key information. However, this progressive interaction logic, which relies on fixed templates, lacks flexibility in adapting to complex and ever-changing dialogue environments, resulting in lower recognition accuracy in scenarios such as fine-grained semantic recognition or deep contextual follow-up questioning. Summary of the Invention
[0004] In view of the above, one or more embodiments of this specification provide the following technical solutions: According to a first aspect of one or more embodiments of this specification, a neural network system for multi-turn dialogue is proposed, including one or more neural network subsystems; At least one of the neural network subsystems includes a first neural network layer, a hybrid expert network layer, and a second neural network layer; The hybrid expert network layer includes N routing layers, M expert neural network sets, and an output layer, where N>1 and M>1, and the expert neural network sets include multiple expert neural networks. The i-th routing layer is configured to select at least one expert neural network from a set of j expert neural networks based on the round parameters corresponding to the i-th round of dialogue and the output of the first neural network layer, and use the output of the first neural network layer as the input of the selected expert neural network, 0 < i ≤ N, 0 < j ≤ M, and the number of expert neural network sets accessed by the i-th routing layer is not less than the number of expert neural network sets accessed by the (i-1)-th routing layer. The expert neural network is configured to process the output of the first neural network layer to obtain a processing result; The output layer is configured to combine the processing results of the expert neural network output selected by the i-th routing layer, and use the combined result as the input of the second neural network layer.
[0005] According to a second aspect of one or more embodiments of this specification, a training method for a neural network system for multi-turn dialogue as described in the first aspect is proposed, comprising: Obtain N rounds of dialogue samples, where each round of dialogue sample in the N rounds of dialogue samples includes a reference question and a corresponding reference answer, where N>1; The reference question and corresponding context information in the i-th round of dialogue sample are input into the neural network system to be trained to obtain the predicted response output by the neural network system; wherein, the context information of the first round of dialogue sample includes the round parameters corresponding to the first round of dialogue, and the context information of other rounds of dialogue sample includes the round parameters corresponding to other rounds of dialogue and the predicted response output by the neural network system in the previous round, 0 < i ≤ N. With the optimization objective of minimizing the error between the reference response and the predicted response in the i-th round, the parameters in the neural network system are adjusted. The parameters in the neural network system include the parameters of the first neural network layer, the parameters of the second neural network layer, the parameters of the i-th routing layer in the hybrid expert network layer, the parameters of all expert neural networks in the j-th expert neural network set accessed by the i-th routing layer, and the parameters of the output layer in the hybrid expert network layer.
[0006] According to a third aspect of the embodiments of this specification, a multi-turn dialogue method is provided, comprising: The question for the first dialogue round is obtained, and the question for the first dialogue round and the corresponding round parameters are input into a pre-trained neural network system for multi-turn dialogue, so that the neural network system outputs the response for the first round. The neural network system is trained based on the method described in the second aspect; and The system obtains questions from dialogue rounds other than the first dialogue round, and inputs the question of the dialogue round, the corresponding round parameters, and the response from the previous round into the neural network system to obtain the response for the current dialogue round.
[0007] According to a fourth aspect of the embodiments of this specification, an electronic device is provided, comprising: processor; Memory used to store processor-executable instructions; Wherein, when the processor executes the executable instructions, it is used to implement the method described in the first aspect.
[0008] According to a fifth aspect of the embodiments of this specification, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in the first aspect.
[0009] As can be seen from the above embodiments, by injecting the round parameters corresponding to the i-th round of dialogue into the i-th routing layer, the system can perceive the depth and context of the current dialogue based on the round information, significantly enhancing the model's ability to capture the dialogue evolution process. As the number of dialogue rounds increases, the number of expert neural network sets accessible by the i-th routing layer is no less than the number of expert neural network sets accessible by the (i-1)-th routing layer. This means that when the dialogue enters the deep questioning stage, the system has more expert resources available for scheduling. By expanding the coverage of the expert neural network set 1122, the system can maintain sufficient semantic parsing capabilities when facing complex tasks such as metaphor recognition, potential risk interpretation, and cross-domain knowledge fusion, thereby improving the understanding accuracy and processing stability in deep questioning scenarios.
[0010] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this specification. Attached Figure Description
[0011] Figure 1 This is a schematic diagram of a neural network system for multi-turn dialogue provided in an exemplary embodiment.
[0012] Figure 2 This is a schematic diagram of a neural network subsystem provided in an exemplary embodiment.
[0013] Figure 3 This is a schematic diagram of another neural network subsystem provided in an exemplary embodiment.
[0014] Figure 4 This is a flowchart of a training method for a neural network system for multi-turn dialogue, provided as an exemplary embodiment.
[0015] Figure 5 This is a flowchart of a multi-turn dialogue method provided in an exemplary embodiment.
[0016] Figure 6 This is a schematic diagram of the structure of a device provided in an exemplary embodiment. Detailed Implementation
[0017] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0018] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties. The collection, use and processing of related data shall comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals shall be provided for users to choose to authorize or refuse.
[0019] The following is an explanation of the relevant terms used in the embodiments of this specification: 1. Large Language Model (LLM): A large language model is a deep learning-based natural language processing model that, through training on massive amounts of text data, possesses the ability to generate high-quality text, understand complex semantics, and perform various downstream tasks. Its core characteristics include a large number of parameters, strong generalization ability, and sensitive capture of contextual information. Large language models are widely used in content generation, risk identification, and other fields, but their performance may be limited by their ability to deeply understand specific domains.
[0020] 2. Mixture of Experts (MoE): A Mixture of Experts (MoE) is a modular neural network architecture that achieves high computational efficiency by distributing computational tasks among multiple expert neural networks. Each expert neural network focuses on a specific task or data pattern, while a routing mechanism determines which expert neural networks process the input data. The MoE architecture can significantly reduce computational costs while maintaining high performance.
[0021] 3. Routing Layer in Hybrid Expert Networks: The routing layer is the core component of a hybrid expert network, responsible for dynamically selecting appropriate expert neural networks for processing based on the input data. It determines which expert neural networks to activate and their corresponding weights by calculating the correlation scores between the input and each expert neural network. The design of the routing layer directly affects the model's efficiency and performance, especially in complex tasks such as multi-round follow-up questions, where optimizing the routing strategy is crucial for improving semantic parsing capabilities.
[0022] 4. Shared Expert Neural Networks: Shared expert neural networks refer to expert neural networks that are used jointly by multiple tasks or dialogue rounds in a hybrid expert network. Shared experts typically handle common or basic task requirements, avoiding redundant computation and improving resource utilization. The introduction of shared experts helps reduce the number of model parameters while ensuring stable handling of common problems in scenarios such as multi-round follow-up questions.
[0023] 5. The set of expert neural networks accessed by the routing layer: The expert neural networks in this set are those specifically responsible for routing decisions within the hybrid expert network framework. In multi-turn questioning scenarios, the activation range of the expert neural networks can be progressively expanded according to the dialogue rounds, providing richer computational resources for each questioning layer. This design enhances the model's adaptability to complex tasks and its semantic parsing capabilities.
[0024] Please see Figure 1 , Figure 1 A schematic diagram of a neural network system 100 for multi-turn dialogue provided in an embodiment of this specification is shown. The neural network system 100 is a system implemented as a computer program on one or more computers at one or more locations, such as being deployed on a server, a terminal device, or a cloud platform, and can achieve distributed collaborative operation via a network.
[0025] In one exemplary embodiment, the neural network system 100 for multi-turn dialogue can receive questions input by a user. Questions can be described not only in the form of natural language text, but also as voice signals, images or videos, structured data queries, or even semi-structured instructions related to a specific application scenario. For example, in a customer service scenario, the input can be a user's natural language inquiry; in an intelligent search scenario, the input can be keywords or search terms; and in an IoT device control scenario, the input can be control commands issued by the user through a terminal device.
[0026] After receiving input, the neural network system 100 can extract features and perform semantic parsing on the input content, and generate a response that matches the user's intent based on the context information of multi-turn dialogue. The response can be output not only as natural language text, but also, depending on the needs, as a synthesized speech to the user, as structured data returned to the calling system, or as tags, charts, etc., in a graphical user interface. For example, in a risk identification scenario, the output can be a risk level label and risk explanation information; in a task execution scenario, the output can be the corresponding execution instructions; and in an educational question-and-answer scenario, the output can be rich text knowledge explanations.
[0027] By supporting diverse input and output formats, the neural network system 100 not only enhances its adaptability to different scenarios but also improves the flexibility and practicality of human-computer interaction. In particular, by introducing a multi-turn dialogue mechanism, the system can gradually clarify the user's intent within a continuous context, avoiding ambiguity or omissions that may occur in a one-time interaction, thereby improving the overall interaction accuracy and user experience.
[0028] Please see Figure 1 The neural network system 100 for multi-turn dialogue may include one or more neural network subsystems 110. For example, the neural network subsystem 110 may include a subsystem based on the Transformer architecture to leverage its advantages in long sequence modeling and contextual semantic understanding. However, it should be understood that the neural network subsystem 110 is not limited to Transformer and may also include recurrent neural networks (RNNs), convolutional neural networks (CNNs), graph neural networks (GNNs), or hybrid deep neural networks to adapt to different application scenarios and computational resource conditions.
[0029] In some embodiments, the multiple neural network subsystems 110 can coordinate with each other through various connection methods: ① serial connection (e.g., Figure 1 (As shown): The output of one neural network subsystem 110 serves as the input of the next neural network subsystem 110, used for progressive feature extraction and abstraction. ② Parallel connection: Different neural network subsystems 110 process the same input simultaneously, and then the output results are weighted and combined through a fusion module, thereby improving diversity and robustness. ③ Hierarchical connection: Different neural network subsystems 110 are invoked in different task levels or dialogue rounds, enabling on-demand switching and dynamic allocation of computing resources. ④ Distributed deployment: Multiple neural network subsystems 110 can run on different computing nodes or devices, collaborating through network communication, thereby improving processing throughput and system scalability in large-scale application scenarios. Through these flexible connection methods, the neural network system 100 can adaptively invoke appropriate combinations of neural network subsystems 110 in multi-turn dialogues based on task complexity, context evolution, and computing resource status. This not only improves the accuracy and robustness of semantic parsing but also effectively balances processing efficiency and resource utilization. Please see Figure 2 At least one neural network subsystem 110 includes a first neural network layer 111, a second neural network layer 113, and a hybrid expert network layer 112 between the first neural network layer 111 and the second neural network layer 113.
[0030] For example, when the neural network subsystem 110 is a Transformer-based subsystem, the first neural network layer 111 may include a self-attention network layer to model the global dependencies between elements in the input sequence, thereby achieving efficient capture of contextual information. The second neural network layer 113 may include a feedforward neural network layer or a normalization layer to further transform and fuse the features processed by the expert network layer.
[0031] In other embodiments, the first neural network layer 111 and the second neural network layer 113 are not limited to the forms described above. For example, the first neural network layer 111 can be a convolutional neural network layer for local feature extraction; the second neural network layer 113 can be a recurrent neural network layer for temporal feature modeling.
[0032] Please see Figure 2 The hybrid expert network layer 112 includes N routing layers 1121, M expert neural network sets 1122, and an output layer 1123, where N>1 and M>1. The expert neural network set 1122 includes multiple expert neural networks, each of which can be trained specifically for different semantic features or task scenarios, thus forming a complementary expert library as a whole.
[0033] The i-th routing layer 1121 is configured to select at least one expert neural network from j expert neural network sets 1122 based on the round parameters corresponding to the i-th round of dialogue and the output of the first neural network layer 111, and use the output of the first neural network layer 111 as the input of the selected expert neural network, where 0 < i ≤ N, 0 < j ≤ M. The number of expert neural network sets 1122 accessed by the i-th routing layer 1121 is no less than the number of expert neural network sets 1122 accessed by the (i-1)-th routing layer 1121, thereby gradually increasing the number of selectable experts during multi-round interactions and improving the system's adaptability to complex contexts.
[0034] The round parameter can be represented using round encoding. For example, the round encoding can be a round position embedding vector, which encodes the position of the i-th round in the dialogue and is used as an additional input along with the output of the first neural network layer 111 to the i-th routing layer 1121, thereby enabling the routing layer 1121 to accurately perceive the current round of the dialogue. In other embodiments, the round parameter may also include, but is not limited to, timestamp-based encoding, dialogue state labels, etc., to enhance the system's context modeling and dynamic adaptation capabilities during multi-round interactions.
[0035] For example, the i-th routing layer 1121 is specifically configured to receive the output from the first neural network layer 111, and combine it with the round parameters corresponding to the i-th round of dialogue to form the input signal for routing decision. The routing layer 1121 matches the input signal with the feature spaces of multiple expert neural networks, calculating the correlation score between the input and each expert neural network. This correlation score can be calculated using dot product attention, gating mechanisms, reinforcement learning strategies, or other probabilistic modeling methods. Based on the correlation score, the routing layer 1121 determines which expert neural networks to select and assigns corresponding weights to each selected expert. In this way, the system can not only flexibly call upon suitable experts but also achieve weighted fusion of the outputs of different experts.
[0036] As the dialogue deepens, the value of i gradually increases, and the size of the expert neural network set 1122 accessible by the routing layer 1121 also gradually expands. For example, in the initial rounds, the routing layer 1121 may only access the expert neural network set 1122 related to general semantic analysis; however, when entering the deep questioning stage, it can call more expert network sets 1122 covering fine-grained semantic parsing, domain-specific knowledge modeling, metaphor recognition, etc., thereby ensuring robustness in complex dialogue contexts.
[0037] In some embodiments, the number of expert neural network sets 1122 accessed by the i-th routing layer 1121 can be equal to or greater than the number of expert neural network sets 1122 accessed by the (i-1)-th routing layer 1121. When the number of accessed expert neural networks by the current layer is greater than that by the previous layer, the system can dynamically expand the parameter space. Specifically, as the number of dialogue rounds increases or the system enters a deeper probing stage, the i-th routing layer 1121 can access more specialized expert neural networks, thereby increasing the total number of available parameters in the system. This mechanism enables the system to obtain sufficient semantic parsing capabilities and computational resources when dealing with complex contexts or multi-round deep probing, ensuring a high-precision understanding of the input information and the stability of the output results.
[0038] For example, the j expert neural network sets 1122 include at least the expert neural network sets 1122 accessed by the (i-1)th routing layer 1121. This means that when each routing layer 1121 accesses the expert neural network sets 1122, it can retain all the expert neural network sets 1122 accessed by the previous layer, and dynamically add new expert network sets according to the current round and dialogue complexity, thereby achieving a gradual expansion of the parameter space.
[0039] In some embodiments, the number j of the expert neural network set 1122 accessed by the i-th routing layer 1121 is not a fixed value, but can be flexibly varied according to different dialogue rounds, contextual complexity, or system design strategies. In this way, the system can achieve adaptive scheduling for different application scenarios while maintaining the generality of the overall architecture.
[0040] In the first possible implementation, the number j of expert neural network sets 1122 accessed by the i-th routing layer 1121 increases linearly with i. Each routing layer 1121 accesses only the number of expert neural network sets 1122 it corresponds to. For example, the first routing layer 1121 accesses one expert neural network set 1122; the second routing layer 1121 accesses two expert neural network sets 1122; the third routing layer 1121 accesses three expert neural network sets 1122; and so on. This approach has a clear structure, and the system can gradually increase the expert coverage with each round, making it suitable for scenarios requiring strict hierarchical control.
[0041] In the second possible implementation, the number j of expert neural network sets 1122 accessed by the i-th routing layer 1121 increases by a fixed step size. For example: the first routing layer 1121 accesses 1 expert neural network set 1122; the second routing layer 1121 accesses 3 expert neural network sets 1122; the third routing layer 1121 accesses 5 expert neural network sets 1122. This design ensures that when entering deeper levels of dialogue, the system can schedule more expert neural network sets 1122 at once, thereby expanding the system's parsing capabilities more quickly. It is suitable for use in complex interaction or high-risk content recognition scenarios.
[0042] In a third possible implementation, the number of expert neural network sets 1122 can be increased after a fixed initial interval. That is, the first few routing layers 1121 might only access a fixed number of expert neural network sets 1122 to handle general semantic parsing; while in deeper routing stages, the number of sets accessed increases rapidly. For example, the first and second routing layers 1121 each access two expert neural network sets 1122; the third routing layer 1121 begins to access four expert neural network sets 1122; and the fourth routing layer 1121 accesses six expert neural network sets 1122. This approach helps control computational resource consumption in the early stages while ensuring sufficient semantic coverage in deeper stages.
[0043] In the fourth possible implementation, the system can also employ a dynamic adaptive strategy. That is, the number j of expert neural network sets 1122 accessed by the i-th routing layer 1121 is not predetermined by fixed rules, but is positively correlated with the complexity of the input question. For example, when the system detects that the input statement is a simple question-and-answer session, the i-th routing layer 1121 only accesses a smaller number of expert neural network sets 1122, such as 1 or 2; when the system detects that the input involves multiple layers of metaphors or domain-specific knowledge, it automatically expands the access scope, scheduling more expert neural network sets 1122, such as 5 or 6. This approach offers greater flexibility, ensuring both performance and efficiency.
[0044] In some embodiments, the number of expert neural networks selected by the i-th routing layer 1121 can be determined according to different strategies to adapt to the complexity of multi-turn dialogues and the computational resource limitations of the system. Exemplary selection logic includes, but is not limited to, the following methods: In the first possible implementation, the number of expert neural networks selected by the i-th routing layer 1121 can be flexibly adjusted according to the actual application scenario. For example, the system can determine the number of expert neural networks selected based on the complexity or semantic features of the input question. For instance, when the input question is a simple question-and-answer session or a routine information query, only a small number of expert neural networks, such as 1-2, are selected to reduce computational overhead; when the input question involves multi-layered metaphors, cross-domain knowledge, or high-risk content, more expert neural networks, such as 4-6 or more, are activated to provide sufficient parsing capabilities. This implementation can intelligently allocate computing resources according to the input content, improving efficiency while ensuring parsing accuracy.
[0045] In the second possible implementation, the number of expert neural networks selected by the i-th routing layer 1121 is greater than the number selected by the (i-1)-th routing layer 1121, i.e., it shows an increasing trend. For example, the first routing layer 1121 can select 2 expert neural networks based on the relevance scores of each expert neural network; the second routing layer 1121 selects 3 expert neural networks; and the third routing layer 1121 selects 5 expert neural networks. Through this increasing approach, the system can gradually expand its processing capacity in multi-turn dialogues, ensuring that more experts participate when entering deeper questioning or complex contexts, thereby improving the accuracy and robustness of deep semantic parsing.
[0046] In the third possible implementation, a maximum upper limit can be set for the number of experts selected by the i-th routing layer 1121 to prevent over-activation from overloading computational resources. For example, regardless of the complexity of the input problem, the number of experts selected by each routing layer 1121 does not exceed the maximum threshold; at the same time, a minimum selection threshold can be set to ensure that a certain number of experts participate even when the dialogue rounds are too shallow. For each routing layer 1121, a corresponding selection range can be set specifically. The selection ranges for different routing layers 1121 can be different. For example, the selection range for the number of expert neural networks in the first routing layer 1121 is [1,2]; the selection range for the number of expert neural networks in the second routing layer 1121 is [3,4]; and the selection range for the number of expert neural networks in the third routing layer 1121 and the first routing layer 1121 is [5,6]. This approach helps the system maintain computational controllability during large-scale deployment while still adapting to complex scenarios.
[0047] In some embodiments, the Nth routing layer 1121 can also be configured to handle more dialogue rounds than a preset number of routing layers 1121. For example, the actual number of dialogue rounds may be greater than the preset number N of routing layers 1121 in the system; for instance, when a user makes multiple consecutive deep follow-up questions, the number of rounds may reach N+1, N+2, or higher. To address this, the Nth routing layer 1121 is also configured to, when the number of dialogue rounds exceeds the number N of routing layers 1121, select at least one expert neural network from a set of M expert neural networks 1122 based on the round parameters corresponding to the current round of dialogue and the output of the first neural network layer 111, and use the output of the first neural network layer 111 as the input of the selected expert neural network. When the number of dialogue rounds exceeds N, the system does not need to add additional routing layers 1121; instead, the Nth routing layer 1121 reuses its routing and expert selection logic to handle the excess rounds, thereby maintaining the computational efficiency and stability of the model. This approach can adapt to situations where the number of dialogue rounds is not fixed and is unpredictable in real-world applications, ensuring that the system can still maintain accurate modeling of contextual evolution and high-precision semantic understanding capabilities in continuous multi-round interactions.
[0048] The expert neural network is configured to process the output of the first neural network layer 111 to obtain the processing result.
[0049] Different expert neural networks can employ different structures and functional orientations. For example, one type of expert neural network can be based on convolutional neural networks (CNNs), focusing on feature extraction at the local context or phrase level; another type can be based on recurrent neural networks (RNNs) or long short-term memory networks (LSTMs) to model cross-sentence or long-distance dependencies; there can also be Transformer-based expert neural networks for global semantic understanding and cross-turn dialogue information aggregation; in some embodiments, specialized knowledge graph experts, emotion recognition experts, metaphor / hint recognition experts, etc., can also be set up, making the entire system highly modular and adaptable to different types of tasks.
[0050] The output layer 1123 is configured to combine the processing results of the expert neural network output selected by the i-th routing layer 1121, and use the combined result as the input of the second neural network layer 113.
[0051] In terms of implementation, the combination operation can be weighted summation, concatenation, attention-weighted fusion, or a nonlinear fusion mechanism based on another lightweight neural network. Through the unified processing of the output layer 1123, it can be ensured that the input passed to the second neural network layer 113 maintains consistency in the semantic space.
[0052] By introducing a multi-level routing layer 1121, an expert neural network set 1122, and an output layer 1123 into the hybrid expert network layer 112, the embodiments of this specification can achieve the following technical effects: (1) By injecting the round parameters corresponding to the i-th round of dialogue into the routing layer 1121, the system can perceive the depth and context state of the current dialogue. Compared with the traditional method that only relies on the features of the input text, this mechanism significantly enhances the model's ability to capture the dialogue evolution process. (2) As the number of dialogue rounds increases, the number of expert neural network sets 1122 that the i-th routing layer 1121 can access is equal to or greater than the number of expert neural network sets 1122 that the (i-1)-th routing layer 1121 can access. This means that when the dialogue enters the deep questioning stage, the system has more expert resources available for scheduling. By expanding the coverage of the expert neural network set 1122, the system can maintain sufficient semantic parsing ability when facing complex tasks such as metaphor recognition, potential risk interpretation, and cross-domain knowledge fusion, thereby improving the understanding accuracy and processing stability in deep questioning scenarios.
[0053] In some embodiments, please refer to Figure 3In addition to the set of independent expert neural networks 1122 accessed by the routing layer 1121, the hybrid expert network layer 112 also includes a shared expert neural network 1124. The shared expert neural network 1124 plays a role in cross-round knowledge inheritance and information retention in multi-round dialogue, ensuring that important semantic information and knowledge from previous rounds can be carried over to subsequent rounds, thereby improving the coherence of dialogue understanding.
[0054] The shared expert neural network 1124 is configured to process the output of the first neural network layer 111 in each dialogue round to obtain the processing result. The shared expert neural network 1124 can adopt the same or different network architecture as the independent expert, such as feedforward network, convolutional layer, attention layer or Transformer submodule, to ensure both versatility and flexibility.
[0055] The output layer 1123 is also configured to combine the processing results of the expert neural network output selected by the i-th routing layer 1121 with the processing results of the shared expert neural network 1124. Through this combination, the system can simultaneously utilize the specialization capabilities of the dedicated expert neural network in the current round and the accumulated knowledge of the shared expert neural network 1124 across rounds, thereby achieving stability and continuity of semantic parsing in multi-round dialogues.
[0056] In one possible implementation, the number of shared expert neural networks 1124 can be one, in which case all dialogue rounds use the same shared expert neural network 1124, ensuring the continuity and consistency of semantic information across rounds, simplifying model parameter management, and reducing resource consumption.
[0057] In another possible implementation, the number of shared expert neural networks 1124 can be two or more, with adjacent dialogue rounds using at least one of the same shared expert neural networks 1124. This effectively improves the expressive power of the shared expert neural networks 1124, supports more complex or diverse semantic parsing, and retains important knowledge from previous rounds, thus achieving cross-round knowledge inheritance.
[0058] In some embodiments, the neural network system 100 for multi-turn dialogue provided in this specification can be applied to the architecture of a large language model. The neural network system 100 includes one or more neural network subsystems 110; each neural network subsystem 110 can be implemented based on a Transformer architecture, wherein the first neural network layer 111 can be a self-attention network layer, directly corresponding to the Transformer encoding or decoding layer of the large language model. In this structure, the neural network subsystem 110 can replace at least some of the original Transformer layers of the large language model. The replaced layer not only possesses the original attention calculation function but also introduces a hybrid expert network layer 112 and a routing mechanism, thereby obtaining the ability to dynamically select experts based on the number of dialogue turns and input complexity within the model.
[0059] Alternatively, the neural network subsystem 110 can be cascaded with the original layers of the large language model as an additional layer. After the input sequence completes preliminary semantic representation through the basic Transformer layer of the large language model, it enters the neural network subsystem 110 of the embodiments of this specification. Through this cascading method, the large language model is responsible for global semantic modeling, and the neural network system 100 is responsible for multi-turn dialogue enhancement based on turn parameters, and the two complement each other.
[0060] Through the above integration method, the embodiments of this specification can be seamlessly embedded into the Transformer structure of the large language model, so that while maintaining large-scale pre-trained knowledge and language generation capabilities, the large language model can also effectively improve context tracking capabilities, complex follow-up questioning capabilities, and cross-round consistency in multi-turn dialogue scenarios by utilizing the hybrid expert network layer 112 and turn parameter mechanism.
[0061] In some embodiments, this specification also provides a training method for a neural network system for multi-turn dialogue. This method can be executed by an electronic device, including but not limited to servers (such as physical servers, virtual servers, etc.), smartphones / mobile phones, tablet computers, personal digital assistants (PDAs), laptops, desktop computers, wearable devices, or other types of devices. This method, through supervised training on a large-scale dialogue corpus, enables the neural network system to learn how to combine turn parameters, contextual information, and the dynamic selection capabilities of hybrid expert network layers in multi-turn interactions, thereby generating more accurate, context-consistent, and logically coherent dialogue responses. See also... Figure 4 The training method includes: In S400, N rounds of dialogue samples are obtained. Each round of dialogue samples in the N rounds of dialogue samples includes a reference question and a corresponding reference answer, where N > 1.
[0062] Where N > 1, it means that the training process involves at least two consecutive dialogue rounds.
[0063] Reference questions refer to user input questions extracted from manually labeled or historical dialogue data, and are usually expressed in natural language. In addition to text, reference questions can also be voice input (transcribed into text by a speech recognition module), multimodal input (such as mixed text and image information), etc.
[0064] A reference response refers to the ideal output for a reference question. It can be annotated by human experts, generated by a rule system, or derived from a high-quality corpus. Reference responses can be natural language text, structured data, triples in a knowledge graph, or even API call results.
[0065] In addition, each round of dialogue samples can be bound to metadata, such as: dialogue scenario tags, such as customer service, medical, and education; and the complexity level of the input question.
[0066] In S402, the reference question and corresponding context information in the i-th round of dialogue sample are input into the neural network system to be trained to obtain the predicted response output by the neural network system; the context information of the first round of dialogue sample includes the round parameters corresponding to the first round of dialogue, and the context information of other rounds of dialogue sample includes the round parameters corresponding to other rounds of dialogue and the predicted response output by the neural network system in the previous round, 0 < i ≤ N.
[0067] The neural network system to be trained is the same neural network system for multi-turn dialogue described above, which includes: ① A first neural network layer, such as a self-attention network layer based on the Transformer architecture, used to encode the input question and context. ② A hybrid expert network layer, including multiple routing layers and multiple sets of expert neural networks. The routing layer corresponding to each turn of dialogue selects an expert network for processing based on the turn parameters and input features. ③ A second neural network layer, which further fuses the output results of the expert networks.
[0068] In this step, by introducing round parameters into all dialogue rounds, the system can explicitly perceive the dialogue depth, thereby distinguishing the problem features of different stages. Furthermore, by introducing the predicted response of the previous round into dialogue rounds other than the first dialogue round, the system not only learns how to generate a response based on the current input, but also learns how to correct and adapt to historical outputs, thereby gradually improving cross-round consistency during training. Optionally, the context information may also include: (1) Historical multi-round dialogue information: not only the predicted response of the previous round, but also the predicted responses or reference responses of several earlier rounds, thereby forming a dialogue history window. The history window can be of fixed length (e.g., retaining the most recent k rounds, k is greater than 1), or of dynamic length (e.g., adjusting the retention range according to the dialogue complexity). (2) Dialogue context embedding: encoding the dialogue context (user intent, topic semantic vector, sentiment state) in the preceding text into context information to help the model generate a more accurate and appropriate response in the current round. (3) User profile or interaction features: such as basic user attributes (e.g., identity, role, permission level), historical preferences (e.g., questioning style, usage scenarios), or session-specific parameters (e.g., security level, risk label). This information helps the model make personalized adjustments. (4) External knowledge or retrieval results: For knowledge-enhanced dialogue systems, the context can include results returned by external knowledge bases or document retrieval modules, such as factual text, document summaries, and entity relationships related to the user's question. (5) System actions or environmental feedback: In some task-oriented dialogue scenarios, the context can also include actions performed by the system in the previous round, API call results, or environmental states, such as database query results and recommendation engine output. (6) Time information: The context can include timestamps, session duration, and the time interval between the current round and the previous round. This type of information is particularly important for tasks that require sequential reasoning or contextual coherence. (7) Confidence information: the confidence score of the predicted response in the previous round, the distribution of activated expert network weights, etc. Introducing these signals during training can help the model learn how to adjust routing or expert selection when confidence is low.
[0069] In S404, the optimization objective is to minimize the error between the reference response and the predicted response in the i-th round. The parameters in the neural network system are adjusted, including the parameters of the first neural network layer, the parameters of the second neural network layer, the parameters of the i-th routing layer in the hybrid expert network layer, the parameters of all expert neural networks in the j expert neural network set accessed by the i-th routing layer, and the parameters of the output layer in the hybrid expert network layer.
[0070] In this step, the parameters of the neural network system are adjusted with the optimization objective of minimizing the error between the reference response and the predicted response in the i-th round. Methods such as cross-entropy loss and mean squared error can be used, and the gradient is calculated and the neural network parameters are updated through backpropagation.
[0071] For example, the i-th routing layer plays a core role in expert selection and allocation in the i-th round of dialogue. Its parameters are used to calculate the relevance score between the input semantic features and the candidate expert networks, and to determine the expert network to be activated and its corresponding weight distribution. By directly minimizing the error between the reference response and the predicted response during the i-th round of training, and applying gradient updates to the parameters of the i-th routing layer and the parameters of all expert neural networks in the j-th expert neural network set it accesses, the routing mechanism and expert parameters can better fit the feature distribution of the dialogue context in that round, thereby synergistically improving the overall representation and collaboration capabilities of the accessed expert neural network set in that round's context.
[0072] For example, the parameters of the first neural network layer, the parameters of the second neural network layer, and the parameters of the output layer in the hybrid expert network layer can be used as common parameters. Common parameters are those used in all rounds of the dialogue. For instance, the first neural network layer is responsible for extracting the input semantic features and representing the contextual information; its output serves as the input basis for subsequent routing layers and expert network selections. The output layer is typically used to pass the outputs of the routing layer and expert network to the second neural network layer for further processing, and therefore is invoked in each round of dialogue prediction.
[0073] Since the aforementioned common parameters play a role in the prediction process across all rounds, during the training phase, the error between the predicted response and the reference response in each round is propagated back to the common parameters, prompting them to receive corresponding gradient updates. This ensures that the common parameters continuously adapt to the input distribution and output requirements of different rounds, gradually forming a robust global semantic modeling capability and a unified response mapping capability. By continuously optimizing the common parameters during each training round, while ensuring that the parameters of specific routing layers and expert networks in local rounds are adjusted accordingly, the entire neural network system can further ensure consistency, generalization, and robustness in multi-round dialogue tasks, thereby improving the overall dialogue coherence and the accuracy of predicted responses.
[0074] In some embodiments, all parameters of the neural network system to be trained are stored in external storage devices, such as hard drives, solid-state drives, distributed storage clusters, or cloud parameter servers. The purpose of this design is to avoid having all parameters resident in memory or video memory at the same time, thereby effectively reducing the memory usage pressure of the system in large-scale training scenarios.
[0075] Regarding the common parameters, before the first round of training, the electronic device can load the parameters of the first neural network layer, the second neural network layer, and the output layer of the hybrid expert network system from external storage into memory. Since these parameters will be used in all rounds of training, loading them into memory in advance ensures the consistency between basic feature extraction and output mapping, while avoiding frequent access to external storage during training, thereby improving training efficiency.
[0076] For the hybrid expert network layer, before the i-th round of training, the parameters of the i-th routing layer and the parameters of all expert neural networks in the i-th expert neural network set can be loaded from external storage into memory as needed. 0 < i ≤ N, 0 < j ≤ M. For example, before the first round of training, the electronic device loads the parameters of the first routing layer and the parameters of all expert neural networks in at least one expert neural network set accessed by the first routing layer into memory; before the second round of training, the parameters of the second routing layer and the parameters of the expert neural network sets it accesses are loaded into memory; and so on, until the N-th round of training is completed.
[0077] This embodiment avoids storing all expert neural network parameters in memory at once through a dynamic loading mechanism, thus significantly reducing memory pressure during large-scale model training. In multi-round dialogue training, the system can dynamically load the corresponding routing layer and expert neural network set according to the context of different rounds, achieving on-demand allocation of resources and computing power.
[0078] In some embodiments, this specification also provides a multi-turn dialogue method, which can be executed by an electronic device, including but not limited to servers (such as physical servers, virtual servers, etc.), smartphones / mobile phones, tablet computers, personal digital assistants (PDAs), laptop computers, desktop computers, wearable devices, or other types of devices. This method utilizes a pre-trained neural network system for multi-turn dialogue to achieve multi-turn interactive responses to user input. The pre-trained neural network system is trained based on the training method of this specification and includes modules such as a first neural network layer, a hybrid expert network layer, and a second neural network layer. During the training phase, the parameters of each layer have been optimized to adapt to the contextual evolution and semantic parsing requirements of multi-turn dialogue. Please refer to [link to relevant documentation]. Figure 5 Multi-turn dialogue methods include: In S500, the question for the first dialogue round is obtained, and the question for the first dialogue round and the corresponding round parameters are input into a trained neural network system for multi-round dialogue, so that the neural network system outputs the response for the first round.
[0079] For example, the first neural network layer receives the input question and round parameters, and extracts semantic features from the input. For instance, if the first neural network layer is a Transformer architecture, it includes a self-attention mechanism layer to capture the dependencies between words in the question and their contextual relevance to the round parameters. The first routing layer in the hybrid expert network layer calculates the relevance scores of each expert neural network in at least one expert neural network set based on the output of the first neural network layer and the round parameters, and selects at least one expert neural network for processing. The selected expert neural network processes the input features, including operations such as semantic encoding, feature transformation, and context enhancement, to generate expert output. If a shared expert neural network exists, it also processes the input simultaneously to ensure cross-round knowledge inheritance.
[0080] The output layer of the hybrid expert network combines the outputs of all selected expert neural networks with the output of the shared expert neural network, for example, through weighted summation or attention fusion, to generate a combined feature representation, which is then passed to the second neural network layer. The second neural network layer performs further processing based on the combined features, and finally, the neural network system outputs the first round of responses, which can be natural language text, structured information, action instructions, or other forms of interactive output.
[0081] Through the above processing, the system is able to generate semantically accurate and context-relevant responses based on the question and round parameters in the first round of dialogue.
[0082] In S502, the questions of other dialogue rounds besides the first dialogue round are obtained, and the questions of the dialogue round, the corresponding round parameters, and the response of the previous round are input into the neural network system to obtain the response of the current dialogue round.
[0083] In this step, the electronic device acquires questions from all dialogue rounds except the first. For the k-th dialogue round (where k>1), the system needs to consider not only the semantic content of the current question but also the contextual state of the dialogue history to ensure the coherence and consistency of the generated response.
[0084] The input includes the question for the k-th round of dialogue, the round parameters corresponding to the k-th round, and the response from the previous round. The round parameters can be round encodings (such as position embeddings), round indices, or numerical representations indicating dialogue depth, used by the neural network system to distinguish the context of different rounds. The response from the previous round can be converted into a vectorized representation (such as through word vectors, sentence vectors, or Transformer encoding) upon input and jointly modeled with the question for the current round.
[0085] The trained neural network system first extracts features from the input question and the previous round's response by the first neural network layer (e.g., a self-attention network layer), and combines this with round parameter encoding to obtain a context-aware semantic representation.
[0086] In the hybrid expert network layer, the k-th routing layer dynamically selects at least one expert neural network from the set of expert neural networks it accesses, based on the current round parameters and the feature representation of the previous layer's output. This ensures that the most suitable expert is activated in different rounds to address contextual differences. The output layer in the hybrid expert network layer combines the outputs of the expert neural networks and inputs them into the second neural network layer to generate the final response for the k-th round. The output can be in the form of natural language, structured information, or other interactive formats suitable for the application scenario.
[0087] By incorporating responses from the previous round into each dialogue round, the system enables cross-round contextual modeling, ensuring that generated responses are semantically coherent and free from contextual fragmentation. Utilizing round parameters, the model can explicitly perceive the current dialogue depth, dynamically adjusting the expert set selected by the routing layer to maintain efficiency in shallow dialogues and enhance semantic parsing capabilities during deeper questioning.
[0088] In some embodiments, all parameters corresponding to the trained neural network system are stored in an external storage device, such as a hard disk, solid-state drive, distributed storage cluster, or cloud parameter server.
[0089] During inference, for the common parameters, the electronic device can load the parameters of the first neural network layer, the second neural network layer, and the output layer of the hybrid expert network from external storage into memory. Since these common parameters are used in all rounds of inference, loading them into memory in advance ensures the consistency between basic feature extraction and output mapping, while avoiding frequent access to external storage during inference, thereby improving inference efficiency and response speed.
[0090] For the hybrid expert network layer, before the i-th round of dialogue reasoning, the parameters of the i-th routing layer and the parameters of the j expert neural network sets accessed by the i-th routing layer can be loaded from external storage devices into memory as needed (0 < i ≤ N, 0 < j ≤ M). For example, before the first round of dialogue, the electronic device loads the parameters of the first routing layer and the parameters of at least one expert neural network set accessed by the first routing layer into memory; before the second round of dialogue, the parameters of the second routing layer and the expert neural network set accessed by it are loaded into memory; and so on, until the N-th round of dialogue is completed.
[0091] This dynamic loading mechanism avoids storing all expert neural network parameters in memory at once, thus significantly reducing memory usage in large-scale model inference. In multi-turn dialogue inference, the system can dynamically load the corresponding routing layer and expert network set according to the dialogue context of different turns, realizing on-demand allocation of computing resources and memory, while ensuring that each turn of dialogue can access sufficient semantic parsing capabilities to improve the accuracy of responses and processing stability.
[0092] In one application scenario, the aforementioned neural network system for multi-turn dialogue can be applied to the field of content risk identification. The system receives user-generated content or platform-circulated text, such as forum posts, social media comments, or short video subtitles. The first neural network layer in the system extracts semantic features from the input text and generates a preliminary contextual representation. The i-th routing layer in the hybrid expert network dynamically selects a set of expert neural networks based on the turn parameters and input semantic features, such as experts specializing in pornographic metaphors, violent insinuations, and hate speech. In the first turn of the dialogue, the system may only call the basic expert set for initial screening; in subsequent turns, when potential risk signals are detected, the routing layer accesses more expert sets for deeper inquiry, such as calling a metaphor parsing expert in scenarios involving ambiguous expressions like "code words" or "puns." The output layer combines the processing results from each expert and inputs them into the second neural network layer, ultimately outputting a risk identification result, such as "low risk," "high risk," or a risk type label. Through this mechanism of expanding experts round by round, the system can balance efficiency and accuracy in content security identification: the initial screening stage quickly filters out explicit risks, and the in-depth questioning stage enhances the ability to identify implicit expressions, thereby significantly reducing the rate of missed and false positives.
[0093] Those skilled in the art will understand that the aforementioned neural network system for multi-turn dialogue can also be applied to other fields, such as intelligent customer service, medical Q&A, online education and tutoring, financial risk control consulting, legal Q&A assistance, mental health intervention, interactive entertainment, game dialogue generation, intelligent cockpit voice interaction, enterprise knowledge base retrieval, public opinion monitoring and analysis, etc. This embodiment does not impose any limitations in this regard.
[0094] The various technical features in the above embodiments can be combined arbitrarily, as long as there is no conflict or contradiction between the combinations of features. However, due to space limitations, they are not described one by one. Therefore, the arbitrary combination of various technical features in the above embodiments is also within the scope of this specification.
[0095] Figure 6 This is a schematic structural diagram of a device provided in an exemplary embodiment. For example... Figure 6As shown, device 600 mainly consists of a communication interface 602, a user interface 604, a processor 606, and a data storage 608. These components are interconnected and communicate with each other via a system bus, network, or other connection mechanism 610. The communication interface 602 enables device 600 to communicate with other devices, access networks, and transmission networks via analog or digital modulation. For example, the communication interface 602 may include a chipset and antenna for wireless communication with a radio access network or access point. Furthermore, the communication interface 602 can be a wired interface such as Ethernet, Token Ring, or a USB port, or a wireless interface such as Wi-Fi, Bluetooth, Global Positioning System (GPS), or a wide-area wireless interface (e.g., WiMAX or LTE). Of course, the communication interface 602 can also support other forms of physical layer interfaces and standard or proprietary communication protocols. The communication interface 602 may also include multiple physical communication interfaces, such as Wi-Fi, Bluetooth, and wide-area wireless interfaces.
[0096] User interface 604 includes receiving user input and providing output to the user. Therefore, user interface 604 may include input components such as a keypad, keyboard, touch-sensitive or presence-sensitive panel, computer mouse, trackball, joystick, microphone, still camera, and video camera, and output components such as a display screen (which may be combined with a touch-sensitive panel), CRT, LCD, LED, display using DLP technology, printer, and other similar devices known or developed in the future. User interface 604 may also generate auditory output via speakers, speaker jacks, audio output ports, audio output devices, headphones, and other similar devices known or developed in the future. In some embodiments, user interface 604 may include software, circuitry, or other forms of logic capable of transmitting and receiving data from external user input / output devices. Additionally or alternatively, device 600 may support remote access from other devices via communication interface 602 or another physical interface (not shown). User interface 604 may be configured to receive user input, the position and movement of which may be indicated by indicators or cursors described herein. User interface 604 may also be configured as a display device for rendering or displaying text fragments.
[0097] Processor 606 may contain one or more general-purpose processors and / or special-purpose processors.
[0098] Data storage 608 may include one or more volatile and / or non-volatile storage components and may be integrated wholly or partially with processor 606. Data storage 608 may include removable and non-removable components.
[0099] Processor 606 is capable of executing program instructions 618 (e.g., compiled or uncompiled program logic and / or machine code) stored in data storage 608 to perform the various functions described herein. Data storage 608 may contain a non-transitory computer-readable medium on which program instructions are stored, which, when executed by device 600, enable device 600 to perform any methods, processes, or functions disclosed in this specification and / or the accompanying drawings. Execution of program instructions 618 by processor 606 may result in processor 606 using data 612.
[0100] For example, program instructions 618 may include an operating system 622 (e.g., an operating system kernel, device drivers, and / or other modules) installed on device 600 and one or more applications 620 (e.g., a browser, social application, or game application). Similarly, data 612 may include operating system data 614 and application data 616. Operating system data 614 is primarily accessible to the operating system 622, while application data 616 is primarily accessible to one or more applications 620. Application data 616 may reside in a file system visible or hidden from the user of device 600.
[0101] Application 620 can communicate with operating system 622 through one or more application programming interfaces (APIs). These APIs help application 620 read and / or write application data 616, transmit or receive information via communication interface 602, receive or display information on user interface 604, etc.
[0102] In some terminology, application 620 may be simply referred to as "app". Furthermore, application 620 can be downloaded to device 600 through one or more online app stores or app markets. However, applications can also be installed on device 600 in other ways, such as through a web browser or a physical interface on device 600 (e.g., a USB port).
[0103] In some embodiments, the training apparatus for a neural network system used in multi-turn dialogue can be applied to, for example... Figure 6 The device shown implements the technical solution of this specification. The training apparatus for the neural network system used in multi-turn dialogue may include: The sample acquisition module is used to acquire N rounds of dialogue samples. Each round of dialogue samples in the N rounds of dialogue samples includes a reference question and a corresponding reference answer, where N>1.
[0104] The training module is used to input the reference question and corresponding context information from the i-th round of dialogue samples into the neural network system to be trained, and obtain the predicted response output by the neural network system; wherein, the context information of the first round of dialogue samples includes the round parameters corresponding to the first round of dialogue, and the context information of other rounds of dialogue samples includes the round parameters corresponding to other rounds of dialogue and the predicted response output by the neural network system in the previous round, 0 < i ≤ N.
[0105] The training module is also used to adjust the parameters in the neural network system with the optimization objective of minimizing the error between the reference response and the predicted response in the i-th round. The parameters in the neural network system include the parameters of the first neural network layer, the parameters of the second neural network layer, the parameters of the i-th routing layer in the hybrid expert network layer, the parameters of all expert neural networks in the j-th expert neural network set accessed by the i-th routing layer, and the parameters of the output layer in the hybrid expert network layer.
[0106] In one implementation, all parameters of the neural network system to be trained are stored in an external storage device.
[0107] The device further includes a parameter loading module, used to load the parameters of the first neural network layer, the parameters of the second neural network layer, and the parameters of the output layer in the hybrid expert network layer of the neural network system to be trained from the external storage device into memory before performing the first round of training; and to load the parameters of the i-th routing layer in the hybrid expert network layer and the parameters of all expert neural networks in the i-th expert neural network set from the external storage device into memory before performing the i-th round of training.
[0108] In other embodiments, the multi-turn dialogue device can be applied to, for example... Figure 6 The device shown is used to implement the technical solution described in this specification. The multi-turn dialogue device may include: The first dialogue module is used to obtain the question for the first dialogue round, and input the question for the first dialogue round and the round parameters corresponding to the first dialogue round into a trained neural network system for multi-round dialogue, so that the neural network system outputs the response for the first round.
[0109] The second dialogue module is used to obtain questions from other dialogue rounds besides the first dialogue round, and inputs the question of the current dialogue round, the corresponding round parameters, and the response of the previous dialogue round into the neural network system to obtain the response of the current dialogue round.
[0110] For ease of description, the above devices are described by dividing them into various modules or units based on their functions. Of course, when implementing one or more of these specifications, the functions of each module or unit can be implemented in the same or different software and / or hardware, or a module that performs the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0111] Based on the same concept as the methods described above, this specification also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor performs the steps of the method as described in any of the above embodiments by executing the executable instructions.
[0112] Based on the same concept as the methods described above, this specification also provides a computer-readable storage medium having computer instructions stored thereon that, when executed by a processor, implement the steps of the methods as described in any of the above embodiments.
[0113] Based on the same concept as the methods described above, this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the methods as described in any of the above embodiments.
[0114] What those skilled in the art will understand is: In this specification, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitation, the presence of additional identical or equivalent elements in a process, method, product, or apparatus that includes said elements is not excluded.
[0115] In this specification, “a,” “an,” and “the” do not specifically refer to the singular, but may also include the plural.
[0116] In this specification, ordinal numbers such as "first," "second," etc., do not necessarily indicate order; they are often used to distinguish between objects. For example, "first server" and "second server" usually refer to two servers. To differentiate between these two servers, they are described as "first server" and "second server." Of course, sometimes these two servers may be the same server.
[0117] In this specification, unless explicitly stated otherwise, "receiving and sending data" does not necessarily mean direct receiving and sending; it can also mean indirect receiving and sending. For example, A receiving data sent by B can be understood as A directly receiving the data sent by B, or it can be understood as A indirectly receiving the data sent by B through other entities such as C. Similarly, B sending data to A can be understood as B sending the data directly to A, or it can be understood as B indirectly sending the data to A through other entities such as C. Here, C can be one entity, or it can be two or more entities.
[0118] In this specification, unless explicitly stated otherwise, the relationships between structures can be direct or indirect. For example, when describing "A is connected to B," unless it is explicitly stated that A and B are directly connected, it should be understood that A can be directly connected to B or indirectly connected to B. Similarly, when describing "A is on top of B," unless it is explicitly stated that A is directly above B (AB is adjacent and A is above B), it should be understood that A can be directly above B or indirectly above B (AB is separated by other elements, and A is above B). And so on.
[0119] This specification uses specific terms to describe embodiments thereof. Terms such as "an embodiment," "one embodiment," and / or "some embodiments" refer to a particular feature, structure, or characteristic associated with at least one embodiment of this specification. Therefore, it should be emphasized and noted that references to "an embodiment," "one embodiment," or "an alternative embodiment" in different locations throughout this specification do not necessarily refer to the same embodiment. Furthermore, those skilled in the art can combine and integrate the different embodiments or examples described herein, as well as the features of those different embodiments or examples, without contradiction.
[0120] Although one or more embodiments of this specification provide method steps as described in the embodiments or flowcharts, it is understood that the order of steps listed in the embodiments or flowcharts is only one of many possible execution orders and does not represent the only execution order. Therefore, when the claims involve method steps, any changes or adjustments to the order of such steps, or the parallelism between steps, are also within the scope of protection of the claims.
Claims
1. A neural network system for multi-turn dialogue, comprising one or more neural network subsystems; at least one of the neural network subsystems comprises a first neural network layer, a hybrid expert network layer, and a second neural network layer; the hybrid expert network layer comprises N routing layers, M expert neural network sets, and an output layer, N > 1, M > 1, the expert neural network sets comprise a plurality of expert neural networks; the ith routing layer is configured to select at least one expert neural network from the jth expert neural network set according to the turn parameter corresponding to the ith dialogue turn and the output of the first neural network layer, and input the output of the first neural network layer into the selected expert neural network, 0 < i ≤ N, 0 < j ≤ M, the number of expert neural network sets accessed by the ith routing layer is not less than the number of expert neural network sets accessed by the (i-1)th routing layer; the expert neural network is configured to process the output of the first neural network layer to obtain a processing result; the output layer is configured to combine the processing results of the outputs of the expert neural networks selected by the ith routing layer, and input the combined result into the second neural network layer.
2. The system of claim 1, wherein the Nth routing layer is further configured to select at least one expert neural network from the M expert neural network sets according to the turn parameter corresponding to the current dialogue turn and the output of the first neural network layer when the dialogue turn is greater than the number of routing layers.
3. The system of claim 1, wherein the hybrid expert network layer further comprises a shared expert neural network; the shared expert neural network is configured to process the output of the first neural network layer to obtain a processing result in each dialogue turn; the output layer is further configured to combine the processing results of the outputs of the expert neural networks selected by the ith routing layer and the processing result of the output of the shared expert neural network.
4. The system of claim 1, wherein the j expert neural network sets accessed by the ith routing layer comprise at least the expert neural network sets accessed by the (i-1)th routing layer; wherein the number j of expert neural network sets accessed by the ith routing layer has a linear increasing relationship with i; alternatively, the number j of expert neural network sets accessed by the ith routing layer increases by a fixed step; alternatively, the number j of expert neural network sets accessed by the ith routing layer has a positive correlation with the complexity of the input question.
5. The system of claim 1, wherein the number of expert neural networks selected by the ith routing layer is greater than the number of expert neural networks selected by the (i-1)th routing layer; and / or, the neural network subsystem comprises a subsystem based on a Transformer architecture, and the first neural network layer comprises a self-attention network layer.
6. A training method for the neural network system for multi-turn dialogue according to any one of claims 1 to 5, comprising: obtain N rounds of dialogue samples, each of the N rounds of dialogue samples comprising a reference question and a corresponding reference reply, N>1; input the reference question and the corresponding context information in the i-th round of dialogue sample into the neural network system to be trained to obtain a predicted reply output by the neural network system; wherein the context information of the first round of dialogue sample comprises a turn parameter corresponding to the first round of dialogue, and the context information of other rounds of dialogue sample comprises a turn parameter corresponding to the other rounds of dialogue and a predicted reply output by the neural network system in the last turn, 0 adjust parameters in the neural network system, including parameters of the first neural network layer, parameters of the second neural network layer, parameters of the i-th routing layer in the hybrid expert network layer, parameters of all expert neural networks in the j-th expert neural network set accessed by the i-th routing layer, and parameters of the output layer in the hybrid expert network layer, to minimize the error between the reference reply corresponding to the i-th round and the predicted reply corresponding to the i-th round as an optimization target.
7. The method of claim 6, wherein all parameters corresponding to the neural network system to be trained are stored in an external storage device; The method further comprises: before the first round of training, loading parameters of the first neural network layer, parameters of the second neural network layer, and parameters of the output layer in the hybrid expert network layer included in the neural network system to be trained from the external storage device to the memory; and before the i-th round of training, loading parameters of the i-th routing layer in the hybrid expert network layer and parameters of all expert neural networks in the i-th expert neural network set from the external storage device to the memory.
8. A multi-turn dialogue method, comprising: obtaining a question of a first dialogue turn and inputting the question of the first dialogue turn and a turn parameter corresponding to the first dialogue turn into a neural network system for multi-turn dialogue which has been trained to output a reply of the first turn by the neural network system, wherein the neural network system is trained based on the method of claim 6 or 7; and obtaining a question of a dialogue turn other than the first dialogue turn and inputting the question of the dialogue turn, a turn parameter corresponding to the dialogue turn and a reply of the last turn into the neural network system to obtain a reply of the dialogue turn. comprising:
9. An electronic device, comprising: a processor; a memory for storing processor-executable instructions; the memory is also used to store parameters of the neural network system for multi-turn dialogue as claimed in any one of claims 1-5; wherein the processor implements the steps of the method of any one of claims 6-8 by running the executable instructions. a computer readable medium having stored thereon computer instructions and parameters of the neural network system for multi-turn dialogue as claimed in any one of claims 1-5, which instructions, when executed by a processor, implement the steps of the method of any one of claims 6-8.
10. A computer-readable storage medium, characterized in that,
