Prompt strategy activation-based multi-language large model translation performance optimization method and system

Through the method based on the prompt strategy, the translation performance of the large language model is activated, which solves the problem that performance cannot be fully utilized in the low-resource language machine translation tasks in Southeast Asia, and achieves the improvement of translation quality in the low-resource language environment.

CN119903855AActive Publication Date: 2025-04-29KUNMING UNIV OF SCI & TECH

Patent Information

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

AI Technical Summary

Technical Problem

The existing large language models cannot fully perform their performance in Southeast Asia's low-resource language machine translation tasks, and there is a lack of public evaluation data and training data for Southeast Asia's low-resource languages.

Method used

Using a prompt strategy-based approach, the translation performance of the large language model is activated by obtaining the prompt data set, building task-oriented system input, filtering and integrating context learning prompt templates. The specific steps include obtaining the Southeast Asian parallel corpus, selecting the test set through the LASER quality score, designing the system input template, setting large language model parameters, and adopting context similarity, randomness, quality priority and historical output prompt strategies.

Benefits of technology

It significantly improves the translation quality of large language models in low-resource language environments, dynamically adjusts prompt strategies and model parameters, and optimizes translation performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119903855A_ABST
    Figure CN119903855A_ABST
Patent Text Reader

Abstract

The invention relates to a multi-language 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 multi-language large model still has insufficiency. The understanding ability of a large model on low-resource language input semantics is limited, so that part of potential translation ability of the large model is not fully activated, in order to relieve the influence, prompts are screened from a high-quality corpus based on four prompt strategies, a context learning template is constructed to serve as large model user input, and therefore the user input of the large model is improved. Task guidance serves as system input, and finally performance optimization of a large model in a low-resource language translation task is achieved by dynamically adjusting a prompt strategy and model parameters. According to the method, the potential translation ability of a large model can be effectively activated, and the translation quality of the large model in a low-resource language environment is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a multi-language large model translation performance optimization method and system based on prompt strategy activation, and belongs to the technical field of natural language processing. Background Art

[0002] With the rapid development of large language models, a lot of work has been done in the early stage to explore the performance of large models on different artificial intelligence tasks, but there is 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 that are directly injected into Southeast Asian low-resource languages ​​for training.

[0003] In real-world scenarios, the translation performance of large models cannot be fully utilized under zero-shot conditions, but through prompt engineering technology, potential translation performance can be effectively stimulated. Prompt learning is one of the core technologies of large models in few-shot or zero-shot learning. The basic principle is to embed task requirements into the 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 giving a few translation examples, the model can better understand and generate translation results. Few-shot prompts are 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 prompts can help the model more accurately capture the translation characteristics of the target language by providing several parallel corpora. Summary of the invention

[0004] The present invention provides a multi-language large model translation performance optimization method and system based on prompt strategy activation to improve the potential translation performance of a large language model.

[0005] The technical solution of the present invention is: a multi-language large model translation performance optimization method based on prompt strategy activation, the method comprising:

[0006] Step 1. Get the prompt data set;

[0007] Step 2. Build the system input of the large language model based on the task orientation; for example: optimize the large model for the Southeast Asian language translation task and build the system input. [System input]: You are a Southeast Asian language translation expert. Please translate the following Southeast Asian languages ​​into Chinese.

[0008] Step 3: Filter prompts from the prompt data set based on the prompt strategy, integrate 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. Perform context learning on the large language model to achieve performance optimization in the large language model translation task.

[0009] Furthermore, the acquisition of the prompt data set includes collecting bilingual parallel corpora and obtaining them through data preprocessing; the Step 1 includes:

[0010] Step 1.1, download the Southeast Asian parallel corpus from the ALT (Asian Language Treebank) dataset for the test set; download the Southeast Asian parallel corpus from the flores-200 dataset as an alternative test set;

[0011] Step 1.2: Cut and select the test set, one part for translation performance evaluation, and the other part as the prompt set for context prompt learning; and perform LASER (Language-Agnostic SEntence Representations) quality scoring on the flores-200 and ALT (Asian Language Treebank) datasets, and use the one with the higher quality score as the test set.

[0012] Furthermore, the LASER quality scoring process is as follows:

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

[0014]

[0015] Among them, h t 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;

[0016] The similarity between sentence vectors is measured using cosine similarity. Given two sentences S 1 and S 2 , the similarity is expressed as follows:

