Model optimizer, multi-hop question answering model training, multi-hop question answering method and device

By optimizing the parameters of the multi-hop question-answering model through Hamiltonian mechanics and symplectic integral algorithm, the stability and efficiency issues of the multi-hop question-answering model in complex reasoning tasks are solved, and a more efficient and explainable reasoning process is achieved.

CN119940554BActive Publication Date: 2025-09-12BEIJING SANSAN SMART EDUCATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510110558.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-09-12
Estimated Expiration
2045-01-23

AI Technical Summary

Technical Problem

Existing multi-hop question-answering models suffer from stability and low efficiency when handling complex reasoning tasks, and find it difficult to effectively navigate complex knowledge structures and provide explainable answers.

Method used

A model optimizer is used, combined with Hamiltonian mechanics and symplectic integration algorithm. The momentum is obtained by calculating the gradient of the loss function and the Hamiltonian equation, optimizing the model parameters of the multi-hop question-answering network, maintaining the geometric structure and energy conservation of the reasoning path, and dynamically adjusting the step size to optimize the reasoning process.

Benefits of technology

It significantly improves the training stability and efficiency of the multi-hop question-answering model, improves the performance and interpretability of complex reasoning tasks, and ensures efficient reasoning of the model in complex knowledge graphs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119940554B_ABST
    Figure CN119940554B_ABST
Patent Text Reader

Abstract

The present disclosure provides a model optimizer, a multi-hop question-answering model training method and apparatus, a multi-hop question-answering method and apparatus, an electronic device, and a computer-readable storage medium, relating to the field of data processing technology, particularly to technical fields such as deep learning and natural language processing. A specific implementation scheme is as follows: the model optimizer includes: a model inference framework for obtaining model parameters of a model and calculating the gradient of a loss function with respect to the model parameters; a Hamiltonian equation module for obtaining momentum based on the gradient and the Hamiltonian equation; a symplectic integrator for obtaining updated model parameters based on the momentum using a symplectic integration algorithm and maintaining the geometric structure of the model's inference path; and a function optimization module for minimizing the curvature and tortuosity of the inference path.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure belongs to the field of data processing technology, and particularly relates to technical fields such as deep learning and natural language processing, and in particular, to a model optimizer, a multi-hop question-answering model training method and device, a multi-hop question-answering method and device, an electronic device, and a computer-readable storage medium. Background Art

[0002] Multi-hop question answering (QA) is a natural language processing task in which answering a question requires reasoning and synthesizing from multiple information sources or facts. Unlike traditional single-hop QA, which only requires extracting the answer from a single source, multi-hop QA requires the model to connect different pieces of information and perform multi-step reasoning to arrive at the final answer. In multi-hop QA, users typically ask a complex question, and the model must not only identify relevant information but also understand and reason about the relationships between that information.

[0003] Multi-hop question answering is highly challenging because it requires deep semantic understanding and reasoning capabilities, often involving logic, causality, and comprehensive information processing. Multi-hop question answering systems require models to navigate complex knowledge structures, skillfully connecting scattered pieces of information to form a logically rigorous and coherent answer. This capability is crucial for developing AI systems that can reason in simple terms, provide easily understood results, and cope with real-world problems that often lack direct, one-step solutions. Summary of the Invention

[0004] The present disclosure provides a model optimizer, a multi-hop question-answering model training method and device, a multi-hop question-answering method and device, an electronic device, and a computer-readable storage medium.

[0005] According to a first aspect, a model optimizer is provided, which includes: a model inference framework for obtaining model parameters of a model and calculating the gradient of a loss function with respect to the model parameters; a Hamiltonian equation module for obtaining momentum based on the gradient and the Hamiltonian equation, wherein the momentum is used to characterize the change in reasoning between continuous model parameters; a symplectic integrator for obtaining updated model parameters through a symplectic integration algorithm based on the momentum, and maintaining the geometric structure of the reasoning path when the model parameters are obtained and the updated model parameters are obtained; and a function optimization module for minimizing the curvature and tortuosity of the reasoning path.

[0006] According to the second aspect, a multi-hop question-answering model training method is provided, the method comprising: obtaining a training data set, the training data set comprising at least one training data, the training data comprising: a question, an answer, and at least one related factual information; obtaining a multi-hop question-answering network; inputting the training data in the training data set into the multi-hop question-answering network to obtain a result output by the multi-hop question-answering network; training the multi-hop question-answering network based on a model optimizer and the result output by each multi-hop question-answering network to obtain a trained multi-hop question-answering network, wherein the model optimizer uses a model optimizer as described in any implementation method of the first aspect to adjust the model parameters of the multi-hop question-answering network.

[0007] According to the third aspect, a multi-hop question-answering model training method is provided, which includes: obtaining questions to be answered and answer-related information, where the answer-related information includes: context information of the question to be answered and at least one item of knowledge graph information; a multi-hop question-answering model trained based on the questions to be answered, the answer-related information and the multi-hop question-answering model training method described in any implementation method of the second aspect, to obtain the answer output by the multi-hop question-answering model.

[0008] According to a fourth aspect, a multi-hop question-answering model training device is provided, which includes: a sample acquisition unit, configured to acquire a training data set, the training data set including at least one training data, the training data including: a question, an answer and at least one related factual information; a network acquisition unit, configured to acquire a multi-hop question-answering network; a result acquisition unit, configured to input the training data in the training data set into the multi-hop question-answering network, and obtain a result output by the multi-hop question-answering network; an adjustment unit, configured to train the multi-hop question-answering network based on a model optimizer and the result output by each multi-hop question-answering network, and obtain a trained multi-hop question-answering network, wherein the model optimizer uses the model optimizer described in any implementation method of the first aspect to adjust the model parameters of the multi-hop question-answering network.

[0009] According to the fifth aspect, a multi-hop question and answer device is provided, which includes: a question acquisition unit, configured to obtain questions to be answered and answer-related information, the answer-related information including: context information of the question to be answered and at least one of the knowledge graph information; an answer acquisition unit, configured to obtain the answer output by the multi-hop question and answer model based on the question to be answered, the answer-related information and the multi-hop question and answer model training device as described in any implementation method of the fourth aspect.

[0010] According to the sixth aspect, an electronic device is provided, which includes: at least one processor; and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in any implementation of the second aspect or the third aspect.

[0011] According to a seventh aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, where the computer instructions are used to cause a computer to execute the method described in any implementation of the second aspect or the third aspect.

[0012] The embodiments of the present disclosure provide a model optimizer and a model reasoning framework for obtaining model parameters of a model and calculating the gradient of a loss function with respect to the model parameters; a Hamiltonian equation module for obtaining momentum based on the gradient and the Hamiltonian equation, wherein the momentum is used to characterize the change in reasoning between continuous model parameters; a symplectic integrator for obtaining updated model parameters based on momentum through a symplectic integration algorithm and maintaining the geometric structure of the reasoning path when the model parameters are obtained and updated; and a function optimization module for minimizing the curvature and tortuosity of the reasoning path. Thus, a model optimizer combined with Hamiltonian mechanics is provided, which can dynamically adjust the step size according to the Hamiltonian state. The symplectic integrator can maintain the geometric integrity of the Hamiltonian system throughout the entire training process of the model, significantly improving the stability and efficiency of model training.

