Large model-based multilingual deep translation method, system and electronic device
By acquiring target sentence groups for semantic enhancement and back-translation model evaluation, and combining user-controlled prompts for translation repair, the semantic shift and uncontrollable output problems of existing multilingual translation systems in complex language structures and professional fields are solved. Context-aware text-level translation and consistency self-evaluation are achieved, improving the accuracy and professionalism of the translation.
Patent Information
- Application Number
- CN202510822214.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-06-19
AI Technical Summary
Existing multilingual translation systems lack context modeling capabilities when dealing with complex language structures, specialized terminology, and long documents. This leads to inconsistencies in terminology, confusion in pronoun references, and abrupt changes in stylistic shifts. Furthermore, they lack self-verification and adjustment mechanisms, making it impossible to identify and correct semantic shifts and mistranslations, thus affecting the professionalism and coherence of the translation.
By acquiring target sentence groups for semantic enhancement, a context-enhanced representation vector is obtained. An initial translation result is generated using an initial translation model, and semantic deviation and consistency score are calculated using a back-translation model. User control prompt vectors are obtained and input into a repair model for translation repair, thus achieving context-aware, text-level translation and consistency self-evaluation.
It improves the accuracy of multilingual translation, solves the problems of missing context and unverifiable results, realizes context-aware text-level translation and user-controllable deep collaboration mechanism, and enhances the professionalism and coherence of translation.
Smart Images