[0017]

[0018] Among them, s 1 ·s 2 There are two sentences S 1 and S 2 The dot product of ||s 1 ||||s 2 || are two sentences S 1 and S 2 The mold length.

[0019] Furthermore, 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.

[0020] Furthermore, the Step 2 includes:

[0021] Step 2.1. Design the system input template of 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 deviation of the model, improve the accuracy of task execution, and reduce the generated noise.

[0022] Step 2.2. According to the specific task, the translation performance of the large language model is activated, and most of the large language models are trained with English as the core corpus, so an English-centered system input is adopted; although the large model supports multi-language input, when inputting non-English content, the model may encounter more difficulties in processing certain language pairs, understanding the context, and generating appropriate results; using English input can reduce the complexity of the task 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] Furthermore, the Step 3 includes:

[0024] Step 3.1. Construct user input for Southeast Asian translation tasks. Since most large language models use English-centric corpora for training, English-centric user input is used. Although large models support multi-language input, when inputting non-English content, the model may encounter more difficulties in processing translation of certain language pairs, 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] Step 3.2, set the initialization model parameters of the large language model;

[0026] Step 3.3, using the prompt strategy to select one or more parallel sentence pairs from the prompt data set and integrate them into the context learning prompt template;

[0027] Step 3.4: Integrate the context learning of prompts. The prompt template is concatenated with the input as the user input of the large language model, which is used for subsequent context learning of the large language model.

[0028] Step 3.5: In the large language model, the user input sequence first passes through the embedding layer to map each word to a high-dimensional vector representation;

[0029] Step 3.6, then processed by multiple stacked self-attention layers; the self-attention layer includes a self-attention mechanism and a feedforward neural network;

[0030] 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.

[0031] Furthermore, 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 sentence pairs with the highest similarity to the sentence to be translated from the prompt set by using cosine similarity and incorporating them into the context learning prompt template, which is used for the model to understand semantics and improve translation accuracy;

[0033] 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 context information to avoid the singleness and limitations of the prompt. However, due to its randomness, it matches sentence pairs in different fields as prompts, which may mislead the large model.

[0034] 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. Quality-first prompts can significantly improve translation quality, especially for texts in the same complex field. However, over-reliance on high-quality prompts may limit the creativity and flexibility of the model, resulting in overly templated translation results.

[0035] The historical output prompt refers to using the output previously generated by the model as prompt information for the current translation task. The historical output prompt can help the model remember and use previous translation results to improve consistency and coherence. However, this strategy is too dependent on the quality of the model's previous output. If there are errors in the model's historical output, the model may continue to use it, resulting in error accumulation.

[0036] The present invention also provides a multi-language large model translation performance optimization system based on prompt strategy activation, and the system includes: a module for executing the above-mentioned multi-language large model translation performance optimization method based on prompt strategy activation.

[0037] The present invention also provides 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 is implemented.

[0038] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned multi-language large model translation performance optimization method based on prompt strategy activation.

[0039] The beneficial effects of the present invention are:

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

[0041] 2. The method of the present invention can effectively activate the potential translation capabilities of large models and significantly improve their translation quality in low-resource language environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 It is the overall flow chart of the present invention;

[0043] Figure 2 The changing trends of CHRF scores of generated translations under different temperature parameters. DETAILED DESCRIPTION

[0044] Example 1: Figure 1-Figure 2 As shown, a multi-language large model translation performance optimization method based on prompt strategy activation includes:

[0045] Step 1. Get the prompt data set;

[0046] Furthermore, the acquisition of the prompt data set includes collecting bilingual parallel corpora and obtaining them through data preprocessing; the Step 1 includes:

[0047] Step 1.1, 20,000 Southeast Asian parallel corpora were downloaded from the ALT (Asian Language Treebank) dataset for the test set; 1,024 Southeast Asian parallel corpora were downloaded from the flores-200 dataset as an alternative test set; the experimental dataset is shown in Table 1:

[0048] Table 1 shows the experimental data set

[0049]

[0050] Here, "k" means thousand.

[0051] Step 1.2, split and select the test set, 3000 sentences for translation performance evaluation, 17000 sentences as the prompt set for context prompt learning; and perform LASER (Language-Agnostic SEntence Representations) quality scoring on the flores-200 and ALT (Asian Language Treebank) datasets, and use the one with the higher quality score as the test set. The scoring purpose is to compare the quality of the traditional public data (flores-200) and the new public data set (ALT).