[0013] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.

[0015] Figure 1 is a schematic structural diagram of an embodiment of a model optimizer according to the present disclosure;

[0016] Figure 2a is the phase diagram for the centralized problem solving in the two-dimensional Hamiltonian system in this disclosure;

[0017] Figure 2b is a phase diagram for multi-concept reasoning in a two-dimensional Hamiltonian system in this disclosure;

[0018] Figure 3 It is a structural diagram of the velocity, acceleration and angle changes of the trajectory described by the Furnet coordinate system;

[0019] Figure 4 is a flowchart of an embodiment of a multi-hop question-answering model training method according to the present disclosure;

[0020] Figure 5 is a flow chart of an embodiment of the multi-hop question answering method according to the present disclosure;

[0021] Figure 6 1 is a schematic structural diagram of an embodiment of a multi-hop question-answering model training device according to the present disclosure;

[0022] Figure 7 is a schematic structural diagram of an embodiment of a multi-hop question-answering device according to the present disclosure;

[0023] Figure 8 It is a block diagram of an electronic device used to implement the model reasoning framework construction method of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] Unless expressly stated otherwise, throughout the specification and claims, the term "comprise" or variations such as "include" or "comprising", etc., will be understood to include the stated elements or components but not to exclude other elements or other components.

[0025] The technical solutions of the present disclosure are described below through specific examples. It should be understood that one or more steps mentioned in the present disclosure do not exclude the existence of other methods and steps before and after the combination step, or other methods and steps may be inserted between these explicitly mentioned steps. It should also be understood that these examples are only used to illustrate the present disclosure and are not used to limit the scope of the present disclosure. Unless otherwise specified, the numbering of each method step is only for the purpose of identifying each method step, and does not limit the order of arrangement of each method or limit the scope of implementation of the present disclosure. Changes or adjustments in their relative relationships can also be regarded as the scope of implementation of the present disclosure without substantial changes in the technical content.

[0026] The sources of the raw materials and instruments used in the examples are not particularly limited and can be purchased from the market or prepared according to conventional methods known to those skilled in the art.

[0027] While current AI inference optimization technologies have made rapid progress, they still face numerous challenges. Transformer-based models, such as BERT (Bidirectional Encoder Representations from Transformers) and GPT (Generative Pre-trained Transformer), have revolutionized language understanding. However, they often struggle when handling complex reasoning chains. While the incorporation of knowledge graphs enhances structured reasoning capabilities, it sacrifices flexibility. Iterative optimization and advanced attention mechanisms improve inference accuracy, but often at the expense of interpretability and computational efficiency. Reinforcement learning offers a promising path for inference optimization, but its effectiveness relies heavily on the rationality of reward design. Neuro-symbolic approaches attempt to combine the flexibility of neural networks with the clarity of symbolic reasoning, but face scalability challenges. Recent innovations in prompt engineering and contextual learning have shown great potential, but their generalization capabilities still need improvement.

[0028] Despite significant progress in optimizing inference processes, many current methods operate as black boxes, making it difficult to interpret their inference processes or ensure their reliability. However, a more comprehensive theoretical framework is needed to better integrate the understanding of different methods.

[0029] In response to the shortcomings of traditional technologies, this disclosure proposes a model optimizer, in which the reasoning process of artificial intelligence corresponds to the Hamiltonian system, thereby providing a new framework for in-depth analysis and optimization of complex artificial intelligence cognitive processes. Figure 1 1 shows a structural diagram of an embodiment of a model optimizer according to the present disclosure. The model optimizer 100 includes: a model reasoning framework 101, a Hamiltonian equation module 102, a symplectic integrator 103 and a function optimization module 104.

[0030] The model inference framework 101 is used to obtain the model parameters of the model and calculate the gradient of the loss function with respect to the model parameters. The Hamiltonian equation module 102 is used to obtain momentum based on the gradient and the Hamiltonian equation. Momentum is used to characterize the change in reasoning between consecutive model parameters. The symplectic integrator 103 is used to obtain updated model parameters based on the momentum using a symplectic integration algorithm, while maintaining the geometric structure of the inference path when obtaining the updated model parameters. The function optimization module 104 is used to minimize the curvature and tortuosity of the inference path.

[0031] In this embodiment, the way in which the model inference framework 101 calculates gradients through model parameters and loss functions is a conventional method in the art and will not be described in detail here.

[0032] Specifically, in Hamiltonian mechanics, the Hamiltonian H(q, p) combines the kinetic energy T(p) and the potential energy V(q), and the potential energy V(q) is related to the loss function, and the gradient calculated by the loss function is directly related to the potential energy.

[0033] In this embodiment, the model optimizer is used to optimize the training steps of the model, calculate the update module parameters through the current model parameters of the model, and output the update module parameters to the model to provide a model parameter update reference for the model. The model parameters obtained by the model inference framework 101 can be various types of models, such as the model is a multi-hop question-answering model.

[0034] In this embodiment, the reasoning path is a continuous model parameter change trajectory of the model, and the continuous model parameters are also model parameters to updated model parameters, wherein the updated model parameters are parameters after the model parameters are updated.

[0035] In this embodiment, the model optimizer's input is the model's current model parameters, and its output is the updated model parameters. Its operating principle is to calculate the Hamiltonian based on momentum and gradients and dynamically adjust the step size. The step size is an adaptive value calculated by the model optimizer based on the Hamiltonian's energy state (kinetic energy and potential energy). It is used to control the amplitude of parameter updates and ensure the conservation of symplectic structure (geometric properties) and energy. It is an intermediate variable in the parameter update process. Momentum and parameters are updated using the symplectic integral rule to obtain updated model parameters. The essence of updating model parameters is to evolve the parameters from the current state to the next state using the symplectic integral rule, which strictly adheres to the laws of Hamiltonian dynamics.

[0036] In this embodiment, the model reasoning framework 101 and the Hamiltonian equation module 102 regard the reasoning process of the model as a trajectory in space, that is, a reasoning path, such as Figure 2a and Figure 2b As shown, in Figure 2a and Figure 2b The black solid line G represents the trajectory, S is the energy level of the inference, and for Figure 2b , H is the key concept equilibrium point, and the movement of the model reasoning process follows the Hamiltonian equation, which is shown in Equations (1) and (2).

[0037] (1)

[0038] (2)

[0039] In formula (1) and formula (2), H RDenotes the Hamiltonian. Equation (2) involves the gradient of the loss function with respect to the model parameters q, indicating that the gradient is indeed used in the update process. The model optimizer preserves the geometric properties of the system, ensuring the stability and accuracy of the update process. It uses the gradient of the loss function to update the momentum p, which in turn affects the update of the model parameters q, resulting in the updated model parameters. The gradient of the loss function is important for guiding the optimization process. They are integrated into the Hamiltonian dynamics to help update the momentum p, and thus the model parameters q.

