Method and system for optimizing translation performance of a multilingual large model activated based on a prompting strategy

Through a prompt strategy-based approach, the translation performance of large language models is optimized using Southeast Asian parallel corpora, which solves the problem of insufficient machine translation performance for low-resource languages ​​in Southeast Asia and improves translation quality and accuracy.

CN119903855BActive Publication Date: 2025-10-17KUNMING UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411983083.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-10-17
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

Existing large language models have insufficient performance in machine translation of low-resource languages ​​in Southeast Asia due to a lack of effective evaluation and training data, resulting in the inability to fully utilize translation performance under zero-sample conditions.

Method used

A prompt strategy-based approach is adopted to acquire and screen Southeast Asian parallel corpora, construct system input and context learning prompt templates, and use a large language model to optimize translation performance, including context similarity, randomization, quality priority, and historical output prompt strategies, combined with self-attention layers and feedforward neural networks to optimize translation tasks.

Benefits of technology

It significantly improves the translation quality and accuracy of large language models in low-resource language environments, dynamically adjusts prompt strategies and model parameters, and activates the model's potential translation capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119903855B_ABST
    Figure CN119903855B_ABST
Patent Text Reader

Abstract

The application relates to a multilingual large model translation performance optimization method and system based on prompt strategy activation and belongs to the field of natural language processing. In a low-resource language environment, the translation performance of a multilingual large model still has defects. This is mainly because the large model has limited understanding ability for low-resource language input semantics, leading to the fact that part of the potential translation ability of the large model has not been fully activated. In order to alleviate this influence, the application first screens prompts from a high-quality corpus based on four kinds of prompt strategies, then constructs a context learning template as the user input of the large model and a task-oriented system as the system input, and finally realizes performance optimization of the large model in a low-resource language translation task by dynamically adjusting the prompt strategy and the model parameters. The method of the application can effectively activate the potential translation ability of the large model and significantly improve the translation quality of the large model in a low-resource language environment.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a multilingual large model translation performance optimization method and system based on prompt strategy activation, and belongs to the technical field of natural language processing. BACKGROUND

[0002] With the rapid development of large language models, a large number of previous works have explored the performance of large models on different artificial intelligence tasks. However, there is currently no research on the performance evaluation of large models for machine translation of Southeast Asian low-resource languages. The main reason is the lack of public evaluation data for Southeast Asian low-resource languages and large models trained directly on Southeast Asian low-resource languages.

[0003] In real-world scenarios, the translation performance of large models under zero-shot conditions cannot be fully utilized, but through prompt engineering techniques, the potential translation performance can be effectively stimulated. Prompt learning is one of the core techniques of large models in few-shot or zero-shot learning. The basic principle is to embed task requirements into input text by designing reasonable prompts, thereby guiding the large model to better complete specific tasks. Prompts can explicitly provide task context, such as by providing a few translation examples, the model can better understand and generate translation results. Few-shot prompting is a method of embedding a small number of task examples in the model, aiming to activate the model's understanding of specific tasks through a small amount of task-related data. For multilingual translation tasks, few-shot prompting can help the model more accurately capture the translation features of the target language by providing a few parallel corpora. SUMMARY

[0004] The application provides a multilingual large model translation performance optimization method and system based on prompt strategy activation to improve the potential translation performance of large language models.

[0005] The technical solution of the application is a multilingual large model translation performance optimization method based on prompt strategy activation, which comprises the following steps:

[0006] Step 1, obtaining a prompt dataset;

[0007] Step 2, constructing the system input of the large language model according to the task orientation; for example, to optimize the translation performance of the large model in Southeast Asian language translation tasks, the system input is constructed as follows: [System input]: You are a Southeast Asian language translation expert, please translate the following Southeast Asian language into Chinese;

[0008] Step 3, selecting prompts from the prompt dataset based on the prompt strategy, integrating the selected prompts into the context learning prompt template, and then concatenating the context learning prompt template with the input sentence as the user input of the large language model for context learning to realize performance optimization in the translation task of the large language model.