[0052] Furthermore, the LASER quality scoring process is as follows:

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

[0054]

[0055] Among them, h t 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;

[0056] The similarity between sentence vectors is measured using cosine similarity. Given two sentences S 1 and S 2 , the similarity is expressed as follows:

[0057]

[0058] Among them, s 1 ·s 2 There are two sentences S 1 and S 2 The dot product of ||s 1 ||||s 2 || are two sentences S 1 and S 2 The mold length.

[0059] Furthermore, in Step 2, a large language model trained on Southeast Asian languages ​​is selected to ensure that the large language model has activation value. The large language model is: Qwen-2-7b-instruct, GPT-3.5-Turbo, Llama-8b-instruct, Llama-70b or Seallms2.5-7b.

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

[0061] Table 2 shows the quality assessment scores

[0062]

[0063] Sep2. Build the system input of the large language model based on the task orientation; for example: optimize the large model in the Southeast Asian language translation task, build the system input, [System input]: You are a Southeast Asian language translation expert, please translate the following Southeast Asian languages ​​into Chinese;

[0064] Furthermore, the Step 2 includes:

[0065] Step 2.1. Design the system input template of 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 deviation of the model, improve the accuracy of task execution, and reduce the generated noise.

[0066] Step 2.2. According to the specific task, the translation performance of the large language model is activated, and most of the large language models are trained with English as the core corpus, so an English-centered system input is adopted; although the large model supports multi-language input, when inputting non-English content, the model may encounter more difficulties in processing certain language pairs, understanding the context, and generating appropriate results; using English input can reduce the complexity of the task 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] Step 3: Filter prompts from the prompt data set based on the prompt strategy, integrate 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 achieve performance optimization in the large language model translation task; for example: optimize the large model in the Southeast Asian language translation task, construct user input, [user input]: [prompt template]; refer to the above template, please translate the following Southeast Asian into Chinese, and filter the prompt set according to the following similarity prompt, random prompt, quality priority prompt and historical output prompt four prompt strategies, and then integrate them into the context learning prompt template;

[0068] Furthermore, the Step 3 includes:

[0069] Step 3.1. Construct user input for Southeast Asian translation tasks. Since most large language models use English-centric corpora for training, English-centric user input is used. Although large models support multi-language input, when inputting non-English content, the model may encounter more difficulties in processing translation of certain language pairs, 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] Step 3.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, top_k is set to 5, and because the large language model needs up and down learning, max_prompt_tokens is set to 518;

[0077] Step 3.3, using the prompt strategy to select one or more parallel sentence pairs from the prompt data set and integrate them into the context learning prompt template;

[0078] Step 3.4: Integrate the context learning of prompts into the prompt template and the input sentence as the user input of the large language model for subsequent context learning of the large language model; specifically:

[0079] Given an input sentence X and a contextual learning prompt template P, the contextual learning prompt template P and the input sentence X are concatenated to form a user input sequence. The user input sequence X input It 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] means concatenating P and X into a whole sequence;

[0082] Step 3.5: In the large language model, the user inputs the sequence X input First, the embedding layer maps each word 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 (transformer layers). 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] Among them, 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 expressiveness of the model:

[0089] MultiHead(Q,K,V)=Concat(head 1 , head 2 , ..., head h )W 0

[0090] Where h is the number of attention heads, and each attention head has its own W Q , W K , W V , and finally through W 0 Make linear changes;

[0091] After the self-attention mechanism, it is processed by a feed-forward neural network:

[0092] FFN(x)=ReLU(xW 1 +b 1 )W 2 +b 2

[0093] Where W1 , W 2 , b 1 , b 2 are the parameters of the feedforward neural network;

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

[0095] H = TransformerLayer (E)

[0096] Stack multiple layers of such structures to generate the final hidden layer representation;

[0097] 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, and the probability distribution of the generated t-th word is:

[0098] P(y t |X input ,y 1 ,...,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] Furthermore, 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 sentence pairs with the highest similarity to the sentence to be translated from the prompt set by using cosine similarity and incorporating them into the context learning prompt template, which is used for the model to understand semantics and improve translation accuracy;

[0102] 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 context information to avoid the singleness and limitations of the prompt. However, due to its randomness, it matches sentence pairs in different fields as prompts, which may mislead the large model.