[0040] Symplectic integrator 103 is used to maintain the geometric structure of the inference path of the model inference framework when updating model parameters through model parameters. Specifically, symplectic integrator 103 uses numerical methods to ensure the geometric characteristics of the model parameter evolution (i.e., the inference path). Function optimization module 104, a component independent of symplectic integrator 103, drives the optimization process. Symplectic integrator 103 ensures that the inference path strictly adheres to the geometric laws of Hamiltonian dynamics (such as symplectic form conservation and energy approximation conservation), ensuring the long-term stability of the model inference path (for example, model energy error does not accumulate over training steps). This is the foundational framework of the optimizer and defines the legality boundaries for parameter updates. Building on the legal trajectory defined by the symplectic integrator, function optimization module 104 further optimizes the path smoothness by adding regularization terms (such as curvature and tortuosity), making the model's inference path more coherent without affecting task performance. Its function is similar to "selecting the optimal path under established physical laws." The function optimization module 104 constrains the geometric characteristics of the reasoning path (such as curvature and twisting) through regularization terms. Its optimization goal is achieved on the legal parameter evolution manifold defined by the symplectic integrator, thereby improving the coherence and interpretability of the reasoning path without destroying the geometric structure of the system.

[0041] In this embodiment, the inference phase space of the model inference framework 101 and the Hamiltonian equation module 102 inherits a symplectic geometric structure, which perfectly preserves its geometric properties during the inference evolution process. This phenomenon is similar to Liouville's theorem in classical mechanics, which states that the volume of the phase space is constant under the action of a Hamiltonian dynamical system:

[0042] (3)

[0043] In Equation (3), ω represents the symplectic form, which is a basic concept in symplectic geometry and is used to describe the symmetry and structure in phase space. i is the position coordinate q i The differential of dp represents an infinitesimal change in position and direction in phase space. i is the momentum coordinate p i The differential of represents an infinitesimal change in the direction of momentum in phase space. represents the exterior product, which is an operation in multilinear algebra that defines the product of two differential forms. Equation (3) describes the definition of the symplectic form in the phase space, where the phase space is defined by the position coordinates q i and momentum coordinate p i High-dimensional space.

[0044] In this embodiment, symplectic integrator 103 approximates the Hamiltonian equations through numerical integration, ensuring that the evolution of the system state follows the laws of Hamiltonian dynamics at each update of the model parameters, thereby maintaining the system's symplectic structure and energy conservation properties. Specifically, symplectic integrator 103 utilizes a custom symplectic integrator based on the Forest-Ruth algorithm, an efficient fourth-order symplectic integration algorithm.

[0045] In this embodiment, the symplectic integrator is an algorithm used to numerically solve the Hamiltonian equation. Its core advantage is that it can maintain the symplectic structure of the system, thereby maintaining the conservation of energy and the stability of other important physical quantities during long-term integration. Based on the Hamiltonian equation, the update rule of the model optimizer is expressed as Equation (4):

[0046] (4)

[0047] In formula (4), Represents a step size that is adaptively adjusted based on the current Hamiltonian value. Through this Hamiltonian perspective, advanced analytical frameworks from physics are introduced into AI reasoning, similar to the application of the Vernet coordinate system. With this model reasoning framework, Hamiltonian equation module, and new integrator, function optimization module 104 determines the curvature of the reasoning path. and distortion :

[0048] (5)

[0049] In formula (5), is the trajectory curve, the first-order derivative γ'(t) represents the tangent vector of the path, that is, the inference direction and speed; the second-order derivative γ''(t) represents the normal acceleration of the path; in formula (5), × represents the vector cross product. Figure 3 The trajectory curve shown in the figure is used to describe the velocity, acceleration and angle change of the trajectory through the Fernet coordinate system. Figure 3 middle, 、 They are tangent and normal respectively. Specifically, is the tangent line along the curve, Is the normal line pointing to the center of the curve. The trajectory curve can also include: and The perpendicular binormal unit vector.

[0050] In this embodiment, the function optimization module 104 calculates the curvature and torsion of the inference path to quantify its geometric properties. These geometric properties can be used to guide the adjustment of the inference path's step size, facilitating the symplectic integrator 103 to generate updated model parameters. The curvature and torsion of the inference path are geometric properties that describe the motion of the inference process in phase space. Curvature describes the degree to which a curve deviates from a straight line, reflecting the degree of curvature of the inference path; torsion (also known as torsion) describes the degree to which a curve deviates from a plane. In three-dimensional space, torsion is an important geometric quantity of a curve, reflecting the degree of "twisting" of the curve in space. In this disclosure, it reflects the degree of twisting of the inference path.

[0051] In this embodiment, in high-dimensional space, we can draw on concepts from three-dimensional space to understand the "torsion" of the reasoning path. In other words, if we consider the reasoning path as a curve γ(t) in high-dimensional space, its torsion can be calculated using the following steps: Steps 1 to 4:

[0052] Step 1. Assume that the reasoning path γ(t) is a function of time t, where t can represent the reasoning step or time step.

[0053] Step 2. Calculate the first and second order derivatives.

[0054] Step 3. Calculate the curvature based on formula (5).

[0055] Step 4. Calculate the torsion according to the torsion formula.

[0056] In this example, high curvature may indicate that the reasoning path has undergone drastic changes at certain steps, potentially corresponding to important turning points or key reasoning steps in the reasoning process. The geometric properties of the reasoning path (such as curvature) may reflect changes in cognitive flexibility during the reasoning process. Curvature is a geometric quantity that describes the degree of curvature of a curve at a specific point; the greater the curvature, the more drastic the curve at that point. High curvature may indicate that the reasoning path has undergone complex distortions in high-dimensional space, potentially corresponding to the integration of information from multiple dimensions or complex logical relationships involved in the reasoning process.

[0057] In this embodiment, by introducing the concepts of curvature and torsion, a new geometric perspective is provided for analyzing and optimizing the reasoning path, which helps to more deeply understand the reasoning mechanism of the model and further improve the performance of the model.

[0058] These geometric properties reveal the system's "cognitive flexibility," where high curvature may indicate a rapid shift in reasoning paths. Conservation laws in reasoning can also be explored. For example, quantities similar to angular momentum in physical systems may represent persistent elements of effective reasoning:

[0059] (6)

[0060] In classical mechanics, L represents the angular momentum of a system. In Equation (6), q is the position vector and p is the momentum vector. Angular momentum is a conserved quantity that represents the inertia of a system in rotational motion. In Hamiltonian mechanics, the conservation of angular momentum is determined by the symmetry of the system, specifically, its rotational symmetry.

[0061] In this embodiment, the concept of angular momentum is introduced into the reasoning process of artificial intelligence. Here, q can be understood as the embedding vector of the reasoning state (i.e., model parameters), and p is the momentum vector, representing the change in the reasoning state. Therefore, the above equation (6) can be interpreted as the "cognitive angular momentum" in the reasoning process, which reflects some form of conservation or invariance in the reasoning process.

[0062] In this embodiment, the model optimizer is a symplectic optimizer, which aims to optimize energy consumption and path efficiency during inference. The goals of the symplectic optimizer are:

[0063] 1. In the Hamiltonian dynamic framework (the aforementioned model inference framework and Hamiltonian equation module), energy consists of kinetic energy and potential energy. The model optimizer adjusts the step size of the inference path to update the model parameters, minimizing total energy consumption and thus improving inference efficiency.

[0064] 2. In classical mechanics, angular momentum is a conserved quantity. In the Hamiltonian dynamic framework, maintaining the conservation of angular momentum ensures the stability of certain key information or reasoning paths during reasoning, avoiding unnecessary fluctuations or errors.

[0065] 3. By optimizing the step size of the reasoning path, the reasoning process is made more coherent and explainable, thereby improving the transparency of the model and user trust.

[0066] By placing AI reasoning within a Hamiltonian framework, this approach opens up innovative avenues for in-depth analysis and optimization. It allows for quantifying the "energy" consumption of cognitive processes, exploring the geometric structure of reasoning paths, and potentially uncovering the fundamental laws governing efficient cognition. This approach not only provides an advanced optimization technique but also offers a new perspective for understanding and improving AI reasoning capabilities, which is particularly critical for handling complex tasks such as multi-hop question answering.

[0067] In this embodiment, the model inference framework 101 of the model optimizer can calculate the gradient of the loss function with respect to the model parameters in each iterative training of the model. The gradient indicates the direction in which the loss function changes fastest, and the opposite direction is the direction in which the model parameters are updated to ensure that the value of the loss function decreases.

[0068] In this embodiment, based on the calculated gradient, the model optimizer will update the model parameters according to a certain step size (learning rate). This step size determines the amplitude of the parameter update. If it is too small, it may lead to slow convergence, while if it is too large, it may cause oscillation or even divergence.

[0069] In this embodiment, after obtaining the model parameters of the current iterative training of the model, the model optimizer obtains updated model parameters under the joint action of the model inference framework, Hamiltonian equation model, symplectic integrator and function optimization module, and outputs the updated model parameters to the model so that the model continues to train in the next iterative training until the model meets the complete training conditions.

[0070] In this embodiment, the symplectic integrator 103 dynamically adjusts the step size based on the current Hamiltonian state and the curvature and tortuosity of the inference path to obtain updated model parameters. Specifically, when the curvature of the inference path is large, it may indicate that the inference process is undergoing a rapidly changing phase. In this case, the optimizer can appropriately reduce the step size to ensure the stability of the inference. Conversely, when the curvature is small, the step size can be appropriately increased to speed up the inference. By adjusting the step size, the model optimizer aims to minimize the loss function of the inference trajectory, which may include the accuracy of the inference, the smoothness of the path, and other related factors.

[0071] In this embodiment, in addition to using the symplectic integrator, the model optimizer also considers adaptive adjustment of the step size of the model inference path. The step size is calculated based on the current value of the Hamiltonian:

[0072] size= \frac{\text{lr}}{\sqrt{\text{hamiltonian}} + \epsilon}(7)

[0073] In Equation (7), lr is the learning rate, a hyperparameter used in deep learning or machine learning to control the speed at which model parameters are updated. Hamiltonian is the Hamiltonian, which is usually used to describe the total energy of a physical system. However, in the fields of optimization and machine learning, this term may also be used to refer to a metric related to the objective function or loss function, perhaps a measure of the complexity of the problem. Epsilon is a small constant, usually used to avoid the denominator being zero and to ensure the stability of numerical calculations.

[0074] In Equation (7), by adjusting the learning rate to adapt to changes in the Hamiltonian, a more stable optimization process may be achieved. When the Hamiltonian is large, it means that the system may be in a more complex or high-energy state. In this case, the step size (i.e., the adjustment value of the learning rate) can be reduced to more cautiously update the parameters; conversely, when the Hamiltonian is small, the step size can be increased to accelerate convergence. In practical applications, such an adjustment method may need to be customized and debugged according to the specific problem and model to achieve the best learning effect and convergence speed. This design also ensures that the integrity of the symplectic geometry is maintained during the training process.

[0075] In this embodiment, by modeling the reasoning process as a dynamic system in a high-dimensional phase space, the model can quickly find the optimal path in a complex knowledge graph. This optimization can effectively reduce unnecessary redundant steps in the reasoning process, thereby improving the system's response speed.

[0076] The model optimizer provided in this embodiment dynamically adjusts model parameters using momentum and step size, enabling it to adhere to Hamiltonian dynamics (symplectic structure and energy conservation) while improving the performance of complex reasoning tasks. This optimization utilizes a physics-inspired numerical method (symplectic integral) to adjust model parameters, rather than adjusting the abstract "inference step size" or independently optimizing intermediate variables. This can improve the performance and interpretability of multi-hop question answering tasks.

[0077] The embodiments of the present disclosure provide a model optimizer and a model reasoning framework for obtaining model parameters of a model and calculating the gradient of a loss function with respect to the model parameters; a Hamiltonian equation module for obtaining momentum based on the gradient and the Hamiltonian equation, wherein the momentum is used to characterize the change in reasoning between continuous model parameters; a symplectic integrator for obtaining updated model parameters based on momentum through a symplectic integration algorithm and maintaining the geometric structure of the reasoning path when the model parameters are obtained and updated; and a function optimization module for minimizing the curvature and tortuosity of the reasoning path. Thus, a model optimizer combined with Hamiltonian mechanics is provided, which can dynamically adjust the step size according to the Hamiltonian state. The symplectic integrator can maintain the geometric integrity of the Hamiltonian system throughout the entire training process of the model, significantly improving the stability and efficiency of model training.

[0078] In some embodiments of the present disclosure, the above-mentioned symplectic integrator adopts a Hamiltonian algorithm to obtain updated model parameters, and the Hamiltonian algorithm includes: the difference between a first sub-algorithm and a second sub-algorithm, wherein the first sub-algorithm is an algorithm for cognitive effort to change model parameters, the second sub-algorithm is an algorithm for correlation of model parameters, and momentum is related to the first sub-algorithm.

[0079] In this optional implementation, the Hamiltonian algorithm is used to characterize the Hamiltonian, which is the "energy" function of the inference process, encompassing both the "kinetic" and "potential" energy of the inference. The optimizer minimizes the Hamiltonian by adjusting the system's momentum and position, thereby optimizing the inference process.

[0080] In this optional implementation, the inference state (Model parameters) are represented as vectors in a high-dimensional embedding space, as shown in Equation (8):

[0081] (8)

[0082] In formula (8), is an embedding function, and Is the input text. Input text First, the natural language model's tokenizer is used to segment the words into a token. Each token are mapped to their corresponding embedding vectors ei:

[0083] (9)

[0084] As shown in formula (10), momentum Represents changes in reasoning between consecutive states:

[0085] (10)

[0086] Hamiltonian:

[0087] (11)

[0088] In formula (11), It is the "kinetic energy" or cognitive effort to change state , where μ is a fixed coefficient that can be set based on demand; and in formula (11), is the "potential energy" or the relevance of the current state ,in is a similarity function (e.g., cosine similarity) and is the expected answer embedding.