Figure CN120387462B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language processing, and particularly relates to a multi-language deep translation method and system based on a large model and an electronic device. BACKGROUND
[0002] With the continuous evolution of large-scale pre-training language models based on the Transformer structure (such as mBART, mT5, GPT, etc.), the multi-language translation task has entered the stage of large model driving. Existing systems can achieve high-quality translation at the sentence level between mainstream language pairs and are widely used in web page translation, APP real-time dialogue, document preliminary transcription and other scenarios. However, when dealing with translation tasks involving complex language structures, professional terms and long documents, the existing translation strategy based on sentence segmentation gradually exposes its core defects: on the one hand, the lack of context modeling capability leads to frequent problems such as inconsistency of terms, confusion of pronoun references, and sudden changes in style and genre, which seriously affect the professionalism and coherence of the translation; on the other hand, the translation system is generally "one-way generation" and lacks self-validation and adjustment mechanism, and cannot identify and correct semantic drift and mistranslation. In summary, the current multi-language translation system still has obvious shortcomings in semantic understanding depth, translation stability and user controllability. Therefore, how to improve the accuracy of multi-language translation has become a technical problem to be solved. SUMMARY
[0003] The main purpose of the embodiments of the present application is to provide a multi-language deep translation method and system based on a large model and an electronic device, which aims to improve the accuracy of multi-language translation.
[0004] To achieve the above-mentioned purpose, the first aspect of the embodiments of the present application provides a multi-language deep translation method based on a large model, which comprises:
[0005] obtaining a target sentence group; wherein the target sentence group comprises a current translation target sentence and a context window sentence;
[0006] performing semantic enhancement according to the target sentence group to obtain a context enhanced representation vector;
[0007] inputting the context enhanced representation vector into a preset initial translation model to obtain an initial translation result;
[0008] inputting the initial translation result into a preset back-translation model to obtain a first back-translation sentence;
[0009] calculating an average residual error according to the current translation target sentence and the first back-translation sentence to obtain a first semantic deviation;
[0010] score the initial translation result according to the first semantic deviation, the current translation target sentence, and the first back translation sentence, to obtain first consistency score data;
[0011] if the first consistency score data is lower than a preset score threshold, obtaining a control prompt vector input by a user;
[0012] obtaining a repair control vector according to the first semantic deviation and the control prompt vector;
[0013] inputting the repair control vector into a preset repair model to obtain a translation repair result.
[0014] In some embodiments, the initial translation model also outputs a first attention matrix, and the first semantic deviation is obtained by calculating an average residual error according to the current translation target sentence and the first back translation sentence, including:
[0015] encoding the current translation target sentence and the first back translation sentence to obtain a target embedding sequence and a first back translation embedding sequence;
[0016] obtaining a first aligned token pair of the target embedding sequence and the first back translation embedding sequence according to the first attention matrix;
[0017] calculating an average residual error according to the first aligned token pair, the target embedding sequence and the first back translation embedding sequence to obtain the first semantic deviation.
[0018] In some embodiments, the first semantic deviation is obtained by calculating an average residual error according to the first aligned token pair, the target embedding sequence and the first back translation embedding sequence, including:
[0019] The average residual error calculation formula is:
[0020]
[0021] wherein, Δ i represents the first semantic deviation, represents a first aligned token pair set, u j represents the target embedding sequence, represents the first back translation embedding sequence.
[0022] In some embodiments, the repair model also outputs a second attention matrix, and after the repair control vector is input into the preset repair model to obtain the translation repair result, including:
[0023] inputting the translation repair result into the back translation model to obtain a second back translation sentence;
[0024] encoding the second back translation sentence to obtain a second back translation embedding sequence;
[0025] obtaining a second alignment token pair of the target embedding sequence and the second back translation embedding sequence according to the second attention matrix;
[0026] calculating an average residual error according to the second alignment token pair, the target embedding sequence and the second back translation embedding sequence to obtain a second semantic deviation;
[0027] scoring the translation repair result according to the second semantic deviation, the current translation target sentence and the second back translation sentence to obtain second consistency score data.
[0028] In some embodiments, after the scoring the translation repair result according to the second semantic deviation, the current translation target sentence and the second back translation sentence to obtain second consistency score data, the method further comprises:
[0029] if the second consistency score data is greater than the score threshold, obtaining a first term of the current translation target sentence, and obtaining a second term of the translation repair result;
[0030] matching the first term and the second term to obtain a plurality of term key-value pairs;
[0031] storing the term key-value pairs into a preset term state cache;
[0032] constructing and storing a pronoun mapping relationship according to the pronoun of the translation repair result and the corresponding entity phrase.
[0033] In some embodiments, the semantic enhancement according to the target sentence group to obtain a context-enhanced representation vector comprises:
[0034] obtaining a structured representation vector of each of the current translation target sentence and the context window sentence; wherein the structured representation vector is a sum of a token embedding vector and an absolute position encoding;
[0035] splicing each of the structured representation vectors to obtain an input sequence;
[0036] encoding the input sequence to obtain a context-enhanced representation vector.
[0037] In some embodiments, the scoring the initial translation result according to the first semantic deviation, the current translation target sentence and the first back translation sentence to obtain first consistency score data comprises:
[0038] The calculation formula of the first consistency score data is:
[0039] Score i = 1 - (Δ i + γ · δ i + μ · R i ) ;
[0040]
[0041] wherein, Score i represents the first consistency score data, Δ i represents the first semantic deviation, γ represents the term penalty term coefficient, δ i represents the term matching deviation degree, represents the current translation target sentence, represents the set of terms successfully recovered in the first back translation sentence, μ represents the control structure rearrangement influence weight, R i represents the sentence rearrangement penalty term.
[0042] To achieve the above object, a second aspect of the embodiment of the application proposes a multilingual deep translation system based on a large model, the system comprising:
[0043] an acquisition module configured to acquire a target sentence group; wherein the target sentence group comprises a current translation target sentence and a context window sentence;
[0044] an enhancement module configured to perform semantic enhancement according to the target sentence group to obtain a context enhanced representation vector;
[0045] a translation module configured to input the context enhanced representation vector into a preset initial translation model to obtain an initial translation result;
[0046] a back translation module configured to input the initial translation result into a preset back translation model to obtain a first back translation sentence;
[0047] a calculation module configured to calculate an average residual error according to the current translation target sentence and the first back translation sentence to obtain a first semantic deviation;
[0048] a scoring module configured to score the initial translation result according to the first semantic deviation, the current translation target sentence and the first back translation sentence to obtain first consistency score data;
[0049] a first input module configured to acquire a user input control prompt vector if the first consistency score data is lower than a preset score threshold;
[0050] a repair module configured to obtain a repair control vector according to the first semantic deviation and the control prompt vector;
[0051] The second input module is configured to input the repair control vector into a preset repair model to obtain a translation repair result.
[0052] To achieve the above object, a third aspect of the embodiments of the present application provides an electronic device, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the method of the first aspect when executing the computer program.
[0053] To achieve the above object, a fourth aspect of the embodiments of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method of the first aspect.
[0054] The method and system for multilingual deep translation based on a large model and the electronic device provided by the present application obtain a target sentence group, wherein the target sentence group comprises a current translation target sentence and a context window sentence. The semantic enhancement is performed according to the target sentence group to obtain a context enhanced representation vector. The context enhanced representation vector is input into a preset initial translation model to obtain an initial translation result. The initial translation result is input into a preset back translation model to obtain a first back translation sentence. The average residual error is calculated according to the current translation target sentence and the first back translation sentence to obtain a first semantic deviation. The initial translation result is scored according to the first semantic deviation, the current translation target sentence and the first back translation sentence to obtain first consistency score data. If the first consistency score data is lower than a preset score threshold, a control prompt vector input by a user is obtained. A repair control vector is obtained according to the first semantic deviation and the control prompt vector. The repair control vector is input into a preset repair model to obtain a translation repair result. The core defects of the existing multilingual translation system in the aspects of context loss, unverifiable result and uncontrollable output are solved. The deep collaborative mechanism of the trinity of context-aware chapter-level translation, consistency self-evaluation and user prompt control is realized. The accuracy of multilingual translation is improved. BRIEF DESCRIPTION OF DRAWINGS
[0055] Figure 1 is a flowchart of the method for multilingual deep translation based on a large model provided by the embodiments of the present application;
[0056] Figure 2 is a flowchart of step S102 in Figure 1 ;
[0057] Figure 3 is a flowchart of step S105 in Figure 1 ;
[0058] Figure 4 is a flowchart of the method for multilingual deep translation based on a large model provided by another embodiment of the present application;
[0059] Figure 5 is a flowchart of a multilingual deep translation method based on a large model provided by a third embodiment of the present application;
[0060] Figure 6 is a structural schematic diagram of a multilingual deep translation system based on a large model provided by an embodiment of the present application;
[0061] Figure 7 is a hardware structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0063] It should be noted that although the functional modules are divided in the system schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than the module division in the system or the order in the flowchart. The terms "first", "second", etc. in the specification and claims and the above drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence.
[0064] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0065] When dealing with translation tasks involving complex language structures, professional terms and long documents, the existing translation strategy based on sentence segmentation gradually exposes its core defects: on the one hand, the lack of context modeling capability leads to inconsistent terms, pronoun reference confusion, style mutation and other problems, which seriously affect the professionalism and coherence of the translation; on the other hand, the translation system is generally "one-way generation", lacking self-validation and adjustment mechanism, and cannot identify and correct semantic drift, mistranslation and other problems. In summary, the current multilingual translation system still has obvious shortcomings in semantic understanding depth, translation stability and user controllability.
[0066] Based on this, the embodiment of the application provides a large model-based multilingual deep translation method and system and electronic equipment, aiming to perform semantic enhancement according to a target sentence group to obtain a context-enhanced representation vector. The current translation target sentence is translated based on the context-enhanced representation vector to obtain an initial translation result. The initial translation result is back translated to obtain a first back translated sentence, and a first semantic deviation amount of the current translation target sentence and the first back translated sentence is calculated. The initial translation result is scored based on the first semantic deviation amount, the current translation target sentence and the first back translated sentence to obtain first consistency score data. If the first consistency score data is lower than a preset score threshold, a control prompt vector input by a user is obtained. A repair control vector is obtained according to the first semantic deviation amount and the control prompt vector. The repair control vector is input into a preset repair model to obtain a translation repair result. The core defects of the existing multilingual translation system in the aspects of context loss, unverifiable results and uncontrollable output are solved, a context-aware article-level translation, consistency self-evaluation and user prompt control trinity deep collaborative mechanism is realized, and the accuracy of multilingual translation is improved.
[0067] The large model-based multilingual deep translation method and system and electronic equipment provided by the embodiment of the application are specifically described through the following embodiments. First, the large model-based multilingual deep translation method in the embodiment of the application is described.
[0068] The embodiment of the application can acquire and process related data based on artificial intelligence technology. Artificial intelligence (AI) is the use of digital computers or computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0069] The basic technology of artificial intelligence generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The software technology of artificial intelligence mainly includes computer vision technology, robot technology, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.
[0070] The method for multilingual deep translation based on a large model provided in the embodiments of the present application can be applied in a terminal, can also be applied in a server end, and can also be software running in the terminal or the server end. In some embodiments, the terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, etc.; the server end can be configured as a stand-alone physical server, can also be configured as a server cluster or a distributed system composed of multiple physical servers, can also be configured as a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN, and big data and artificial intelligence platform; and the software can be an application for implementing the method for multilingual deep translation based on a large model, etc., but is not limited to the above forms.
[0071] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as a program module. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in a distributed computing environment, in which tasks are performed by remote processing devices connected by a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0072] Please refer to Figure 1 , Figure 1 is a flowchart of the method for multilingual deep translation based on a large model provided in the embodiments of the present application, Figure 1 The method in the flowchart can include but is not limited to steps S101 to S109.
[0073] Step S101, obtaining a target sentence group; wherein the target sentence group includes a current translation target sentence and a context window sentence;
[0074] Step S102, performing semantic enhancement according to the target sentence group to obtain a context-enhanced representation vector;
[0075] Step S103, inputting the context-enhanced representation vector into a preset initial translation model to obtain an initial translation result;
[0076] Step S104, inputting the initial translation result into a preset back-translation model to obtain a first back-translation sentence;
[0077] Step S105, calculating an average residual according to the current translation target sentence and the first back-translation sentence, to obtain a first semantic deviation;
[0078] Step S106, scoring the initial translation result according to the first semantic deviation, the current translation target sentence and the first back-translation sentence, to obtain first consistency score data;
[0079] Step S107, if the first consistency score data is lower than a preset score threshold, obtaining a control prompt vector input by a user;
[0080] Step S108, obtaining a repair control vector according to the first semantic deviation and the control prompt vector;
[0081] Step S109, inputting the repair control vector into a preset repair model to obtain a translation repair result.
[0082] In step S101 of some embodiments, the current translation target sentence T i and its context window sentence C i ={T i-k ,...,T i-1 ,T i+1 ,...,T i+k} constitute a target sentence group for subsequent splicing. Wherein k is the window width, usually set to 2. The original paragraph text comes from the translation task request received by the system, which can be: uploaded local documents (such as.docx,.pdf files, processed by language detection and paragraph division module), web page text after extraction (obtained by DOM structure analysis), or OCR scanning results (combined with character confidence to filter out natural language sentences). The text processing module uses a regular syntax divider (based on language-specific separation rules) to divide the paragraph into a sentence sequence, forming a sentence list [T1, T2,...,T n ]. If the current translation target sentence is the second sentence T2, the system automatically extracts the context window sentence C2={T1,T3}, which constitutes a target sentence group for subsequent splicing.
[0083] Please refer to Figure 2 In some embodiments, step S102 can include but is not limited to steps S201 to S203:
[0084] Step S201, obtaining a structured representation vector of each current translation target sentence and context window sentence; wherein the structured representation vector is the sum of token embedding vectors and absolute position encoding;
[0085] Step S202, splicing each structured representation vector to obtain an input sequence;
[0086] Step S203, encode the input sequence to obtain a context-enhanced representation vector.
[0087] In step S201 of some embodiments, the token is the smallest unit in text processing, which can be a word, a character or a word. Each sentence will produce several tokens, that is, each sentence is a token sequence. Tokenize the text in each sentence of the target sentence group into a token sequence, and use a tokenizer consistent with the main model for encoding (such as mBART using a SentencePiece tokenizer). For each sentence T j ∈{T i}∪C i , the token is mapped to a token embedding vector where l j is the number of tokens in the sentence, and d is the embedding dimension, usually 768 or 1024. The embedding layer is implemented using a preloaded multilingual word vector matrix, initialized in the model training phase.
[0088] Further, in order to maintain the boundary information of each sentence in the spliced input, an independent absolute position encoding not only reflects the position of the token within the sentence, but also combines the "relative position of the sentence in the paragraph". For example, the current translation target sentence T2 is set as the reference position 0, and the front and rear sentences are -1 and +1 respectively, to prevent the same position token of different sentences from conflicting in encoding. The token embedding vector of each sentence is added to the absolute position encoding to generate a structured representation vector, as shown in the following formula (1):
[0089] H j =E j +P j , (1)
[0090] where H j represents the structured representation vector of the sentence T j , E j represents the token embedding vector of the sentence T j , and P j represents the absolute position encoding of the sentence T j , which is constructed by combining the intra-sentence position index and the inter-sentence offset.
[0091] In steps S202 to S203 of some embodiments, the structured representation vectors of all sentences in the target sentence group are spliced to form a complete input sequence, and are sent to the encoder part of the initial translation model for encoding to obtain a context-enhanced representation vector, as shown in the following formula (2):
[0092] S i =M(Concat(Hi-k ..., H i ..., H i+k )), (2)
[0093] wherein, denotes the context-enhanced representation vector, L =∑ j l j is the total number of tokens after concatenation. Concat(·) denotes concatenating the structured representation vectors of multiple sentences into a long sequence in token order. M denotes the encoder part of the initial translation model, which is specifically a 12-layer Transformer structure, each layer containing 8 attention mechanisms and feed-forward sub-layers. H i denotes the structured representation vector. S i The context semantic structure of the current translation target sentence in the paragraph is retained and serves as a key input generated by the initial translation model.
[0094] Through the above steps S201 to S203, a structured concatenation mechanism is introduced, which uses sentence-level position information to structure encode the initial translation model input, so that the model can still retain the sentence boundary and semantic flow when processing multiple language sentence concatenation. A context-enhanced representation vector with chapter context information is constructed to improve the semantic consistency, term consistency and reference continuity in multilingual translation. Especially in language pairs with large differences in word order structure such as Chinese-Arabic and Chinese-German, the problems of subject confusion and term inconsistency caused by isolated sentence translation can be avoided. Unlike conventional pre-training models that only input continuous tokens, this step improves the model's ability to analyze and model the semantics of the target sentence in the multi-sentence context by fusing multiple sentence structures and explicitly retaining sentence boundaries.
[0095] In step S103 of some embodiments, considering the need to face the context requirement high, the term dependence strong, the language style needs to be coherent control of professional text translation scene (such as multilingual legal documents, technical documents, patent specifications, etc.), therefore, this step needs to ensure that the initial translation result generation process is not only based on word meaning, but also must explicitly consider the complex semantic structure of the context, such as term dependence, syntactic logical position and paragraph style.
[0096] Therefore, a context alignment reinforced translation mechanism is proposed, which introduces a structural position bias term and a term attention penalty term in the conventional Transformer decoding structure, to ensure that the context-enhanced representation vector constructed in the above step is fully utilized in the generation process, and to avoid the model ignoring the known term distribution or shifting the context center of gravity.
[0097] The input of this step is the context-enhanced representation vector where L is the number of concatenated context tokens, and d is the vector dimension. The context-enhanced representation vector is generated by the encoder model M, which integrates the structural and semantic information of the current translation target sentence T i and its context window sentences C i .
[0098] The current goal is to generate an initial translation result Y i , whose initial decoding input is a special start symbol, and the subsequent generation depends on the forward prediction at each step and the context-enhanced representation vector S i . The Transformer decoder structure in the large language model (initial translation model) is adopted, where each layer contains a multi-head self-attention mechanism and a context cross-attention module.
[0099] To ensure the pertinence of context utilization, a structural alignment position bias term is introduced in the cross-attention layer. The idea is that when the initial translation model is generating the t-th token of the current translation target sentence, it should give priority to the content in the context that is closest to its semantic / syntactic position, especially near the boundary of the current translation target sentence T i . To this end, a bias term B t,j is added when calculating the attention, which is used to adjust the degree to which the model pays attention to the j-th token in the context. The attention distribution is shown in the following formula (3):
[0100]
[0101] where α t represents the query vector of the current generation position t, which is calculated by the feedforward layer of the decoder. S i represents the context-enhanced representation vector, represents the transpose of the context-enhanced representation vector. q t represents the query vector of the current decoding position. d represents the vector dimension scaling factor. B t,j represents the structural alignment bias term, whose value is calculated according to the relative sentence distance and the relative position within the sentence of the token j in the context to the current translation target sentence T i . The calculation is shown in the following formula (4):
[0102] B t,j = -λ1·|p j -p i |-λ2·|r j -r t |, (4)
[0103] where p j represents the paragraph position number of the sentence to which the token j belongs, and p i represents the current translation target sentence Ti The paragraph position number of token j. j rj represents the position of token j in its sentence. t λ1, λ2 represent hyperparameters controlling the alignment strength of the two dimensions (e.g. λ1 = 0.3, λ2 = 0.7).
[0104] This structure alignment bias term has a clear scenario background: in legal text or patent translation, the same term often appears repeatedly in adjacent sentences, or is semantically consistent in a paragraph, so it is extremely critical to guide the model to preferentially focus on close-range terms. This mechanism breaks the indiscriminate projection of attention in the standard Transformer and strengthens the context relevance.
[0105] In addition, in order to prevent the model from generating term drift (e.g. "the invention" is translated into "the device" and other biased expressions), a term attention sparsity penalty term is introduced. This mechanism is based on the set of term position indexes ( output synchronously by the term identification module in the above steps), if the attention distribution α t of the current generated token does not concentrate on the term position, the decoding loss will be increased.
[0106] The specific form is shown in the following formula (5), and the following regularization term is added during training:
[0107]
[0108] wherein, represents the attention sparsity penalty term. α t,j represents the attention value of the tth generated token to the jth context token. β represents the penalty term coefficient (e.g. β = 1.5), represents the set of term position indexes. m represents the total number of tokens to be generated in the current translation target sentence.
[0109] This regularization term directly adds structural preference to the training target of the model, prompting it to preferentially use known term context in the context structure rather than "inventing" term translation every time, thereby greatly improving the consistency and stability of professional text translation.
[0110] Beam search (size 4) is used in the generation process to search for candidates, and the sequence with the highest log-likelihood is finally selected as the translation output to obtain the initial translation result. The translation output also retains the attention vector α t of each token, which is combined to form the first attention matrix
[0111] It should be noted that the above steps propose two innovative mechanisms for multilingual, term-intensive scenarios: structural alignment attention bias and term attention sparsity penalty term, on the one hand, to enhance the model's use of structural information in the context, and on the other hand, to explicitly guide the consistency tracking of terms in the generation process, thereby solving the problems of term polysemy, subject error, and style jump in traditional large model translation. In step S104 of some embodiments, the initial translation result Y i and the first attention matrix A i On this basis, a semantic consistency detection mechanism for multilingual professional scenarios is designed. Compared with general text, patent, legal, technical document and other content have the characteristics of high consistency of terminology, strong context dependence and complex syntax structure, making it difficult for traditional methods based on BLEU, ROUGE and other shallow indicators to find deep semantic shifts. The core goal of this step is to determine whether the initial translation result Y i faithfully expresses the true meaning of the original text T i (current translation target sentence) and whether it maintains the consistency of proper nouns, subject-predicate logic and context terms. To this end, a multi-channel residual detection mechanism based on back-translation, attention alignment and term comparison is used to form a structured analysis of translation quality.
[0112] To realize semantic consistency judgment, a back-translation mechanism is used to perform reverse translation of the initial translation result Y i from the target language to the source language. The back-translation model M r is consistent with the structure of the initial translation model (for example, the same pre-training system such as mBART / mT5), and its parameters are frozen at deployment. The initial translation result is input into the preset back-translation model to obtain a first back-translation sentence whose language is the original source language and length is n'.
[0113] Please refer to Figure 3 In some embodiments, the initial translation model also outputs a first attention matrix, and step S105 can include but is not limited to steps S301 to S303:
[0114] Step S301 encodes the current translation target sentence and the first back-translation sentence to obtain a target embedding sequence and a first back-translation embedding sequence;
[0115] Step S302 obtains a first aligned token pair of the target embedding sequence and the first back-translation embedding sequence according to the first attention matrix;
[0116] Step S303 calculates the average residual according to the first aligned token pair, the target embedding sequence and the first back-translation embedding sequence to obtain a first semantic deviation.
[0117] In step S301 of some embodiments, due to language differences and structural changes, when judging whether the initial translation result Y i faithfully expresses the true meaning of the original text T i , position alignment cannot be simply used, so the following multi-level alignment and residual detection process is designed:
[0118] Embedded alignment construction: encode the current translation target sentence T i using a shared cross-language encoder (such as XLM-R or LaBSE model) to obtain the target embedding sequence Encode the first back-translation sentence to obtain the first back-translation embedding sequence
[0119] In step S302 of some embodiments, to construct the alignment relationship, the first attention matrix A i is relied on to extract the maximum attention position of each generated token as the semantic source position of the token, and then find the reverse mapping point of the corresponding token in back-translation, thereby establishing a cross-language token alignment table of to obtain the first aligned token pair.
[0120] In step S303 of some embodiments, after obtaining the first aligned token pair, the average residual is calculated by the following formula (6):
[0121]
[0122] Where Δ i represents the first semantic deviation, and the larger the value, the more serious the deviation. represents the first aligned token pair set, including multiple first aligned token pairs, u j represents the target embedding sequence, represents the first back-translation embedding sequence.
[0123] Through the above steps S301 to S303, the first semantic deviation can be obtained, so as to judge whether the initial translation result Y i faithfully expresses the true meaning of the current translation target sentence T i . And this structural residual is based on real semantic space embedding rather than surface text form, which can identify scenarios with different structures but semantic drift, and is especially suitable for language pairs with significant differences in word order, such as Chinese-German and Chinese-Arabic.
[0124] In step S106 of some embodiments, the initial translation result is scored according to the first semantic deviation amount, the current translation target sentence, and the first back-translation sentence to obtain first consistency score data. Specifically, the first consistency score data is calculated according to the following formula (7) and formula (8):
[0125] Score i = 1 - (Δ i + γ · δ i + μ · R i ), (7)
[0126]
[0127] wherein Score i represents the first consistency score data, Δ i represents the first semantic deviation amount, γ represents a term penalty term coefficient (such as 1.2) for controlling the intensity of the term missing penalty. δ i represents the term matching deviation degree, represents the current translation target sentence, represents the set of terms successfully recovered in the first back-translation sentence. μ represents a control structure rearrangement influence weight (such as 0.5), R i represents a sentence rearrangement penalty term, which is calculated by comparing the dependency tree sequence difference between the current translation target sentence and the first back-translation sentence (for example, based on syntactic distance or edit distance).
[0128] The first consistency score data Score i is lower, the semantic reliability of the translation is lower. A score threshold τ (such as 0.75) is set, and when Score i ≤ τ, B i = 1 is marked, representing that the translation is not reliable and needs to be repaired in the next step.
[0129] In step S107 of some embodiments, when the first consistency score data is lower than the score threshold, it indicates that the initial translation result Y i exists semantic deviation. In order to ensure the semantic fidelity and term consistency of the final translation, while meeting the user control requirements (such as style, professional term use, etc.), a repair control mechanism that fuses the control prompt vector P i and the first semantic deviation amount Δ i is designed, so that the translation repair not only has the ability to correct errors, but also has the directionality of style and professional expression. Therefore, if the first consistency score data is lower than the score threshold, the control prompt vector input by the user is obtained.
[0130] In steps S108 to S109 of some embodiments, when B i = 1, the system determines that the first back-translation sentence Yi Semantic issues exist, triggering a translation correction process. This step reuses the decoder architecture of the initial translation model M and injects correction control vectors into the input stage and intermediate layers to achieve targeted reconstruction of erroneous translations. The entire correction process is modeled in the following three modules:
[0131] Semantic offset embedding construct:
[0132] In order to calculate the first semantic deviation Δ in the previous step i The input is converted into a vector and encoded into a control signal using a single-layer feedforward network, as shown in Equation (9) below:
[0133] r i =tanh(W r ·Δ i +b r (9)
[0134] in, The vector representing the residual signal has the same dimension as the intermediate layers of the model (e.g., d=768). This vector is used to indicate the semantic direction that needs to be repaired, and acts as a "semantic adjustment anchor point". Indicates learnable parameters, This represents the bias term. Δ i This indicates the first semantic deviation.
[0135] Hint: Fusion Module
[0136] Control cue vector P i The text is derived from explicit user input (such as "use formal style") or extracted by the system from the original paragraph text (such as stylistic feature labels, term lists), and then transformed into a format similar to r after being encoded through an embedding layer. i Same-dimensional vector p i The two are then merged into a repair control vector c. i Specifically, as shown in the following formula (10):
[0137] c i =tanh(W c [r i ;p i ]+b c (10)
[0138] in, This represents the repair control vector, which is subsequently injected into the intermediate layer of the decoder in the repair model to guide the generation behavior during the repair process. [·; ·] indicates vector concatenation. The learnable weight matrix represents the fusion of cue vectors and semantic residual vectors. This represents the bias term in the fusion process.
[0139] The control injection generation module:
[0140] In the translation repair, the initial translation result Y i Tokens with errors or ambiguities need to be replaced, while the parts without problems can be retained, so the partial masking rewriting strategy is adopted. First, according to the first attention matrix A i and the context-enhanced representation vector S i Calculate which token attention concentration is too low (indicating that the reference context is insufficient during generation, and there is a risk of mistranslation), mask the position, and form a rewriting input ( To retain the trusted content and mask the intermediate sequence of the position to be repaired). Then the rewriting input The context-enhanced representation vector S i and the repair control vector c i are input into the decoder end of the repair model M, which performs context-aware rewriting of the masked part, and finally outputs a complete and more consistent translation repair result This process ensures that the model only accurately repairs the untrusted part, avoiding style drift or term inconsistency problems caused by full sentence rewriting.
[0141] It should be noted that at each intermediate layer in the repair process, the intermediate representation h t of the current decoding position t is modified as follows:
[0142] h t '=h t +α·c i , (11)
[0143] Where h t 'represents the modified state with control information, h t represents the hidden state of the tth token in the standard Transformer. Alpha represents the injection strength of the repair control vector (empirically set to 0.5), and c i represents the repair control vector. Such fusion realizes the unified action of semantic adjustment direction (from r i ) and style guidance (from p i ), so that the repaired translation is consistent in form with the original style and closer in semantics to the source text.
[0144] In one patent scenario, for example, the original text "The invention relates to a multilingual translation method" is misinterpreted as "this invention talks about multilingual usage", by prompting control to replace "talks about" with "relates to" and keep the term "multilingual translation method", the repair of professional and consistency can be embodied.
[0145] This step fully utilizes the first semantic offset Δ i , the initial translation result Y i , the first attention matrix A i , and combines the control prompt vector P i to build a semantic + style joint control repair mechanism. The innovation lies in embedding the translation residual signal into the modeling vector and injecting it into the Transformer structure, and fusing it with the prompt for local correction and rewriting, which is especially suitable for professional translation tasks with high term accuracy and strong context correlation, such as technical specifications, legal provisions or patent claims, etc., to ensure that the translation quality meets the standards in both fidelity and style guidance.
[0146] The steps S101 to S109 shown in the embodiments of the present application are to obtain a target sentence group, wherein the target sentence group includes a current translation target sentence and a context window sentence. Perform semantic enhancement according to the target sentence group to obtain a context enhanced representation vector. Input the context enhanced representation vector into a preset initial translation model to obtain an initial translation result. Input the initial translation result into a preset back translation model to obtain a first back translation sentence. Calculate the average residual according to the current translation target sentence and the first back translation sentence to obtain the first semantic deviation. According to the first semantic deviation, the current translation target sentence, the first back translation sentence, score the initial translation result to obtain the first consistency score data. If the first consistency score data is lower than the preset score threshold, obtain the control prompt vector input by the user. According to the first semantic deviation and the control prompt vector, a repair control vector is obtained. Input the repair control vector into the preset repair model to obtain a translation repair result. The core defects of the existing multilingual translation system in the context of missing, unverifiable results and uncontrollable output are solved, realizing the trinity of deep collaborative mechanism of context-aware chapter-level translation, consistency self-evaluation and user prompt control, and improving the accuracy of multilingual translation.
[0147] Please refer to Figure 4 In some embodiments, the repair model also outputs a second attention matrix, and after step S109, the multilingual deep translation method based on large models can further include but not limited to steps S401 to S405:
[0148] Step S401, input the translation repair result to the back translation model to obtain a second back translation sentence;
[0149] Step S402, encode the second back translation sentence to obtain a second back translation embedding sequence;
[0150] Step S403, obtain a second alignment token pair of the target embedding sequence and the second back translation embedding sequence according to the second attention matrix;
[0151] Step S404, calculate the average residual error according to the second alignment token pair, the target embedding sequence and the second back translation embedding sequence to obtain a second semantic deviation;
[0152] Step S405, score the translation repair result according to the second semantic deviation, the current translation target sentence and the second back translation sentence to obtain second consistency score data.
[0153] In steps S401 to S402 of some embodiments, after repairing the initial translation result to obtain a more accurate translation repair result, it is still necessary to verify whether the translation repair result passes the consistency evaluation. Therefore, the translation repair result is input to the back translation model to obtain a second back translation sentence. The second back translation sentence is encoded by the method in step S301 to obtain a second back translation embedding sequence.
[0154] In steps S403 to S405 of some embodiments, the second alignment token pair of the target embedding sequence and the second back translation embedding sequence is obtained according to the second attention matrix by the method in steps S302 to S303. The second semantic deviation is obtained by calculating the average residual error according to the second alignment token pair, the target embedding sequence and the second back translation embedding sequence. The second consistency score data is obtained by scoring the translation repair result according to the second semantic deviation, the current translation target sentence and the second back translation sentence. If the second consistency score data is greater than the score threshold, it means that the translation repair result passes the consistency evaluation. Otherwise, it means that the translation repair result has a semantic deviation and needs to be repaired by reacquiring the user input control prompt vector.
[0155] After obtaining the second consistency score data in steps S401 to S405 of the present embodiment, it can be judged whether to re-perform repair by judging whether the second consistency score data is greater than the score threshold, so as to ensure that an accurate translation repair result can be obtained.
[0156] Please refer to Figure 5 In some embodiments, after step S405, the multilingual deep translation method based on a large model can further include but is not limited to steps S501 to S504:
[0157] In step S501, if the second consistency score data is greater than the score threshold, the term of the current translation target sentence is obtained to obtain a first term, and the term of the translation repair result is obtained to obtain a second term.
[0158] In step S502, the first term and the second term are matched to obtain a plurality of term key-value pairs.
[0159] In step S503, the term key-value pairs are stored in a preset term state cache.
[0160] In step S504, pronoun mapping relationships are constructed and stored according to the pronoun of the translation repair result and the corresponding entity phrase.
[0161] In steps S501 and S503 of some embodiments, the translation object concerned by the present application is usually a professional text of a paragraph level and a multi-paragraph structure, such as a patent specification, international standard provisions, contract legal documents, etc. The terms in these texts are highly repetitive, the subject is frequently omitted, and the syntactic structure is highly dependent on the previous text. Without a state cache mechanism, each sentence translation may introduce style mutations, term drifts, and even meaning misinterpretations due to the lack of context, which seriously affects the accuracy of multilingual output. Therefore, this step is developed around the two goals of “explicit storage of term state” and “backtracking mapping of reference”, to ensure controllable model behavior and stable output style.
[0162] Therefore, if the second consistency score data is greater than the score threshold, the term of the current translation target sentence is obtained to obtain a first term, and the term of the translation repair result is obtained to obtain a second term. The first term and the second term are matched by a term alignment module to obtain a plurality of term pairs, which are stored in the term state cache S c in the form of term key-value pairs. The cache is a structured dictionary type data structure, and a persistent memory structure (such as Redis or SQLite embedded cache) can be used in actual deployment. The cache updating process is shown in the following formula (12):
[0163]
[0164] wherein, represents the term state cache updated after the translation of the ith sentence, including the newly identified term pairs of the current sentence, represents the term state cache already available when the translation of the (i-1)th sentence is completed. represents the term extracted from the current translation target sentence, represents the term extracted from the translation repair result. represents the term set extracted from the current translation target sentence, which is usually obtained by dictionary matching and named entity recognition. denotes the set of extracted terms from the translation repair result, obtained by statistical or rule-based extraction (e.g. capitalized consecutive phrases). Term matching is done by the attention matrix A of the model M i Assisted decision making, reference to the alignment strength of which filters high-confidence term pairs.
[0165] In step S504 of some embodiments, to improve referential consistency, the system extracts pronouns (such as "it", "this module", "they", etc.) from the translation repair result and tracks their corresponding entity phrases r k using the above context cache, and constructs a pronoun mapping relationship as shown in the following formula (13):
[0166]
[0167] where p k denotes the pronoun extracted from the translation repair result r k denotes the corresponding entity phrase of p k obtained by dependency syntax analysis and context term hits. denotes the translation repair result, denotes the jth translation repair result before . The pronoun mapping relationship is stored in the form of a FIFO queue, maintaining a certain context window length (e.g. 5 sentences), for reference when translating the next translation target sentence T i+1 .
[0168] In addition, to ensure the practical application effect of the term in future translation, the system will pass and into the context window construction module in step S101, so that the context window sentence C i+1 of the next sentence contains not only the original text context, but also structured state information. This state "back-annotation" mechanism ensures that the system has memory capability, rather than starting from zero for each sentence. For example, when translating the following Chinese passage:
[0169] "The invention relates to an efficient training method for graph neural networks. This method can be applied to multilingual scenarios."
[0170] The system will identify the term "graph neural network" in the current translation target sentence T i , which corresponds to "graph neural network" in the translated text, and store it in S cAnd "the method" is mapped to "the proposed method", forming a pronoun mapping. When processing the next sentence "it is especially suitable for cross-country text analysis tasks", the system will preferentially replace "it" with "the proposed method" and incorporate term consistency into the candidate generation sequence.
[0171] The steps S501 to S504 shown in this embodiment, the core task is to convert the "real operation" result completed in the translation process into a sustainable knowledge state of the system, so as to support the translation of subsequent sentences, realize the chapter-level term consistency and semantic coherence of "multilingual long text translation system". In the whole scheme, the previous steps solve "accurately" and "correctly", and this step solves "remember". Therefore, this step no longer involves modeling or abstract optimization, but directly acts on the semantic content level of the translation result, and performs operational data structure update so as to have consistent context reference for subsequent continuous processing.
[0172] Please refer to Figure 6 The embodiment of the application also provides a multilingual deep translation system based on a large model, which can implement the above-mentioned multilingual deep translation method based on a large model. The system comprises:
[0173] The acquisition module 601 is configured to acquire a target sentence group, wherein the target sentence group comprises a current translation target sentence and a context window sentence;
[0174] The enhancement module 602 is configured to perform semantic enhancement according to the target sentence group to obtain a context enhanced representation vector;
[0175] The translation module 603 is configured to input the context enhanced representation vector into a preset initial translation model to obtain an initial translation result;
[0176] The back-translation module 604 is configured to input the initial translation result into a preset back-translation model to obtain a first back-translation sentence;
[0177] The calculation module 605 is configured to calculate an average residual error according to the current translation target sentence and the first back-translation sentence to obtain a first semantic deviation;
[0178] The scoring module 606 is configured to score the initial translation result according to the first semantic deviation, the current translation target sentence and the first back-translation sentence to obtain first consistency score data;
[0179] The first input module 607 is configured to acquire a user input control prompt vector if the first consistency score data is lower than a preset score threshold;
[0180] The repair module 608 is configured to obtain a repair control vector according to the first semantic deviation and the control prompt vector.
[0181] The second input module 609 is configured to input the repair control vector into a preset repair model to obtain a translation repair result.
[0182] The specific implementation of the large model-based multilingual deep translation system is basically the same as that of the above-mentioned large model-based multilingual deep translation method, and will not be described here.
[0183] The embodiments of the present application also provide an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor implements the above-mentioned large model-based multilingual deep translation method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a vehicle-mounted computer, etc.
[0184] Please refer to Figure 7 , Figure 7 The hardware structure of the electronic device of another embodiment is illustrated, which includes:
[0185] The processor 701 can be implemented in the form of a general-purpose CPU (Central Processing Unit), a microprocessor, an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits, etc., and is used to execute related programs to implement the technical solutions provided by the embodiments of the present application.
[0186] The memory 702 can be implemented in the form of a ROM (Read Only Memory), a static storage device, a dynamic storage device, or a RAM (Random Access Memory), etc. The memory 702 can store an operating system and other application programs. When the technical solutions provided by the embodiments of the present application are implemented by software or firmware, the related program codes are saved in the memory 702 and are called and executed by the processor 701 to implement the large model-based multilingual deep translation method of the embodiments of the present application.
[0187] The input / output interface 703 is used to realize information input and output.
[0188] The communication interface 704 is used to realize the communication interaction between the device and other devices. The communication can be realized by a wired manner (for example, a USB, a network cable, etc.) or a wireless manner (for example, a mobile network, WIFI, Bluetooth, etc.).
[0189] The bus 705 transmits information between various components (for example, the processor 701, the memory 702, the input / output interface 703, and the communication interface 704) of the device.
[0190] The processor 701, the memory 702, the input / output interface 703, and the communication interface 704 are communicatively connected with each other through the bus 705.
[0191] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the above-mentioned multi-language deep translation method based on a large model.
[0192] The memory is a non-transitory computer readable storage medium, and can be used to store a non-transitory software program and a non-transitory computer executable program. In addition, the memory can include a high-speed random access memory, and can further include a non-transitory memory, for example, at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include a memory remotely arranged relative to the processor, and the remote memory can be connected to the processor through a network. Examples of the network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0193] The embodiments described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0194] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than the figures, or combine certain steps, or different steps.
[0195] The system embodiments described above are only schematic, and the units described as separate components can or can not be physically separate, that is, can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0196] Those skilled in the art can understand that all or some steps in the above disclosed method, the function modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.
[0197] The terms "first", "second", "third", "fourth", and the like in the description and in the claims of this application, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of the terms so termed is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of orderly or chronological mundane operation, reverse order operation, based on circuitry availability, based on stated preference or the like, and that "default" or other orderings are thus permissible. Further, the terms "comprise", "comprising", "include", "including", and the like, are specifically intended to be open-ended. That is, references to individual steps and the like do not suhstantially exclude the presence of two or more of a recited step or its integral sub-steps or additional steps whether or not readily ascertainable from the description or the like. Further, the words "a" or "an", as used herein in the disclosure and elsewhere, are used indiscriminately and are to be interpreted in the same way, i.e. as meaning "one or more".
[0198] It should be understood that, in the application, "at least one" means one or more, and "multiple" means two or more. "And / or" is used to describe the relationship between associated objects, which means that there can be three relationships, for example, "A and / or B" can mean that there are only A, only B, and A and B at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects. "At least one of the following" or the like means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can mean a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0199] In several embodiments provided in the application, it should be understood that the disclosed system and method can be implemented in other ways. For example, the above-described system embodiments are only illustrative, for example, the division of the above-mentioned units is only a logical functional division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed objects can be indirect coupling or communication connection through some interfaces, systems or units, which can be electrical, mechanical or other forms.
[0200] The units described above as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0201] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.
[0202] If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in part, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes multiple instructions used to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various other media that can store programs.
[0203] The preferred embodiments of the embodiments of the present application are described above with reference to the accompanying drawings, and are not limited to the scope of the embodiments of the present application. Any modifications, equivalent replacements and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the embodiments of the present application.
Claims
1. A large model-based multilingual deep translation method, characterized in that, The method comprises: acquiring a target sentence group; wherein the target sentence group comprises a current translation target sentence and a context window sentence; performing semantic enhancement according to the target sentence group to obtain a context-enhanced representation vector; inputting the context-enhanced representation vector into a preset initial translation model to obtain an initial translation result; wherein the initial translation model also outputs a first attention matrix; inputting the initial translation result into a preset back-translation model to obtain a first back-translation sentence; calculating an average residual error according to the current translation target sentence and the first back-translation sentence to obtain a first semantic deviation; scoring the initial translation result according to the first semantic deviation, the current translation target sentence and the first back-translation sentence to obtain first consistency score data; if the first consistency score data is lower than a preset score threshold, acquiring a user-input control prompt vector; A repair control vector is obtained based on the first semantic deviation and the control cue vector; wherein, the first semantic deviation is encoded by a feedforward network to obtain the residual signal vector r. i The control cue vector is encoded through an embedding layer to obtain a vector p with the same dimension as the residual signal vector. i , will r i and p i The repair control vector is obtained by fusion. inputting the repair control vector into a preset repair model to obtain a translation repair result; wherein, according to the first attention matrix and the context-enhanced representation vector, it is determined which token attention concentration is too low, and the position is masked to form a rewritten input; the rewritten input, the context-enhanced representation vector and the repair control vector are input into the repair model, and the masked part is rewritten with context awareness, and the translation repair result is output.
2. The method of claim 1, wherein, The initial translation model also outputs a first attention matrix, and the average residual error is calculated according to the current translation target sentence and the first back-translation sentence to obtain a first semantic deviation, which comprises: encoding the current translation target sentence and the first back-translation sentence to obtain a target embedding sequence and a first back-translation embedding sequence; obtaining a first aligned token pair of the target embedding sequence and the first back-translation embedding sequence according to the first attention matrix; calculating an average residual error according to the first aligned token pair, the target embedding sequence and the first back-translation embedding sequence to obtain the first semantic deviation.
3. The method of claim 2, wherein, The average residual error is calculated according to the first aligned token pair, the target embedding sequence and the first back-translation embedding sequence to obtain the first semantic deviation, which comprises: The average residual error calculation formula is: wherein, Δ i denotes a first semantic deviation amount, denotes a first set of aligned token pairs, u j denotes a target embedding sequence, denotes a first back-translation embedding sequence.
4. The method of claim 2, wherein, The repair model also outputs a second attention matrix, and after the repair control vector is input into the preset repair model to obtain the translation repair result, it comprises: inputting the translation repair result into the back-translation model to obtain a second back-translation sentence; encoding the second back-translation sentence to obtain a second back-translation embedding sequence; obtaining a second aligned token pair of the target embedding sequence and the second back-translation embedding sequence according to the second attention matrix; calculating an average residual error according to the second aligned token pair, the target embedding sequence and the second back-translation embedding sequence to obtain a second semantic deviation; scoring the translation repair result according to the second semantic deviation, the current translation target sentence and the second back-translation sentence to obtain second consistency score data.
5. The method of claim 4, wherein, After the second consistency score data is obtained by scoring the translation repair result according to the second semantic deviation amount, the current translation target sentence and the second back-translation sentence, the method further comprises: If the second consistency score data is greater than the score threshold, a term of the current translation target sentence is obtained to obtain a first term, and a term of the translation repair result is obtained to obtain a second term; The first term and the second term are matched to obtain a plurality of term key-value pairs; The term key-value pairs are stored in a preset term state cache; An anaphor mapping relationship is constructed and stored according to the anaphor of the translation repair result and the corresponding entity phrase.
6. The method of claim 1, wherein, The context-enhanced representation vector is obtained by performing semantic enhancement according to the target sentence group, comprising: Obtaining a structured representation vector of each of the current translation target sentence and the context window sentence; wherein the structured representation vector is a sum of a token embedding vector and an absolute position encoding; Splicing each of the structured representation vectors to obtain an input sequence; Encoding the input sequence to obtain a context-enhanced representation vector.
7. The method of claim 1, wherein, The first consistency score data is obtained by scoring the initial translation result according to the first semantic deviation amount, the current translation target sentence and the first back-translation sentence, comprising: The calculation formula of the first consistency score data is: Score i = 1 - (Δ i + γ · δ i + μ · R i ); wherein Score i represents the first consistency score data, Δ i represents the first semantic deviation amount, γ represents a term penalty term coefficient, δ i represents the term matching deviation degree, represents the current translation target sentence, represents a set of terms successfully recovered in the first back-translation sentence, μ represents a control structure rearrangement influence weight, R i represents a sentence rearrangement penalty term.
8. A large model-based multilingual deep translation system, characterized by, The system comprises: An acquisition module configured to acquire a target sentence group; wherein the target sentence group comprises a current translation target sentence and a context window sentence; An enhancement module configured to perform semantic enhancement according to the target sentence group to obtain a context-enhanced representation vector; A translation module configured to input the context-enhanced representation vector into a preset initial translation model to obtain an initial translation result; wherein the initial translation model also outputs a first attention matrix; A back-translation module configured to input the initial translation result into a preset back-translation model to obtain a first back-translation sentence; A calculation module configured to calculate an average residual error according to the current translation target sentence and the first back-translation sentence to obtain a first semantic deviation amount; A scoring module configured to score the initial translation result according to the first semantic deviation amount, the current translation target sentence and the first back-translation sentence to obtain first consistency score data; A first input module configured to acquire a user input control prompt vector if the first consistency score data is lower than a preset score threshold; a repair module configured to obtain a repair control vector according to the first semantic deviation amount and the control prompt vector; wherein the first semantic deviation amount is encoded by a feedforward network to obtain a residual signal vector r i the control prompt vector is encoded by an embedding layer to obtain a vector p of the same dimension as the residual signal vector i r i and p i are fused to obtain the repair control vector; A second input module configured to input the repair control vector into a preset repair model to obtain a translation repair result; wherein, according to the first attention matrix and the context-enhanced representation vector, the token attention concentration of which is too low is determined, and the position thereof is masked to form a rewritten input; the rewritten input, the context-enhanced representation vector and the repair control vector are input into the repair model, and the masked part is rewritten by the repair model in a context-aware manner to output the translation repair result.
9. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the large model-based multilingual deep translation method in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1-9. The computer program is executed by the processor to implement the large model-based multilingual deep translation method in any one of claims 1 to 7.
Citation Information
Patent Citations
Translation detection method and related equipment
CN117709365A
Multilingual translation conversation system
JP2023058045A