[0009] Further, the acquisition of the prompt data set comprises collecting bilingual parallel corpus, which is obtained through data preprocessing; the Step1 comprises:

[0010] Step1.1, download the Southeast Asian parallel corpus from ALT(Asian Language Tree Bank) data set for test set; download the Southeast Asian parallel corpus from flores-200 data set as alternative test set;

[0011] Step1.2, cut the test set, part of which is used for translation performance evaluation, and the other part is used as a prompt set for context prompt learning; and LASER(Language-Agnostic SEntence Representations) quality score is performed on flores-200 and ALT(Asian Language Tree Bank) data set, and the one with higher quality score is used as the test set.

[0012] Further, the process of the LASER quality score is as follows:

[0013] Suppose the sentence vector is S, and each word in the sentence is represented as h t The sentence vector S is calculated by the following formula:

[0014]

[0015] Where h t is the word vector generated by the encoder at time step t, T is the length of the sentence, and the sentence vector S is generated by the average pooling operation, and S is the final representation of the sentence.

[0016] The similarity between sentence vectors is measured using cosine similarity. Given two sentences S1 and S2, the similarity is represented as follows:

[0017]

[0018] Where s1·s2 is the dot product of two sentences S1 and S2, and ||s1|| and ||s2|| are the lengths of two sentences S1 and S2.

[0019] Further, in the Step2, the large language model adopts: Qwen-2-7b-instruct, GPT-3.5-Turbo, Llama-8b-instruct, Llama-70b or Seallms2.5-7b.

[0020] Further, the Step2 comprises:

[0021] Step2.1, according to the task-oriented design of the system input template of the large language model, through the provision of clear structure and guiding prompts, the system input template can effectively reduce the output deviation of the model, improve the accuracy of task execution, and reduce the noise generated;

[0022] Step2.2, according to the specific task to activate the translation performance of the large language model, and most of the large language model training corpus uses English as the core, so the system input is centered on English; Although the large model supports multi-language input, when inputting non-English content, the model may encounter more difficulties in processing some languages for translation, understanding context and generating appropriate results; Using English input can reduce task complexity and ensure that the model can generate accurate results more efficiently; Specifically, [system input]: You are an expert in translating from Chinese to Southeast Asian languages. Translate the following {src_lang} into {tgt_lang} and output only the result.

[0023] Further, the Step3 includes:

[0024] Step3.1, construct user input for Southeast Asian translation task, since most of the large language model training corpus uses English as the core, so take the English-centered user input, although the large model supports multi-language input, but when inputting non-English content, the model may encounter more difficulties in processing some languages for translation, understanding context and generating appropriate results; Using English input can reduce task complexity and ensure that the model can generate accurate results more efficiently;

[0025] Step3.2, set the initialization model parameters of the large language model;

[0026] Step3.3, adopt prompt strategy to select one or more pairs of parallel sentences from prompt data set and integrate into context learning prompt template;

[0027] Step3.4, the context learning prompt template with prompt is spliced as the user input of the large language model, which is used for subsequent context learning of the large language model;

[0028] Step3.5, in the large language model, the user input sequence is first passed through the embedding layer to map each word to a high-dimensional vector representation;

[0029] Step3.6, further processing through multiple stacked self-attention layers; the self-attention layer includes a self-attention mechanism and a feedforward neural network;

[0030] Step3.7, after the prompt is processed through the self-attention, the large language model predicts the next word according to the current input and the generated context.

[0031] Further, the prompt strategy includes context similarity prompt, random prompt, quality priority prompt and historical output prompt; wherein:

[0032] The context similarity prompt refers to selecting the highest similarity sentence pair from the prompt set by using cosine similarity and integrating it into the context learning prompt template to improve the semantic understanding of the model and improve the translation accuracy;

