A machine translation optimization method and system based on a large language model
Patent Information
- Application Number
- CN202611393301.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-10-16
Smart Images

Figure CN122927328A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine translation optimization technology, and more specifically, to a machine translation optimization method and system based on a large language model. Background Technology
[0002] With the continuous growth of global information exchange needs, machine translation optimization technology, as a core means to improve the quality of cross-language information processing, is playing an increasingly prominent role. This technology not only strives to improve the accuracy and fluency of translations, but also addresses key issues such as discourse coherence, terminology consistency, and semantic fidelity in long text translation. By continuously optimizing translation models and strategies, machine translation optimization technology can significantly improve the translation efficiency and quality of large-scale texts, providing reliable support for the cross-language dissemination of long texts such as technical documents, academic papers, and literary works, thereby effectively reducing the cost of cross-language communication and promoting the efficient flow of global information.
[0003] In existing technologies, long text machine translation typically employs a segmented approach, breaking down long texts into multiple segments and inputting them sequentially into the model for translation. However, when translating each segment independently, it relies heavily on local context for word choice and sentence structure generation. The identities of characters, referents, temporal relationships, and thematic context established in the preceding text are difficult to sustain in subsequent translations, easily leading to issues such as inconsistent translations of the same entity, incorrect pronoun referencing, broken tense connections, and logical shifts between sentences. Furthermore, in document-level translation, the model suffers from insufficient utilization of long context and disjointed texts. These problems directly affect the overall consistency and readability of long text translations, limiting the effectiveness of machine translation in professional long document scenarios. Therefore, how to achieve continuous transmission of semantic state during long text translation, thereby reducing contextual semantic drift caused by segmented processing, has become a challenge for the industry. Summary of the Invention
[0004] This application provides a machine translation optimization method and system based on a large language model, which can realize the continuous transmission of the semantic state of the text during the translation of long texts, thereby reducing the contextual semantic drift caused by segmentation processing.
[0005] Firstly, this application provides a machine translation optimization method based on a large language model, comprising the following steps:
[0006] Obtain the long text to be translated and divide it into multiple consecutive sentence segments;
[0007] An initial translation is performed on the first sentence segment. During the initial translation process, the discourse topic vector and entity reference chain of the first sentence segment are extracted, and the discourse topic vector and entity reference chain are cached together as a global semantic state.
[0008] When translating subsequent sentence segments, the global semantic state is appended as a prefix to the input sequence of the current sentence segment, so that the large language model can synchronously receive the topic information and entity reference relationship in the global semantic state when decoding the current sentence segment;
[0009] After translating each sentence segment, the newly added entities and their referential relationships in the current sentence segment are added to the global semantic state, and a time decay factor is applied to the historical chapter topic vector in the global semantic state.
[0010] After all sentence segments are translated, the translations of all sentence segments are checked for discourse-level consistency based on the global semantic state, and translation conflicts and reference breaks caused by local context selection are corrected.
[0011] In this embodiment, dividing the long text into multiple consecutive sentence segments specifically includes:
[0012] The long text is subjected to semantic coherence scanning to identify topic drift positions and generate a sequence of candidate segmentation points composed of the boundaries of continuous text segments.
[0013] Traverse each candidate segment in the candidate segment sequence, detect whether there is an unclosed entity reference chain that crosses the candidate segment, and move the candidate segment to the reference closure position of the unclosed entity reference chain to obtain the adjusted segment sequence;
[0014] The long text is segmented by adjusting the segmentation point sequence to obtain multiple consecutive sentence segments.
[0015] In this embodiment, an initial translation is performed on the first sentence segment. During the initial translation process, the discourse topic vector and entity reference chain of the first sentence segment are extracted, and the discourse topic vector and entity reference chain are cached together as a global semantic state. Specifically, this includes:
[0016] When performing the initial translation of the first sentence segment, a dual-channel attention decoupling mechanism is adopted to separate the top-level hidden state of the decoder into a topic semantic channel and an entity perception channel, and extract the chapter topic vector of the first sentence segment from the topic semantic channel;
[0017] Guided by the entity perception channel, the accessibility migration path of each entity reference in the first sentence segment translation is tracked synchronously, thereby constructing the entity reference chain of the first sentence segment, and marking the corresponding reference level and antecedent pointing information for each reference relationship in the entity reference chain.
[0018] The chapter topic vector is embedded as a topic prototype and cross-channel interactive encoding is performed with each entity node in the entity reference chain to generate a joint representation of the differentiable index of entity reference relationship under topic anchoring;
[0019] The joint representation is compressed into incrementally updatable neural memory units and stored in a global cache to obtain the global semantic state.
[0020] In this embodiment, when performing the initial translation of the first sentence segment, a dual-channel attention decoupling mechanism is adopted to separate the top-level hidden state of the decoder into a topic semantic channel and an entity perception channel. Extracting the discourse topic vector of the first sentence segment from the topic semantic channel specifically includes:
[0021] When performing the initial translation on the first sentence segment, a bi-branch orthogonal projection operation is applied to the top-level hidden state of the large language model decoder, decomposing the top-level hidden state into a topic semantic channel and an entity perception channel, wherein the topic semantic channel encodes discourse coherence information and the entity perception channel encodes entity boundary information.
[0022] A bidirectional mutual attention interaction is performed on the topic semantic channel and the entity perception channel, so that the topic semantic channel absorbs entity boundary constraints from the entity perception channel, and at the same time, the entity perception channel absorbs text context constraints from the topic semantic channel, resulting in an enhanced topic semantic channel.
[0023] The topic activation values of each word position are extracted from the enhanced topic semantic channel, and weighted pooling is performed according to the semantic contribution of each word to the topic of the text to generate the topic vector of the first sentence segment.
[0024] In this embodiment, when translating subsequent sentence segments, the global semantic state is appended as a prefix to the input sequence of the current sentence segment, so that the large language model can synchronously receive the topic information and entity reference relationships in the global semantic state when decoding the current sentence segment. Specifically, this includes:
[0025] When translating subsequent sentence segments, the global semantic state is decoded and deconstructed into a discourse topic prefix vector and an entity reference chain prefix embedding. The discourse topic prefix vector carries the topic semantic information of the historical sentence segments, and the entity reference chain prefix embedding carries the structured encoding of the established entity reference relationship.
[0026] Based on the passage distance between the current sentence segment and historical sentence segments, apply a time decay weight that is positively correlated with the passage distance to the passage topic prefix vector;
[0027] The attenuated chapter topic prefix vector and the entity referential chain prefix embedding are concatenated according to semantic hierarchy to generate a global semantic prefix sequence with chapter awareness capability.
[0028] The global semantic prefix sequence is concatenated to the beginning of the input sequence of the current sentence segment, so that in each step of the large language model performing autoregressive decoding on the current sentence segment, the topic information and entity referential relationships in the global semantic state are synchronously obtained through the attention interaction of the global semantic prefix sequence.
[0029] In this embodiment, the process of concatenating the attenuated document topic prefix vector with the entity referential chain prefix embedding at the semantic level to generate a global semantic prefix sequence with document awareness specifically includes:
[0030] Using the decayed chapter topic prefix vector as a query sequence, multi-head cross-attention interaction is performed on the entity reference chain prefix embedding, so that each entity reference embedding is adaptively recoded according to its semantic fit with the chapter topic, generating topic-aware entity reference embedding.
[0031] Apply recursive positional encoding based on the reference hierarchy to the topic-aware entity reference embedding, so that the entity reference embeddings at different reference levels carry the hierarchical structure information of their depth in the entity reference chain, and obtain hierarchically labeled entity reference embeddings.
[0032] Using the decayed topic prefix vector as the sequence anchor, the hierarchical entity referential embeddings are mounted to the sequence anchor in order of increasing referential level. Learnable hierarchical transition embeddings are inserted between every two referential levels to generate a global semantic prefix sequence with discourse awareness.
[0033] In this embodiment, after translating each sentence segment, the newly added entities and their referential relationships in the current sentence segment are appended to the global semantic state, and a time decay factor is applied to the historical chapter topic vector in the global semantic state. Specifically, this includes:
[0034] After translating each sentence segment, entity and referential relationships are extracted from the current sentence segment translation.
[0035] The extraction results are semantically compatible with the entity reference chains in the global semantic state to identify newly added entities. The newly added entities are then recoded with topic awareness to align their embedded representation with the global semantic space.
[0036] The newly added entities and their referential relationships after recoding are attached to the end of the entity referential chain of the global semantic state in the form of incremental nodes, and the affected existing entity referential chains are closed-fit alignment is performed to obtain the updated entity referential chain.
[0037] A dual-path time decay is applied to the historical chapter topic vector in the global semantic state. The first path generates a basic time decay factor based on the sentence segment time interval and performs exponential decay, while the second path generates an adaptive time decay factor based on the topic drift detection result and performs corrective decay.
[0038] The exponentially decayed base time decay factor and the modified decayed adaptive time decay factor are fused and applied to the historical chapter topic vector to obtain the decayed chapter topic vector, which is then encapsulated together with the updated entity reference chain into the updated global semantic state.
[0039] In this embodiment, the extraction result is semantically compatible with the entity reference chain in the global semantic state to identify newly added entities. The newly added entities are then re-encoded with a topic-aware approach to align their embedded representation with the global semantic space. Specifically, this includes:
[0040] The embedding representations of each candidate entity in the extraction results and the existing entity embeddings of the entity reference chains in the global semantic state are respectively input into the dual-tower semantic comparison model to calculate the semantic compatibility between each candidate entity and the existing entity reference chains.
[0041] Candidate entities with semantic compatibility scores below a preset compatibility threshold are marked as new entities, and candidate entities with semantic compatibility scores above a preset compatibility threshold are merged with their corresponding existing entities through referential link merging.
[0042] Using the chapter topic vector in the global semantic state as the alignment anchor, the embedded representation of the newly added entity is subjected to topic-aware projection transformation, so that it is aligned with the global semantic space while maintaining the semantic independence of the entity.
[0043] In this embodiment, after all sentence segments are translated, a discourse-level consistency check is performed on the translations of all sentence segments based on the global semantic state, and the translation conflicts and referential breaks caused by local context selection are corrected, specifically including:
[0044] After all sentence segments are translated, the entity reference chain records in the global semantic state are used as the consistency benchmark. The actual translations of the corresponding entities in each sentence segment are scanned sequentially to construct a translation consistency deviation matrix and mark the entities with translation conflicts and reference breaks.
[0045] For the entity with the translation conflict, the local context semantic vector at the corresponding position is fused with the chapter topic vector in the global semantic state to generate a corrected translation embedding that combines chapter consistency and local fluency.
[0046] According to the modified translation embedding, the entity with translation conflict is forced to be replaced, and the reference link is completed at the reference break position according to the reference hierarchy and antecedent pointing information in the global semantic state, so as to obtain the translation of each sentence segment that is consistent at the chapter level.
[0047] Secondly, this application provides a machine translation optimization system based on a large language model, used to execute a machine translation optimization method based on a large language model, the machine translation optimization system comprising:
[0048] The sentence segmentation module is used to obtain the long text to be translated and divide the long text into multiple continuous sentence segments;
[0049] The state caching module is used to perform initial translation on the first sentence segment. During the initial translation process, the chapter topic vector and entity reference chain of the first sentence segment are extracted, and the chapter topic vector and entity reference chain are cached together as the global semantic state.
[0050] The context injection module is used to prepend the global semantic state to the input sequence of the current sentence segment when translating subsequent sentence segments, so that the large language model can synchronously receive the topic information and entity reference relationship in the global semantic state when decoding the current sentence segment;
[0051] The state update module is used to add the newly added entities and their referential relationships in the current sentence segment to the global semantic state after each sentence segment is translated, and to apply a time decay factor to the historical chapter topic vector in the global semantic state.
[0052] The translation verification module is used to perform discourse-level consistency verification on the translations of all sentence segments based on the global semantic state after all sentence segments have been translated, and to correct translation conflicts and reference breaks caused by local context selection.
[0053] The technical solutions provided by the embodiments disclosed in this application have the following beneficial effects:
[0054] The process involves acquiring a long text to be translated and dividing it into multiple consecutive sentence segments. An initial translation is performed on the first sentence segment, extracting its discourse topic vector and entity reference chain during this process. These vectors are then cached as a global semantic state. When translating subsequent sentence segments, the global semantic state is appended as a prefix to the input sequence of the current sentence segment, allowing the large language model to synchronously receive the topic information and entity reference relationships from the global semantic state while decoding the current sentence segment. After translating each sentence segment, newly added entities and their reference relationships are appended to the global semantic state, and a time decay factor is applied to the historical discourse topic vectors in the global semantic state. After all sentence segments are translated, discourse-level consistency checks are performed on the translations of all sentence segments based on the global semantic state, correcting translation conflicts and reference breaks caused by local context selection.
[0055] Therefore, this application demonstrates that after all sentence segments are translated, the translations of all sentence segments can be verified for discourse-level consistency based on the global semantic state, and translation conflicts and referential breaks caused by local context selection can be corrected. Firstly, by dividing the long text to be translated into multiple consecutive sentence segments, and extracting the discourse theme vector and entity referential chain as a global semantic state during the initial translation of the first sentence segment, an initial discourse state benchmark can be established for the entire translation process. This solidifies the theme context, key entities, and their referential relationships established at the beginning, providing a unified semantic reference anchor for the translation of all subsequent sentence segments, reducing the possibility of losing key information from the first sentence segment in subsequent translations. Secondly, when translating subsequent sentence segments, the global semantic state is appended to the input sequence as a prefix, enabling the large language model to synchronously receive the theme information and entity referential relationships accumulated in the preceding text during decoding. This breaks the limitation of independent decoding of each sentence segment in traditional segmented translation, allowing the model to directly utilize the explicitly injected discourse state information without relying on its implicit memory of distant contexts, which helps reduce pronoun pointing errors and other issues. The probability of inconsistencies in translation and topic shifts is assessed to ensure semantic coherence between the current sentence segment and the preceding text. Furthermore, after translating each sentence segment, newly added entities and referential relationships are appended to the global semantic state. Simultaneously, a time decay factor is applied to the historical text topic vectors. This dynamically updates the global semantic state, ensuring that subsequent sentence segments receive the latest text information and avoiding omissions of key new content. Time decay also balances global topic continuity and local contextual relevance, making the model focus more on recent topic contexts and reducing interference from outdated topic information, thus improving the fit between the translation and the current context. Finally, after all sentence segments are translated, a text-level consistency check is performed on the translations of all segments based on the global semantic state. Translation conflicts and referential breaks caused by local context selection are corrected. As a post-translation safeguard, this process identifies residual local consistency issues during segmented translation and makes targeted corrections, improving the consistency and coherence of the final translation from a holistic perspective and effectively mitigating semantic drift caused by segmented processing.
[0056] In summary, the technical solution adopted in this application can realize the continuous transmission of the semantic state of the text during the translation of long texts, thereby reducing the contextual semantic drift caused by segmentation processing. Attached Figure Description
[0057] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only for this embodiment of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0058] Figure 1 This is an exemplary flowchart of a machine translation optimization method based on a large language model provided in this application;
[0059] Figure 2 This is a bar chart showing the compression ratio of neural memory units provided in this application;
[0060] Figure 3 It is based on the curve of the relationship between chapter distance and time decay weight provided in this application;
[0061] Figure 4 This is a module structure diagram of a machine translation optimization system based on a large language model provided in this application;
[0062] Figure 5 This is an application scenario diagram of a machine translation optimization method based on a large language model provided in this application. Detailed Implementation
[0063] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0064] This application provides a machine translation optimization method and system based on a large language model. The core of the method is to acquire a long text to be translated, divide the long text into multiple consecutive sentence segments, perform an initial translation on the first sentence segment, extract the discourse topic vector and entity reference chain of the first sentence segment during the initial translation process, and cache the discourse topic vector and entity reference chain together as a global semantic state. When translating subsequent sentence segments, the global semantic state is appended to the input sequence of the current sentence segment as a prefix, so that the large language model synchronously receives the topic information and entity reference relationships in the global semantic state when decoding the current sentence segment. After each sentence segment is translated, the newly added entities and their reference relationships in the current sentence segment are appended to the global semantic state, and a time decay factor is applied to the historical discourse topic vector in the global semantic state. After all sentence segments are translated, discourse-level consistency checks are performed on the translations of all sentence segments based on the global semantic state, and translation conflicts and reference breaks caused by local context selection are corrected.
[0065] Example 1
[0066] To better understand the above technical solutions, a detailed explanation will be provided below with reference to the accompanying drawings and specific implementation methods.Figure 1 As shown in the figure, this is an exemplary flowchart of a machine translation optimization method based on a large language model according to this embodiment of the application. The unified access method for intelligent devices includes the following steps:
[0067] In step S1, the long text to be translated is obtained and divided into multiple consecutive sentence segments.
[0068] In this embodiment, dividing the long text into multiple consecutive sentence segments can be achieved using the following steps:
[0069] The long text is subjected to semantic coherence scanning to identify topic drift positions and generate a sequence of candidate segmentation points composed of the boundaries of continuous text segments.
[0070] Traverse each candidate segment in the candidate segment sequence, detect whether there is an unclosed entity reference chain that crosses the candidate segment, and move the candidate segment to the reference closure position of the unclosed entity reference chain to obtain the adjusted segment sequence;
[0071] The long text is segmented by adjusting the segmentation point sequence to obtain multiple consecutive sentence segments.
[0072] In specific implementation, firstly, a pre-trained sentence vector encoding model is used to encode each pair of adjacent sentences in the long text to obtain their respective sentence vectors. The sentence vector encoding model employs the Sentence-BERT model, which uses BERT as the basic encoder. A Siamese network structure is constructed, and a natural language inference dataset is used as the training corpus. The parameters of the BERT basic encoder are fine-tuned using a cosine similarity loss function, enabling the encoded sentence vectors to effectively capture the semantic similarity between sentences. The cosine similarity between the sentence vectors of each pair of adjacent sentences is calculated as the topic semantic association strength. The text segment boundaries between adjacent sentences with a topic semantic association strength lower than a preset association threshold are marked as topic drift positions. This preset association threshold is obtained statistically from a corpus containing known topic boundary annotations. Specifically, different candidate thresholds are traversed on this corpus, and the F1 score between the segmentation result and the manually annotated boundary is calculated. First, the candidate threshold corresponding to the maximum F1 score is selected as the preset association threshold. The boundaries of all text segments corresponding to the topic drift positions are arranged in the order of text appearance to obtain a candidate segmentation point sequence. Second, each candidate segmentation point in the candidate segmentation point sequence is traversed in the text order. For each candidate segmentation point, a dependency parsing tool is used to perform entity recognition and referential relationship detection on the sentences within the preset window range before and after the candidate segmentation point. The entity referential relationship where the antecedent is located before the candidate segmentation point and the pronoun is located after the candidate segmentation point is identified as an unclosed entity referential chain crossing the candidate segmentation point. If an unclosed entity referential chain exists, the candidate segmentation point is moved to the end boundary position of the sentence containing the pronoun in the unclosed entity referential chain. If no unclosed entity referential chain exists, the position of the candidate segmentation point remains unchanged. All the corrected segmentation points are arranged in the text order to obtain an adjusted segmentation point sequence. Finally, the long text is segmented using the positions of each segmentation point in the adjusted segmentation point sequence as the segmentation boundary to obtain multiple continuous sentence segments.
[0073] It should be noted that, in this application, semantic coherence scanning refers to the process of detecting the strength of thematic semantic association between adjacent sentences in a long text sentence by sentence; the topic drift position refers to the position where the strength of thematic semantic association between adjacent sentences is lower than a preset association threshold; the candidate segmentation point sequence refers to the segmentation point sequence composed of the text segment boundaries corresponding to all topic drift positions arranged in text order; the unclosed entity reference chain refers to an entity reference relationship at the current candidate segmentation point where the antecedent is located before the candidate segmentation point and the pronoun is located after the candidate segmentation point, and the reference closure has not yet been completed; the reference closure position refers to the sentence-end boundary position of the sentence containing the pronoun in the unclosed entity reference chain; the adjusted segmentation point sequence refers to the final segmentation point sequence after the reference closure position is corrected; and the continuous sentence segment refers to a text paragraph with a completely closed internal entity reference relationship and thematic semantic coherence.
[0074] In step S2, an initial translation is performed on the first sentence segment. During the initial translation process, the discourse topic vector and entity reference chain of the first sentence segment are extracted, and the discourse topic vector and entity reference chain are cached together as a global semantic state.
[0075] In this embodiment, an initial translation is performed on the first sentence segment. During the initial translation process, the discourse topic vector and entity reference chain of the first sentence segment are extracted. The discourse topic vector and entity reference chain are cached together as a global semantic state, which can be achieved by the following steps:
[0076] When performing the initial translation of the first sentence segment, a dual-channel attention decoupling mechanism is adopted to separate the top-level hidden state of the decoder into a topic semantic channel and an entity perception channel, and extract the chapter topic vector of the first sentence segment from the topic semantic channel;
[0077] Guided by the entity perception channel, the accessibility migration path of each entity reference in the first sentence segment translation is tracked synchronously, thereby constructing the entity reference chain of the first sentence segment, and marking the corresponding reference level and antecedent pointing information for each reference relationship in the entity reference chain.
[0078] The chapter topic vector is embedded as a topic prototype and cross-channel interactive encoding is performed with each entity node in the entity reference chain to generate a joint representation of the differentiable index of entity reference relationship under topic anchoring;
[0079] The joint representation is compressed into incrementally updatable neural memory units and stored in a global cache to obtain the global semantic state.
[0080] It should be noted that, in this application, the accessibility migration path refers to the evolutionary path of entity reference from its initial introduction to subsequent references, where the referential form gradually simplifies from a full noun phrase to a pronoun or ellipsis; the entity reference chain refers to the chain structure composed of all entities and their referential relationships in the first sentence segment; the reference hierarchy refers to the depth level of entity reference in the entity reference chain, with the first introduced entity being the first level, the first referred entity being the second level, and so on; the antecedent pointing information refers to the positional identifier of the antecedent pointed to by each reference in the text; the topic prototype embedding refers to the embedded representation of the discourse topic vector as the topic anchor; the joint representation refers to the fused representation obtained after cross-channel interactive encoding of the discourse topic vector and each entity node in the entity reference chain; the neural memory unit refers to a vectorized storage structure that can support incremental updates after compression; and the global semantic state refers to global cache information composed of neural memory units that can be continuously updated during the translation of subsequent sentence segments.
[0081] In specific implementation, firstly, during the initial translation of the first sentence segment, a dual-channel attention decoupling mechanism is employed to separate the top-level hidden state of the decoder into a topic semantic channel and an entity perception channel. The topic vector of the first sentence segment is extracted from the topic semantic channel. Secondly, a named entity recognition tool, such as the spaCy named entity recognizer, is used to perform entity recognition on the translated first sentence segment. All entity noun phrases in the translated first sentence segment and their positional information within the translated text are extracted. The process of tracking the change in the referential form of each entity according to its order of appearance in the text is specifically as follows: Starting with the first occurrence of a full noun phrase for each entity, the spaCy dependency parser is used to perform dependency parsing on subsequent sentences. By detecting whether there are pronouns or zero-reference forms in subsequent sentences that match the identified entities in semantic role and grammatical function, the evolution sequence of reference forms from full noun phrases to pronouns and then to zero-reference is recorded as an accessibility migration path. Using each entity as a node, reference relationships as directed edges, and an adjacency list data structure, a chain structure is constructed from antecedents to referents as the entity reference chain. Each referent in the entity reference chain is then assigned a reference value. The relation annotation corresponds to the referential hierarchy, where the first entity annotation introduced is at level 1, the first annotation referred to by a pronoun is at level 2, and so on. It also annotates antecedent information, recording the sentence order position and word position offset of the antecedent referred to by each referent within the sentence segment. Next, the discourse topic vector is embedded as a topic prototype. A multi-head cross-attention mechanism is used, with the embedded representations of each entity node in the entity referential chain as queries and the topic prototype embeddings as keys and values for cross-attention calculation. This integrates the embedded representations of each entity node with the discourse topic information, resulting in a more comprehensive understanding. The entity nodes anchored by the topic are embedded and concatenated into an entity matrix according to the entity reference chain order. The topic prototype embedding and the entity matrix are concatenated along the feature dimension and then input into a gated fusion network. The gated fusion network adopts a gated recurrent unit structure. The fusion gate vector is obtained by adaptively calculating the weights of the concatenation result through the gate mechanism of the sigmoid activation function. The fusion gate vector is multiplied element-wise with the concatenation result to obtain the fusion output. The fusion output is nonlinearly transformed through two fully connected layers to obtain the joint representation.Finally, a fully connected autoencoder is used to reduce the dimensionality of the joint representation. This fully connected autoencoder includes an encoder and a decoder. The encoder consists of three fully connected layers connected sequentially, with each layer's output dimension being 1 / 2, 1 / 4, and 1 / 8 of the joint representation's dimension, respectively. The decoder also consists of three fully connected layers connected sequentially, with each layer's output dimension being 1 / 4, 1 / 2, and the original dimension, respectively. The joint representation is used as the input to the fully connected autoencoder. The encoder reduces the dimensionality layer by layer to obtain the compressed vector. The decoder then restores the representation layer by layer and calculates the mean squared error reconstruction loss with the joint representation. The parameters of the fully connected autoencoder are trained with the goal of minimizing the mean squared error reconstruction loss. After training, the final output of the encoder is used as the compressed vector. This compressed vector is used as the memory value, and the embeddings of each entity node are used as memory keys. A key-value memory network structure is used as the neural memory unit, and the data is stored in a global cache to obtain the global semantic state.
[0082] For example, to facilitate the illustration of the compression process of the neural memory unit, the original dimension of the joint representation is normalized to 100%. The relative dimensions of the encoder's first layer, second layer, and final compressed vector are calculated as 1 / 2, 1 / 4, and 1 / 8 of the joint representation dimension, respectively, according to the encoder's output dimensions being 1 / 2, 1 / 4, and 1 / 8 of the joint representation dimension. (Reference) Figure 2 As shown in the figure, this is a bar chart of the compression ratio of the neural memory unit provided in this application. As can be seen from the figure, after three layers of encoding, the relative dimension of the joint representation is reduced from 100% to 12.5%, that is, the memory value written into the neural memory unit is reduced by 87.5% of the vector dimension compared to the joint representation; at the same time, the embedding of each entity node is still retained as a memory key, so that the compression mainly acts on the memory value without changing the index relationship of the entity reference chain, thereby reducing the vector size of continuous sentence segments accumulated in the global cache while maintaining the subsequent entity retrieval path.
[0083] In this embodiment, when performing the initial translation of the first sentence segment, a dual-channel attention decoupling mechanism is used to separate the top-level hidden state of the decoder into a topic semantic channel and an entity perception channel. The extraction of the discourse topic vector of the first sentence segment from the topic semantic channel can be achieved through the following steps:
[0084] When performing the initial translation on the first sentence segment, a bi-branch orthogonal projection operation is applied to the top-level hidden state of the large language model decoder, decomposing the top-level hidden state into a topic semantic channel and an entity perception channel, wherein the topic semantic channel encodes discourse coherence information and the entity perception channel encodes entity boundary information.
[0085] A bidirectional mutual attention interaction is performed on the topic semantic channel and the entity perception channel, so that the topic semantic channel absorbs entity boundary constraints from the entity perception channel, and at the same time, the entity perception channel absorbs text context constraints from the topic semantic channel, resulting in an enhanced topic semantic channel.
[0086] The topic activation values of each word position are extracted from the enhanced topic semantic channel, and weighted pooling is performed according to the semantic contribution of each word to the topic of the text to generate the topic vector of the first sentence segment.
[0087] It should be noted that, in this application, the bi-branch orthogonal projection operation represents a linear transformation operation that maps the top-level hidden state to two semantically independent subspaces through two sets of projection matrices satisfying column space orthogonality constraints; the topic semantic channel represents the hidden state subspace representation that encodes discourse coherence information; the entity perception channel represents the hidden state subspace representation that encodes entity boundary information; the bidirectional mutual attention interaction represents the process of bidirectional information exchange between the topic semantic channel and the entity perception channel through a cross-attention mechanism; the enhanced topic semantic channel represents the topic semantic channel that incorporates entity boundary constraints after bidirectional mutual attention interaction; the topic activation value represents the hidden state vector corresponding to each word position in the enhanced topic semantic channel; the semantic contribution represents the relative importance weight of each word to the discourse topic; and the discourse topic vector represents a dense vector representation that uniformly encodes the global topic semantics of the entire sentence segment.
[0088] In specific implementation, firstly, when performing initial translation on the first sentence segment, the DeepSeek V4 large language model is used as the translation model. The DeepSeek V4 large language model adopts the MoE hybrid expert architecture. The top-level hidden state output by the last Transformer decoder layer of the DeepSeek V4 large language model is obtained. The shape of the top-level hidden state is a two-dimensional matrix composed of the word sequence length and the hidden layer dimension of the model. The projection subspace dimension is set to one-quarter of the hidden layer dimension of the model. Singular value decomposition is performed on the randomly initialized first projection matrix. The column of the front projection subspace dimension of the left singular vector matrix is taken from the decomposition result. The resulting column vectors are combined as the first orthogonal projection matrix. Singular value decomposition is performed on the randomly initialized second projection matrix. The column of the front projection subspace dimension of the left singular vector matrix is taken from the decomposition result. The resulting column vectors are combined as the second orthogonal projection matrix. During the training phase, the first The Frobenius norm of the product of the transpose of the orthogonal projection matrix and the second orthogonal projection matrix is added to the overall loss function as an orthogonality penalty term. The column space orthogonality constraint is imposed on the first and second orthogonal projection matrices by minimizing the orthogonality penalty term through backpropagation. After training, the first and second orthogonal projection matrices are taken, and the top-level hidden state is multiplied with the first orthogonal projection matrix. The resulting projection feature matrix is used as the topic semantic channel, and the top-level hidden state is multiplied with the second orthogonal projection matrix. The resulting projection feature matrix is used as the entity perception channel. The topic semantic channel encodes the coherence information of the text, and the entity perception channel encodes the entity boundary information.Next, a multi-head cross-attention mechanism with 8 heads is used to perform bidirectional mutual attention interaction between the topic semantic channel and the entity perception channel. The dimension of each attention head is set to the hidden layer dimension of the model divided by 8. For each attention head, the query weight matrix is used to linearly transform the topic semantic channel to obtain the query matrix, the key weight matrix is used to linearly transform the entity perception channel to obtain the key matrix, and the value weight matrix is used to linearly transform the entity perception channel to obtain the value matrix. The product of the query matrix and the transpose of the key matrix is calculated and divided by the square root of the attention head dimension for scaling. The resulting scaled dot product matrix is used as the original attention score matrix. The original attention score matrix is then normalized along the word sequence dimension using the softmax function. The attention weight matrix is obtained by multiplying it with the value matrix to get the attention head output. The attention head outputs of the eight attention heads are concatenated along the feature dimension and then linearly transformed using the output projection matrix. The resulting cross-attention output matrix is used as the first cross-attention output. Simultaneously, the entity perception channel's representation after linear transformation using the query weight matrix is used as the query matrix, the topic semantic channel's representation after linear transformation using the key weight matrix is used as the key matrix, and the topic semantic channel's representation after linear transformation using the value weight matrix is used as the value matrix. Following the same scaling dot product attention calculation and multi-head concatenation projection method, the resulting cross-attention output matrix is used as the second cross-attention output. The first cross-attention output is then combined with the topic... After element-wise addition of residual connections in the semantic channels, layer normalization is applied. The resulting normalized feature matrix serves as the enhanced topic semantic channel, allowing it to absorb entity boundary constraints from the entity perception channel. Simultaneously, reverse cross-attention computation, using the entity perception channel as the query matrix and the topic semantic channel as the key and value matrices, enables the entity perception channel to absorb discourse context constraints from the topic semantic channel. Finally, the enhanced topic semantic channel is a two-dimensional matrix composed of the lexical sequence length and the model's hidden layer dimension. The enhanced topic semantic channel is traversed row by row index, and the row vector corresponding to the i-th row is used as the topic activation value at the i-th lexical position. A dimension of... is introduced. The learnable topic query vectors in the hidden layer dimension of the model are initialized randomly using a normal distribution with a mean of 0 and a standard deviation of 0.02. The dot product of the topic query vector and the topic activation value at the i-th word position is calculated and scaled by dividing by the square root of the hidden layer dimension. The original attention scores for each word position are obtained by traversing all word positions. These original attention scores are normalized using a softmax function. The weights corresponding to each normalized word position are used as the semantic contribution of each word position to the discourse topic. The topic activation values and corresponding semantic contributions of each word position are weighted and summed, and the resulting aggregated vector is used as the discourse topic vector for the first sentence segment.
[0089] In step S3, when translating subsequent sentence segments, the global semantic state is appended as a prefix to the input sequence of the current sentence segment, so that the large language model can synchronously receive the topic information and entity reference relationships in the global semantic state when decoding the current sentence segment.
[0090] In this embodiment, when translating subsequent sentence segments, the global semantic state is appended as a prefix to the input sequence of the current sentence segment, so that the large language model can synchronously receive the topic information and entity reference relationships in the global semantic state when decoding the current sentence segment. This can be achieved through the following steps:
[0091] When translating subsequent sentence segments, the global semantic state is decoded and deconstructed into a discourse topic prefix vector and an entity reference chain prefix embedding. The discourse topic prefix vector carries the topic semantic information of the historical sentence segments, and the entity reference chain prefix embedding carries the structured encoding of the established entity reference relationship.
[0092] Based on the passage distance between the current sentence segment and historical sentence segments, apply a time decay weight that is positively correlated with the passage distance to the passage topic prefix vector;
[0093] The attenuated chapter topic prefix vector and the entity referential chain prefix embedding are concatenated according to semantic hierarchy to generate a global semantic prefix sequence with chapter awareness capability.
[0094] The global semantic prefix sequence is concatenated to the beginning of the input sequence of the current sentence segment, so that in each step of the large language model performing autoregressive decoding on the current sentence segment, the topic information and entity referential relationships in the global semantic state are synchronously obtained through the attention interaction of the global semantic prefix sequence.
[0095] It should be noted that the global semantic state representation is a comprehensive semantic representation obtained by concatenating the discourse topic vector of the historical sentence segment with the entity reference relation; the discourse topic prefix vector representation is a vector representation carrying the semantic information of the discourse topic of the historical sentence segment; the entity reference chain prefix embedding representation is a structured encoding carrying the established entity reference relation; the discourse distance represents the number of sentences between the current sentence segment and the historical sentence segment; the time decay weight represents the decay coefficient that is positively correlated with the discourse distance; and the global semantic prefix sequence represents the concatenated prefix sequence with discourse awareness capability.
[0096] In specific implementation, firstly, the global semantic state is a two-dimensional matrix with concatenation dimension and model hidden layer dimension. The first half of the row vectors corresponds to the chapter topic vector, and the second half corresponds to entity referential relationships. The first half of the row vectors is linearly transformed using the first linear projection matrix obtained through end-to-end backpropagation joint learning during the translation model training phase. The transformed result is used as the chapter topic prefix vector. The second half of the row vectors is linearly transformed using the second linear projection matrix obtained through end-to-end backpropagation joint learning during the translation model training phase. The transformed result is used as the entity referential chain prefix embedding. Both the first and second linear projection matrices are randomly initialized during training using a normal distribution with a mean of 0 and a standard deviation of 0.02. The chapter topic prefix vector carries the topic semantic information of historical sentence segments, and the entity referential chain prefix embedding carries the structured encoding of established entity referential relationships. Then… The process involves calculating the number of segments between the current sentence segment and historical sentence segments as the discourse distance. An exponential decay function is used to calculate the time decay weight, specifically by exponentially multiplying the product of the decay coefficient and the discourse distance by the natural constant e. The result of this exponentiation is used as the time decay weight, with the decay coefficient set to an empirical value of 0.1 obtained through optimization based on the translation quality assessment of the validation set. The discourse topic prefix vector is then multiplied element-wise with the time decay weight, and the resulting decayed vector is used as the decayed discourse topic prefix vector. Next, the decayed discourse topic prefix vector is concatenated with the entity referential chain prefix embedding at the semantic level to generate a global semantic prefix sequence with discourse awareness. Finally, the global semantic prefix sequence is concatenated to the beginning of the input sequence for the current sentence segment. Specifically, the row vectors in the global semantic prefix sequence are arranged in row order before the row vectors in the input sequence for the current sentence segment, forming an expanded input sequence. This expanded input sequence is then input into DeepSeek. The decoder of the DeepSeek V4 large language model employs a causal self-attention mechanism for computation at each step of the autoregressive decoding process. The causal self-attention mask makes each position in the global semantic prefix sequence visible to all subsequent lexical positions, thereby enabling the decoder to synchronously acquire topic information and entity referential relationships in the global semantic state through the attention interaction of the global semantic prefix sequence when generating each lexical in the current sentence segment.
[0097] For example, the passage distance d between the current sentence segment and historical sentence segments is sequentially set from 0 to 10, and the time decay weight is calculated using the exponential decay method with a decay coefficient of 0.1 in this embodiment. The resulting weights are 1.000, 0.905, 0.819, 0.741, 0.670, 0.607, 0.549, 0.497, 0.449, 0.407, and 0.368, respectively. (Reference) Figure 3As shown in the figure, this is a curve illustrating the relationship between document distance and time decay weight provided in this application. As can be seen from the figure, when the document distance increases from 1 to 5, the time decay weight decreases from 0.905 to 0.607; when the document distance increases to 10, the time decay weight remains at 0.368. Therefore, historical topic information closer to the current sentence segment retains a higher weight in the global semantic prefix sequence, while historical topic information farther away gradually weakens with document distance. This avoids distant historical topics continuously participating in the decoding of the current sentence segment with the same intensity, while retaining a certain amount of cross-sentence topic continuity information.
[0098] In this embodiment, the process of concatenating the attenuated document topic prefix vector with the entity referential chain prefix embedding at the semantic level to generate a global semantic prefix sequence with document awareness can be achieved through the following steps:
[0099] Using the decayed chapter topic prefix vector as a query sequence, multi-head cross-attention interaction is performed on the entity reference chain prefix embedding, so that each entity reference embedding is adaptively recoded according to its semantic fit with the chapter topic, generating topic-aware entity reference embedding.
[0100] Apply recursive positional encoding based on the reference hierarchy to the topic-aware entity reference embedding, so that the entity reference embeddings at different reference levels carry the hierarchical structure information of their depth in the entity reference chain, and obtain hierarchically labeled entity reference embeddings.
[0101] Using the decayed topic prefix vector as the sequence anchor, the hierarchical entity referential embeddings are mounted to the sequence anchor in order of increasing referential level. Learnable hierarchical transition embeddings are inserted between every two referential levels to generate a global semantic prefix sequence with discourse awareness.
[0102] It should be noted that the topic-aware entity referential embedding representation is obtained by adaptively recoding each entity referential embedding according to its semantic fit with the topic of the text through multi-head cross-attention interaction; the hierarchical labeled entity referential embedding representation is a representation that carries hierarchical structure information after applying recursive positional encoding based on the referential hierarchy to the topic-aware entity referential embedding; the global semantic prefix sequence representation is a sequence obtained by using the attenuated text topic prefix vector as the sequence anchor, mounting the hierarchical labeled entity referential embeddings level by level according to the referential hierarchy, and inserting hierarchical transition embeddings between levels.
[0103] In specific implementation, a multi-head cross-attention mechanism with 8 heads is first adopted. The decayed document topic prefix vector is used as the query sequence, and the entity referential chain prefix embedding is used as the key and value sequences. For each attention head, the query weight matrix obtained through end-to-end backpropagation joint learning during the translation model training phase is used to linearly transform the decayed document topic prefix vector to obtain the query matrix. The key weight matrix obtained through end-to-end backpropagation joint learning during the translation model training phase is used to linearly transform the entity referential chain prefix embedding to obtain the key matrix. The value weight matrix obtained through end-to-end backpropagation joint learning during the translation model training phase is used to linearly transform the entity referential chain prefix embedding to obtain the value matrix. The product of the query matrix and the transpose of the key matrix is calculated and divided by the square root of the attention head dimension. Row scaling yields a scaled dot product matrix. This matrix is then normalized along the word sequence dimension using the softmax function to obtain the attention weight matrix. The matrix product of the attention weight matrix and the value matrix is calculated to obtain the attention head output. The attention head outputs of the eight attention heads are concatenated along the feature dimension and then linearly transformed using the output projection matrix obtained through end-to-end backpropagation joint learning during the translation model training phase. The resulting cross-attention output is used as the topic-aware entity reference embedding. Next, a sinusoidal-cosine positional encoding method is applied to the topic-aware entity reference embedding with recursive positional encoding based on the reference hierarchy. Specifically, the positional encoding value is calculated based on the reference hierarchy depth *d* of each topic-aware entity reference embedding in the entity reference chain. For the encoding value at dimension position 2i, a specific encoding method is used. The calculation is performed for the encoded value at dimension position 2i+1. The calculation is performed, where D is the hidden layer dimension of the model. The calculated positional encoding value is added element-wise to the topic-aware entity reference embedding. The resulting encoded embedding is used as the hierarchical entity reference embedding. Finally, using the decayed document topic prefix vector as the sequence anchor, the hierarchical entity reference embedding is arranged in order of reference level from shallow to deep after the sequence anchor. The hierarchical transition embedding obtained by end-to-end backpropagation joint learning during the translation model training stage is inserted between every two reference levels. The concatenated sequence is used as a global semantic prefix sequence with document awareness capability.
[0104] In step S4, after each sentence segment is translated, the newly added entities and their referential relationships in the current sentence segment are added to the global semantic state, and a time decay factor is applied to the historical chapter topic vector in the global semantic state.
[0105] In this embodiment, after translating each sentence segment, the newly added entities and their referential relationships in the current sentence segment are appended to the global semantic state, and a time decay factor is applied to the historical chapter topic vector in the global semantic state. This can be achieved through the following steps:
[0106] After translating each sentence segment, entity and referential relationships are extracted from the current sentence segment translation.
[0107] The extraction results are semantically compatible with the entity reference chains in the global semantic state to identify newly added entities. The newly added entities are then recoded with topic awareness to align their embedded representation with the global semantic space.
[0108] The newly added entities and their referential relationships after recoding are attached to the end of the entity referential chain of the global semantic state in the form of incremental nodes, and the affected existing entity referential chains are closed-fit alignment is performed to obtain the updated entity referential chain.
[0109] A dual-path time decay is applied to the historical chapter topic vector in the global semantic state. The first path generates a basic time decay factor based on the sentence segment time interval and performs exponential decay, while the second path generates an adaptive time decay factor based on the topic drift detection result and performs corrective decay.
[0110] The exponentially decayed base time decay factor and the modified decayed adaptive time decay factor are fused and applied to the historical chapter topic vector to obtain the decayed chapter topic vector, which is then encapsulated together with the updated entity reference chain into the updated global semantic state.
[0111] It should be noted that the newly added entity refers to an entity that exists in the current sentence segment translation but has not yet been recorded in the entity reference chain of the global semantic state; the updated entity reference chain refers to the entity reference chain obtained by attaching the newly added entity and its reference relationship to the end of the entity reference chain and performing closed matching alignment on the affected links; the basic time decay factor refers to the decay value calculated by exponential decay based on the sentence segment time interval; the adaptive time decay factor refers to the decay value calculated based on the topic drift detection result; the decayed chapter topic vector refers to the vector obtained by applying it to the historical chapter topic vector after dual-path time decay fusion; and the updated global semantic state refers to the global semantic state encapsulated by the decayed chapter topic vector and the updated entity reference chain.
[0112] In specific implementation, after the large language model completes the autoregressive decoding of the current sentence segment and outputs the translation of the current sentence segment, the global semantic state update process is immediately triggered. First, a named entity recognition model based on the BiLSTM-CRF architecture is used to perform sequence annotation on the translation of the current sentence segment. The input layer processes the translation of the current sentence segment into lexical units to obtain a word embedding sequence, which is then input into the BiLSTM layer for bidirectional encoding. The BiLSTM layer uses a bidirectional long short-term memory network with a hidden layer dimension of 256 to extract context features from the word embedding sequence to obtain a context representation sequence. The CRF layer uses the Viterbi decoding algorithm to process the context representation sequence. The text describes a process for decoding a sequence of tags using optimal labels. The tag set includes four categories: person names, place names, organization names, and non-entity tags. The tokens corresponding to the non-entity tags in the decoding result are aggregated into entities, resulting in an entity set. Simultaneously, a Stanford Parser-based dependency parsing method is used to perform syntactic analysis on the current sentence segment, identifying the referential relationships between entities. These referential relationships include anaphora and coreference. The extracted entity set and referential relationships are used as the extraction result. Next, the extraction result is semantically compatible with the entity referential chains in the global semantic state, identifying newly added entities. The algorithm first identifies newly added entities and then performs topic-aware recoding to align their embeddings with the global semantic space. Next, a greedy matching algorithm is used to perform one-to-one matching on nodes in the affected existing entity referencing links. Specifically, the cosine similarity between the embedding vector of the newly added entity and the embedding vectors of each node in the existing entity referencing links is calculated. Node pairs with a cosine similarity exceeding a preset matching threshold are considered successfully matched. The preset matching threshold is a candidate threshold with a step size of 0.05, traversing a validation set containing document-level translation annotations within a range of 0.7 to 0.95. For each candidate threshold, the entity referencing link is calculated. The F1 score of the identified entity is used as the candidate threshold that maximizes the F1 score. The embedding vectors of successfully matched node pairs are updated by weighted averaging with a weight of 0.5. The embedding vectors of unmatched entities in the newly added entities after recoding are appended to the end of the node sequence of the entity reference chain as new nodes. Directed reference edges are established between the new nodes and existing nodes according to the reference relationship. The updated entity reference chain is used as the updated entity reference chain. Then, the difference between the sentence number of the current segment and the sentence number of the previous segment is calculated as the segment time interval, with the natural constant e as the base and the decay coefficient 0.The product of 05 and the sentence interval is exponentially raised to the power of the result, which serves as the base time decay factor. Simultaneously, cosine similarity is used to calculate the cosine similarity between the current sentence's topic vector and the historical document topic vectors in the global semantic state. The difference between 1 and the cosine similarity value is taken as the topic drift degree. When the topic drift degree exceeds a preset drift threshold, it is used as the adaptive time decay factor; otherwise, a preset minimum decay value is used. The preset drift threshold is a candidate threshold with a step size of 0.05, traversing the range of 0.1 to 0.5 on a validation set containing document-level translation annotations. For each candidate threshold, a document coherence evaluation index (BLEU score) is calculated, and the threshold that satisfies the BLEU score is selected. The candidate threshold that maximizes the score is used as the preset drift threshold. The preset minimum decay value is calculated by iterating through candidate values in the range of 0.005 to 0.05 with a step size of 0.005 on the validation set containing document-level translation annotations. For each candidate value, the document coherence evaluation index BLEU score is calculated, and the candidate value that maximizes the BLEU score is selected as the preset minimum decay value. Finally, the basic time decay factor and the adaptive time decay factor are multiplied element-wise, and the resulting product is used as the fused time decay factor. The fused time decay factor is then multiplied element-wise with the historical document topic vector, and the resulting decayed vector is used as the decayed document topic vector. The decayed document topic vector and the updated entity referencing chain are jointly encapsulated into the updated global semantic state.
[0113] In this embodiment, the semantic compatibility verification of the extraction results with the entity reference chains in the global semantic state is performed to identify newly added entities. The newly added entities are then recoded with topic awareness to align their embedded representation with the global semantic space. This can be achieved through the following steps:
[0114] The embedding representations of each candidate entity in the extraction results and the existing entity embeddings of the entity reference chains in the global semantic state are respectively input into the dual-tower semantic comparison model to calculate the semantic compatibility between each candidate entity and the existing entity reference chains.
[0115] Candidate entities with semantic compatibility scores below a preset compatibility threshold are marked as new entities, and candidate entities with semantic compatibility scores above a preset compatibility threshold are merged with their corresponding existing entities through referential link merging.
[0116] Using the chapter topic vector in the global semantic state as the alignment anchor, the embedded representation of the newly added entity is subjected to topic-aware projection transformation, so that it is aligned with the global semantic space while maintaining the semantic independence of the entity.
[0117] It should be noted that semantic compatibility represents a quantitative value of the probability that a candidate entity and an existing entity refer to the same object; the preset compatibility threshold represents a semantic compatibility boundary value used to distinguish whether a candidate entity is a new entity; and topic-aware projection transformation represents a linear projection operation performed on the embedded representation of the new entity with the chapter topic vector as the alignment anchor.
[0118] In specific implementation, a dual-tower semantic comparison model based on the Siamese BERT architecture is first used to calculate the semantic compatibility between each candidate entity and the existing entity reference chain. The two towers of the dual-tower semantic comparison model share parameters. The first tower inputs the embedded representations of each candidate entity in the extraction results into the BERT encoding layer for context encoding to obtain the candidate entity representation vector. The second tower inputs the existing entity embeddings of the entity reference chain in the global semantic state into the BERT encoding layer for context encoding to obtain the existing entity representation vector. After L2 normalization of both the candidate and existing entity representation vectors, cosine similarity is calculated. The maximum cosine similarity between each candidate entity and all existing entity representation vectors is taken as the semantic compatibility of that candidate entity. Next, candidate entities with semantic compatibility scores below a preset compatibility threshold are marked as new entities, and candidate entities with semantic compatibility scores above the preset compatibility threshold are merged with their corresponding existing entities through reference chain merging. The tolerance threshold is determined by iterating through candidate thresholds ranging from 0.6 to 0.9 with a step size of 0.05 on a validation set containing document-level entity annotations. For each candidate threshold, the F1 score for entity recognition is calculated, and the candidate threshold that maximizes the F1 score is selected as the preset compatibility threshold. Finally, using the document topic vector in the global semantic state as the alignment anchor, the topic-aware projection matrix obtained through end-to-end backpropagation joint learning during the translation model training phase is used to linearly transform the embedding representation of the newly added entities, resulting in the topic-aware projected embedding vector. The topic-aware projected embedding vector and the embedding representation of the newly added entities are then weighted and fused with weight ratios of 0.7 and 0.3. The weighted fused embedding vector is used as the aligned entity embedding representation, where the weight ratios of 0.7 and 0.3 are determined by iterating through candidate weight combinations on the validation set containing document-level entity annotations and selecting the weight combination that maximizes the entity referencing F1 score.
[0119] In step S5, after all sentence segments have been translated, the translations of all sentence segments are checked for textual consistency based on the global semantic state, and translation conflicts and reference breaks caused by local context selection are corrected.
[0120] In this embodiment, after all sentence segments have been translated, the translations of all sentence segments are checked for discourse-level consistency based on the global semantic state, and the translation conflicts and referential breaks caused by local context selection can be corrected by the following steps:
[0121] After all sentence segments are translated, the entity reference chain records in the global semantic state are used as the consistency benchmark. The actual translations of the corresponding entities in each sentence segment are scanned sequentially to construct a translation consistency deviation matrix and mark the entities with translation conflicts and reference breaks.
[0122] For the entity with the translation conflict, the local context semantic vector at the corresponding position is fused with the chapter topic vector in the global semantic state to generate a corrected translation embedding that combines chapter consistency and local fluency.
[0123] According to the modified translation embedding, the entity with translation conflict is forced to be replaced, and the reference link is completed at the reference break position according to the reference hierarchy and antecedent pointing information in the global semantic state, so as to obtain the translation of each sentence segment that is consistent at the chapter level.
[0124] It should be noted that the translation consistency deviation matrix is a matrix constructed with each sentence segment as a row and the standardized translations of each entity recorded in the entity reference chain in the global semantic state as columns. The matrix element values represent the degree of deviation between the actual translation and the standardized translation of the corresponding entity in the corresponding sentence segment; the translation conflict entity represents the entity in the translation consistency deviation matrix whose deviation exceeds the preset deviation threshold; the reference break position represents the position where the entity that appeared in the preceding text should have been referred to in the following sentence segment but was not correctly referred to in the actual translation; the corrected translation embedding represents the embedding vector that combines discourse consistency and local fluency after context adaptive fusion.
[0125] In practice, after the large language model completes the autoregressive decoding of all sentence segments and outputs the translations of all sentence segments, a document-level consistency verification process is immediately triggered. First, the entity reference chain records in the global semantic state are used as the consistency benchmark. Then, the actual translations of the corresponding entities in each sentence segment are scanned sequentially. A character-level edit distance algorithm is used to calculate the edit distance between the actual translation and the corresponding reference chain translation of each entity in each sentence segment. The obtained edit distance is used as a character difference metric. The character difference metric is then normalized by dividing by the total length of the reference chain characters. The normalized result is used as the deviation value. Translation consistency is then constructed with each sentence segment as a row and each entity in the entity reference chain as a column. A deviation matrix is generated by filling the deviation values of each entity corresponding to each sentence segment into the corresponding positions in the matrix. Entities in the translation consistency deviation matrix whose deviation values exceed a preset deviation threshold are marked as translation conflict entities. The preset deviation threshold is a statistical threshold calculated by adding twice the standard deviation to the mean of the deviation values between the actual and standard translations of all sentence segments in the validation set, which includes document-level translation annotations. Simultaneously, the translations of each sentence segment are scanned. For existing entities recorded in the entity reference chain in the global semantic state, it is checked whether there are instances where a reference should exist but is missing in the actual translation in subsequent sentence segments. The locations of missing references are marked as reference breakpoints. Then, for translation conflict entities, an attention fusion method is used to... The local context semantic vector of the corresponding location is adaptively fused with the document topic vector in the global semantic state. Specifically, the local context semantic vector is used as the query vector, and the document topic vector is used as the key and value vectors. The dot product of the query vector and the key vector is calculated, and the resulting dot product is used as the attention score. The attention score is then subjected to sigmoid activation, and the activation result is used as the attention weight. The attention weight is then multiplied element-wise with the document topic vector, and the resulting product is used as the fused context enhancement vector. The fused context enhancement vector is then input into the translation model training phase through end-to-end backpropagation joint learning of the translation projection layer for linear transformation. The transformed result is used as the projection vector. The projection vector and the embedding vector of the entity's standard translation are weighted and summed with fusion weight and residual weight. The sum is used as the corrected translation embedding. The fusion weight is 0.7, and the residual weight is the difference between 1 and the fusion weight, which is 0.3. The fusion weight is the optimal value obtained by grid search based on the BLEU score of the discourse coherence evaluation index in the validation set containing discourse-level translation annotations, which is in the range of 0.5 to 0.9. Finally, the entities with translation conflicts are forced to replace according to the corrected translation embedding, and the reference link is completed at the reference break position according to the reference hierarchy and antecedent information in the global semantic state, so as to obtain the discourse-level consistent translation of each sentence segment.
[0126] In this embodiment, the forced replacement of entities with conflicting translations is performed according to the modified translation embedding, and the reference link is completed at the reference break position according to the reference hierarchy and antecedent pointing information in the global semantic state. The following steps can be used to obtain the text-level consistent translations of each sentence segment:
[0127] Using the modified translation embedding as a global consistency constraint, cross-attention recoding is performed on the local context semantic vector of each referential break position to generate a context-enhanced representation of the break position carrying the global translation constraint;
[0128] Extract the hierarchical sequence of references and antecedent information corresponding to the broken entity from the global semantic state, combine the context enhancement representation of the broken position, and deduce the reference form that should be filled in the broken position step by step through the conditional decoder to generate the complete reference sequence.
[0129] According to the modified translation embedding, the conflicting entities of each translation are forcibly replaced, and the completed referential sequence is filled into the corresponding referential break position. Cross-sentence coherence verification is performed on each sentence segment after replacement and completion, and the translated sentences segment with consistent chapter level is output.
[0130] It should be noted that the local context semantic vector representation described in this application is a vector representation obtained by bidirectional encoding of the word embeddings within a preset window range before and after each referential break position; the break position context enhancement representation refers to a vector representation carrying global translation constraints obtained by performing cross-attention recoding on the local context semantic vector with the modified translation embedding as a global consistency constraint; the complete referential sequence representation is a sequence of referential forms that should be filled into the referential break position obtained by step-by-step derivation through the conditional decoder.
[0131] In specific implementation, firstly, for each referential breakpoint, a local context window is constructed in the translated sentence segment, extending 5 words to the left and right from the breakpoint word. For each word within the local context window, the corresponding word embedding is retrieved from the word embedding table of the translation model. These word embeddings are then arranged in word order to form an embedding sequence. This embedding sequence is input into a bidirectional long short-term memory network (LSTM) obtained through end-to-end backpropagation joint learning during the translation model training phase for encoding. The hidden state output of the last time step of the LSM is used as the local context semantic vector. Secondly, the local context semantic vector is used as the query vector, and the corrected translation embedding is used as the key and value vectors. The dot product of the query vector and the key vector is calculated, and the resulting dot product is used as cross-attention. The cross-attention score is processed by softmax normalization, and the normalized result is used as the cross-attention weight. The cross-attention weight is then weighted and summed with the corrected translation embedding, and the sum is used as the global constraint context vector. The global constraint context vector is concatenated with the local context semantic vector. The concatenated vector is then input into the recoding projection layer obtained through end-to-end backpropagation joint learning during the translation model training phase for linear transformation. The transformed result is used as the context enhancement representation of the breakpoint. The recoding projection layer consists of two fully connected layers. The first fully connected layer has a 512-dimensional output dimension and uses the ReLU activation function. The output dimension of the second fully connected layer is the same as that of the local context semantic vector. The dimensions are consistent. Next, the break point node is located in the directed graph structure of the entity reference chain in the global semantic state. The node is backtracked level by level along the directed reference edge to the antecedent node. The identifier of each node passed on the backtracking path and its level depth relative to the antecedent node are recorded. The recorded results are used as the reference level sequence. At the same time, the direction encoding of the directed reference edge pointing from each node to the predecessor node on the backtracking path is recorded as the antecedent pointing information. The direction encoding is a binary encoding that encodes the forward reference as 0 and the back reference as 1. The embedded vectors of the context enhancement representation of the break point, the level depth of each level in the reference level sequence, and the embedded vectors of each direction encoding in the antecedent pointing information are concatenated. The concatenated vector is used as the conditional input vector. The conditional input vector is input into the translation. During the translation model training phase, a two-layer decoder based on the Transformer architecture, obtained through end-to-end backpropagation joint learning, serves as the conditional decoder. Each decoder layer contains a masked self-attention sublayer, a cross-attention sublayer, and a feedforward neural network sublayer. The masked self-attention sublayer performs autoregressive decoding using the conditional input vector as the query vector, key vector, and value vector. The cross-attention sublayer performs cross-attention calculation using the output of the masked self-attention sublayer as the query vector and the corrected translation embedding as the key vector and value vector. The feedforward neural network sublayer performs a nonlinear transformation on the output of the cross-attention sublayer. At each time step, the decoder outputs a lexical probability distribution, and the lexical with the highest probability value is selected as the referential lexical for the current time step.The pronouns output at each time step are concatenated, and the concatenation result is used as the complete pronoun sequence. Finally, the cosine similarity between the corrected translation embedding and the embeddings of each lexical in the translation model vocabulary is calculated. The lexical with the highest cosine similarity is used as the standard translation lexical. Lexicals at the corresponding positions of conflicting translation entities in each sentence segment are replaced with standard translation lexicals. The pronouns in the complete pronoun sequence are then sequentially filled into the empty lexical slots at the corresponding pronoun breaks. Cross-sentence coherence verification is performed on each sentence segment after replacement and completion, and discourse-level consistent sentence segment translations are output. Specifically, the replaced and completed sentence segment translations are input into the dependency syntax based on a graph neural network obtained through end-to-end backpropagation joint learning during the translation model training phase. The parser performs syntactic analysis, obtaining the segment dependency syntax tree for each segment's translation. For the preceding segment translation in an adjacent segment pair, it locates the leaf nodes corresponding to each named entity in the segment dependency syntax tree. From each leaf node, it ascends step by step along the dependency edges to the root node, recording the part-of-speech tags of each node traversed along the ascending path. The recorded tags are arranged in ascending order to form the node label sequence of the dependency path of each named entity's preceding segment. For the following segment translation in an adjacent segment pair, it locates the leaf nodes corresponding to each pronoun in the segment dependency syntax tree. From each leaf node, it ascends step by step along the dependency edges to the root node, recording the part-of-speech tags of each node traversed along the ascending path. The recorded tags are arranged in ascending order to form the node label sequence of each pronoun's preceding segment. For each pronoun node in the translated sentence segment of the preceding sentence, the longest common subsequence length between its dependency path node label sequence and the dependency path node label sequences of each named entity node in the translated sentence segment is calculated. This longest common subsequence length is divided by the length of the longer of the two paths, and the quotient is taken as the path matching degree of that pronoun node. The average path matching degree of all pronoun nodes in the translated sentence segment is taken as the segment dependency coherence of the current segment pair. Segment pairs with a dependency coherence lower than a preset coherence threshold are marked as segment pairs to be corrected. The translated sentence segment of the preceding sentence segment is used as the context for the translated sentence segment of the segment pair to be corrected. For the prefix, a preset paragraph separator is inserted between the context prefix and the source language text of the following sentence segment translation. The complete sequence after the paragraph separator is inserted is input into the translation model for autoregressive re-decoding. The re-decoded translation replaces the original following sentence segment translation. The re-decoded sentence segment translation is then re-input into the dependency parser for syntactic analysis. The updated sentence segment dependency parser tree is re-performed with dependency path matching calculation. The iteration count is incremented by one, and the above-mentioned sentence segment pair marking and re-decoding operations are repeated until the sentence segment pair dependency coherence of all adjacent sentence segment pairs is not lower than the preset coherence threshold or the iteration count reaches the preset maximum iteration count. The final sentence segment translations are then output as document-level consistent sentence segment translations.The preset coherence threshold is a statistical threshold calculated by subtracting twice the standard deviation from the mean of the dependency coherence of adjacent sentence-to-sentence pairs in the validation set, which includes document-level translation annotations. The preset maximum number of iterations is 3.
[0132] Therefore, this application demonstrates that after all sentence segments are translated, the translations of all sentence segments can be verified for discourse-level consistency based on the global semantic state, and translation conflicts and referential breaks caused by local context selection can be corrected. Firstly, by dividing the long text to be translated into multiple consecutive sentence segments, and extracting the discourse theme vector and entity referential chain as a global semantic state during the initial translation of the first sentence segment, an initial discourse state benchmark can be established for the entire translation process. This solidifies the theme context, key entities, and their referential relationships established at the beginning, providing a unified semantic reference anchor for the translation of all subsequent sentence segments, reducing the possibility of losing key information from the first sentence segment in subsequent translations. Secondly, when translating subsequent sentence segments, the global semantic state is appended to the input sequence as a prefix, enabling the large language model to synchronously receive the theme information and entity referential relationships accumulated in the preceding text during decoding. This breaks the limitation of independent decoding of each sentence segment in traditional segmented translation, allowing the model to directly utilize the explicitly injected discourse state information without relying on its implicit memory of distant contexts, which helps reduce pronoun pointing errors and other issues. The probability of inconsistencies in translation and topic shifts is assessed to ensure semantic coherence between the current sentence segment and the preceding text. Furthermore, after translating each sentence segment, newly added entities and referential relationships are appended to the global semantic state. Simultaneously, a time decay factor is applied to the historical text topic vectors. This dynamically updates the global semantic state, ensuring that subsequent sentence segments receive the latest text information and avoiding omissions of key new content. Time decay also balances global topic continuity and local contextual relevance, making the model focus more on recent topic contexts and reducing interference from outdated topic information, thus improving the fit between the translation and the current context. Finally, after all sentence segments are translated, a text-level consistency check is performed on the translations of all segments based on the global semantic state. Translation conflicts and referential breaks caused by local context selection are corrected. As a post-translation safeguard, this process identifies residual local consistency issues during segmented translation and makes targeted corrections, improving the consistency and coherence of the final translation from a holistic perspective and effectively mitigating semantic drift caused by segmented processing.
[0133] In summary, the technical solution adopted in this application can realize the continuous transmission of the semantic state of the text during the translation of long texts, thereby reducing the contextual semantic drift caused by segmentation processing.
[0134] Example 2
[0135] This application provides a machine translation optimization system based on a large language model, referencing...Figure 4 As shown in the figure, this is a modular structure diagram of a machine translation optimization system based on a large language model according to this embodiment of the present application. The machine translation optimization system includes:
[0136] The sentence segmentation module 100 is used to acquire the long text to be translated and divide the long text into multiple continuous sentence segments;
[0137] The state caching module 200 is used to perform initial translation on the first sentence segment. During the initial translation process, the chapter topic vector and entity reference chain of the first sentence segment are extracted, and the chapter topic vector and entity reference chain are cached together as a global semantic state.
[0138] The context injection module 300 is used to prepend the global semantic state to the input sequence of the current sentence segment when translating subsequent sentence segments, so that the large language model can synchronously receive the topic information and entity reference relationship in the global semantic state when decoding the current sentence segment;
[0139] The state update module 400 is used to add the newly added entities and their referential relationships in the current sentence segment to the global semantic state after each sentence segment is translated, and to apply a time decay factor to the historical chapter topic vector in the global semantic state.
[0140] The translation verification module 500 is used to perform discourse-level consistency verification on the translations of all sentence segments based on the global semantic state after all sentence segments have been translated, and to correct translation conflicts and reference breaks caused by local context selection.
[0141] refer to Figure 5 As shown in the figure, this is an application scenario diagram of the machine translation optimization method based on a large language model provided in this application. In the figure, the long document to be translated is used as the input text. After segmentation processing, it is divided into sentence segment 1, sentence segment 2, up to sentence segment N, and then input into the translation system sequentially. The translation system uses a large language model as the translation model and performs collaborative processing of the sentence segment content through a topic semantic channel and an entity perception channel. During the translation of the first sentence segment, the document topic vector and entity reference chain are extracted and compressed and stored in the global semantic state. As subsequent sentence segments are continuously translated, the global semantic state is incrementally updated according to the sentence segment translation process, so that subsequent sentence segments can utilize the topic semantic information and entity reference relationships accumulated by the previous sentence segments, thereby maintaining the translation names, reference relationships, and semantic coherence of different sentence segments. After all sentence segments are translated, the corresponding sentence segment translation and the complete translation are output. This method can be applied to long text translation scenarios such as cross-domain long documents, books and papers, news reports, policy contracts, and multilingual content localization.
[0142] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0143] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compactdisc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0144] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
Claims
1. A machine translation optimization method based on a large language model, characterized in that, Includes the following steps: Obtain the long text to be translated and divide it into multiple consecutive sentence segments; An initial translation is performed on the first sentence segment. During the initial translation process, the discourse topic vector and entity reference chain of the first sentence segment are extracted, and the discourse topic vector and entity reference chain are cached together as a global semantic state. When translating subsequent sentence segments, the global semantic state is appended as a prefix to the input sequence of the current sentence segment, so that the large language model can synchronously receive the topic information and entity reference relationship in the global semantic state when decoding the current sentence segment; After translating each sentence segment, the newly added entities and their referential relationships in the current sentence segment are added to the global semantic state, and a time decay factor is applied to the historical chapter topic vector in the global semantic state. After all sentence segments are translated, the translations of all sentence segments are checked for discourse-level consistency based on the global semantic state, and translation conflicts and reference breaks caused by local context selection are corrected.
2. The machine translation optimization method based on a large language model as described in claim 1, characterized in that, Dividing the long text into multiple consecutive sentence segments specifically includes: The long text is subjected to semantic coherence scanning to identify topic drift positions and generate a sequence of candidate segmentation points composed of the boundaries of continuous text segments. Traverse each candidate segment in the candidate segment sequence, detect whether there is an unclosed entity reference chain that crosses the candidate segment, and move the candidate segment to the reference closure position of the unclosed entity reference chain to obtain the adjusted segment sequence; The long text is segmented by adjusting the segmentation point sequence to obtain multiple consecutive sentence segments.
3. The machine translation optimization method based on a large language model as described in claim 1, characterized in that, An initial translation is performed on the first sentence segment. During the initial translation process, the discourse topic vector and entity reference chain of the first sentence segment are extracted. The discourse topic vector and the entity reference chain are cached together as a global semantic state. Specifically, this includes: When performing the initial translation of the first sentence segment, a dual-channel attention decoupling mechanism is adopted to separate the top-level hidden state of the decoder into a topic semantic channel and an entity perception channel, and extract the chapter topic vector of the first sentence segment from the topic semantic channel; Guided by the entity perception channel, the accessibility migration path of each entity reference in the first sentence segment translation is tracked synchronously, thereby constructing the entity reference chain of the first sentence segment, and marking the corresponding reference level and antecedent pointing information for each reference relationship in the entity reference chain. The chapter topic vector is embedded as a topic prototype and cross-channel interactive encoding is performed with each entity node in the entity reference chain to generate a joint representation of the differentiable index of entity reference relationship under topic anchoring; The joint representation is compressed into incrementally updatable neural memory units and stored in a global cache to obtain the global semantic state.
4. The machine translation optimization method based on a large language model as described in claim 3, characterized in that, When performing the initial translation of the first sentence segment, a dual-channel attention decoupling mechanism is adopted to separate the top-level hidden state of the decoder into a topic semantic channel and an entity perception channel. The specific extraction of the discourse topic vector of the first sentence segment from the topic semantic channel includes: When performing the initial translation on the first sentence segment, a bi-branch orthogonal projection operation is applied to the top-level hidden state of the large language model decoder, decomposing the top-level hidden state into a topic semantic channel and an entity perception channel, wherein the topic semantic channel encodes discourse coherence information and the entity perception channel encodes entity boundary information. A bidirectional mutual attention interaction is performed on the topic semantic channel and the entity perception channel, so that the topic semantic channel absorbs entity boundary constraints from the entity perception channel, and at the same time, the entity perception channel absorbs text context constraints from the topic semantic channel, resulting in an enhanced topic semantic channel. The topic activation values of each word position are extracted from the enhanced topic semantic channel, and weighted pooling is performed according to the semantic contribution of each word to the topic of the text to generate the topic vector of the first sentence segment.
5. The machine translation optimization method based on a large language model as described in claim 1, characterized in that, When translating subsequent sentence segments, the global semantic state is appended as a prefix to the input sequence of the current sentence segment, enabling the large language model to synchronously receive the topic information and entity reference relationships in the global semantic state when decoding the current sentence segment. Specifically, this includes: When translating subsequent sentence segments, the global semantic state is decoded and deconstructed into a discourse topic prefix vector and an entity reference chain prefix embedding. The discourse topic prefix vector carries the topic semantic information of the historical sentence segments, and the entity reference chain prefix embedding carries the structured encoding of the established entity reference relationship. Based on the passage distance between the current sentence segment and historical sentence segments, apply a time decay weight that is positively correlated with the passage distance to the passage topic prefix vector; The attenuated chapter topic prefix vector and the entity referential chain prefix embedding are concatenated according to semantic hierarchy to generate a global semantic prefix sequence with chapter awareness capability. The global semantic prefix sequence is concatenated to the beginning of the input sequence of the current sentence segment, so that in each step of the large language model performing autoregressive decoding on the current sentence segment, the topic information and entity referential relationships in the global semantic state are synchronously obtained through the attention interaction of the global semantic prefix sequence.
6. The machine translation optimization method based on a large language model as described in claim 5, characterized in that, The attenuated document topic prefix vector and the entity referential chain prefix embedding are concatenated at the semantic level to generate a global semantic prefix sequence with document awareness capabilities. Specifically, this includes: Using the decayed chapter topic prefix vector as a query sequence, multi-head cross-attention interaction is performed on the entity reference chain prefix embedding, so that each entity reference embedding is adaptively recoded according to its semantic fit with the chapter topic, generating topic-aware entity reference embedding. Apply recursive positional encoding based on the reference hierarchy to the topic-aware entity reference embedding, so that the entity reference embeddings at different reference levels carry the hierarchical structure information of their depth in the entity reference chain, and obtain hierarchically labeled entity reference embeddings. Using the decayed topic prefix vector as the sequence anchor, the hierarchical entity referential embeddings are mounted to the sequence anchor in order of increasing referential level. Learnable hierarchical transition embeddings are inserted between every two referential levels to generate a global semantic prefix sequence with discourse awareness.
7. The machine translation optimization method based on a large language model as described in claim 1, characterized in that, After translating each sentence segment, the newly added entities and their referential relationships in the current sentence segment are appended to the global semantic state, and a time decay factor is applied to the historical chapter topic vector in the global semantic state, specifically including: After translating each sentence segment, entity and referential relationships are extracted from the current sentence segment translation. The extraction results are semantically compatible with the entity reference chains in the global semantic state to identify newly added entities. The newly added entities are then recoded with topic awareness to align their embedded representation with the global semantic space. The newly added entities and their referential relationships after recoding are attached to the end of the entity referential chain of the global semantic state in the form of incremental nodes, and the affected existing entity referential chains are closed-fit alignment is performed to obtain the updated entity referential chain. A dual-path time decay is applied to the historical chapter topic vector in the global semantic state. The first path generates a basic time decay factor based on the sentence segment time interval and performs exponential decay, while the second path generates an adaptive time decay factor based on the topic drift detection result and performs corrective decay. The exponentially decayed base time decay factor and the modified decayed adaptive time decay factor are fused and applied to the historical chapter topic vector to obtain the decayed chapter topic vector, which is then encapsulated together with the updated entity reference chain into the updated global semantic state.
8. The machine translation optimization method based on a large language model as described in claim 7, characterized in that, The extraction results are semantically compatible with the entity reference chains in the global semantic state to identify newly added entities. The newly added entities are then re-encoded with a topic awareness to align their embedded representation with the global semantic space. Specifically, this includes: The embedding representations of each candidate entity in the extraction results and the existing entity embeddings of the entity reference chains in the global semantic state are respectively input into the dual-tower semantic comparison model to calculate the semantic compatibility between each candidate entity and the existing entity reference chains. Candidate entities with semantic compatibility scores below a preset compatibility threshold are marked as new entities, and candidate entities with semantic compatibility scores above a preset compatibility threshold are merged with their corresponding existing entities through referential link merging. Using the chapter topic vector in the global semantic state as the alignment anchor, the embedded representation of the newly added entity is subjected to topic-aware projection transformation, so that it is aligned with the global semantic space while maintaining the semantic independence of the entity.
9. The machine translation optimization method based on a large language model as described in claim 1, characterized in that, After all sentence segments are translated, a discourse-level consistency check is performed on the translations of all sentence segments based on the global semantic state, and translation conflicts and referential breaks caused by local context selection are corrected, specifically including: After all sentence segments are translated, the entity reference chain records in the global semantic state are used as the consistency benchmark. The actual translations of the corresponding entities in each sentence segment are scanned sequentially to construct a translation consistency deviation matrix and mark the entities with translation conflicts and reference breaks. For the entity with the translation conflict, the local context semantic vector at the corresponding position is fused with the chapter topic vector in the global semantic state to generate a corrected translation embedding that combines chapter consistency and local fluency. According to the modified translation embedding, the entity with translation conflict is forced to be replaced, and the reference link is completed at the reference break position according to the reference hierarchy and antecedent pointing information in the global semantic state, so as to obtain the translation of each sentence segment that is consistent at the chapter level.
10. A machine translation optimization system based on a large language model, used to execute a machine translation optimization method based on a large language model as described in any one of claims 1 to 9, characterized in that, The machine translation optimization system includes: The sentence segmentation module is used to obtain the long text to be translated and divide the long text into multiple continuous sentence segments; The state caching module is used to perform initial translation on the first sentence segment. During the initial translation process, the chapter topic vector and entity reference chain of the first sentence segment are extracted, and the chapter topic vector and entity reference chain are cached together as the global semantic state. The context injection module is used to prepend the global semantic state to the input sequence of the current sentence segment when translating subsequent sentence segments, so that the large language model can synchronously receive the topic information and entity reference relationship in the global semantic state when decoding the current sentence segment; The state update module is used to add the newly added entities and their referential relationships in the current sentence segment to the global semantic state after each sentence segment is translated, and to apply a time decay factor to the historical chapter topic vector in the global semantic state. The translation verification module is used to perform discourse-level consistency verification on the translations of all sentence segments based on the global semantic state after all sentence segments have been translated, and to correct translation conflicts and reference breaks caused by local context selection.