[0103] 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. Quality-first prompts can significantly improve translation quality, especially for texts in the same complex field. However, over-reliance on high-quality prompts may limit the creativity and flexibility of the model, resulting in overly templated translation results.

[0104] The historical output prompt refers to using the output previously generated by the model as prompt information for the current translation task. The historical output prompt can help the model remember and use previous translation results to improve consistency and coherence. However, this strategy is too dependent on the quality of the model's previous output. If there are errors in the model's historical output, the model may continue to use it, resulting in error accumulation.

[0105] The present invention also provides a multi-language large model translation performance optimization system based on prompt strategy activation, the system comprising:

[0106] An acquisition module, used to acquire a prompt data set;

[0107] Building module, which is used to build the system input of large language model according to task orientation;

[0108] The activation module is used to filter prompts from the prompt data set based on the prompt strategy, integrate 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. The large language model is subjected to context learning to achieve performance optimization in the large language model translation task.

[0109] The present invention also provides 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 is implemented.

[0110] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned multi-language large model translation performance optimization method based on prompt strategy activation.

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

[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 n consecutive 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, that is, the ratio of the overlap between the output and the reference n-grams to all n-grams in the output. Recall: Indicates how many n-grams in the reference translation can be found in the model translation output, that is, the ratio 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, and the formula is as follows:

[0117]

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

[0119] Weighted combination of n-gram F1 scores. 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 have equal weights). The final chrF score is a weighted average of the F1 scores of different n-grams:

[0120]

[0121] In order to illustrate the translation effect of the present invention, a comparison is made between a zero sample and the present invention after a small number of sample prompts. The multilingual large language model used in the experiment is as follows:

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

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

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

[0125] 4) Seallms-7b-2.5: SeaLLM is a series of large language models (LLMs) customized for Southeast Asia launched by Alibaba Group's DAMO Academy, designed to handle the various 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 better able to grasp the complexity of regional languages ​​through continuous pre-training, vocabulary expansion, professional guidance, and adjustments.

[0126] 5) Qwen-8b-instruct: Qwen-8b-instruct is a language model released by Alibaba for instruction following tasks. It has been fine-tuned to optimize its ability to understand and generate task instructions.

[0127] Experiment 1: Comparative experiment:

[0128] First, the present invention takes the performance of the large language model under zero sample as the baseline effect, and the results are shown in Table 3.

[0129] Table 3 shows the CHRF scores of various language models under zero-sample prompts

[0130]

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

[0132] Under zero-sample prompts, the main factors affecting the translation performance of large models are the quality and scale of the dataset. From an overall perspective, Seallms-7b-2.5 outperforms other large models on average in Southeast translation tasks, especially in Southeast Asian to Chinese translation tasks, with an average CHRF score of 19.7, significantly higher than other large models. This is due to the fact that Seallms-7b-2.5 has been fine-tuned on the Southeast Asian dataset, which enables the model to better capture regional language characteristics and translation details when processing specific language pairs.

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

[0134] Table 4 shows the CHRF scores of various language models under single sample prompts

[0135]

[0136] Among them, HP stands for historical output prompt, QP stands for quality priority prompt, RP stands for random prompt, and CP stands for similarity priority prompt.

[0137] Among them, GPT-3.5-Turbo has a small improvement, while Llama3-70b has a more obvious performance improvement. After two strategic prompts, quality priority prompts and random selection prompts, Llama-3-70b has an average improvement of 0.5 from Chinese to Southeast Asian languages, and an average improvement of 3.365 from Southeast Asian to Chinese, indicating that the prompt of parallel sentence pairs can significantly increase the performance of Southeast Asian language to Chinese translation. The model can learn some common translation patterns and structures through contextual prompts, so as to translate Southeast Asian languages ​​into Chinese more accurately. However, after using the historical output strategy, the effect of the large language model on the historical output prompt is not significant, and even decreases. Since the historical output uses zero-sample output as a prompt, these results may contain translation errors or incorrect output formats if they are not correctly corrected, resulting in the model being unable to learn high-quality context information and translation results, thereby affecting the translation effect. Therefore, using historical output as a prompt not only fails to effectively improve model performance, but may introduce more noise and reduce translation quality. In contrast, the quality-first prompt strategy can provide the model with more accurate and targeted translation examples by selecting high-precision parallel sentence pairs, which increases the model's confidence in processing complex syntactic structures in Southeast Asian languages. The effect of the random selection prompt strategy is basically the same as that of the quality-first strategy. This strategy helps the model capture different translation patterns through diverse examples, thereby improving translation performance to a certain extent.