[0033] The random prompt refers to randomly selecting prompt information from the prompt set during instruction construction and providing it to the model; the random prompt method introduces diversified context information to avoid the singleness and limitation of the prompt, but due to its randomness, there is a possibility of misleading the large model by matching different domain sentence pairs as prompts;

[0034] The quality priority prompt refers to using the LASER method to sort the quality of the prompt set and selecting the highest quality parallel sentence pair as the prompt information to guide the model to generate high-quality translation results; the quality priority prompt can significantly improve the translation quality, especially in the same complex field of text, and the effect is particularly significant, but too much dependence on high-quality prompts may limit the creativity and flexibility of the model, resulting in too much template translation results;

[0035] The historical output prompt refers to using the previously generated output of the model as the prompt information for the current translation task; the historical output prompt can help the model to remember and utilize the previous translation results to improve consistency and coherence; but this strategy relies too much on the quality of the model's previous output, and if there are errors in the model's historical output, the errors may be continuously utilized by the model, leading to error accumulation;

[0036] The application also provides a multilingual large model translation performance optimization system based on prompt strategy activation, which comprises a module for executing the above-mentioned multilingual large model translation performance optimization method based on prompt strategy activation.

[0037] The application also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the above-mentioned multilingual large model translation performance optimization method based on prompt strategy activation.

[0038] The application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-mentioned method for optimizing translation performance of a multilingual large model based on a prompt strategy.

[0039] The application has the following advantages:

[0040] 1. By dynamically adjusting the prompt strategy and the model parameters, the performance of the large model in the low-resource language translation task is optimized.

[0041] 2. The method can effectively activate the potential translation capability of the large model and significantly improve the translation quality in the low-resource language environment. BRIEF DESCRIPTION OF DRAWINGS

[0042] Fig. 1 is the general flowchart in the application;

[0043] Fig. 2 Variation trend of CHRF score of translation generated under different temperature parameters. DETAILED DESCRIPTION

[0044] Example 1: As shown in the following table, the method for optimizing translation performance of a multilingual large model based on a prompt strategy includes: Figs. 1-2

[0045] Step 1, obtaining a prompt data set;

[0046] Further, the obtaining of the prompt data set includes collecting bilingual parallel corpus, which is obtained through data preprocessing; the Step 1 includes:

[0047] Step 1.1, 20,000 pieces of Southeast Asian parallel corpus are downloaded from the ALT (Asian Language Treebank) data set for the test set; 1024 pieces of Southeast Asian parallel corpus are downloaded from the flores-200 data set as the alternative test set; wherein the experimental data set is shown in Table 1:

[0048] Table 1 is the experimental data set

[0049]

[0050] Among them, "k" represents thousand.

[0051] ​Step1.2, cut the test set, 3000 sentences for translation performance evaluation, 17000 sentences as prompt set, used for context prompt learning; and LASER (Language-Agnostic SEntence Representations) quality score of flores-200 and ALT (Asian Language Treebank) data set, which quality score is high, which is used as the test set. The purpose of scoring is to compare the quality of traditional public data (flores-200) and new public data set (ALT).

[0052] Further, the process of LASER quality score is as follows:

[0053] Assume that the sentence vector is S, and each word in the sentence is represented as h t The sentence vector S is calculated by the following formula:

[0054]

[0055] Where h t is the word vector generated by the encoder at time step t, T is the length of the sentence, and the sentence vector S is generated by the average pooling operation, and S is the final representation of the sentence.

[0056] The similarity between sentence vectors is measured using cosine similarity. Given two sentences S1 and S2, the similarity is represented as follows:

[0057]

[0058] Where s1·s2 is the dot product of two sentences S1 and S2, and ||s1|| and ||s2|| are the lengths of two sentences S1 and S2.

[0059] Further, in Step2, a large language model trained in Southeast Asia is selected to ensure that the large language model has activation value. The large language model uses: Qwen-2-7b-instruct, GPT-3.5-Turbo, Llama-8b-instruct, Llama-70b or Seallms2.5-7b.