[0089] The model optimizer provided by this optional implementation adopts a Hamiltonian algorithm, which effectively characterizes the Hamiltonian, and the Hamiltonian effectively combines the model parameters and the Hamiltonian momentum, thereby improving the rationality of the construction of the model reasoning framework.

[0090] Figure 4 A process 400 of an embodiment of a multi-hop question answering model training method according to the present disclosure is shown. The multi-hop question answering model training method includes the following steps:

[0091] Step 401: Obtain a training data set.

[0092] In this embodiment, the execution entity on which the multi-hop question-answering model training method is running can obtain the training dataset through various methods. For example, the execution entity can obtain the training dataset stored in the database server through a wired or wireless connection. For another example, a user can obtain the training dataset collected by the terminal by communicating with the terminal.

[0093] In this embodiment, the training dataset includes at least one training data point, which includes a question, an answer, and at least one piece of relevant factual information. The at least one piece of relevant factual information refers to at least two relevant factual texts used to reason and answer questions in multi-hop question answering tasks. The at least two factual texts are typically extracted from different information sources or knowledge bases and are used to construct a reasoning chain from question to answer. In multi-hop question answering, the answer to a question often cannot be directly derived from a single fact, but requires reasoning based on multiple facts.

[0094] Specifically, at least two factual texts provide the necessary information foundation for multi-hop reasoning. For example, suppose a question involves two related but not directly related facts—"Fact 1" and "Fact 2"—where "Fact 1" provides a relationship or condition, and "Fact 2" provides another relationship or condition. By combining these two facts, the model can reason and arrive at the correct answer.

[0095] Each training data set consists of a question, an answer, and at least one relevant fact. This data is used to train the model to extract relevant information from multiple facts and perform reasoning. This training enables the model to better simulate human reasoning when faced with new multi-hop question-answering tasks, thereby improving the accuracy and coherence of responses.

[0096] In the technical solution disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of the training data set involved are carried out after authorization and in compliance with relevant laws and regulations.

[0097] Step 402: Obtain a multi-hop question-answering network.

[0098] In this embodiment, a multi-hop question-answering network is used to analyze input questions, identify reasoning chains across multiple different facts, and obtain answers. This multi-hop question-answering network can be based on a multimodal language model called GPT-4o. GPT-4o is a multimodal model capable of processing multiple modal inputs, including text (such as images and audio). In this disclosure, GPT-4o's ability to process textual information is utilized, while retaining its multimodal processing potential.

[0099] In this embodiment, the multi-hop question-answering network is the initial network for analyzing the answers. Since the multi-hop question-answering network has not undergone the model process, the accuracy of the answers output by the multi-hop question-answering network cannot be guaranteed.

[0100] Step 403: Input the training data in the training data set into the multi-hop question-answering network to obtain the output result of the multi-hop question-answering network.

[0101] In this embodiment, the execution subject can select training data from the training data set obtained in step 401, and execute the training steps from step 403 to step 404 to complete an iterative training of the multi-hop question answering network. The selection method and the number of training data from the training data set are not limited in this application, and the number of iterative training of the multi-hop question answering network is not limited. For example, in one iterative training, multiple continuous training data can be randomly selected, and the result output by the multi-hop question answering network can be obtained through the selected training data.

[0102] Step 404: Based on the model optimizer and the results output by each multi-hop question-answering network, the multi-hop question-answering network is trained to obtain a trained multi-hop question-answering network.

[0103] In this embodiment, the model optimizer uses the model optimizer disclosed in the above embodiment to adjust the model parameters of the multi-hop question-answering network.

[0104] In this embodiment, during each iterative training of the multi-hop question-answering network, training data is selected from the training data set, and the selected training data is input into the multi-hop question-answering network to obtain the answer output by the multi-hop question-answering network. In each iterative training, the model optimizer obtains the model parameters of the multi-hop question-answering network, and uses the model recommendation framework and symplectic integrator therein to update the model parameters to obtain updated model parameters. The updated model parameters are applied to the multi-hop question-answering network before the next iterative training.

[0105] In this embodiment, during each iterative training of the multi-hop question-answering network, the network loss value of the multi-hop question-answering network is calculated. Based on the network loss value and the number of iterative training times, it is detected whether the multi-hop question-answering network meets the training completion conditions; if the training completion conditions are met, a trained multi-hop question-answering network is obtained.

[0106] In this embodiment, the loss function for the multi-hop question-answering network can use the cross-entropy loss function. The cross-entropy loss function measures the difference between two different probability distributions for the same random variable. In machine learning, this is represented as the difference between the true probability distribution and the predicted probability distribution. The smaller the value of the cross-entropy loss function, the better the prediction performance of the multi-hop question-answering network.

[0107] The multi-hop question-answering model training method provided by the embodiments of the present disclosure first obtains a training data set, which includes at least one training data, and the training data includes: a question, an answer, and at least one related factual information; secondly, obtains a multi-hop question-answering network; then, inputs the training data in the training data set into the multi-hop question-answering network to obtain the output result of the multi-hop question-answering network; finally, based on the model optimizer and the output result of each multi-hop question-answering network, trains the multi-hop question-answering network to obtain a trained multi-hop question-answering network, and adjusts the model parameters of the multi-hop question-answering network through the model optimizer, thereby improving the efficiency, stability, and interpretability of the decision-making process of artificial intelligence.

[0108] In some optional implementations of the present disclosure, the multi-hop question-answering network includes: a multimodal language subnet and a classification layer; the multimodal language subnet is used to characterize the correspondence between the multimodal material and the identified text results, and the classification layer is used to classify the text results into corresponding answers to obtain answer classification results. The inputting of the training data in the training data set into the multi-hop question-answering network to obtain the result output by the multi-hop question-answering network includes: selecting training data from the training data set; inputting the training data into the multi-hop question-answering network to obtain the answer classification result of the multi-hop question-answering network; the training of the multi-hop question-answering network based on the model optimizer and the result of each multi-hop question-answering network output to obtain the trained multi-hop question-answering network includes: calculating the network loss value of the multi-hop question-answering network based on the answer classification result and the predefined Hamiltonian loss function; training the multi-hop question-answering network based on the loss value and the model optimizer to obtain a trained multi-hop question-answering model.

[0109] In this optional implementation, the Hamiltonian loss function changes the reasoning path of the multi-hop question-answering network based on the change of the Hamiltonian in the Hamiltonian dynamics. Specifically, the Hamiltonian loss function can directly adopt the cross-entropy function.

[0110] In this optional implementation, the above-mentioned calculation of the network loss value of the multi-hop question-answering network based on the answer classification result and the predefined Hamiltonian loss function includes: inputting the answer classification result into the Hamiltonian loss function to obtain the network loss value.

[0111] In this optional implementation, the multi-hop question-answering network is trained based on the loss value and the model optimizer to obtain a trained multi-hop question-answering model, including: detecting whether the multi-hop question-answering network meets the training completion conditions based on the loss value; if the training completion conditions are not met, updating the model parameters of the multi-hop question-answering network using the model optimizer, and continuing to detect whether the multi-hop question-answering network meets the training completion conditions based on the loss value based on the multi-hop question-answering network after the parameter update. The training completion conditions include: the network loss value of the multi-hop question-answering network is less than a first loss value threshold. The first loss threshold can be determined based on specific training requirements, for example, the first loss threshold is 0.01.