[0138] In the case of using five-sample prompts, the specific experimental results are shown in Table 4. The translation performance of the large model is further improved. From the overall trend, Llama3-70b has a significantly better improvement after the five-sample prompt due to its high potential translation performance. However, since this study is contextual learning under the condition of frozen parameters, there are certain bottlenecks in the performance improvement of the model. Although the five-sample prompt does further improve the translation performance of the large model, its rising rate is much slower than the rising rate from zero-sample to single-sample prompt. 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 case of single-sample prompt. The reasons for this phenomenon can be attributed to the following aspects. First, under the setting of frozen parameters, the large model cannot further adapt to the new prompt information by adjusting the internal weights, resulting in its limited ability to respond to additional prompt samples. As the number of prompt samples increases, the performance improvement of the model tends to saturate, because the initial learning ability of the model has been fully utilized in the few-sample prompt, and further increasing the number of samples does not significantly expand the learning boundary of the model.

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

[0140]

[0141]

[0142] Among them, QP stands for quality priority prompt, RP stands for random selection prompt, and CP stands for similarity priority prompt.

[0143] In addition, this work also explores whether the temperature parameter has an impact on the single sample prompts 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 creativity. This paper considers whether the temperature parameter has a certain impact on the large model's understanding of rich text prompts, and analyzes and experiments with different temperature parameters. Specifically, Figure 2 As shown in the figure, under the zero-sample prompt condition, the model has the best translation performance when the temperature parameter is 0.1, and the generated text has high accuracy and consistency. Under the single-sample prompt condition, the model has the best translation performance 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 the target text.

[0145] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose 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 data set; Step 2: Build the system input of the large language model based on the task orientation; Step 3: Filter prompts from the prompt data set based on the prompt strategy, integrate 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. Perform context learning on the large language model to achieve performance optimization in the large language model translation task.

2. 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 acquisition of the prompt data set includes collecting bilingual parallel corpora and obtaining them through data preprocessing; the 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: Cut and select the test set, one part for translation performance evaluation, and the other part as the prompt set for context prompt learning; and 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 multi-language large model based on prompt strategy activation according to claim 2, characterized in that: The LASER quality scoring process is as follows: Assume that the sentence vector is S and each word in the sentence is represented by h t , the sentence vector S is calculated by the following formula: Among them, h t 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 S1 and S2, the similarity is expressed as follows: Among them, s1·s2 is the dot product of the two sentences S1 and S2, and ||s1||||s2|| is the modulus length of the two sentences S1 and S2.

4. The method for optimizing translation performance of a multi-language large model based on prompt strategy activation according to claim 1, characterized in that: In the 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 Step 2 includes: Step 2.

1. Design the system input template of 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 deviation of the model, improve the accuracy of task execution, and reduce the generated noise. Step 2.2, adopt English-centered system input.

6. 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 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 data set and integrate them into the context learning prompt template; Step 3.4: Integrate the context learning of prompts. The prompt template is concatenated with the input as the user input of the large language model, which is used for subsequent context learning of the large language model. Step 3.5: In the large language model, the user input sequence first passes through the embedding layer to map each word to a high-dimensional vector representation; Step 3.6, then processed by multiple stacked self-attention layers; the self-attention layer includes 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.

7. 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 selecting the sentence pairs with the highest similarity to the sentence to be translated from the prompt set by using cosine similarity and incorporating them into the context learning prompt template, which is used for 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 context 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.

8. A multi-language large model translation performance optimization system based on prompt strategy activation, characterized in that: The system comprises: a module for executing the multi-language large model translation performance optimization method based on prompt strategy activation as described in any one of claims 1 to 7.

9. 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 7 is implemented.

10. 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 multi-language large model translation performance optimization method based on prompt strategy activation is implemented as described in any one of claims 1 to 7.

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

Cited By

  • Multi-language deep translation method and system based on large model and electronic equipment

    CN120387462A

  • Visual arrangement system and method for large language model workflow

    CN121615664A

  • A large language model workflow visual arrangement system and method

    CN121615664B