[0060] The evaluation scores of public data (flores-200) and new public data set (ALT) under LASER quality score are shown in Table 2:

[0061] Table 2 is the quality evaluation score

[0062]

[0063] Sep2、According to the task-oriented construction of the system input of the large language model; such as: optimizing the large model in the Southeast Asian language translation task, constructing the system input, [system input]: you are an expert in Southeast Asian language translation, please translate the following Southeast Asian language into Chinese;

[0064] Further, the Step2 includes:

[0065] Step2.1、According to the task-oriented design of the system input template of the large language model, by providing clear structure and guiding prompts, the system input template can effectively reduce the output deviation of the model, improve the accuracy of task execution, and reduce the generated noise;

[0066] Step2.2、According to the specific task to activate the translation performance of the large language model, and most of the corpus used in the training of the large language model is English-centered, so the system input is centered on English; Although the large model supports multi-language input, when inputting non-English content, the model may encounter more difficulties in processing some language pairs, understanding the context, and generating appropriate results; Using English input can reduce task complexity and ensure that the model can generate accurate results more efficiently; Specifically, [system input]: You are an expert in translating from Chinese to Southeast Asian languages. Translate the following {src_lang} into {tgt_lang} and output only the result.

[0067] Step3、Based on the prompt strategy, filter prompts from the prompt data set, fuse the filtered prompts into the context learning prompt template, and then concatenate the context learning prompt template with the input sentence as the user input of the large language model, and perform context learning on the large language model to realize performance optimization in the large language model translation task; such as: optimizing the large model in the Southeast Asian language translation task, constructing the user input, [user input]: [prompt template]; Referring to the above template, please translate the following Southeast Asian language into Chinese, and according to the four prompt strategies of context similarity prompt, random prompt, quality priority prompt, and historical output prompt, filter the prompt set and fuse it into the context learning prompt template;

[0068] Further, the Step3 includes:

[0069] Step3.1, construct user input for Southeast Asian translation task, since most large language models use English as the core during training, the user input is centered on English, although large models support multi-language input, when inputting non-English content, the model may encounter more difficulties in processing some languages for translation, understanding context and generating appropriate results; Using English input can reduce task complexity and ensure that the model can generate accurate results more efficiently; Specifically:

[0070] [User input]:

[0071] [{src_lang}]:[{src_lang_prompt}]

[0072] [{tgt_lang}]:[{tgt_lang_prompt}]

[0073] Translate according to the above template,Output the target language,do not copy the template.

[0074] [{src_lang}]:[{sentence}]

[0075] [{tgt_lang}]:[{output}];

[0076] Step3.2, set the initialization model parameters of the large language model; The temperature of the large language model is set to 0.1, the maximum length of the output text max_new_tokens is set to 216, top_p is set to 0.3, and top_k is set to 5, since the large language model needs to learn, so max_prompt_tokens is set to 518;

[0077] Step3.3, adopt the prompt strategy to select one or more pairs of parallel sentences from the prompt data set and integrate them into the context learning prompt template;

[0078] Step3.4, integrate the context learning prompt template with the input sentence to form the user input of the large language model, which is used for subsequent context learning of the large language model; Specifically:

[0079] Given an input sentence X and a context learning prompt template P, the context learning prompt template P and the input sentence X are concatenated to form a user input sequence, the user input sequence X input is expressed as:

[0080] X input= [P; X]

[0081] where P is the context learning prompt template, X is the input sentence, and [P; X] represents concatenating P and X into a whole sequence;

[0082] Step 3.5, in a large language model, the user input sequence X input First, through the embedding layer, each word is mapped to a high-dimensional vector representation:

[0083] E = Embedding(X input )

[0084] Step 3.6, large language models (such as GPT, BERT, etc.) usually contain multiple stacked self-attention layers, and the core calculation of each layer includes self-attention mechanism and feedforward neural network; the high-dimensional vector representation is processed through multiple stacked self-attention layers;

