A large language model machine translation optimization method and system
By identifying and optimizing the large language model for common errors, generating preliminary translations and performing word segmentation, calculating common error scores and translation status, constructing prompt templates and performing low-rank adaptive training, the problem of unstable translation quality in large language models when processing texts with common errors is solved, thus improving translation quality and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU UNIV
- Filing Date
- 2026-01-26
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies lack automated methods for identifying source-end error-prone words and targeted translation optimization schemes, resulting in unstable translation quality and low-quality translations when large language models process texts containing source-end error-prone words.
A preliminary translation is generated by traversing the bilingual corpus, word segmentation is performed, and error-prone word scores are calculated to determine the translation status and error rate. Candidate examples are selected to construct prompt templates, and the large language model is optimized by low-rank adaptive training using the training set.
It improves translation quality and efficiency, enhances interpretability and flexibility, adapts to complex translation tasks, and is applicable to a wide range of scenarios, especially showing good adaptability to language pairs with significant structural differences, such as Chinese-English and Chinese-Spanish.
Smart Images

Figure CN121562641B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine translation technology, and in particular to a method and system for optimizing machine translation using a large language model. Background Technology
[0002] Machine translation technology, as a core support for cross-language information exchange, has significant application value in globalized scenarios. In recent years, machine translation technology based on Large Language Models (LLMs) has made groundbreaking progress. Compared with traditional neural machine translation (NMT) technology that relies on parallel corpora, LLMs, through pre-training and in-context learning (ICL) mechanisms, can achieve high-quality translation under conditions of few or even zero samples. This not only improves the fluency and generalization ability of the translated text, but its translation performance has also approached or surpassed the level of traditional NMT systems and commercial translation systems, injecting new impetus into the development of the field of machine translation.
[0003] Although large language model-driven machine translation systems possess relatively reliable empirical distributions and maintain high translation accuracy in most common translation scenarios, their translation quality remains unstable in practical applications, especially when dealing with specific source vocabulary, which can easily lead to low-quality translations. Specifically, culturally specific expressions of terminology, metaphorical expressions, and core vocabulary corresponding to complex sentence structures in source vocabulary can all easily lead to a decline in the translation quality of large language models. Identifying and processing these source vocabulary words that are prone to translation errors (hereinafter referred to as error-prone words) is crucial for improving the translation performance of large language models: on the one hand, these error-prone words are core indicators of potential translation difficulties and are also the main cause of low-quality translations; on the other hand, targeted optimization of error-prone words can effectively improve the stability and overall performance of large language model translation. However, currently, the identification of error-prone words mainly relies on manual methods, which not only consumes a lot of manpower and time but also has low identification efficiency, making it difficult to meet the large-scale needs of the widespread application scenarios of large language models. Therefore, an automated method for error-prone word identification and optimization is urgently needed.
[0004] Currently, existing optimization schemes for improving the translation quality of large language models mainly fall into two categories: The first category is optimization schemes during the inference stage. These schemes utilize the context learning capabilities of large language models by designing specific prompt texts, enabling the model to learn hidden translation patterns within these prompts and thus complete the translation task. The second category is optimization schemes during the training stage. These schemes fine-tune the large language model using parallel corpora. A typical example is ALMA, which first performs initial fine-tuning based on monolingual data and then further optimizes using high-quality parallel data. The existing technology ALMA-R further introduces the Contrast Preference Optimization (CPO) strategy to fine-tune the model using LoRA. Although both types of optimization schemes can improve the translation quality of large language models to some extent, existing technologies have not conducted systematic research on the core problem of "low-quality translation caused by source-end misspellings." They lack effective means of identifying source-end misspellings and have not proposed targeted optimization schemes for them. As a result, large language models still cannot effectively avoid translation errors when processing texts containing source-end misspellings, making it difficult to guarantee the stability of translation quality. Summary of the Invention
[0005] Therefore, the technical problem to be solved by the present invention is to overcome the shortcomings of the existing technology, which lacks automatic identification methods for source-end error-prone words and has no corresponding targeted translation optimization schemes, resulting in unstable translation quality and low-quality translations when large language models process texts containing source-end error-prone words.
[0006] Firstly, to address the aforementioned technical problems, this invention provides a method for optimizing machine translation using a large language model, comprising:
[0007] Traverse the bilingual corpus and generate the corresponding first translation for the source sentences in the bilingual corpus;
[0008] The source sentence is segmented into multiple words; the frequency of occurrence of common words in each segment is counted, and the common word score of each common word is calculated. A set of common words is obtained based on the common word score.
[0009] The first translation is compared with the reference translation in the bilingual corpus to obtain the comparison result; the translation status of each error-prone word in the error-prone word set in the generated translation is determined based on the comparison result; based on the translation status, the error information in the first translation is located, and the translation error rate of each error-prone word in the error-prone word set is calculated.
[0010] Calculate the semantic similarity between the sentence to be translated and multiple candidate examples in a pre-set sentence database, and calculate the quality score of the multiple candidate examples in the pre-set sentence database; based on the semantic similarity and the quality score, select the optimal candidate example from the multiple candidate examples in the pre-set sentence database. Candidate examples;
[0011] The optimal The candidate examples are constructed as prompt templates, and the prompt templates and the sentence to be translated are input into the large language model;
[0012] Based on the error-prone word score, training sentence pairs are obtained from the bilingual corpus; the training sentence pairs are ranked according to their translation status and translation error rate to obtain a ranking result; and a training set is selected based on the ranking result.
[0013] The large language model is trained using the training set to achieve low-rank adaptation, resulting in an optimized large language model.
[0014] In one embodiment of the present invention, the steps of counting the occurrence frequency of easily misspelled words in each word segmentation, calculating the easily misspelled word score of the easily misspelled words, and obtaining the easily misspelled word set based on the easily misspelled word score are as follows:
[0015] Obtain the average evaluation score of the first translation containing the error-prone words;
[0016] Based on the frequency of occurrence and the average evaluation score, calculate the error-prone word score for the error-prone words;
[0017] The word segmentation is filtered based on the error-prone word score, preset frequency threshold, and preset quality degradation threshold to obtain an error-prone word set.
[0018] In one embodiment of the present invention, the expression for calculating the error-prone word score is:
[0019] ;
[0020] in, This indicates words that are easily confused. Indicates the score for commonly misspelled words. This represents the overall average evaluation score. This represents the average assessment score. Indicates the frequency of occurrence of commonly misspelled words.
[0021] In one embodiment of the present invention, the optimal example is selected from multiple candidate examples in the preset sentence database based on the semantic similarity and the quality score. The steps for selecting candidate examples are as follows:
[0022] Based on the semantic similarity and the quality score, a comprehensive score is calculated for each candidate example in the preset sentence database; wherein, the expression for the comprehensive score is:
[0023] ;
[0024] in, This indicates the overall score. Indicates quality score. Indicates semantic similarity; and Indicates the weighting parameter;
[0025] Based on the comprehensive score, the optimal example is selected from multiple candidate examples in the preset sentence database. Candidate examples.
[0026] In one embodiment of the present invention, calculating the semantic similarity between the sentence to be translated and multiple candidate examples in a preset sentence database includes calculating the lexical similarity between the sentence to be translated and the multiple candidate examples; and calculating the semantic similarity at the sentence level to be translated.
[0027] In one embodiment of the present invention, the step of obtaining training sentence pairs from the bilingual corpus based on the error-prone word score is as follows:
[0028] Calculate the sampling weights based on the scores of the commonly misspelled words;
[0029] The number of samples to be allocated is calculated based on the sampling weights; wherein the formula for calculating the number of samples to be allocated is:
[0030] ;
[0031] in, Indicates the number of samples to be allocated. This represents the total number of sampled sentences. Indicates the sampling weight. Indicates words that are easily confused;
[0032] Training sentence pairs are obtained from the bilingual corpus according to the allocated sampling quantity.
[0033] In one embodiment of the present invention, the formula for calculating the sampling weight is:
[0034] ;
[0035] in, Indicates the sampling weight. Indicates the score for commonly misspelled words. This indicates words that are easily confused. This represents a set of words that are prone to being misspelled.
[0036] In one embodiment of the present invention, the low-rank adaptation training of the large language model using the training set specifically involves: performing low-rank adaptation training on the attention layer and feedforward layer of the large language model, wherein the parameter update expression in the low-rank adaptation training is:
[0037] ;
[0038] in, This indicates updating the parameter weight matrix. Represents the original weights. Represents an ascending matrix. This represents the descent matrix.
[0039] In one embodiment of the present invention, the process of determining the translation status of each error-prone word in the set of error-prone words in the generated translation based on the comparison result includes: if the comparison result shows that the current error-prone word has a corresponding phrase in the first translation, then the text overlap between the corresponding phrase and the incorrect phrase is calculated; if the text overlap is greater than a preset threshold, then the translation status of the current error-prone word in the generated translation is determined to be an incorrect translation.
[0040] Secondly, to solve the above-mentioned technical problems, the present invention provides a large language model machine translation optimization system, comprising:
[0041] The translation generation module is used to traverse the bilingual corpus and generate a corresponding first translation for the source sentences in the bilingual corpus.
[0042] The error-prone word set construction module is used to perform word segmentation on the source sentence to obtain multiple word segments; count the occurrence frequency of error-prone words in each word segment, calculate the error-prone word score of each error-prone word, and obtain the error-prone word set based on the error-prone word score;
[0043] The translation error rate acquisition module is used to compare the first translation with the reference translation in the bilingual corpus to obtain a comparison result; determine the translation status of each error-prone word in the error-prone word set in the generated translation based on the comparison result; locate the error information in the first translation based on the translation status, and calculate the translation error rate of each error-prone word in the error-prone word set.
[0044] The prompt template construction module is used to calculate the semantic similarity between the sentence to be translated and multiple candidate examples in a preset sentence library, and to calculate the quality score of the multiple candidate examples in the preset sentence library; based on the semantic similarity and the quality score, the optimal example is selected from the multiple candidate examples in the preset sentence library. Candidate examples; the optimal one The candidate examples are constructed as prompt templates, and the prompt templates and the sentence to be translated are input into the large language model;
[0045] The training set filtering module is used to obtain training sentence pairs from the bilingual corpus based on the error-prone word scores; to sort the training sentence pairs by quality based on the translation status and the translation error rate to obtain a sorting result; and to filter out the training set based on the sorting result.
[0046] An optimization module is used to perform low-rank adaptation training on the large language model using the training set to obtain an optimized large language model.
[0047] Compared with the prior art, the above-described technical solution of the present invention has the following advantages:
[0048] This invention discloses a large language model machine translation optimization method and system, which improves translation quality and efficiency. First, it traverses a bilingual corpus and generates preliminary translations, laying the foundation for subsequent optimization. Next, it segments the source sentences, calculates error-prone word scores, accurately locates error-prone words, and identifies the core causes of translation quality defects, facilitating understanding and maintenance by technical personnel and enhancing the interpretability of the translation. By comparing the preliminary translation with reference translations, it determines the translation status of error-prone words and calculates the error rate, accurately correcting problems and thus improving translation quality. Furthermore, it calculates the semantic similarity and quality scores between the sentence to be translated and candidate examples in a pre-set sentence database, selecting the optimal example to construct a prompt template, enriching translation reference resources and improving translation diversity and flexibility. Finally, it uses a quality-ranked training set to perform low-rank adaptive training on the large language model, further optimizing the model to better handle complex translation tasks. This invention improves the translation quality and stability of machine translation using large language models by accurately detecting and optimizing source-end error-prone words. It does not rely on large-scale additional parallel corpora, effectively improving resource utilization efficiency. It has good adaptability to language pairs with large structural differences (such as Chinese-English, Chinese-Spanish, etc.) and is applicable to a wide range of scenarios. Attached Figure Description
[0049] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings.
[0050] Figure 1 This is a flowchart of a machine translation optimization method for a large language model according to a preferred embodiment of the present invention;
[0051] Figure 2 This is an architecture diagram of a machine translation optimization method for a large language model according to a preferred embodiment of the present invention;
[0052] Figure 3 This is a distribution diagram of the mistranslation rate and omission rate of the Llama2 model in a preferred embodiment of the present invention;
[0053] Figure 4 This is a distribution diagram of the mistranslation rate and omission rate of the Llama3 model in a preferred embodiment of the present invention;
[0054] Figure 5 This is a bar chart comparing the dependency depth distribution in the syntax complexity of error-prone words in a preferred embodiment of the present invention.
[0055] Figure 6 This is a bar chart comparing the average sentence length in the syntactic complexity of error-prone words in a preferred embodiment of the present invention.
[0056] Figure 7 This is a bar chart comparing the distribution of dependency arc span in the syntax complexity of error-prone words in a preferred embodiment of the present invention.
[0057] Figure 8 This is a bar chart comparing the proportion of clauses in the syntactic complexity of error-prone words in a preferred embodiment of the present invention.
[0058] Figure 9 This is a part-of-speech distribution diagram of the Llama3 model in a preferred embodiment of the present invention;
[0059] Figure 10 This is a part-of-speech distribution diagram of the Llama2 model in a preferred embodiment of the present invention. Detailed Implementation
[0060] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.
[0061] Example 1:
[0062] Reference Figures 1 to 2 As shown, this embodiment of the invention provides a machine translation optimization method for large language models, including but not limited to the following steps:
[0063] S1. Traverse the bilingual corpus and generate the corresponding first translation for the source sentences in the bilingual corpus;
[0064] S2. Perform word segmentation on the source sentence to obtain multiple word segments; count the number of times common words appear in each word segment, calculate the common word score of the common words, and obtain a set of common words based on the common word scores;
[0065] S3. Compare the first translation with the reference translation in the bilingual corpus to obtain the comparison results; determine the translation status of each error-prone word in the error-prone word set in the generated translation based on the comparison results; locate the error information in the first translation based on the translation status, and calculate the translation error rate of each error-prone word in the error-prone word set.
[0066] S4. Calculate the semantic similarity between the sentence to be translated and multiple candidate examples in the preset sentence database, and calculate the quality score of multiple candidate examples in the preset sentence database; based on semantic similarity and quality score, select the optimal candidate example from multiple candidate examples in the preset sentence database. Candidate examples;
[0067] S5, Optimal Each candidate example is constructed as a prompt template, and the prompt template and the sentence to be translated are input into the large language model.
[0068] S6. Based on the scoring of common misspelled words, obtain training sentence pairs from the bilingual corpus; rank the training sentence pairs according to translation status and translation error rate to obtain the ranking results; select the training set based on the ranking results.
[0069] S7. Use the training set to perform low-rank adaptation training on the large language model to obtain an optimized large language model.
[0070] This invention presents a large language model machine translation optimization method that improves translation quality and optimizes the translation process efficiently. First, by traversing the bilingual corpus and performing preliminary translation of the source sentences, a first translation is generated, providing a foundation for subsequent optimization. Next, the source sentences are segmented and error-prone word scores are calculated to accurately locate these words. This not only helps to avoid common errors in advance during translation but also clearly identifies the core causes of translation quality defects (error-prone words in the source sentences), facilitating understanding and maintenance by technical personnel and thus providing strong interpretability. By comparing the first translation with a reference translation, the translation status of error-prone words is further determined, and the translation error rate is statistically analyzed. This process accurately identifies and corrects problems in translation, ensuring a steady improvement in translation quality. Furthermore, the semantic similarity and quality scores of the sentence to be translated with candidate examples in a pre-set sentence database are calculated, and the optimal candidate example is selected as a prompt template. This not only enriches the reference resources for translation but also improves the diversity and flexibility of the translation process. Finally, the large language model is subjected to low-rank adaptive training using a quality-ranked and filtered training set, resulting in an optimized large language model. This process further enhances the model's translation capabilities and adaptability, enabling it to better handle various complex translation tasks. The method described in this embodiment of the invention, through accurate detection and targeted optimization of source-end error-prone words, not only improves the translation quality and stability of the large language model machine translation but also possesses strong interpretability, facilitating understanding and maintenance by technical personnel. Furthermore, the method described in this embodiment of the invention does not rely on a large-scale additional parallel corpus, effectively improving resource utilization efficiency, and exhibits good adaptability to language pairs with significant structural differences (such as Chinese-English and Chinese-Spanish), making it applicable to a wider range of scenarios.
[0071] Specifically, in step S1, a large-scale bilingual corpus is traversed, and a first translation is generated using a large language model (such as Llama2-7B or Llama3.1-8B). In this embodiment, COMET is preferably used as the quality score. In this embodiment of the invention, the large language model can also be referred to as a translation model.
[0072] Specifically, in step S2, the frequency of occurrence of easily misspelled words in each word segment is counted, and the easily misspelled word score is calculated. The specific steps for obtaining the set of easily misspelled words based on the easily misspelled word scores are as follows:
[0073] S210. Obtain the average evaluation score (also known as the average COMET score) of the first translation containing the most frequently misspelled words.
[0074] It should be noted that the error-prone words (or simply error-prone words) referred to in the embodiments of this invention do not mean that the model will definitely make mistakes when translating these words. Rather, they refer to words that, when appearing in the source language sentence, will significantly increase the probability of translation errors for the entire sentence. The characteristics of these error-prone words include: sentences containing the word have an average translation quality significantly lower than the overall average; the word has a certain frequency of occurrence in the corpus; and the negative impact of the word on translation quality is statistically significant.
[0075] S220. Calculate the error-prone word score based on the frequency of occurrence and the average evaluation score; the expression used to calculate the error-prone word score is:
[0076] ;
[0077] in, This indicates words that are easily confused. Indicates the score for commonly misspelled words. This represents the overall average evaluation score. This includes commonly misspelled words. The average score of the sentences, This indicates the frequency of occurrence of commonly misspelled words. The score takes into account both quality differences and frequency of occurrence; a higher score indicates a greater negative impact of the word on translation quality.
[0078] S230, Scoring based on frequently misspelled words, preset frequency threshold and preset quality degradation threshold The word segmentation is filtered to obtain a set of easily misspelled words. .
[0079] For example, a preset frequency threshold is used. Defined as the minimum occurrence threshold, with a preset quality degradation threshold. Defined as a quality difference threshold, for different combinations of thresholds ( ∈{20,50,100}, A comparative analysis was conducted using parameters ∈{0.03,0.05,0.07} to examine the impact of these parameters on the identification results of error-prone words. The experiment found that as... As the number of errors increased, the number of error-prone words selected gradually decreased, but their correlation with low-quality translation samples significantly increased. To balance the coverage of error-prone words with their correlation with translation quality, the final selection was... =50、 =0.05 was used as the balancing scheme. Under this parameter combination, the Pearson correlation coefficient between the set of error-prone words and the overall translation quality reached -0.26, showing good correlation and coverage.
[0080] Furthermore, an exemplary step is given for step S2, specifically as follows:
[0081] First, initialize a vocabulary statistics dictionary. Used to record statistical information for each word.
[0082] Secondly, iterate through each sentence pair in the large-scale bilingual corpus. This includes: using translation models to analyze source sentences. The translation was performed, resulting in the first translation. Use quality assessment tools (such as COMET) to calculate the first translation. Compared with the reference translation COMET scores between Use a word segmenter to process the source sentence Perform word segmentation to obtain the segmentation results. For word segmentation results Each word in Update the dictionary List the score and frequency of occurrence of the word.
[0083] Then, calculate the global average evaluation score. .
[0084] Finally, traverse the dictionary. Each word in This includes: calculating the word Average assessment score and the number of times it appears If the number of times the word appears Not less than the preset frequency threshold And the average evaluation score of the word Less than the global average evaluation score Compared with the preset quality degradation threshold The difference between them (i.e.) - If a word is found to be a misspelled word, then add that word to the set of easily confused words. Chinese; up to the dictionary Commonly Misspelled Words After all iterations are completed, the final set of common misspellings is obtained. .
[0085] Step S2 is designed to accurately identify keywords that affect translation quality. By segmenting the source sentence and calculating scores for error-prone words, this step effectively identifies words that are prone to errors during translation, thus providing a clear direction and basis for subsequent translation optimization.
[0086] Specifically, in step S3, a word alignment model (such as Awesome-Align) is used to compare the first translation with the reference translation in the bilingual corpus to obtain the comparison results. Based on the comparison results, a set of error-prone words is determined. The translation status of each error-prone word in the generated translation includes various states such as correct translation, mistranslation, and omission. The specific steps are as follows:
[0087] S310. Phrase Alignment Extraction. Using a word alignment model, the corresponding target phrases are found in the reference translations of the first translation and the bilingual corpus, and labeled as follows: and .
[0088] S320. Use the XCOMET (eXplainable COMET, abbreviated as XCOMET) tool to perform error analysis on the first translation. It can accurately locate erroneous phrases in the translation and output their specific locations and contents, marking them as... .
[0089] S330, Attribution Logic Judgment. Based on the information extracted in steps S310 and S320, the following rules are designed for judgment:
[0090] If the currently misused word has a corresponding phrase in the first translation (i.e.) If not empty, then calculate Error phrases detected by the model The degree of text overlap between the texts. If the text overlap is greater than a preset threshold, meaning there is any overlap between the texts... and If there is a high degree of overlap, it is determined that the easily confused word has been mistranslated in this sentence.
[0091] If a common mispronunciation does not have a corresponding phrase in machine translation ( If it is empty, then further check its correspondence in the reference translation. If the corresponding phrase exists in the reference translation ( (Not empty), which indicates that the word needs to be translated in the current context, therefore it is determined that it was omitted from translation.
[0092] S340. Using the COMET-KIWI professional tool, based on the current translation status, locate the error information in the first translation, and count the mistranslation rate, omission rate and their distribution to provide data support for subsequent optimization.
[0093] Steps S310 to S340 can be used to calculate the mistranslation rate and omission rate of each seriously misspellable word in the sample, thereby quantitatively determining the extent to which it is the direct cause of low-quality translation.
[0094] Furthermore, the specific process of quantifying the similarity between the aligned phrase (step S310) and the erroneous segment (step S320) and calculating the overlap is as follows: The two texts to be compared (such as corresponding phrases and erroneous phrases) undergo unified lowercase and necessary normalization processing, and are marked as... and ; Retrieve the set of matching blocks, marked as:
[0095] ;
[0096] in, This represents the set of matching blocks obtained at the character level. Indicates the first A matching block in the text The starting position, Indicates the first A matching block in the text The starting position, Indicates the first The length of each matching block, Indicates the total number of matched blocks. Defines the total number of matched characters. The expression is:
[0097] .
[0098] Therefore, the overlap (similarity) between two text segments is defined as:
[0099] ;
[0100] in, Representing text Length, This indicates the length of the text t.
[0101] Furthermore, this embodiment of the invention conducts experimental analysis on two large language models, Llama2 and Llama3, in two translation directions: Arabic to English (Ar→En) and Chinese to English (Zh→En). During the experiments, thresholds were set. (like This is used to determine the similarity between two text segments. Whether the standard of high overlap was met. The experimental results are shown in Table 1, which displays the number of seriously mistranslated words with a mistranslation rate or omission rate exceeding 30% and their proportion in their respective sets. Furthermore, the mistranslation / omission rate distribution of each language direction and model can be found by referring to... Figures 3 to 4 As shown.
[0102] Table 1:
[0103]
[0104] Furthermore, following step S340, syntactic complexity analysis and semantic ambiguity analysis are also included. Syntactic complexity analysis employs dependency parsing, while semantic ambiguity analysis utilizes WordNet or OpenHowNet resources. The metrics for dependency parsing include average dependency depth, average sentence length, average dependency arc span, and subordinate clause ratio. Specific analysis results can be found in [reference needed]. Figures 5 to 8 As shown. In this embodiment, by combining dependency parsing with the semantic resources of WordNet / OpenHowNet, a more in-depth analysis of syntactic complexity and semantic polysemy can be achieved. This comprehensive analysis method enhances the understanding and handling of translation challenges, thereby contributing to improved accuracy and naturalness of the translation.
[0105] Furthermore, to achieve automated annotation, the GLM-4.5 model was used for part-of-speech tagging, and a two-layer part-of-speech classification system was designed to further improve the ability to identify and correct translation errors. The two-layer part-of-speech classification system is as follows:
[0106] The first layer (priority categories) includes task-related categories such as modal particles, terms, symbols, non-source words, and polysemous words, which are used to capture linguistic phenomena directly related to translation difficulties.
[0107] The second layer (standard category): When a word does not belong to any priority category, it is then assigned a regular part-of-speech label (such as noun, verb, adjective, etc.).
[0108] By guiding the GLM-4.5 model through prompting, it strictly adheres to the aforementioned two-layer logic, thereby obtaining structured part-of-speech tags for critically error-prone words, as referenced. Figures 9 to 10 As shown. Figures 9 to 10 It shows its overall distribution. According to Figures 9 to 10 An analysis of the part-of-speech distribution of seriously misused words yielded the following conclusions:
[0109] Nouns accounted for the highest proportion across all language directions and models. However, this phenomenon does not necessarily mean that nouns themselves are more prone to mistranslation. Given that nouns have the highest frequency in natural language, their high proportion is more likely to reflect the influence of the overall word frequency distribution rather than a defect in a specific translation mechanism.
[0110] Different language directions exhibit unique error patterns: In the Chinese-to-English translation task, polysemous words are the second largest source of errors after nouns, highlighting that word meaning disambiguation is the core bottleneck of this language direction; while in the Arabic-to-English translation task, the proportion of errors is relatively high for symbols and non-source words, with the latter accounting for a higher proportion, reflecting the model's insufficient robustness in handling code-switching or foreign word mixing in the source text.
[0111] In this embodiment, step S3, through causal mechanism judgment of error-prone words, reveals that most error-prone words are not the direct source of translation errors, but rather indicators of complex translation structures. These error-prone words often reflect potential syntactic, semantic, or pragmatic problems in the translation process, and their existence suggests the complexity and potential risks of the translation structure. Therefore, in-depth analysis of these error-prone words can better understand the root causes of translation errors, thereby enabling targeted optimization measures to improve the accuracy and stability of translation.
[0112] Specifically, although causal analysis shows that most error-prone words are not direct sources of errors, but rather indicators of complex translation challenges, the specific types of translation problems these indicators foreshadow still require systematic empirical analysis. To this end, this invention employs a large-scale sample-based error type distribution analysis to establish a quantitative correlation between error-prone words of specific parts of speech and specific translation error patterns, thereby providing refined guidance for targeted optimization strategies. For the Llama2-7B and Llama3.1-8B models in the Chinese-English translation direction, a systematic error type analysis was conducted on all identified severely error-prone words. The specific process is as follows:
[0113] Step 1: Sample extraction. For each seriously misspellable word, extract up to 30 sentence pairs containing the word from the corresponding translation corpus to ensure the representativeness and statistical reliability of the analysis.
[0114] Step 2: Error Classification and Labeling. The GLM-4.5 model is used as the automatic labeler. Referring to the Multidimensional Quality Metrics (MQM) error classification system, error analysis is performed on the machine translation of each sentence pair. The model is required to identify and classify the most serious translation errors in the sentences, including but not limited to: accuracy errors (including mistranslation, omission, addition, and no translation); fluency errors (including grammatical errors, word order errors, and character encoding errors); terminology errors (including mistranslation of terminology); style errors (including inappropriate register); and localization errors (including date / time / number / currency formatting).
[0115] Step 3: Distribution statistics. Based on the annotation results, calculate the proportion distribution of each error type for each error-prone word in all its samples to form an error type profile for that word.
[0116] Step 4: Aggregation analysis. Individual error-prone words are aggregated according to part-of-speech category, and the association strength between different part-of-speech categories and each error type is calculated, using the log odds ratio (log OR) as a quantitative indicator. To reveal the systematic association pattern between part-of-speech and error type, a statistical analysis framework based on a 2×2 contingency table is constructed. For a given part-of-speech c and error type e, let... 'b' represents the weighted frequency of this error type in the part of speech, 'b' represents the weighted frequency of this error type in other parts of speech, and 'c' represents the weighted frequency of this error type in other parts of speech. The expression for calculating the log-dominance ratio is:
[0117] ;
[0118] In this context, log OR > 0 indicates a positive association, log OR < 0 indicates a negative association, and the magnitude of |log OR| reflects the strength of the association.
[0119] Specifically, in step S4, the semantic similarity between the sentence to be translated and multiple candidate examples in the pre-set sentence database is calculated using the BGE (Bilingual General Embedding) model. Simultaneously, the COMET-ref-free tool is used to score the quality of these candidate examples. This combined approach allows for a more accurate assessment of the matching degree between candidate examples and the sentence to be translated, as well as their translation quality, thus providing a more reliable reference for subsequent translation optimization.
[0120] Furthermore, calculating the semantic similarity between the sentence to be translated and multiple candidate examples in the pre-defined sentence database includes calculating the lexical similarity between the sentence to be translated and multiple candidate examples; and calculating the semantic similarity at the sentence level to be translated.
[0121] Furthermore, based on semantic similarity and quality scores, the optimal example is selected from multiple candidate examples in the pre-set sentence database. The specific steps for selecting candidate examples are as follows:
[0122] S410. In this embodiment, a hybrid scoring strategy is adopted, that is, a comprehensive score is calculated for each candidate example in the preset sentence database based on semantic similarity and quality scores. The expression for the comprehensive score is:
[0123] ;
[0124] in, This indicates the overall score. Indicates quality score. Indicates semantic similarity; and This represents the weighting parameter.
[0125] S420. Based on the comprehensive score, select the optimal example from multiple candidate examples in the preset sentence database. Candidate examples.
[0126] Specifically, in step S5, the k best candidate examples selected in step S4 are used to construct ICL (In-Context Learning) prompt templates to guide the large language model in accurate translation. This design can effectively improve the translation quality of sentences containing error-prone words, ensuring the accuracy and reliability of the translation results.
[0127] Specifically, in step S6, the steps for obtaining training sentence pairs from the bilingual corpus based on the error-prone word score are as follows:
[0128] S610. Calculate the sampling weight based on the scores of frequently misspelled words; the formula for calculating the sampling weight is as follows:
[0129] ;
[0130] in, Indicates the sampling weight. Indicates the score for commonly misspelled words. This indicates words that are easily confused. This represents a set of commonly misspelled words. This represents the most frequently misspelled words in the set of easily misspelled words. In this embodiment of the invention, it is used... Smoothing can prevent high-scoring words from having an excessively high proportion during the sampling phase. Furthermore, regarding sampling weights... The relationship that satisfies this is:
[0131] .
[0132] The proportion of each error-prone word in the fine-tuned corpus can be obtained by using the above sampling weights.
[0133] S620. Based on the sampling weights, allocate the number of sentence pairs to be extracted, i.e., calculate the allocated sampling quantity. The formula for calculating the allocated sampling quantity is as follows:
[0134] ;
[0135] in, Indicates the number of samples to be allocated. This represents the total number of sampled sentences. Indicates the sampling weight. This indicates words that are easily confused.
[0136] S630. Obtain training sentence pairs from the bilingual corpus according to the allocated sampling quantity.
[0137] Furthermore, all words containing common misspellings were retrieved from the original bilingual corpus. A set of sentence pairs, and randomly select from them. Sample 1. If there are insufficient corresponding sentence pairs for certain easily confused words, they can be supplemented in the following way:
[0138] Method 1: Prioritize supplementing with easily confused words Pairs of words with similar meanings;
[0139] Method 2: Supplement with sentence pairs that have the same syntactic structure or the same domain characteristics.
[0140] S640. The training sentence pairs are ranked according to their translation status and translation error rate to obtain the ranking results, and then a high-quality training set is constructed.
[0141] For example, for each misspelled word, the sentence with the highest overall quality score is selected from all sentences containing that word. The sentence is as follows. The overall quality score considers translation quality, perplexity, and sentence length, and is expressed as follows:
[0142] ;
[0143] in, This indicates the overall quality score. Indicates the level of confusion. Indicates sentence length. This represents the normalization function. In this example, high-quality, manually selected data provided by the ALMA project is used as the upper bound reference for the scoring.
[0144] The training set obtained through step S6 can accurately cover the weak areas of the model's translation, thereby improving the model's performance in a targeted manner.
[0145] Specifically, in step S7, a large language model (such as Llama2-7B or Llama3.1-8B) is selected as the base model, and LoRA (Low-Rank Adaptation, simply referred to as LoRA) is used for parameter-efficient fine-tuning. The specific process of performing low-rank adaptation training on the large language model using the training set obtained in step S6 is as follows:
[0146] Keep the original weights of the large language model unchanged, and perform low-rank adaptation training on the attention layer and the feed-forward layer of the large language model. Among them, the update expression of the LoRA parameters during the low-rank adaptation training is:
[0147] ;
[0148] Among them, represents the updated parameter weight matrix, represents the original weight, represents the ascending matrix, represents the descending matrix. During this low-rank adaptation training process, the ranks of the ascending matrix and the descending matrix are both lower than the original dimension, thus significantly reducing the number of training parameters.
[0149] After multiple rounds of iterative training, the large language model can focus on learning the sentence translation patterns and their structural rules containing error-prone words. After fine-tuning, the optimized large language model shows significant improvement in dealing with complex structures and semantic ambiguity phenomena, etc.
[0150] Furthermore, in order to more clearly illustrate the method described in the embodiments of the present invention, the following will be described in detail through exemplary steps:
[0151] Step 1: Identify error-prone words at the source end. Select 1,190,000 sentence pairs of Chinese-English bilingual parallel corpus, and use Jieba分词 to segment the Chinese sentences. The large language model (i.e., the translation model) is preferably Llama2-7B (HF version), and the inference parameters are set as: temperature = 0, max_tokens = 150. The quality evaluation tool selects COMET (wmt22-comet-da). Traverse all sentence pairs and perform translation. Input each source sentence into the model to obtain the translation.
[0152] Exemplarily, the source sentence is "Emphasize entities,轻视 procedures", and the initial translation of the translation model is: "Heavy substance and light procedure", and at this time the quality evaluation score COMET = 0.627.
[0153] Step 2: Refer to Figure 2As shown, the source sentence is segmented according to syntax and the statistical table is updated. Taking "emphasis on entity, neglect of procedure" as an example, the example segmentation result is: ["emphasis", "on", "entity", "neglect", "of", "procedure"]. The statistical table records the number of occurrences of each word and the average COMET score of the sentence pair it belongs to. Assuming that the global average COMET score is 0.7638, and the word "neglect" appears 83 times with an average score of 0.702, then score("neglect") = 0.7638 - 0.702 = 0.0618 is calculated, which is higher than the threshold of 0.05. Therefore, "neglect" is determined as an error-prone word. Error-prone words in the Chinese-to-English translation direction are identified by the same method.
[0154] Step 3: According to the pre-constructed list of error-prone words (generated by statistics in Step 2), when it is determined that "emphasis" belongs to the high-frequency error-prone words, trigger the RAG (Retrieval-Augmented Generation) optimization process. The specific optimization process is as follows:
[0155] Step 3-1: Construct a corpus vector library. Vectorize all source sentences in the corpus. Select the BGE-large-zh-v1.5 model, with a vector dimension of 1024. The storage method can choose vector libraries such as FAISS, Milvus, or Elasticsearch. After processing, the complete vector library V = {v1, v2,..., v m} is obtained, where m represents the total number of vectors in the vector library.
[0156] Step 3-2: Vectorize the input sentence. For example: =BGE.encode("emphasis on entity, neglect of procedure"), thus obtaining the query vector .
[0157] Step 3-3: Using the error-prone word "emphasis" as the keyword, retrieve all source sentences containing "emphasis" in the corpus to obtain the candidate example set , and the expression is:
[0158] .
[0159] In this process, the candidate example sentences include but are not limited to: "emphasis on form, neglect of content", "emphasis on result, neglect of process", "emphasis on efficiency, neglect of procedure", etc. Each example contains a Chinese-English sentence pair . In this example, the size of the candidate example set is 3820 sentence pairs.
[0160] Step 4: In order to select the optimal prompting example from the candidate example set, it is necessary to calculate the comprehensive score for each sentence pair. The following processing is performed on each candidate sentence pair :
[0161] Step 4-1: Calculate the semantic similarity. Use the BGE vector cosine similarity The calculation is performed, and the expression is:
[0162] .
[0163] Step 4-2: Use a no-reference translation quality assessment tool (such as COMET-KIWI) to calculate candidate sentence pairs. The quality score is expressed as:
[0164] ;
[0165] in, This represents the quality scoring function.
[0166] Furthermore, based on the cosine similarity of BGE vectors and quality rating Calculate the overall score The specific expression is:
[0167] .
[0168] Step 4-3: Rank multiple candidate examples from the preset sentence database according to their comprehensive scores. Sort from highest to lowest and select the best. Candidate examples.
[0169] Step 5: Select the optimal Candidate examples (e.g.) This is constructed as a prompt template.
[0170] For example, the final selected candidate example is:
[0171] "Emphasis on form over content";
[0172] "Focus on results, downplay process"
[0173] Based on the two best candidate examples above, the following suggestion template is constructed:
[0174] First prompt template:
[0175] “Translate Chinese to English:
[0176] Chinese: Emphasizing form over content;
[0177] English: Stress form over content”.
[0178] Second prompt template:
[0179] “Translate Chinese to English:
[0180] Chinese: Emphasizing results over process;
[0181] English: Value results over process”.
[0182] These prompt templates explicitly provide the structural features of "heavy...light..." to the large language model, thereby guiding the model to generate more standardized English expressions.
[0183] Step 6: Employ large language models such as Llama3-8B and Qwen2-7B, and input the aforementioned prompt template. After processing in steps 3 to 6, the large language model generates the corresponding translation: “Prioritize substance overprocedure”. In contrast, the translation generated by the unoptimized large language model is: “Heavy substance and light procedure”, which is a literal translation error. In the COMET quality score, the unoptimized method has a COMET score of 0.627, while the method described in this embodiment of the invention has a COMET score of 0.846, an improvement of approximately 0.219 points, significantly improving the translation quality.
[0184] Step 7: Fine-tune the large language model from Step 6 using the training set and LoRA to obtain an enhanced translation model. Input test sentences containing common misspellings into the fine-tuned large language model to obtain translations that conform to English expression habits.
[0185] Furthermore, the performance of the fine-tuned large language model was quantitatively evaluated, using automatic evaluation metrics such as COMET, COMETkiwi, and BLEU to compare the translation performance before and after fine-tuning. Evaluation results show that in language pairs with significant structural differences (such as Chinese to English and Arabic to English), the model fine-tuned using weighted sampling LoRA shows significant improvement, with the highest improvement exceeding 5 points on the COMET metric. Compared to random sampling or high-quality sentence pair sampling, the weighted sampling method has a clear advantage in translation quality for sentences containing error-prone words. This result demonstrates that the method described in this embodiment can effectively alleviate the systematic translation error problem of large language models on specific source words.
[0186] Furthermore, to verify the effectiveness of the method described in the embodiments of the present invention, experimental evaluations were conducted in three translation directions. The specific experimental steps are as follows:
[0187] The first step is to obtain datasets for three translation directions. Specifically, this includes:
[0188] Chinese-English translation (Zh→En): The training set contains 1.19 million sentence pairs, which are from the NIST MT training data; the test set uses the WMT22 Chinese-English test set, which contains 2,037 sentence pairs; the error-prone word retrieval database is constructed from high-quality sentence pairs selected from the training set.
[0189] English-German translation (En→De): The training set consists of 1.21 million sentence pairs, derived from WMT training data; the test set is the WMT22 English-German test set, containing 1,984 sentence pairs; the common misspelling search database was also selected from the training set.
[0190] Ar→En translation: The training set contains 990,000 sentence pairs from WikiMatrix; the test set selects the top 2,000 sentence pairs from the WMT22 English-German test set; the error-prone word retrieval database consists of high-quality sentence pairs from the training set.
[0191] The second step involves selecting and setting the parameters for the large language model. Llama2-7B and Llama3.1-8B large language models were chosen, with Llama3.1-8B demonstrating stronger capabilities in multilingual processing. Furthermore, the Llama series models are highly representative in the open-source large model system, and many subsequent models (such as Mistral, Qwen, and Yi) are based on improvements to its architecture. Therefore, the patterns obtained from the Llama series models are more generalizable and have greater research value. During the inference phase, based on the vLLMv0.3.0 framework, the generation parameters were set to temperature=0, max_tokens=150, seed=42, and the batch size was 32. In the fine-tuning phase, the LoRA method was used, with parameters set to rank=16, alpha=16, and dropout=0.1. The target modules included the Q, K, and V projections of the attention layer and the gate, up, and down projection layers of the feedforward network. The optimizer used was AdamW with a learning rate of 1e-4 and a weight decay of 0.01. The training configuration was set to a batch size of 12, a gradient accumulation step count of 4, and a total training duration of 1 epoch. Experiments were conducted on an NVIDIA A100 40GB GPU. Furthermore, regarding the retrieval system, a hybrid approach combining example quality and example semantic similarity (similarity calculation using a BGE model) was employed, with the hybrid weights determined using the validation set. , .
[0192] The third step is to set up evaluation metrics. Use the following three types of complementary automatic evaluation metrics:
[0193] COMET: A neural assessment index based on XLM-R, using the wmt22-comet-da model, which is highly correlated with human scoring.
[0194] COMET-ref-free: Quality assessment of translations without the need for references, using the wmt22-cometkiwi-da model.
[0195] BLEU: A classic metric based on n-gram matching, implemented using SacreBLEU.
[0196] The fourth step involved compiling a list of commonly misspelled words, the results of which are shown in Table 2. Table 2 shows that the number of commonly misspelled words in Chinese-English and Arabic-English translations is significantly higher than in English-German translations. This reflects the impact of language structural differences on the difficulty of translating commonly misspelled words. The greater the difference in language structure, the more pronounced the phenomenon of commonly misspelled words at the source.
[0197] Table 2:
[0198]
[0199] The fifth step was to verify the impact of error-prone words. The verification results are shown in Table 3. Table 3 compares the translation quality of sentences containing error-prone words with that of the overall test set. The experimental results confirm that the presence of error-prone words does indeed significantly affect translation quality, providing a theoretical basis for subsequent optimization methods.
[0200] Table 3:
[0201]
[0202] Step 6 involves performing context learning optimization and LoRA fine-tuning, with the final results shown in Tables 4 and 5. Table 5 illustrates the fine-tuning effects of different training data strategies. All methods used the same amount of training data (approximately 15,000 records) to ensure fair comparison. It should be noted that due to the insufficient quantity of Arabic-English training data in the high-quality ALMA dataset, comparisons were not made in this experiment.
[0203] Table 4:
[0204]
[0205] Table 5:
[0206]
[0207] Step 7: Analysis of experimental results, as detailed below:
[0208] Analysis of the general effectiveness of the retrieval strategy: As shown in Tables 3, 4, and 5, the retrieval strategy designed in this embodiment of the invention demonstrates superiority across different language pairs. Specifically, the error-prone word guidance outperforms random selection and the hybrid strategy. Specifically, in the Chinese-English and Arabic-English language pairs, which have significant structural differences, the "examples containing error-prone words" suggestion effect is significantly better than "random examples," proving the effectiveness of providing suggestions for error-prone words. The "hybrid strategy," combining quality and semantics, achieved the best COMET score in most cases. For example, in Arabic-English translation, the COMET score for Llama2-7B improved by 1.53 points, and the Chinese-English translation improved by 0.76 points. This indicates that an excellent example must not only be semantically relevant to the sentence to be translated, but its own translation quality is also crucial.
[0209] Language Pair Specificity Analysis: First, for language pairs with significant structural differences (Chinese-English, Arabic-English), the performance differences between different retrieval strategies are substantial, and the optimization space is also larger. For example, in Arabic-English translation, the best strategy (hybrid strategy) of Llama2-7B outperforms the worst non-baseline strategy (random examples) by 1.06 COMET points. This indicates that for such language pairs, more refined retrieval strategies must be employed to achieve significant improvements. Second, for structurally similar language pairs (English-German), even simple random examples can bring considerable performance improvements in English-German translation (Llama2-7B: +0.91 COMET). However, optimization methods based on error-prone words do not show significant improvements. This suggests that for structurally similar languages, the model is more likely to learn translation patterns from any form of context and has fewer error-prone words, thus error-prone word-based optimization methods are not applicable.
[0210] Analysis of the impact of model size: As a more powerful base model, Llama 3.1-8B inherently possesses higher translation quality, thus the absolute improvement potential through contextual learning optimization is relatively small. For example, in Arabic-English translation, Llama 2-7B's maximum improvement in COMET score is 1.53 points, while Llama 3.1-8B's is only 0.15 points. This indicates that the more powerful model has internalized more linguistic knowledge, partially alleviating the problems caused by misspellable words, but targeted optimization can still bring stable performance gains.
[0211] LoRA Fine-Tuning Performance Analysis: The success of LoRA fine-tuning is highly dependent on the quality and relevance of the training data. Specifically, on all language pairs, fine-tuning using high-quality ALMA data or high-COMET sampled data yielded significant performance improvements, while random sampling data could even lead to performance degradation (Chinese-English Llama2: -2.45 BLEU). This verifies that data quality is a prerequisite for successful fine-tuning. Furthermore, regarding the effectiveness of error-prone word weighted sampling, the error-prone word weighted sampling strategy performed particularly well in Chinese-English and Arabic-English translations with significant structural differences. In Arabic-English translation, it was the best strategy on both models, improving the COMET score of Llama2-7B by 5.78 points. In Chinese-English translation, its performance was comparable to that of manually selected ALMA data. This strongly demonstrates that specifically teaching the model how to handle known difficulties is an extremely efficient fine-tuning method.
[0212] Language pair specificity analysis: In Chinese-English and Arabic-English translation, the error-prone word sampling data achieved the best or near-best results in these two directions, indicating that for language pairs with significant structural differences, targeted training based on error-prone words is an efficient and automated method for constructing high-quality training sets. Secondly, in English-German translation, the error-prone word weighted sampling data performed only moderately in this direction. This is consistent with the trend shown by context-based optimization methods, further demonstrating that error-prone word-based optimization methods may not be applicable to structurally similar language pairs.
[0213] Compared with existing technologies, the embodiments of this invention have significant advantages. First, this invention enhances translation interpretability by establishing a causal relationship between error-prone words and translation difficulties, providing a clear path for root cause analysis of translation errors. Second, this method excels in improving translation quality, achieving a maximum improvement of 5.78 points in COMET scores in Chinese-English and Arabic-English translation tasks, realizing a comprehensive improvement in translation quality. Furthermore, this method demonstrates excellent resource utilization efficiency, requiring only a small amount of high-value data to significantly improve model performance, greatly reducing resource costs. Simultaneously, this method has broad applicability, applicable to various open-source large language models, such as Llama, Qwen, and Mistral, providing a general solution for optimizing different models. Finally, this invention is particularly suitable for language pairs with significant structural differences, such as Chinese-English and Arabic-English, demonstrating remarkable effects in these complex scenarios and effectively solving the challenges of cross-language translation.
[0214] Example 2:
[0215] Based on the same inventive concept, this embodiment provides a large language model machine translation optimization system. The principle of its problem-solving is similar to that of the large language model machine translation optimization method provided in Embodiment 1, and the repeated parts will not be described again.
[0216] This embodiment provides a large language model machine translation optimization system, including:
[0217] The translation generation module is used to traverse the bilingual corpus and generate the corresponding first translation for the source sentences in the bilingual corpus.
[0218] The module for constructing a set of common misspelled words is used to segment the source sentence into multiple words; count the occurrence of common misspelled words in each word segment, calculate the common misspelled word score, and obtain a set of common misspelled words based on the common misspelled word score;
[0219] The translation error rate acquisition module is used to compare the first translation with the reference translation in the bilingual corpus to obtain the comparison result; based on the comparison result, it determines the translation status of each error-prone word in the error-prone word set in the generated translation; based on the translation status, it locates the error information in the first translation and calculates the translation error rate of each error-prone word in the error-prone word set.
[0220] The prompt template building module is used to calculate the semantic similarity between the sentence to be translated and multiple candidate examples in the preset sentence library, and to calculate the quality score of multiple candidate examples in the preset sentence library; based on semantic similarity and quality score, the optimal example is selected from multiple candidate examples in the preset sentence library. 10 candidate examples; the optimal one Each candidate example is constructed as a prompt template, and the prompt template and the sentence to be translated are input into the large language model.
[0221] The training set selection module is used to obtain training sentence pairs from the bilingual corpus based on the scoring of error-prone words; to sort the training sentence pairs according to translation status and translation error rate, and to obtain the sorting results; and to select the training set based on the sorting results.
[0222] The optimization module is used to perform low-rank adaptive training on the large language model using the training set, so as to obtain an optimized large language model.
[0223] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0224] 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 flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0225] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0226] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0227] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A large language model machine translation optimization method, characterized in that, include: Traverse the bilingual corpus and generate the corresponding first translation for the source sentences in the bilingual corpus; The source sentence is segmented into multiple words; the frequency of common misspellings in each segment is counted, and a common misspelling score is calculated for each common misspelling; a set of common misspellings is obtained based on the common misspelling scores; wherein, the step of obtaining the set of common misspellings based on the common misspelling scores is as follows: Obtain the average evaluation score of the first translation containing the error-prone words; Based on the frequency of occurrence and the average evaluation score, the error-prone word score is calculated; wherein, the expression for calculating the error-prone word score is: ; in, This indicates words that are easily confused. Indicates the score for commonly misspelled words. This represents the overall average evaluation score. This represents the average assessment score. Indicates the frequency of occurrence of commonly misspelled words; The word segmentation is filtered based on the error-prone word score, preset frequency threshold, and preset quality degradation threshold to obtain an error-prone word set; The first translation is compared with the reference translation in the bilingual corpus to obtain the comparison result; the translation status of each error-prone word in the error-prone word set in the generated translation is determined based on the comparison result; based on the translation status, the error information in the first translation is located, and the translation error rate of each error-prone word in the error-prone word set is calculated. Calculate the semantic similarity between the sentence to be translated and multiple candidate examples in a pre-set sentence database, and calculate the quality score of the multiple candidate examples in the pre-set sentence database; based on the semantic similarity and the quality score, select the optimal candidate example from the multiple candidate examples in the pre-set sentence database. Candidate examples; The optimal The candidate examples are constructed as prompt templates, and the prompt templates and the sentence to be translated are input into the large language model; Based on the error-prone word score, training sentence pairs are obtained from the bilingual corpus; the training sentence pairs are ranked according to their translation status and translation error rate to obtain a ranking result; and a training set is selected based on the ranking result. The large language model is trained using the training set to achieve low-rank adaptation, resulting in an optimized large language model.
2. The method for optimizing machine translation using a large language model according to claim 1, characterized in that, Based on the semantic similarity and the quality score, the optimal example is selected from multiple candidate examples in the preset sentence database. The steps for selecting candidate examples are as follows: Based on the semantic similarity and the quality score, a comprehensive score is calculated for each candidate example in the preset sentence database; wherein, the expression for the comprehensive score is: ; in, This indicates the overall score. Indicates quality score. Indicates semantic similarity; and Indicates the weighting parameter; Based on the comprehensive score, the optimal example is selected from multiple candidate examples in the preset sentence database. Candidate examples.
3. The method for optimizing machine translation using a large language model according to claim 1, characterized in that, Calculating the semantic similarity between the sentence to be translated and multiple candidate examples in the pre-defined sentence database includes calculating the lexical similarity between the sentence to be translated and multiple candidate examples; Calculate the semantic similarity at the sentence level to be translated.
4. The method for optimizing machine translation using a large language model according to claim 1, characterized in that, Based on the error-prone word scoring, the steps for obtaining training sentence pairs from the bilingual corpus are as follows: Calculate the sampling weights based on the scores of the commonly misspelled words; The number of samples to be allocated is calculated based on the sampling weights; wherein the formula for calculating the number of samples to be allocated is: ; in, Indicates the number of samples to be allocated. This represents the total number of sampled sentences. Indicates the sampling weight. Indicates words that are easily confused; Training sentence pairs are obtained from the bilingual corpus according to the allocated sampling quantity.
5. The method for optimizing machine translation using a large language model according to claim 4, characterized in that, The formula for calculating the sampling weight is: ; in, Indicates the sampling weight. Indicates the score for commonly misspelled words. This indicates words that are easily confused. This represents a set of words that are prone to being misspelled.
6. The method for optimizing machine translation using a large language model according to claim 1, characterized in that, The low-rank adaptation training of the large language model using the training set specifically involves: performing low-rank adaptation training on the attention layer and feedforward layer of the large language model, wherein the parameter update expression in the low-rank adaptation training is: ; in, This indicates updating the parameter weight matrix. Represents the original weights. Represents an ascending matrix. This represents the descent matrix.
7. The method for optimizing machine translation using a large language model according to claim 1, characterized in that, The process of determining the translation status of each error-prone word in the generated translation based on the comparison results includes: if the comparison results show that the current error-prone word has a corresponding phrase in the first translation, then the text overlap between the corresponding phrase and the incorrect phrase is calculated; if the text overlap is greater than a preset threshold, then the translation status of the current error-prone word in the generated translation is determined to be incorrect.
8. A large language model machine translation optimization system, used to implement the large language model machine translation optimization method according to any one of claims 1 to 7, characterized in that, include: The translation generation module is used to traverse the bilingual corpus and generate a corresponding first translation for the source sentences in the bilingual corpus. The error-prone word set construction module is used to perform word segmentation on the source sentence to obtain multiple word segments; count the occurrence frequency of error-prone words in each word segment, calculate the error-prone word score of each error-prone word, and obtain the error-prone word set based on the error-prone word score; The translation error rate acquisition module is used to compare the first translation with the reference translation in the bilingual corpus to obtain the comparison result; and to determine the translation status of each error-prone word in the error-prone word set in the generated translation based on the comparison result. Based on the translation status, locate the error information in the first translation and calculate the translation error rate of each error-prone word in the error-prone word set; The prompt template construction module is used to calculate the semantic similarity between the sentence to be translated and multiple candidate examples in the preset sentence library, and to calculate the quality score of the multiple candidate examples in the preset sentence library; Based on the semantic similarity and the quality score, the optimal example is selected from multiple candidate examples in the preset sentence database. Candidate examples; the optimal one The candidate examples are constructed as prompt templates, and the prompt templates and the sentence to be translated are input into the large language model; The training set filtering module is used to obtain training sentence pairs from the bilingual corpus based on the error-prone word scores; to sort the training sentence pairs by quality based on the translation status and the translation error rate to obtain a sorting result; and to filter out the training set based on the sorting result. An optimization module is used to perform low-rank adaptation training on the large language model using the training set to obtain an optimized large language model.
Citation Information
Patent Citations
Large language model training method and related device
CN119493997A
Low-resource language translation model training method based on large language
CN121351849A