Translation method, system, medium, device and program product based on semantic energy conservation network
By combining the Hamiltonian deep neural network and VI Verlet integrator with the Transformer translation network, the semantic loss problem of the Transformer translation network in special contexts is solved, achieving higher translation accuracy and semantic transfer.
Patent Information
- Application Number
- CN202510149161.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-02-11
AI Technical Summary
The existing Transformer translation network has difficulty in effectively transmitting the semantic information in the source language text in special contexts, resulting in semantic loss.
The Hamiltonian deep neural network (HDNN) and VI Verlet integrator are introduced, and the semantic energy conservation network is used to evolve vocabulary information. Combined with the Transformer translation network, this ensures the stability and consistency of information and improves translation accuracy.
Avoiding semantic loss or information distortion during the translation process improves the translation accuracy of Transformer in long sentences or complex grammatical structures and enhances the model's ability to understand contextual relationships.
Smart Images

Figure CN120181099B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of machine translation, and particularly relates to a translation method and system based on a semantic energy conservation network, a medium, equipment and a program product. BACKGROUND
[0002] In modern life, cross-language communication is increasingly frequent, and for this reason, machine translation technology is gradually popularized and developed.
[0003] Although the Transformer model has achieved remarkable results in machine translation, in some special contexts, the Transformer translation network can only achieve literal translation without error from the source language to the target language, but it is difficult to effectively convey some semantic information in the source language text to the target language, resulting in semantic loss.
[0004] Therefore, it is necessary to provide an improved technical solution to the above-mentioned deficiencies of the prior art. SUMMARY
[0005] The purpose of the present application is to provide a translation method, system, medium, equipment and program product based on a semantic energy conservation network to solve or alleviate the problems existing in the prior art.
[0006] In order to achieve the above-mentioned purpose, the present application provides the following technical solutions:
[0007] In a first aspect, the present application provides a translation method based on a semantic energy conservation network, comprising:
[0008] Obtaining a text to be translated, and determining the relative position of each vocabulary in the sentence to be translated and the corresponding feature vector thereof;
[0009] Mapping the relative position of each vocabulary in the sentence to be translated into a generalized coordinate in Hamiltonian dynamics, mapping the feature vector of each vocabulary in the sentence to be translated into an active quantity corresponding to the relative position, and converting the sentence to be translated into an energy form representation using an energy conversion network;
[0010] According to the energy form representation, calculating the Hamiltonian of each vocabulary in the initial state and the Hamiltonian total amount of the sentence to be translated as the initial energy of each vocabulary and the initial total energy of the sentence to be translated;
[0011] Using the Xavier method to initialize the weight, and inputting the initialized result into a Hamiltonian deep neural network HDNN to extract the feature of the vocabulary information with the target of semantic energy conservation, to obtain the relative position and active quantity evolved at each time point;
[0012] The processing result of the HDNN is input to a VI Verlet integrator, and further evolution is performed according to a time step to obtain further evolved relative positions and activities;
[0013] The further evolved relative positions and activities are input to a translation network based on a Transformer to obtain a translation result;
[0014] The energy evaluation network is used to recalculate the Hamiltonian of each word and the Hamiltonian total of the sentence to be translated, and calculate the energy difference to obtain a final result.
[0015] In combination with the first aspect, in some possible implementations, the energy form is specifically represented as:
[0016] E 0i = H(p i , q i ),
[0017]
[0018] In the formula, E 0i is the initial energy of the i-th word, obtained by H(p i , q i ), H is the Hamiltonian, p i is the activity of the i-th word, q i is the relative position of the i-th word, i = 1, 2, …, n, and E tot0 is the initial total energy of the sentence to be translated.
[0019] In combination with the first aspect, in some possible implementations, the Hamiltonian H is represented as:
[0020]
[0021] In the formula, U and V are parameter matrices, q is a vector composed of the relative positions of all words, and p is a vector composed of the activities of all words.
[0022] In combination with the first aspect, in some possible implementations, the HDNN is a time-varying Hamiltonian system, and a dynamic equation of the time-varying Hamiltonian system is expressed as:
[0023]
[0024] In the formula, is a state vector, t is time, J(t) is a time-varying skew-symmetric matrix, y (0) is an initial state vector, including the initial energy of each word and the initial total energy of the sentence to be translated.
[0025] In combination with the first aspect, in some possible implementation manners, in the Hamilton deep neural network HDNN, the extended Hamiltonian is discretized by using an S-IE discretization method to obtain the relative position and activity of each vocabulary at each time point, and the expression is as follows:
[0026]
[0027] q i+1 =q i -hLM q,i σ(M p,i q i +b p,i ),
[0028] In the formula, i represents the i-th time step, p i and p i+1 are the relative positions of adjacent time steps, q i and q i+1 are the activities of adjacent time steps, h is a time step, L and M are parameter matrices, L T and M T are transpose matrices of L and M respectively, M p,i is a parameter matrix having a specific expression at the i-th time step in relation to the variable p i , M q,i is a parameter matrix having a specific expression at the i-th time step in relation to the variable q i , b q,i represents a bias term in relation to the variable q i and having a specific value at the i-th time step, and b p,i represents a bias term in relation to the variable p i and having a specific value at the i-th time step.
[0029] In the second aspect, the embodiment provides a translation system based on a semantic energy conservation network, comprising:
[0030] An acquisition module is configured to acquire a text to be translated and determine the relative position of each vocabulary in the sentence to be translated and the corresponding feature vector of each vocabulary;
[0031] A mapping module is configured to map the relative position of each vocabulary in the sentence to be translated into a generalized coordinate in Hamiltonian dynamics, map the feature vector of each vocabulary in the sentence to be translated into an activity corresponding to the relative position, and convert the sentence to be translated into an energy form by using an energy conversion network;
[0032] A calculation module is configured to calculate the Hamiltonian of each vocabulary in an initial state and the Hamiltonian total amount of the sentence to be translated according to the energy form, as the initial energy of each vocabulary and the initial total energy of the sentence to be translated;
[0033] The first evolution module is configured to initialize weights using the Xavier method, and input the initialized results into a Hamilton deep neural network (HDNN) to extract features of vocabulary information with semantic energy conservation as a target, so as to obtain relative positions and active amounts of evolution at each time point;
[0034] The second evolution module is configured to input the processing results of the HDNN into a VI Verlet integrator to further evolve according to a time step, so as to obtain relative positions and active amounts after further evolution;
[0035] The translation module is configured to input the relative positions and active amounts after further evolution into a translation network based on a Transformer to obtain a translation result.
[0036] The evaluation module is configured to recalculate Hamiltonians of each vocabulary and a Hamilton total of a sentence to be translated using an energy evaluation network, and calculate an energy difference to obtain a final result.
[0037] In a third aspect, the present embodiment provides a computer-readable storage medium having a computer program stored thereon, and the computer program is executed by a processor to implement the steps of the translation method based on the semantic energy conservation network according to any one of the above embodiments.
[0038] In a fourth aspect, the present embodiment provides an electronic device, which includes a memory, a processor, and a program stored in the memory and executable on the processor, and the processor implements the steps of the translation method based on the semantic energy conservation network according to any one of the above embodiments when executing the program.
[0039] In a fifth aspect, the present embodiment provides a computer program product containing computer executable instructions for causing a computer to execute the steps of the translation method based on the semantic energy conservation network according to any one of the above embodiments.
[0040] The technical scheme of the present embodiment has the following beneficial effects:
[0041] In the embodiment of the first aspect, the vocabulary of the input source language sentence is represented in the form of energy. From the perspective of energy conservation, a Hamiltonian deep neural network (HDNN) and a VI Verlet integrator are used as an energy evolution network to process the evolution of the vocabulary position and activity information. The evolved relative position and activity are input into a translation network based on a Transformer to obtain a translation result. This method combines the ideas of Hamiltonian dynamics and the advantages of deep learning. The evolution is performed through semantic energy conservation to ensure the stability and consistency of the information, avoiding semantic loss or information distortion during translation. Moreover, the HDNN is used for vocabulary information evolution and feature extraction, which enables the model to better understand the context relationship of the input text, especially in long sentences or complex grammatical structures, helping to improve the accuracy of the Transformer during translation.
[0042] By using the Xavier initialization method in the HDNN, the model can have a reasonable parameter distribution at the beginning of training, which helps to accelerate the training process and improve the convergence.
[0043] Based on the evolution of the HDNN, the VI Verlet integrator is used for further evolution. The VI Verlet integrator has the property of reversibility, which facilitates tracing the changes in the vocabulary representation (relative position q and activity p) according to the time step, further improving the translation accuracy.
[0044] The technical effects achieved by any one of the above-mentioned second to fifth aspects can be referred to the description of the beneficial effects of the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0045] Figure 1 A flowchart of a translation method based on a semantic energy conservation network according to some embodiments of the present application.
[0046] Figure 2 A structure diagram of a semantic energy conservation network according to some embodiments of the present application.
[0047] Figure 3 A flowchart of a translation method based on a semantic energy conservation network according to another embodiment of the present application.
[0048] Figure 4 A structure block diagram of a translation system based on a semantic energy conservation network according to another embodiment of the present application.
[0049] Figure 5 A schematic diagram of an electronic device according to another embodiment of the present application.
[0050] REFERENCE SIGNS
[0051] 1 - Energy evolution module, 11 - Energy conversion network, 12 - Hamiltonian deep neural network HDNN, 13 - VI Verlet integrator, 2 - Transformer translation network, 21 - Multi-head attention mechanism, 22 - Residual connection and normalization processing, 23 - Feedforward neural network, 26 - Experience data augmentation, 3 - Energy evaluation network. DETAILED DESCRIPTION
[0052] As described in the background, in some special contexts, the existing machine learning translation technology based on Transformer technology is prone to semantic loss, for example, the Chinese text: "Three common cobblers can equal Zhuge Liang.", which is translated into English text as: "Three common cobblers can equal Zhuge Liang.", The above translation is correct in literal sense, but it is difficult to reflect the relationship between the wise and the foolish, resulting in semantic loss.
[0053] Therefore, the present disclosure provides a translation method, system, medium, device and program product based on a semantic energy conservation network, introduces a Hamiltonian mechanics system, uses a Hamiltonian deep neural network HDNN to evolve the vocabulary information with the goal of semantic energy conservation, and then inputs the evolution result of the HDNN into a VI Verlet integrator for further evolution, and uses a translation network of Transformer for translation, so as to alleviate the semantic loss problem of the Transformer translation network and improve the translation accuracy from the source language to the target language.
[0054] The terms "first", "second", "third", and "fourth" and the like in the specification and claims of the present application and the accompanying drawings are used to distinguish different objects, and are not used to describe a particular order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed, or can optionally include other steps or units inherent to the process, method, product or device.
[0055] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearance of the phrase in various places in the specification does not necessarily all refer to the same embodiment, nor does it necessarily exclude other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0056] Embodiments of the present application will be described below with reference to the accompanying drawings.
[0057] The embodiment provides a translation method based on a semantic energy conservation network, as shown in the figure, the method comprises the following steps: Figure 1
[0058] Step S101: obtaining a text to be translated, and determining the relative position of each vocabulary in the sentence to be translated and the corresponding feature vector.
[0059] In the embodiment, the text to be translated is obtained, that is, the source language text to be translated is obtained. The text to be translated can be obtained through an input box provided by a user interface or other user interfaces provided by a system, or the text to be translated can be obtained by uploading a document (such as a PDF or Word document) or by API calling a document. The specific obtaining method is not limited in the embodiment.
[0060] In the embodiment, the word embedding technology and the position coding technology can be used to determine the relative position of each vocabulary in the sentence to be translated and the corresponding feature vector. For example, Word2Vec, GloVe or context-aware BERT and GPT are used to map each vocabulary in the sentence to be translated to a high-dimensional feature vector, so as to capture the semantic information of the vocabulary, and the relative position of each vocabulary in the sentence is identified through position coding.
[0061] For ease of description, q = (q1…q n ) represents the relative position of each vocabulary, and p = (p1…p n ) represents the feature vector of each vocabulary.
[0062] Step S102: mapping the relative position of each vocabulary in the sentence to be translated into a generalized coordinate in Hamiltonian dynamics, mapping the feature vector of each vocabulary in the sentence to be translated into an active quantity corresponding to the relative position, and converting the sentence to be translated into an energy form using an energy conversion network.
[0063] In the embodiment, the energy conversion network is used to map the vocabulary position and feature vector of the source language into the concept in Hamiltonian dynamics, and to represent in the form of energy.
[0064] In Hamiltonian dynamics, p represents generalized momentum, and q represents generalized coordinate.
[0065] For example, it is assumed that the sentence A to be translated contains N vocabularies, the relative position of each vocabulary is q1…q n , and the corresponding active quantity (i.e., the feature vector in NLP) is p1…p n , the energy conversion network takes the relative position and activity of each vocabulary as input, obtains the energy of each vocabulary by calculating the Hamiltonian H of each vocabulary, and obtains the total energy of the sentence by summing the energy of all vocabularies.
[0066] Step S103: According to the energy form expression, the Hamiltonian of each vocabulary in the initial state and the Hamiltonian total of the sentence to be translated are calculated as the initial energy of each vocabulary and the initial total energy of the sentence to be translated.
[0067] Exemplarily, the initial energy of each vocabulary is represented by E 0i , and the total energy of the sentence is represented by E tot0 , and the calculation formula is as follows:
[0068] E 0i = H(p i , q i ),
[0069]
[0070] In the formula, E 0i is the initial energy of the i-th vocabulary, which is obtained by the Hamiltonian H of the system, p i is the activity of the i-th vocabulary, q i is the relative position of the i-th vocabulary, i = 1, 2, …, n, and R tot0 is the initial total energy of the sentence to be translated.
[0071] The Hamiltonian H of the system, also known as the Hamiltonian function, here, a specific form of H is given, which corresponds to the mass ball physical model of energy conservation, and the expression of H is:
[0072]
[0073] In the formula, U and V are parameter matrices, q is a vector composed of the relative positions of all vocabularies, and p is a vector composed of the activities of all vocabularies.
[0074] Step S104: The Xavier method is used for weight initialization, and the initialized results are input into the Hamiltonian deep neural network HDNN to extract the features of vocabulary information with the goal of semantic energy conservation, and the relative positions and activities evolved at each time point are obtained.
[0075] The Xavier method sets the initial value of the weight of the neural network layer reasonably to keep the variance of the output and gradient of each layer as stable as possible, thereby accelerating the training process and improving the performance of the model. In the embodiment, the parameter matrices U and V are introduced into the Hamiltonian function, and the Xavier method is used to initialize the parameter matrices, which facilitates feature optimization and semantic understanding.
[0076] Further, when the Xavier method initializes the parameter matrix, the parameter matrix can be initialized as a weight matrix subject to a uniform distribution, or the parameter matrix can be initialized as a weight matrix subject to a normal distribution, and the embodiment is not limited in this regard.
[0077] The result of the Xavier initialization is input into the Hamilton deep neural network HDNN, and the vocabulary information is further processed so that the energy is close to conservation.
[0078] It should be noted that the Hamilton deep network HDNN is a network built based on Hamilton dynamics, and the core idea is to apply Hamilton mechanics to the training of the neural network, and the evolution of the system is described by introducing the Hamiltonian H.
[0079] HDNN is a time-varying Hamiltonian system, and the dynamic equation of the time-varying Hamiltonian system is expressed as follows:
[0080]
[0081] In the formula, is a state vector, t is time, J(t) is a time-varying skew-symmetric matrix, y (0) is an initial state vector, including the initial energy of each vocabulary and the initial total energy of the sentence to be translated.
[0082] In order to ensure the marginal stability of the system, the S-IE discretization method is used for discretization processing: T is the end point corresponding to the motion time interval of the dynamic model, the time sampling period h = T / n, n represents the number of HDNN network layers, and the sampling period h is also called the step length of the time step. Then the total time T is divided into n discrete time steps, each time step corresponds to a level of the neural network, which also corresponds to an update of the system state. The parameters matrix L, M and the bias b are introduced, and the discretization processing is obtained as follows:
[0083]
[0084] In the formula: σ represents a common activation function, such as tanh(·), ReLU(·) and the like.
[0085] For convenience of solution, it is assumed that:
[0086]
[0087] The relative position and activity of each vocabulary at each time point are obtained, and the expression is as follows:
[0088]
[0089] q i+1 q i -hLMq,i σ(M p,i q i +b p,i ),
[0090] where i denotes the i-th time step, p i , p i+1 is the relative position of adjacent time steps, q i , q i+1 is the activity of adjacent time steps, h is the time step, L, M are parameter matrices, L T , M T are the transpose matrices of L, M, M p,i is a parameter matrix with specific representation at the i-th time step related to the variable p i , M q,i is a parameter matrix with specific representation at the i-th time step related to the variable q i , b q,i represents a bias term related to the variable q i and has a specific value at the i-th time step, b p,i , represents a bias term related to the variable p i and has a specific value at the i-th time step.
[0091] In this embodiment, the application of Hamilton depth network HDNN strengthens the reinforcement and extraction of lexical semantic information.
[0092] Step S105: input the processing result of HDNN to VI Verlet integrator, further evolve according to the time step, and obtain the further evolved relative position and activity.
[0093] In this embodiment, VI Verlet integrator realizes further evolution according to the time step by combining Hamilton equation and symplectic property according to the input lexical position information q and activity p:
[0094]
[0095] q i+1 = 2q i -q i-1 +p i ′t 2 ,
[0096] where p i ′ is the first order derivative of p i with respect to time t.
[0097] The further evolved relative position and activity quantity are obtained. At this point, the energy evolution ends, and thus the relative position and activity quantity output by the VI Verlet integrator are also referred to as the final result of the energy evolution.
[0098] Step S106: input the further evolved relative position and activity quantity into the Transformer-based translation network to obtain a translation result.
[0099] In this embodiment, the further evolved relative position and activity quantity, that is, the relative position and activity quantity processed by the VI Verlet integrator, is also the final result of the energy evolution.
[0100] The Transformer-based translation network, also referred to as the Transformer translation network, is a deep learning model based on a self-attention mechanism, which processes the input and output sequences through the self-attention mechanism and parallelization design, and is commonly used in natural language processing (NLP) tasks, especially in machine translation (Machine Translation), so that long-range dependencies can be captured more efficiently during the training process.
[0101] The Transformer translation network includes a multi-head attention mechanism (MHA) for receiving the evolved relative position q and activity quantity p, and capturing long-range dependencies in the input sentence through the attention mechanism. The calculation formula of the multi-head attention mechanism is as follows:
[0102]
[0103] In the formula, Q1, K1, and V1 are query (Query), key (Key), and value (Value) matrices, respectively, d k is the dimension of the key (Key) and query (Query).
[0104] In the formula, Q1 corresponds to the relative position q in the final result of the energy evolution, K1 corresponds to the activity quantity p in the final result of the energy evolution, and V1 = (v1, …, v i is the output result of the attention mechanism.
[0105] Step S107: use an energy evaluation network (NN) to recalculate the Hamiltonian of each word and the Hamiltonian total of the sentence to be translated, and calculate the energy difference to obtain a final result.
[0106] In this embodiment, the energy evaluation network recalculates the Hamiltonian of each word and the Hamiltonian total of the sentence to be translated according to V1 output by the multi-head attention mechanism and the relative position q output by the VI Verlet integrator according to the following formula:
[0107]
[0108] where v i , q i are the output and relative position of the i-th word in V1, q, respectively, E 1i is the Hamiltonian of the i-th word after recalculation, E tot1 is the total Hamiltonian of the sentence to be translated after recalculation.
[0109] That is, the capability evaluation network re-evaluates the energy of each word and the total energy of the sentence by comparing the final result of energy evolution with the output result of the Transformer translation network.
[0110] The energy difference between E tot1 and E tot0 , that is, the evaluation energy loss, is calculated to obtain the final result, that is, to evaluate the effect of translation from the energy point of view.
[0111] The translation method based on the semantic energy conservation network provided in the embodiment is specifically implemented through the semantic energy conservation network, and the structure of the semantic energy conservation network is as shown in Figure 2 , which includes the following three parts: an energy evolution module 1, a Transformer translation network 2, and an energy evaluation network 3 (NN). Among them, the energy evolution module 1 is used to strengthen the expression and extraction of word information; the Transformer translation network 2 is used to receive the output of the energy evolution module to realize the translation from the source language to the target language; and the energy evaluation network 3 (NN) is used to evaluate the translation loss.
[0112] Specifically, the energy evolution module 1 includes an energy conversion network (ETN) 11, a Hamiltonian deep neural network 12 (HDNN), and a VI Verlet integrator 13 (VI). The energy conversion network 11 is used to convert the text input in the source language into an energy form representation; the Hamiltonian deep neural network 12 (HDNN) and the VI Verlet integrator 13 are used to evolve the word information in the energy representation form to strengthen the feature expression capability and feature extraction capability of the word information.
[0113] The Transformer translation network 2 includes a multi-head attention mechanism 21 (MHA), a residual connection and normalization processing 22 (Add&Norm), a feedforward neural network 23 (FFN), an experience data enhancement 26 (EDA), and the like. The multi-head attention mechanism 21 receives the lexical information (including relative position and activity amount) output by the energy evolution module, processes it using the multi-head attention mechanism, sequentially passes through the residual connection and normalization processing 22 (Add&Norm) and the feedforward neural network 23 (FFN), and again uses the residual connection and normalization processing 22 (Add&Norm) to obtain an intermediate result 1. At the same time, the experience data of the target language is input into the Transformer translation network 2, processed by the multi-head attention mechanism 21 (MHA), and an intermediate result 2 is obtained. The intermediate result 1 and the intermediate result 2 are combined and input into the experience data enhancement 26 (EDA) module. The output result of the EDA module is processed by the feedforward neural network 23 (FFN) to obtain the output result of the Transformer translation network 2.
[0114] Finally, the energy evaluation network 3 (NN) calculates the loss between the output result of the Transformer translation network 2 and the output result of the energy evolution module 1 to obtain the final output to evaluate the translation effect.
[0115] As an example, as shown in Figure 3 The method provided by the embodiment can be executed according to the following steps.
[0116] Step 1: input the source language, and obtain the energy of each sentence;
[0117] The energy of each sentence is achieved by mapping the lexical relative position and feature vector to the energy form through the energy conversion network.
[0118] Step 2: train in the model to minimize the energy loss;
[0119] Here, the model refers to the semantic energy conservation network model, including the energy evolution module 1, the Transformer translation network 2, and the energy evaluation network 3. The detailed results of each part are described above and will not be repeated here.
[0120] Step 3: re-evaluate the energy in the neural network;
[0121] Here, the neural network refers to the semantic energy conservation network, and the energy is re-evaluated, that is, the energy of each lexical is recalculated according to the output result of the energy evolution module 1 and the translation result of the Transformer translation network 2, and then the total energy of the sentence is calculated.
[0122] Step 4: output the translation result, and the semantic deviation is manifested as energy loss.
[0123] In summary, the translation method based on the semantic energy conservation network provided in this embodiment combines physical theory and artificial intelligence language translation by applying the Hamiltonian mechanics system to the field of language translation. Specifically, the semantic energy conservation network is used to perform a translation task, including an energy evolution module 1, a Transformer translation network 2, and an energy evaluation network 3, to achieve the task of translating a source language. The Hamiltonian mechanics system is introduced in the energy evolution module 1, and the Hamiltonian function generally represents the total energy of a system. For a dynamic system, if no external force does work, the energy of the system is constant. According to this theory, it is proposed in this embodiment that, in an ideal state, the energy of the source language and the target language is conserved in the semantic space during the neural network translation process. Therefore, the semantic energy conservation network is trained with the goal of minimizing energy loss, so that the translation from the source language to the target language is accurate in terms of literal translation, and the semantics of the source language can be better transmitted to the target language, thereby alleviating the problem of semantic loss in the translation process as much as possible.
[0124] It should be noted that the "Hamiltonian function" involved in this application and the "Hamiltonian operator" and "Hamiltonian matrix element" of the traditional Hamiltonian combined with artificial intelligence belong to different concepts and borrow different physical ideas. The "Hamiltonian operator" and "Hamiltonian matrix element" are concepts in quantum mechanics and do not belong to the category of Hamiltonian dynamics. In quantum mechanics, the Hamiltonian operator is used to represent the total energy of a system, and the time evolution of a quantum state is described by the Schrödinger equation. The Hamiltonian matrix element is a matrix element in quantum mechanics that describes the transition probability or amplitude between system states. In quantum mechanics, it represents the transition between the i-th and j-th quantum states, and it is the matrix representation of the Hamiltonian operator in the selected basis. However, the Hamiltonian function in this application is a concept in classical mechanics and belongs to the part of Hamiltonian dynamics. Hamiltonian dynamics uses the Hamiltonian function to describe the state and evolution of a system. Although all three names contain the word "Hamilton", and they are all related to the energy of a system, they belong to two different theoretical systems of classical mechanics and quantum mechanics, respectively.
[0125] It should also be noted that in some existing technologies, the Hamiltonian evolution layer is mainly used to process generalized potentials and generalized momenta, mainly by means of Hamiltonian neural networks and Euler integrators. However, in this application, the input source language sentence is represented in the form of energy, and the energy evolution network is used to process word position and active quantity information from the perspective of energy conservation. The Hamiltonian deep neural network combined with the VI Verlet integrator can better utilize the properties of symplectic structure to ensure the accuracy and stability of numerical simulation and better ensure the constancy of energy in the semantic space. This is not the same as the understanding and combination of the existing technology of Hamiltonian classical dynamics.
[0126] Based on the same inventive concept, the embodiment also provides a translation system based on a semantic energy conservation network, as shown in the accompanying drawings, the system comprises an acquisition module 301, a mapping module 302, a calculation module 303, a first evolution module 304, a second evolution module 305, a translation module 306 and an evaluation module 307. Figure 4
[0127] Among them:
[0128] The acquisition module 301 is configured to acquire a text to be translated, and determine the relative position of each vocabulary in the sentence to be translated and the corresponding feature vector thereof.
[0129] The mapping module 302 is configured to map the relative position of each vocabulary in the sentence to be translated into a generalized coordinate in Hamiltonian dynamics, map the feature vector of each vocabulary in the sentence to be translated into an active quantity corresponding to the relative position, and convert the sentence to be translated into an energy form representation using an energy conversion network.
[0130] The calculation module 303 is configured to calculate the Hamiltonian of each vocabulary in the initial state and the Hamiltonian total amount of the sentence to be translated according to the energy form representation, as the initial energy of each vocabulary and the initial total energy of the sentence to be translated.
[0131] The first evolution module 304 is configured to use the Xavier method to initialize the weight, input the initialized result into the Hamiltonian deep neural network HDNN, extract the feature of the vocabulary information with the semantic energy conservation as the target, and obtain the relative position and the active quantity evolved at each time point.
[0132] The second evolution module 305 is configured to input the processing result of the HDNN into the VI Verlet integrator, further evolve according to the time step, and obtain the relative position and the active quantity after further evolution.
[0133] The translation module 306 is configured to input the relative position and the active quantity after further evolution into the translation network based on the Transformer, and obtain the translation result.
[0134] The evaluation module 307 is configured to use the energy evaluation network to recalculate the Hamiltonian of each vocabulary and the Hamiltonian total amount of the sentence to be translated, calculate the energy difference, and obtain the final result.
[0135] The translation system based on the semantic energy conservation network provided by the embodiment can realize the steps and processes of the translation method based on the semantic energy conservation network provided by any of the above embodiments, and achieve the same technical effects, which will not be described here.
[0136] The translation method based on semantic energy conservation network provided in any of the above embodiments can be applied to Figure 5 In the electronic device 500 shown, the electronic device 500 can be, but is not limited to, mobile terminals such as mobile phones, tablet computers, handheld computers, personal digital assistants (PDAs), smart home devices such as smart TVs and smart cameras, wearable devices such as smart bracelets, smart watches, and smart glasses, or other computer devices such as desktops, laptops, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, and smart screens.
[0137] like Figure 5 As shown, the electronic device 500 may include one or more of the following components: a processor 501, a memory 503, a communication interface 502, and a communication bus 504. The memory 503 may be connected to the processor 501 via the bus 504. The bus can transmit data between the processor 501 and the memory 503. The bus can be divided into an address bus, a data bus, a control bus, and the like.
[0138] The processor 501 can include one or more processing cores, and can utilize various interfaces and lines to connect various parts within the entire electronic device 500, execute various functions of the electronic device 500 and process data by running or executing instructions, programs, code sets or instruction sets stored in the memory 503, and calling data stored in the memory 503. For example, the processor 501 can include an application processor (AP), a modem processor, a CPU, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a field-programmable gate array (FPGA), a programmable logic array (PLA), a neural-network processing unit (NPU), and the like. Among them, the CPU mainly processes operating systems, user interfaces, and application programs; the GPU is responsible for rendering and drawing the content to be displayed; the NPU is used to implement artificial intelligence (AI) functions; and the modem is used to process wireless communication. Different processing units can be independent devices or integrated in one or more processors. For example, the above-mentioned multiple processing units are integrated in one SoC, or the AP is a separate semiconductor chip and the other processing units are integrated in one SoC, which is not limited in the present application.
[0139] The memory 503 can include a random access memory (RAM) and can also include a read-only memory (ROM), and can further include a non-transitory computer-readable storage medium. The memory 503 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 503 can include a program storage area and a data storage area, wherein the program storage area can store instructions for implementing an operating system, instructions for at least one function, such as a three-dimensional rough fracture nonlinear flow field simulation method, a three-dimensional rough fracture long-term dissolution mechanism analysis method, etc.; and the data storage area can store data created according to the use of the electronic device 500, such as input data of flow field simulation, etc.
[0140] In addition, those skilled in the art can understand that the structure of the electronic device 500 shown in the above-mentioned drawings does not constitute a limitation on the electronic device 500, and the electronic device can include more or fewer components than those shown in the drawings, or combine certain components, or different component arrangements. For example, the electronic device 500 also includes components such as a microphone, a speaker, radio frequency circuitry, a sensor, audio circuitry, a power supply, a Bluetooth module, and the like, which are not described here.
[0141] The embodiments of the present application also provide a computer program product containing computer executable instructions. In an embodiment, the computer executable instructions are used to make a computer execute the functions in the above-mentioned method embodiments.
[0142] The computer executable instructions can be stored in a computer readable storage medium, and the embodiments of the present application also provide a computer readable storage medium, which stores executable instructions. In an embodiment, the computer executable instructions are used to make a computer execute the functions in the above-mentioned method embodiments.
[0143] The computer readable storage medium provided by the embodiments of the present application can be a random access memory (RAM), a flash memory, a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically ePROM (EEPROM), a register, a hard disk, a mobile hard disk, a CD-ROM, or any other form of computer readable storage medium known in the art.
[0144] The computer executable instructions can be stored in a computer readable storage medium, or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer program or instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center through a wired or wireless manner. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be a magnetic medium, for example, a floppy disk, a hard disk, a magnetic tape; or an optical medium, for example, a digital video disc (DVD); or a semiconductor medium, for example, a solid state disk.
[0145] The above descriptions are only the preferred embodiment of the application, not intended to limit the application. The application can be variously changed and modified by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the application shall be included in the protection scope of the application.
Claims
1. A translation method based on a semantic energy conservation network, characterized in that: include: Obtain the text to be translated and determine the relative position of each word in the sentence to be translated and its corresponding feature vector; The relative position of each word in the sentence to be translated is mapped to the generalized coordinates in Hamiltonian dynamics, the feature vector of each word in the sentence to be translated is mapped to the activity corresponding to the relative position, and the sentence to be translated is converted into an energy form using an energy conversion network; According to the energy form, the Hamiltonian of each word in the initial state and the total Hamiltonian of the sentence to be translated are calculated as the initial energy of each word and the initial total energy of the sentence to be translated; The Xavier method is used to initialize the weights, and the initialization results are input into the Hamiltonian deep neural network (HDNN). The feature extraction of lexical information is carried out with the goal of semantic energy conservation, and the relative position and activity of each time point are obtained. The processing results of HDNN are input into VI Verlet integrator, and further evolved according to the time step to obtain the relative position and activity after further evolution; The further evolved relative position and activity are input into the Transformer-based translation network to obtain the translation result; The energy evaluation network is used to recalculate the Hamiltonian of each word and the total Hamiltonian of the sentence to be translated, and the energy difference is calculated to obtain the final result.
2. The method according to claim 1, characterized in that The energy form is specifically represented as follows: E 0i =H(p i ,q i ), Where, E 0i is the initial energy of the i-th word, which is expressed by H(p i ,q i ) is obtained, H is the Hamiltonian, p i is the activity of the i-th word, q i is the relative position of the i-th word, i = 1, 2, ..., n, E tot0 is the initial total energy of the sentence to be translated.
3. The method according to claim 2, characterized in that The Hamiltonian H is expressed as: Where U and V are parameter matrices, q is a vector consisting of the relative positions of all words, and p is a vector consisting of the activity of all words.
4. The method according to claim 1, wherein HDNN is a time-varying Hamiltonian system; the dynamic equation of the time-varying Hamiltonian system is expressed as follows: Where, is the state vector, t is the time, M(t) is the time-varying skew-symmetric matrix, y (0) is the initial state vector, including the initial energy of each word and the initial total energy of the sentence to be translated.
5. The method according to claim 4, characterized in that In the Hamiltonian deep neural network HDNN, the S-IE discretization method is used to discretize the extended Hamiltonian to obtain the relative position and activity of each word at each time point. The expression is as follows: q i+1 =q i -hLM q,i σ(M p,i q i +b p,i ), Where i represents the i-th time step, p i 、p i+1 is the relative position of adjacent time steps, q i ,q i+1 is the activity of adjacent time steps, h is the time step, L and M are parameter matrices, L T 、M T are the transposed matrices of L and M respectively, M p,i is related to the variable p i The parameter matrix M is specifically represented at the i-th time step. q,i is related to the variable q i The parameter matrix with specific representation at the i-th time step, b q,i Represents the variable q i is a bias term that is relevant and has a specific value at the i-th time step, b p,i Represents the variable p i It is a bias term that is relevant and has a specific value at the i-th time step.
6. A translation system based on a semantic energy conservation network, characterized in that: include: An acquisition module is used to acquire the text to be translated and determine the relative position of each word in the sentence to be translated and its corresponding feature vector; A mapping module is used to map the relative position of each word in the sentence to be translated into generalized coordinates in Hamiltonian dynamics, map the feature vector of each word in the sentence to be translated into an activity corresponding to the relative position, and use an energy conversion network to convert the sentence to be translated into an energy form representation; A calculation module is used to calculate the Hamiltonian of each word in the initial state and the total Hamiltonian of the sentence to be translated according to the energy form, as the initial energy of each word and the initial total energy of the sentence to be translated; The first evolution module is used to initialize weights using the Xavier method and input the initialization results into the Hamiltonian deep neural network (HDNN). It extracts features of lexical information with the goal of semantic energy conservation and obtains the relative position and activity of the evolution at each time point. The second evolution module is used to input the processing results of HDNN into the VI Verlet integrator, further evolve according to the time step, and obtain the relative position and activity after further evolution; The translation module is used to input the further evolved relative positions and activity levels into the Transformer-based translation network to obtain the translation results; The evaluation module is used to use the energy evaluation network to recalculate the Hamiltonian of each word and the total Hamiltonian of the sentence to be translated, and calculate the energy difference to obtain the final result.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the translation method based on the semantic energy conservation network according to any one of claims 1 to 5 are implemented.
8. An electronic device, characterized in that: include: A memory, a processor, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the translation method based on the semantic energy conservation network according to any one of claims 1 to 5 are implemented.
9. A computer program product, characterized in that The method comprises computer-executable instructions for causing a computer to execute the steps of the translation method based on the semantic energy conservation network according to any one of claims 1 to 5.
Citation Information
Patent Citations
Non-autoregressive neural machine translation decoding method and device, equipment and storage medium
CN114611505A
Arbitrary continuous time perception model for simulating mixed synaptic transfer and training method
CN116861974A