[0085] The calculation formula of self-attention is:

[0086]

[0087] where Q = EWQ is the query matrix, K = EWK is the key matrix, V = EWV is the value matrix, WQ, WK, WV are the learning weight matrices, d k is the key vector dimension;

[0088] Using multi-head attention, the attention calculation is extended to multiple independent heads to enhance the expression ability of the model:

[0089] MultiHead(Q, K, V) = Concat(head1, head2,..., head h )W0

[0090] where h is the number of attention heads, each attention head has its own W Q , W K , W V , and finally linearly changes through W0;

[0091] After the self-attention mechanism, a feedforward neural network is used for processing:

[0092] FFN(x) = ReLU(xW1 + b1)W2 + b2

[0093] where W1, W2, b1, b2 are the parameters of the feedforward neural network;

[0094] The output of the whole self-attention layer is:

[0095] H = TransformerLayer(E)

[0096] Stacking multiple layers of such structures generates the final hidden layer representation;

[0097] Step3.7, after the prompt is processed by self-attention, the large language model predicts the next word according to the current input and the generated context, and the probability distribution of the t-th word is:

[0098] P(y t |X input ,y1,...,y t-1 )=softmax(H t W out +b out )

[0099] Where: H t is the hidden state at the current time t, representing the semantic information of the current generated sequence, W out and b out are the weights and biases of the output layer.

[0100] Further, the prompt strategy includes context similarity prompt, random prompt, quality priority prompt and historical output prompt; wherein:

[0101] The context similarity prompt refers to selecting the highest similarity sentence pair from the prompt set by cosine similarity and integrating it into the context learning prompt template to improve the accuracy of translation.

[0102] The random prompt refers to randomly selecting prompt information from the prompt set during instruction construction and providing it to the model. The random prompt method introduces diversified context information to avoid the singleness and limitations of the prompt, but due to its randomness, there is a possibility of misleading the large model by matching different domain sentence pairs as prompts.

[0103] The quality priority prompt refers to using the LASER method to sort the quality of the prompt set and selecting the highest quality parallel sentence pair as the prompt information to guide the model to generate high-quality translation results. The quality priority prompt can significantly improve the translation quality, especially in the same complex field of text, the effect is particularly significant, but relying too much on high-quality prompts may limit the creativity and flexibility of the model, leading to the translation results being too template-based.

[0104] The historical output prompt refers to using the output generated before the model as prompt information for the current translation task, and the historical output prompt can help the model to remember and use the previous translation results, thereby improving consistency and coherence; however, this strategy is too dependent on the quality of the previous output of the model, and if there is an error in the historical output of the model, the error may be continuously used by the model, resulting in error accumulation.

[0105] The application also provides a multilingual large model translation performance optimization system activated based on a prompt strategy, and the system comprises:

[0106] The acquisition module is configured to acquire a prompt data set.

[0107] The construction module is configured to construct system input of the large language model according to a task orientation.

[0108] The activation module is configured to filter prompts from the prompt data set based on a prompt strategy, integrate the filtered prompts into a context learning prompt template, splice the context learning prompt template and an input sentence as user input of the large language model, and perform context learning on the large language model to realize performance optimization in a translation task of the large language model.

[0109] The application also provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned multilingual large model translation performance optimization method activated based on a prompt strategy when executing the program.

[0110] The application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program is executable on a processor to implement the above-mentioned multilingual large model translation performance optimization method activated based on a prompt strategy.

[0111] The application uses the CHRF evaluation index as a standard for measuring the translation performance of the model, then uses a pre-prepared test set to evaluate the translation ability of the large language model under zero-shot, and evaluates the translation performance of the large language model after a few-shot context prompt.