[0112] In this optional implementation, the multimodal language subnet actually refers to a multimodal language model based on GPT-4o. GPT-4o is a multimodal model that can process multiple modal inputs (such as images, audio, etc.) including text.

[0113] In this optional implementation, the classification layer is a custom layer attached to the multimodal language subnet, which is used to further classify the representations generated by the multimodal language subnet to adapt to the specific multi-hop question answering task.

[0114] In this optional implementation, the multimodal language subnet processes the input text and generates corresponding semantic representations. These representations capture the rich semantic information of the input text and provide a foundation for subsequent classification tasks. The classification layer is used to classify the semantic representations generated by the multimodal language subnet to determine the correct answer in the multi-hop question answering task. Specifically, the output of the classification layer is the classification result for the multi-hop question answering problem, such as determining whether a candidate answer is correct or selecting the most appropriate answer among multiple candidate answers.

[0115] In this paper, the output of the classification layer is the classification result of the answer to the multi-hop question answering problem. Specifically, the classification layer may output a binary classification (e.g., true or false) or select the most likely correct answer from multiple candidate answers. The specific design of the classification layer depends on the task requirements, but in the context of this paper, it is used to determine the answer to the multi-hop question answering problem.

[0116] This optional implementation provides a method for training a multi-hop question-answering network. When the multi-hop question-answering network includes: a multimodal language subnetwork and a classification layer, the network loss value is calculated based on the answer classification result output by the classification layer and the Hamiltonian loss function; based on the network loss value and a model optimizer, the multi-hop question-answering network is trained to obtain a trained multi-hop question-answering model, thereby improving the accuracy of the result output of the multi-hop question-answering model.

[0117] Optionally, the multi-hop question-answering network includes: a multimodal language subnet and a classification layer; the inputting of training data from the training dataset into the multi-hop question-answering network to obtain the output of the multi-hop question-answering network includes: selecting training data from the training dataset; inputting the training data into the multi-hop question-answering network to obtain the answer classification result of the multi-hop question-answering network; the training of the multi-hop question-answering network based on the model optimizer and the output of each multi-hop question-answering network to obtain the trained multi-hop question-answering network includes: determining the current number of iterative training times of the multi-hop question-answering network; training the multi-hop question-answering network based on the number of iterative training times and the model optimizer to obtain the trained multi-hop question-answering model. The training of the multi-hop question-answering network based on the number of iterative training times and the model optimizer to obtain the trained multi-hop question-answering model includes: in response to detecting that the number of iterative training times is less than a training times threshold, obtaining updated model parameters based on the model optimizer, adjusting the multi-hop question-answering network using the updated model parameters, and continuing to train the multi-hop question-answering network.

[0118] In some optional implementations of the present disclosure, the above-mentioned training of the multi-hop question-answering network based on the loss value and the model optimizer to obtain a trained multi-hop question-answering model includes: detecting whether the multi-hop question-answering network meets the training completion conditions based on the loss value; in response to detecting that the multi-hop question-answering network does not meet the training completion conditions, using the model optimizer to adjust the model parameters of the multi-hop question-answering network; continuing to select training data from the training data set, inputting the training data into the multi-hop question-answering network, and obtaining the answer classification results of the multi-hop question-answering network.

[0119] In this optional implementation, the training completion condition includes: a network loss value of the multi-hop question-answering network is less than a first loss value threshold. The first loss threshold can be determined based on specific training requirements.

[0120] In this optional implementation, using a model optimizer to adjust the model parameters of the multi-hop question-answering network means: obtaining updated model parameters through the model optimizer, and replacing the current model parameters of the multi-hop question-answering network with the updated model parameters.

[0121] The method for training a multi-hop question-answering model provided by this optional implementation method uses a model optimizer to adjust the model parameters of the multi-hop question-answering network in response to detecting that the multi-hop question-answering network does not meet the training completion conditions; continues to select training data from the training data set, inputs the training data into the multi-hop question-answering network, and obtains the answer classification results of the multi-hop question-answering network, providing a reliable implementation method for training the multi-hop question-answering network.

[0122] Optionally, the above-mentioned training of the multi-hop question-answering network based on the loss value and the model optimizer to obtain a trained multi-hop question-answering model also includes: in response to detecting that the multi-hop question-answering network meets the training completion condition, obtaining a trained multi-hop question-answering model.

[0123] In some optional implementations of the present disclosure, the above-mentioned Hamiltonian loss function includes: a cross-entropy loss function and a regularization term based on a parameter norm. Based on the answer classification result and the predefined Hamiltonian loss function, calculating the network loss value of the multi-hop question-answering network includes: calculating the cross-entropy loss value based on the answer classification result and the cross-entropy loss function; calculating the regularization loss value based on the answer classification result and the regularization term; and obtaining the network loss of the multi-hop question-answering network based on the cross-entropy loss value and the regularization loss value.

[0124] In this optional implementation, the Hamiltonian loss function includes not only the traditional classification loss, but also a regularization term based on the parameter norm to reduce the "energy" consumption in the Hamiltonian and prevent overfitting.

[0125] This optional implementation provides a Hamiltonian loss function that cleverly combines a traditional classification loss with a regularization term on the model parameter norm. This encourages the model to seek solutions that reduce "energy" consumption, effectively promoting the model towards more stable and generalizable representations. By penalizing such high parameter values, the risk of overfitting is reduced and the model's generalization ability is improved in a variety of situations.

[0126] In some optional implementations of the present disclosure, the network loss of the multi-hop question-answering network obtained based on the cross-entropy loss value and the regularization loss value includes: multiplying the cross-entropy loss value by the cross-entropy loss weight and adding the regularization loss value by the regularization loss weight to obtain the network loss of the multi-hop question-answering network.

[0127] In this optional implementation, according to the proportion of the cross-entropy function and the regularization term in model training, a cross-entropy loss weight is set for the cross-entropy function and a regularization loss weight is set for the regularization term. By setting these two weights, the reliability of the network loss of the multi-hop question-answering network is improved.

[0128] Optionally, obtaining the network loss of the multi-hop question-answering network based on the cross-entropy loss value and the regularization loss value includes: adding the cross-entropy loss value to the regularization loss value to obtain the network loss of the multi-hop question-answering network.

[0129] Figure 5 A process 500 according to an embodiment of a multi-hop question-answering method of the present disclosure is shown. The multi-hop question-answering method includes the following steps:

[0130] Step 501: Obtain questions to be answered and answer-related information.

[0131] In this embodiment, the reply-related information includes: context information of the question to be replied and at least one of knowledge graph information. The context information is information related to the question to be replied, and the knowledge graph information is professional information for replying to the question to be replied.

[0132] In this embodiment, the multi-hop question-answering model processes the pending questions and answer-related information to obtain answers to the pending questions. The execution entity of the multi-hop question-answering method can obtain the pending questions and answer-related information in a variety of ways. For example, the execution entity can obtain the pending questions and answer-related information stored in a database server via a wired or wireless connection. For another example, the execution entity can also receive the pending questions and answer-related information collected in real time by a terminal or other device.