[0112] chrF calculation process, extraction of character n-grams. First, chrF splits both the translation output and the reference translation into character-level n-grams. An n-gram represents a sequence of n characters (excluding spaces). chrF usually calculates character combinations from 1-gram to 6-gram. That is, for a translation output and a reference sentence, it extracts character-level 1-gram, 2-gram,..., 6-gram respectively.

[0113] Calculate precision and recall. Precision: indicates how many n-grams in the model translation output can be found in the reference translation, i.e. the proportion of n-grams in the output that overlap with the n-grams in the reference. Recall: indicates how many n-grams in the reference translation can be found in the model translation output, i.e. the proportion of n-grams in the reference that are correctly translated.

[0114] For a given n-gram, precision and recall are calculated as follows:

[0115]

[0116] Calculate F-Score. Use F1-score to balance precision and recall. F1-score is the harmonic mean of precision and recall, formula as follows:

[0117]

[0118] Here, the F1 score will be calculated for different n values, and the final chrF value will combine the F1 scores of all n-grams.

[0119] Combine n-gram F1 scores with weights. chrF can use different weights to combine the F1 scores of different n-grams, usually the weight of each n-gram is the same (such as 1-gram to 6-gram weight is equal). The final chrF score is the weighted average of the F1 scores of different n-grams:

[0120]

[0121] In order to illustrate the translation effect of the present application, zero-shot and few-shot prompt of the present application are compared, and the multilingual large language model used in the experiment is as follows:

[0122] GPT-3.5-Turbo: A decoder-only model based on Transformer, supports context expansion, has strong zero-shot and few-shot learning ability.

[0123] 2) LLaMA-8b: A decoder-only model based on Transformer, LLaMA-8b is a lighter model suitable for multilingual processing, translation, generation tasks, and has good generalization ability.

[0124] 3) Llama-70b: A decoder-only model based on Transformer, LLaMA-70b can handle longer context, complex language translation, and has good few-shot prompt learning ability.

[0125] 4) Seallms-7b-2.5: SeaLLM is a series of large language models (LLMs) tailored for Southeast Asia by Alibaba's DAMO Academy. These models are designed to handle the diverse languages used in the region, including but not limited to English, Chinese, Indonesian, Vietnamese, Thai, Tagalog, Malay, Burmese, Khmer, Lao, Tamil, and Javanese. These models are based on the Llama2 model and are fine-tuned with continuous pre-training, expanded vocabulary, specialized guidance, and adjustments to better grasp the complexities of regional languages

[0126] 5) Qwen-8b-instruct: Qwen-8b-instruct is a language model released by Alibaba for instruction-following tasks, fine-tuned to optimize its understanding and generation capabilities for task instructions.

[0127] Experiment 1, comparative experiment:

[0128] First, the performance of large language models under zero-shot is taken as the baseline effect, and the results are shown in Table 3.

[0129] Table 3: CHRF scores of each large language model under zero-shot prompt

[0130]

[0131] Among them, zh represents Chinese, vi represents Vietnamese, th represents Thai, my represents Burmese, and lo represents Lao.

[0132] Under zero-shot prompt, the main factors affecting the translation performance of large models are the quality and size of the dataset. Overall, Seallms-7b-2.5 outperforms other large models in Southeast Asian translation tasks, especially in translating Southeast Asian languages into Chinese, with an average CHRF score of 19.7, significantly higher than other large models. This is due to the fine-tuning of Seallms-7b-2.5 on Southeast Asian datasets, allowing the model to better capture regional language characteristics and translation details when processing specific language pairs.

[0133] After using high-quality single-sample prompts, large language models improve translation performance, and the experimental results are shown in Table 4.

[0134] Table 4: CHRF scores of each large language model under single-sample prompt

[0135]

[0136] Among them, HP represents historical output prompts, QP represents quality-first prompts, RP represents random prompts, and CP represents similarity-first prompts.

[0137] Among them, GPT-3.5-Turbo has a small improvement, while the performance of Llama3-70b is more obvious. After the quality priority prompt and random selection prompt strategies, Llama-3-70b improves by an average of 0.5 from Chinese to Southeast Asian languages, and an average of 3.365 from Southeast Asian languages to Chinese, indicating that through parallel sentence pair prompting, the performance of Southeast Asian language to Chinese translation can be significantly improved. The model can learn some common translation patterns and structures through context prompts, so as to more accurately translate Southeast Asian languages into Chinese. However, after using the historical output strategy, the effect of the large language model on the historical output is not significant, and even decreases. Since the historical output uses zero-shot output as a prompt, these results may contain translation errors or incorrect output formats without being corrected, preventing the model from learning high-quality context information and translation results, thereby affecting translation effectiveness. Therefore, using historical output as a prompt not only cannot effectively improve model performance, but may also introduce more noise and reduce translation quality. In contrast, the quality priority prompt strategy selects high-precision parallel sentence pairs to provide more accurate and targeted translation examples for the model, increasing the model's confidence when dealing with complex Southeast Asian language syntax structures. The random selection prompt strategy is basically on par with the quality priority strategy, and this strategy helps the model capture different translation patterns through diverse examples, thereby improving translation performance to some extent.

[0138] In the case of five-sample prompting, the specific experimental results are shown in Table 4. The translation performance of large models is further improved. From the overall trend, Llama3-70b significantly outperforms other models in terms of performance improvement after five-sample prompting due to its higher potential translation performance. However, since this study is conducted under the condition of frozen parameters, there is a certain bottleneck in the performance improvement of the model. Although five-sample prompting does further improve the translation performance of large models, the rate of increase is much slower than that from zero-shot to single-sample prompting. In particular, in the experiment of GPT-3.5-Turbo, although the number of prompt samples is increased, its average CHRF score is almost the same as that in the single-sample prompting case. The reason for this phenomenon can be attributed to the following aspects. First, under the setting of frozen parameters, large models cannot further adapt to new prompt information by adjusting internal weights, resulting in limited response capability to additional prompt samples. As the number of prompt samples increases, the performance improvement of the model tends to saturate, as the initial learning ability of the model has been fully utilized in the few-sample prompting, and further increasing the number of samples does not significantly expand the learning boundary of the model.

[0139] Table 5 is the performance of each model under the CHRF score standard under five sample prompts

[0140]

[0141]

[0142] where QP represents quality priority prompt, RP represents random selection prompt, and CP represents similarity priority prompt.

[0143] In addition, this work also explores whether the temperature parameter has an impact on the single-sample prompt of different prompt strategies,

[0144] In generative models, the temperature parameter has a significant impact on the output. The temperature parameter controls the randomness and diversity of the generated text. High temperature is suitable for tasks that require creativity and diversity, but it also increases the risk of generating incoherent or unreasonable content. Low temperature is suitable for tasks that require high precision and consistency, but the output may lack diversity and innovation. This invention considers whether the temperature parameter has an impact on the large model's understanding of rich text prompts. Through analysis experiments on different temperature parameters, as shown in Table 6, under the condition of zero-sample prompt, the translation performance of the model is best when the temperature parameter is 0.1, and the generated text has high accuracy and consistency. Under the condition of single-sample prompt, the translation performance of the model is best when the temperature parameter is 0.3, which shows that after providing some samples, a slightly higher temperature parameter can help the model better understand and generate target text. Fig. 2

[0145] The specific embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.​

Claims

1. A multi-language large-model translation performance optimization method based on prompt strategy activation, characterized by: The method comprises: Step 1. Get the prompt dataset; Step 2: Build the system input of the large language model based on the task orientation; Step 3: Based on the prompt strategy, prompts are filtered from the prompt dataset, and the filtered prompts are integrated into the context-learning prompt template. The context-learning prompt template is then concatenated with the input sentence as the user input of the large language model. The large language model is then subjected to context learning to achieve performance optimization in the large language model translation task. Step 2 includes: Step 2.