[0133] In this embodiment, the answer to the question to be replied is a result of the question to be replied. Specifically, the result includes: information selected from context information or knowledge graph information.

[0134] Step 502: Based on the question to be answered, the answer-related information, and the multi-hop question-answering model, obtain the answer output by the multi-hop question-answering model.

[0135] In this embodiment, the multi-hop question-answering model is a model trained using the multi-hop question-answering model training method of the above embodiment.

[0136] In this embodiment, the execution entity may input the question to be answered and the answer-related information obtained from step 501 into the multi-hop question-answering model, thereby obtaining the answer output by the multi-hop question-answering model.

[0137] In this embodiment, the multi-hop question answering model can be adopted as described above. Figure 4 The multi-hop question answering model trained by the method described in the embodiment is obtained. The specific training process can be found in Figure 4 The relevant description of the embodiment will not be repeated here.

[0138] The multi-hop question-answering model training method provided by the embodiments of the present disclosure first obtains the question to be answered and the answer-related information, where the answer-related information includes: the context information of the question to be answered and at least one of the knowledge graph information; then, based on the question to be answered, the answer-related information and the multi-hop question-answering model trained by the multi-hop question-answering model training method, the answer output by the multi-hop question-answering model is obtained, thereby improving the accuracy and reliability of the answer.

[0139] Further references Figure 6 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a multi-hop question answering model training device. Figure 4 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0140] like Figure 6As shown, the multi-hop question-answering model training device 600 provided in this embodiment includes: a sample acquisition unit 601, a network acquisition unit 602, a result acquisition unit 603, and an adjustment unit 604. The sample acquisition unit 601 can be configured to acquire a training data set, wherein the training data set includes at least one training data, and the training data includes: a question, an answer, and at least one related factual information. The network acquisition unit 602 can be configured to acquire a multi-hop question-answering network. The result acquisition unit 603 can be configured to input the training data in the training data set into the multi-hop question-answering network to obtain the result output by the multi-hop question-answering network. The adjustment unit 604 can be configured to train the multi-hop question-answering network based on the model optimizer and the result output by each multi-hop question-answering network to obtain a trained multi-hop question-answering network. The model optimizer uses the model optimizer provided in the above embodiment to adjust the model parameters of the multi-hop question-answering network.

[0141] In this embodiment, the specific processing and technical effects of the multi-hop question answering model training device 600: the sample acquisition unit 601, the network acquisition unit 602, the result acquisition unit 603, and the adjustment unit 604 can be referred to respectively. Figure 4 The relevant descriptions of step 401, step 402, step 403, and step 404 in the corresponding embodiment are not repeated here.

[0142] In some embodiments of the present disclosure, the multi-hop question-answering network unit is configured as follows: a multimodal language subnet and a classification layer; the multimodal language subnet is used to characterize the correspondence between the multimodal material and the identified text results, and the classification layer is used to classify the text results into corresponding answers to obtain answer classification results. The result obtaining unit 603 is configured as follows: selecting training data from the training data set; inputting the training data into the multi-hop question-answering network to obtain the answer classification results of the multi-hop question-answering network; the adjustment unit 604 is configured as follows: calculating the network loss value of the multi-hop question-answering network based on the answer classification results and the predefined Hamiltonian loss function; training the multi-hop question-answering network based on the loss value and the model optimizer to obtain a trained multi-hop question-answering model.

[0143] In some embodiments of the present disclosure, the above-mentioned adjustment unit 604 is configured to: detect whether the multi-hop question-answering network meets the training completion conditions based on the loss value; in response to detecting that the multi-hop question-answering network does not meet the training completion conditions, use a model optimizer to adjust the model parameters of the multi-hop question-answering network; continue to select training data from the training data set, input the training data into the multi-hop question-answering network, and obtain the answer classification results of the multi-hop question-answering network.

[0144] In some embodiments of the present disclosure, the above-mentioned Hamiltonian loss function includes: a cross-entropy loss function and a regularization term based on a parameter norm, and the above-mentioned adjustment unit 604 is configured to: calculate the cross-entropy loss value based on the answer classification result and the cross-entropy loss function; calculate the regularization loss value based on the answer classification result and the regularization term; and obtain the network loss of the multi-hop question-answering network based on the cross-entropy loss value and the regularization loss value.

[0145] In some embodiments of the present disclosure, the adjustment unit 604 is configured to: multiply the cross entropy loss value by the cross entropy loss weight and add the regularization loss value by the regularization loss weight to obtain the network loss of the multi-hop question-answering network.

[0146] The multi-hop question-answering model training device provided by the embodiments of the present disclosure, first, the sample acquisition unit 601 acquires a training data set, the training data set includes at least one training data, the training data includes: a question, an answer and at least one related factual information; secondly, the network acquisition unit 602 acquires a multi-hop question-answering network; then, the result acquisition unit 603 inputs the training data in the training data set into the multi-hop question-answering network to obtain the result output by the multi-hop question-answering network; finally, the adjustment unit 604 trains the multi-hop question-answering network based on the model optimizer and the result output by the multi-hop question-answering network each time, and obtains a trained multi-hop question-answering network. Thus, the model parameters of the multi-hop question-answering network are adjusted by the model optimizer, thereby improving the efficiency, stability and interpretability of the decision-making process of artificial intelligence.

[0147] Further references Figure 7 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a multi-hop question-answering device. Figure 5 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0148] like Figure 7 As shown, the multi-hop question-answering apparatus 700 provided in this embodiment includes: a question acquisition unit 701 and an answer acquisition unit 702. The question acquisition unit 701 can be configured to acquire a question to be answered and answer-related information, where the answer-related information includes at least one of contextual information about the question to be answered and knowledge graph information. The answer acquisition unit 702 can be configured to obtain an answer output by the multi-hop question-answering model based on the question to be answered, the answer-related information, and a multi-hop question-answering model trained using the multi-hop question-answering model training method.

[0149] In this embodiment, in the multi-hop question-answering model training device 700, the specific processing of the question obtaining unit 701 and the answer obtaining unit 702 and the technical effects thereof can be referred to respectively. Figure 5 The relevant descriptions of step 501 and step 502 in the corresponding embodiment are not repeated here.

[0150] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0151] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their modes are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0152] like Figure 8 As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. Computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to bus 804.

[0153] Various components in device 800 are connected to I / O interface 805, including an input unit 806, such as a keyboard, mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a magnetic disk, optical disk, etc.; and a communication unit 809, such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0154] The computing unit 801 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as the multi-hop question-answering model training method or the multi-hop question-answering method. For example, in some embodiments, the multi-hop question-answering model training method or the multi-hop question-answering method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the multi-hop question-answering model training method or the multi-hop question-answering method described above can be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform a jump question answering model training method or a multi-hop question answering method in any other appropriate manner (eg, by means of firmware).