1. Design a system input template for the large language model based on the task orientation. By providing a clear structure and guiding prompts, the system input template can effectively reduce the output bias of the model, improve the accuracy of task execution, and reduce the generated noise. Step 2.2, adopt English-centered system input; Step 3 includes: Step 3.1, take English-centric user input; Step 3.2, set the initialization model parameters of the large language model; Step 3.3, using the prompt strategy to select one or more parallel sentence pairs from the prompt dataset and integrate them into the context learning prompt template; Step 3.4: Incorporate contextual learning into the prompt. The prompt template is concatenated with the input as the user input for the large language model, which is then used for contextual learning of the large language model. Step 3.5: In the large language model, the user input sequence first passes through the embedding layer, which maps each word to a high-dimensional vector representation; Step 3.6: The data is then processed through multiple stacked self-attention layers, which include a self-attention mechanism and a feedforward neural network. Step 3.7: After the self-attention processing prompt is completed, the large language model predicts the next word based on the current input and the generated context.

2. The method for optimizing translation performance of a multilingual large model based on prompt strategy activation according to claim 1, characterized in that: The acquisition of the prompt data set includes collecting bilingual parallel corpora and obtaining them through data preprocessing; Step 1 includes: Step 1.1, download the Southeast Asian Parallel Corpus from the ALT dataset for the test set; download the Southeast Asian Parallel Corpus from the flores-200 dataset as an alternative test set; Step 1.2: Split and select the test set, with one part used for translation performance evaluation and the other as a prompt set for contextual prompt learning. Perform LASER quality scoring on the Flores-200 and ALT datasets, and use the one with the higher quality score as the test set.

3. The method for optimizing translation performance of a multilingual large model based on prompt strategy activation according to claim 2, characterized in that: The process of LASER quality scoring is as follows: Assume that the sentence vector is S, and each word in the sentence is represented by , the sentence vector S is calculated by the following formula: ; in, is the word vector generated by the encoder at time step t, T is the sentence length, the sentence vector S is generated by the average pooling operation, and S is the final representation of the sentence; The similarity between sentence vectors is measured using cosine similarity. Given two sentences and , the similarity is expressed as follows: ; in, There are two sentences and The dot product of There are two sentences and The mold length.

4. The method for optimizing translation performance of a multilingual large model based on prompt strategy activation according to claim 1, characterized in that: In Step 2, the large language model adopts: Qwen-2-7b-instruct, GPT-3.5-Turbo, Llama-8b-instruct, Llama-70b or Seallms2.5-7b.

5. The method for optimizing translation performance of a multi-language large model based on prompt strategy activation according to claim 1, characterized in that: The prompt strategy includes context similarity prompt, random prompt, quality priority prompt and historical output prompt; wherein: The context similarity prompt refers to using cosine similarity to select the sentence pairs with the highest similarity to the sentence to be translated from the prompt set and incorporate them into the context learning prompt template, which is used by the model to understand semantics and improve translation accuracy; The random prompt refers to randomly selecting prompt information from the prompt set and providing it to the model during the instruction construction process. The random prompt method introduces diverse contextual information to avoid the singleness and limitation of the prompt; The quality-first prompt refers to using the LASER method to sort the prompt set by quality, selecting the highest-quality parallel sentence pairs as prompt information, and guiding the model to generate high-quality translation results; The historical output prompt refers to using the output previously generated by the model as prompt information for the current translation task.

6. A multi-language large-model translation performance optimization system based on prompt strategy activation, characterized by: The system includes: a module for executing the multi-language large model translation performance optimization method based on prompt strategy activation according to any one of claims 1 to 5.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the multi-language large model translation performance optimization method based on prompt strategy activation as described in any one of claims 1 to 5 is implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for optimizing translation performance of a multi-language large model based on prompt strategy activation as claimed in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Multi-modal fusion machine translation method based on visual feature and semantic information fusion

    CN117610587A

  • Large language model code translation method based on prompt fine tuning

    CN118963756A