[0155] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0156] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable jump question answering model training device or a multi-hop question answering device, so that when the program code is executed by the processor or controller, the modes / operations specified in the flowchart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0157] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fibers, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0158] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0159] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0160] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not limited herein.

[0161] The foregoing descriptions of specific exemplary embodiments of the present disclosure are for purposes of illustration and description. These descriptions are not intended to limit the present disclosure to the precise forms disclosed, and it is apparent that many variations and modifications are possible in light of the foregoing teachings. The exemplary embodiments have been selected and described for the purpose of explaining the specific principles of the present disclosure and their practical application, thereby enabling those skilled in the art to realize and utilize a variety of exemplary embodiments of the present disclosure and various options and modifications. The scope of the present disclosure is intended to be defined by the claims and their equivalents.

Claims

1. A multi-hop question-answering model training method, the method comprising: Obtaining a training dataset, the training dataset including at least one training data, the training data including: a question, an answer, and at least one related factual information, wherein the related factual information refers to at least two related factual texts used for reasoning and answering questions in a multi-hop question answering task, wherein both the question and the answer are text; Get a multi-hop question answering network; Inputting the training data in the training data set into the multi-hop question answering network to obtain a result output by the multi-hop question answering network; Based on the model optimizer and the results output by the multi-hop question-answering network each time, training the multi-hop question-answering network to obtain a trained multi-hop question-answering network, wherein the model optimizer is used to adjust the model parameters of the multi-hop question-answering network; The model optimizer includes: a model inference framework for obtaining model parameters of the model and calculating the gradient of the loss function with respect to the model parameters; a Hamiltonian equation module for obtaining momentum based on the gradient and the Hamiltonian equation, wherein the momentum is used to characterize the change in reasoning between continuous model parameters; a symplectic integrator for obtaining updated model parameters based on the momentum through a symplectic integration algorithm and maintaining the geometric structure of the reasoning path when obtaining the updated model parameters; and a function optimization module for minimizing the curvature and tortuosity of the reasoning path. The symplectic integrator uses a Hamiltonian algorithm to obtain updated model parameters. The Hamiltonian algorithm includes: the difference between a first sub-algorithm and a second sub-algorithm, wherein the first sub-algorithm is an algorithm for cognitive effort to change model parameters, the second sub-algorithm is an algorithm for correlation of model parameters, and the momentum is related to the first sub-algorithm.

2. The method according to claim 1, wherein the multi-hop question-answering network comprises: Multimodal language subnet and classification layer; The multimodal language subnet is used to characterize the correspondence between the multimodal material and the recognized text results, the classification layer is used to classify the text results into corresponding answers to obtain answer classification results, and the inputting of the training data in the training data set into the multi-hop question-answering network to obtain the result output by the multi-hop question-answering network includes: Selecting training data from the training data set; Inputting the training data into the multi-hop question-answering network to obtain an answer classification result of the multi-hop question-answering network; The training of the multi-hop question answering network based on the model optimizer and the result outputted by the multi-hop question answering network each time to obtain the trained multi-hop question answering network comprises: Calculating a network loss value of the multi-hop question-answering network based on the answer classification result and a predefined Hamiltonian loss function; Based on the loss value and the model optimizer, the multi-hop question answering network is trained to obtain a trained multi-hop question answering model.

3. The method according to claim 2, wherein the step of training the multi-hop question-answering network based on the loss value and the model optimizer to obtain a trained multi-hop question-answering model comprises: Based on the loss value, detecting whether the multi-hop question answering network meets the training completion condition; In response to detecting that the multi-hop question-answering network does not meet a training completion condition, adjusting model parameters of the multi-hop question-answering network using the model optimizer; Continue to select training data from the training data set, input the training data into the multi-hop question-answering network, and obtain an answer classification result of the multi-hop question-answering network.

4. The method according to claim 2, wherein the Hamiltonian loss function comprises: A cross entropy loss function and a parameter norm-based regularization term, wherein the network loss value of the multi-hop question-answering network is calculated based on the answer classification result and the predefined Hamiltonian loss function, including: Calculating a cross entropy loss value based on the answer classification result and the cross entropy loss function; Calculating a regularization loss value based on the answer classification result and the regularization term; Based on the cross entropy loss value and the regularization loss value, a network loss of the multi-hop question answering network is obtained.

5. The method according to claim 4, wherein obtaining the network loss of the multi-hop question-answering network based on the cross entropy loss value and the regularization loss value comprises: The network loss of the multi-hop question answering network is obtained by multiplying the cross entropy loss value by the cross entropy loss weight and adding the regularization loss value by the regularization loss weight.

6. A multi-hop question answering method, comprising: Obtaining a question to be answered and answer-related information, wherein the answer-related information includes: context information of the question to be answered and at least one of knowledge graph information; Based on the question to be answered, the answer-related information, and the multi-hop question-answering model trained by the multi-hop question-answering model training method according to any one of claims 1-5, the answer output by the multi-hop question-answering model is obtained.

7. A multi-hop question-answering model training device, comprising: a sample acquisition unit configured to acquire a training data set, the training data set including at least one training data, the training data including: a question, an answer, and at least one related factual information, the related factual information being at least two related factual texts used for reasoning and answering questions in a multi-hop question answering task, the question and the answer being both text; a network acquisition unit configured to acquire a multi-hop question-answering network; A result obtaining unit is configured to input the training data in the training data set into the multi-hop question answering network to obtain a result output by the multi-hop question answering network; an adjustment unit configured to train the multi-hop question answering network based on the model optimizer and the results output by the multi-hop question answering network each time, to obtain a trained multi-hop question answering network, wherein the model optimizer is used to adjust the model parameters of the multi-hop question answering network; The model optimizer includes: a model inference framework for obtaining model parameters of the model and calculating the gradient of the loss function with respect to the model parameters; a Hamiltonian equation module for obtaining momentum based on the gradient and the Hamiltonian equation, wherein the momentum is used to characterize the change in reasoning between continuous model parameters; a symplectic integrator for obtaining updated model parameters based on the momentum through a symplectic integration algorithm and maintaining the geometric structure of the reasoning path when obtaining the updated model parameters; and a function optimization module for minimizing the curvature and tortuosity of the reasoning path. The symplectic integrator uses a Hamiltonian algorithm to obtain updated model parameters. The Hamiltonian algorithm includes: the difference between a first sub-algorithm and a second sub-algorithm, wherein the first sub-algorithm is an algorithm for cognitive effort to change model parameters, the second sub-algorithm is an algorithm for correlation of model parameters, and the momentum is related to the first sub-algorithm.

8. A multi-hop question-answering device, comprising: a question acquisition unit configured to acquire a question to be answered and answer-related information, wherein the answer-related information includes: at least one of context information of the question to be answered and knowledge graph information; The answer obtaining unit is configured to obtain the answer output by the multi-hop question answering model based on the question to be answered, the answer related information and the multi-hop question answering model trained by the multi-hop question answering model training device according to claim 7.

9. An electronic device, characterized in that: include: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable the computer to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Knowledge graph multi-hop question and answer method and model based on cognitive reasoning

    CN113360604A

  • Building health monitoring and evaluation method and system based on physical neural network

    CN119249073A