Large language model training method and related device

By constructing a set of instruction variants of multiple prompt instruction groups and training a large language model, the problem of inaccurate translation of the large language model is solved, and the consistency and professionalism of the translation results are achieved, which is especially suitable for vertical knowledge fields such as the medical field.

CN119493997APending Publication Date: 2025-02-21ALIBABA HEALTH TECH (CHINA) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411523452.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

In the prior art, when using large language models for translation, there are problems of inaccurate translation, such as mistranslation, multi-translation and missing logic.

Method used

By building a set of instruction variants containing multiple prompt instruction groups and using these prompt instruction sets to train a large language model, the large language model can output consistent and accurate translation text when facing different forms of prompt instructions. .

Benefits of technology

Improve the accuracy of large language models in translation tasks, ensuring consistency and professionalism of translation results, especially in vertical knowledge areas such as medical fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119493997A_ABST
    Figure CN119493997A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a large language model training method and a related device. The training method of the large language model comprises the following steps: constructing an instruction variant set; wherein the instruction variant set comprises a plurality of prompt instruction groups; the prompt instruction group comprises a plurality of prompt instructions with the same target text, and different prompt instruction groups comprise different target texts; the prompt instructions in each prompt instruction group are used for indicating the large language model to translate the target text into a translated text in a specified language, and prompt instruction words included in the plurality of prompt instructions in each prompt instruction group are at least partially different; and training a large language model according to the instruction variant set, so that translated texts output by a plurality of prompt instructions in the prompt instruction group corresponding to the large language model are the same. And the text translation accuracy of the large language model can be improved to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to a training method and related device for a large language model. Background Art

[0002] In the field of machine translation, traditional machine translation models (such as those based on statistical methods or small-scale neural networks) usually rely on a large amount of manually annotated bilingual data for training to improve translation accuracy. However, as translation needs expand, the construction of high-quality bilingual parallel corpora covering different languages ​​and specialized fields (such as medical, legal, etc.) has become increasingly difficult.

[0003] In the existing technology, large language models have better semantic understanding and content generation capabilities than traditional machine learning models. The related applications of large language models have developed rapidly, and large language models have also been applied to the translation field.

[0004] However, the existing technology has the problem of inaccurate translation when using large language models for translation, such as wrong translation, multiple translations caused by translation hallucination, and missing translations caused by logical deficiencies. Summary of the invention

[0005] In view of this, multiple embodiments of the present application are dedicated to providing a large language model training method and related devices, which can improve the accuracy of the translated text of the large language model to a certain extent.

[0006] One embodiment of the present application provides a training method for a large language model, comprising: constructing an instruction variant set; wherein the instruction variant set includes a plurality of prompt instruction groups; the prompt instruction group includes a plurality of prompt instructions having the same target text, and different prompt instruction groups include different target texts; the prompt instructions in each prompt instruction group are used to instruct the large language model to translate the target text into a translation text in a specified language, and the prompt instruction words included in the plurality of prompt instructions in each prompt instruction group are at least partially different; and the large language model is trained according to the instruction variant set so that the translation texts output by the large language model corresponding to the plurality of prompt instructions in the prompt instruction group are the same.

[0007] One embodiment of the present application provides a training device for a large language model, comprising: a construction module, used to construct an instruction variant set; wherein the instruction variant set includes multiple prompt instruction groups; the prompt instruction group includes multiple prompt instructions with the same target text, and different prompt instruction groups include different target texts; the prompt instructions in each prompt instruction group are used to instruct the large language model to translate the target text into a translation text in a specified language, and the prompt instruction words included in the multiple prompt instructions in each prompt instruction group are at least partially different; and a training module, used to train the large language model according to the instruction variant set so that the translation texts output by the large language model corresponding to the multiple prompt instructions in the prompt instruction group are the same.

[0008] One embodiment of the present application provides a computer device, which includes a memory and a processor, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the training method of the large language model as described above.

[0009] One embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores at least one computer program, and when the at least one computer program is executed by a processor, it can implement the training method of the large language model as described above.

[0010] One embodiment of the present application provides a computer program product, which is used to implement the training method of the large language model as described above.

[0011] In multiple implementations provided in the present application, by constructing an instruction variant set including multiple prompt instruction groups, and using these prompt instruction sets to train a large language model, the large language model can output consistent and accurate translation text corresponding to the target text when faced with different forms of prompt instructions, thereby improving the accuracy of the translation results. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 A schematic diagram of the interaction between a large language model training device and a large language model provided for one embodiment of the present application.

[0013] Figure 2 A schematic diagram of multiple training stages of a large language model provided for one embodiment of the present application.

[0014] Figure 3 A flowchart of a method for training a large language model provided for one embodiment of the present application.

[0015] Figure 4 A schematic diagram of modules of a large language model training device provided for one embodiment of the present application.

[0016] Figure 5 A schematic diagram of a computer device provided for one embodiment of the present application. DETAILED DESCRIPTION

[0017] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0018] In the description of the embodiments of the present application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0019] In the related art, in the field of machine translation, it is usually necessary to train the translation model through a large amount of manually annotated bilingual data to improve the accuracy of translation. Specifically, a large amount of text data needs to be manually annotated first, so that it can be paired with the corresponding translation text, and then the translation model is trained using these annotated parallel corpora. However, the construction of bilingual parallel corpora is usually time-consuming and costly.

[0020] With the rapid development of natural language processing technology, large language models (LLMs) have gradually been widely used. Before being put into the market, large language models have been trained with ultra-large-scale data and have strong semantic understanding and content generation capabilities. Therefore, in some translation tasks, the use of large language models can reduce the dependence on manually annotated data and enable translation tasks to be performed efficiently in a wider range of contexts and language environments. However, although large language models have demonstrated excellent translation capabilities, there is still the problem of inaccurate translation results in translation tasks. This problem is mainly manifested in that due to the differences in the expression of different prompt instructions, large language models may generate different translation results for the same content, resulting in insufficient accuracy of the translation results.

[0021] In summary, it is necessary to improve the accuracy of large language models when handling translation tasks.

[0022] See also Figure 1. In multiple implementations provided in the present application, the training method of a large language model can be applied to an electronic device with certain computing power and network access capabilities. The electronic device can be a desktop computer, a laptop computer, a tablet computer, a smart phone, or a server. The electronic device can connect to the training platform of the large language model through the network to execute the construction of the prompt instruction set and the model training tasks. In some implementations, the training device can also be used to train a large language model deployed locally. Specifically, the electronic device includes a processor, a memory, and a network access module for network communication. The processor is used to execute the parsing of the prompt instruction set, the scheduling and feedback processing of the training data, and the memory can be used to store the constructed prompt instruction set. The network access module is used to access the large language model server or training platform.

[0023] See also Figure 1 and Figure 2 . One embodiment of the present application provides an example of an application scenario of a training device for a large language model. The training device can perform training tasks for a large language model. Specifically, in this application scenario example, the training device is used to train a large language model for translation in the medical field. The training process of the training device for the large language model for translation can be divided into three stages. The training device can first prepare a large language model base as a translation large language model. The large language model base can be a general large language model after training with a large number of samples, and of course, it can also be a translation large language model after training with a certain number of samples.

[0024] In the first stage, the training device can use the context fine-tuning method to perform preliminary training on the large language model. The training device introduces the correspondence between the medical dictionary and the error-prone terms, and embeds them into the prompt instructions for training the large language model in the first stage. Specifically, Loss Mask can be used to control the training process of the large language model. For example, the training device inputs a sentence with a masked word in the prompt instruction to the large language model: "In the medical field, 'myocardial infarction' is called [MASK]." The large language model needs to predict the masked [MASK] content based on the context and correctly output "myocardial infarction". Through multiple similar trainings, the model gradually establishes a stable correspondence between "myocardial infarction" and "myocardial infarction".

[0025] In the second stage, the training device can use a set of instruction variants in the medical field to perform SFT (Supervised Fine-Tuning) on ​​the large language model. The instruction variant set includes multiple prompt instruction groups. For example, the prompt instruction group including the target text: "The patient was diagnosed with myocardial infarction and wasadministered anticoagulant therapy promptly to reduce the risk ofthrombosis." includes the following prompt instructions.

[0026] Tips:

[0027] Role setting instruction segment: As a medical translation expert,

[0028] Task definition instructions: Please translate the following text into Chinese:

[0029] Task Requirements Instructions: Please ensure that the translation is accurate and professional, using standard medical terminology.

[0030] Target text: "The patient was diagnosed with myocardial infarction and was administered anticoagulant therapy promptly to reduce the risk of thrombosis."

[0031] Standard translation text: The patient is diagnosed with myocardial infarction and is given anticoagulant therapy promptly to reduce the risk of thrombosis.

[0032] Tip 2:

[0033] Role setting instruction segment: You are a translator who is proficient in medicine.

[0034] Task definition instruction section: Convert the following English content into Chinese.

[0035] Task requirements Instructions: Please keep the medical terminology accurate and the translation should be professional and fluent.

[0036] Target text: "The patient was diagnosed with myocardial infarction and was administered anticoagulant therapy promptly to reduce the risk of thrombosis."

[0037] Standard translation text: The patient is diagnosed with myocardial infarction and is given anticoagulant therapy promptly to reduce the risk of thrombosis.

[0038] Tip instruction 3:

[0039] Role setting instruction paragraph: As a translation scholar in the medical field,

[0040] Task definition instruction section: Please express the following in Chinese:

[0041] Task requirements Instructions: Be sure to use correct medical terminology to ensure the professionalism and accuracy of the translation.

[0042] Target text: "The patient was diagnosed with myocardial infarction and was administered anticoagulant therapy promptly to reduce the risk of thrombosis."

[0043] Standard translation text: The patient is diagnosed with myocardial infarction and is given anticoagulant therapy promptly to reduce the risk of thrombosis.

[0044] During the training process, the training device inputs the prompt instructions in the prompt instruction group into the large language model, and expects the large language model to output a translation result consistent with the standard translation text. The parameters of the large language model can be adjusted according to the difference between the actual output text of the large language model and the standard translation text. Since the prompt instructions in each prompt instruction group have different prompt instruction words on the same instruction element, the large language model can learn the same translation task under different expressions.

[0045] After the above two stages of training, the big language model can be used in actual applications. Medical professionals can use a variety of different wordings to request translation, and the big language model can output consistent and accurate translation results.

[0046] Furthermore, in some cases, in order to make the translation results of the large language model more in line with the doctor's translation preferences, a third stage of training can be performed. The prompt instructions of the training device in the third stage of training the large language model can include standard translation texts and excluded translation texts, so that after the prompt instructions are input to the large language model, the large language model can directly learn the expression of the corresponding standard translation text. For example, the prompt instruction group can include the following prompt instructions.

[0047] Tips:

[0048] Role setting instruction segment: As a medical translation expert,

[0049] Task definition instruction section: Please translate the following text into Chinese.

[0050] Task Requirements Instructions: Please ensure that the translation is accurate and professional, using standard medical terminology.

[0051] Target text: "The patient has diabetes mellitus and needs regular insulin injections.".

[0052] Standard translation text: The patient suffers from diabetes and requires regular insulin injections.

[0053] Exclusion translation text: The patient has diabetes and needs frequent injections.

[0054] Tip 2:

[0055] Role setting instruction segment: You are a translator who is proficient in medicine.

[0056] Task definition instruction section: Convert the following English content into Chinese.

[0057] Task requirements Instructions: Please keep the medical terminology accurate and the translation should be professional and fluent.

[0058] Target text: "The patient has diabetes mellitus and needs regular insulin injections.".

[0059] Standard translation text: The patient suffers from diabetes and requires regular insulin injections.

[0060] Exclusion translation text: The patient has diabetes and requires regular insulin injections.

[0061] Tip instruction 3:

[0062] Role setting instruction paragraph: As a translation scholar in the medical field,

[0063] Task definition instructions: Please express the following in Chinese:

[0064] Task requirements Instructions: Be sure to use correct medical terminology to ensure the professionalism and accuracy of the translation.

[0065] Target text: "The patient has diabetes mellitus and needs regular insulin injections."

[0066] Standard translation text: The patient suffers from diabetes and requires regular insulin injections.

[0067] Exclusionary translation text: The patient has diabetes and needs to take insulin regularly.

[0068] During the training process, the training device inputs these prompt instructions into the large language model so that the large language model learns the expression of the standard translation text and the expression of the excluded translation text. By adjusting the parameters of the large language model, the large language model learns the diversified expression of different prompt instructions. In particular, the accuracy of the translation text output by the translation large model in the vertical knowledge field is improved.

[0069] In this application scenario example, the large language model obtained after training by the training device can be used as a translation large language model in the medical field and can be used by medical personnel. For example, the doctor can directly input the target text to be translated into the large language model to obtain the translation text fed back by the large language model. Of course, the doctor can also select retrieval enhancement generation (RAG) through the client operation, so that the retrieval enhancement generation content can be added to the prompt instruction of the client calling the translation large language model. For example, before a prompt instruction is input to the translation large language model, the RAG requirement is added to the prompt instruction, and the term dictionary can be integrated in the RAG requirement. For example, the term dictionary: hypertension: high blood pressure; insulin injections: insulin injections; diabetes mellitus: diabetes. The target text example entered by the doctor is: "The patient has diabetes mellitus and requires regular insulin injections to manage blood glucose levels.". The translation large language model may correctly translate the target text as: "The patient has diabetes and needs regular insulin injections to control blood glucose levels.". In this way, the accuracy of the translation large model can be further improved by further combining the use of the RAG function.

[0070] See also Figure 3 . An embodiment of the present application provides a method for training a large language model. The method for training a large language model can be applied to a training device. The training device can be an electronic device with certain computing power and network access capabilities. Of course, the classification device can also refer to a software program running in an electronic device. The method for training a large language model can include the following steps.

[0071] Step S110: constructing an instruction variant set; wherein the instruction variant set includes a plurality of prompt instruction groups; the prompt instruction group includes a plurality of prompt instructions having the same target text, and different prompt instruction groups include different target texts; the prompt instructions in each prompt instruction group are used to instruct the large language model to translate the target text into a translation text in a specified language, and the prompt instruction words included in the plurality of prompt instructions in each prompt instruction group are at least partially different.

[0072] Step S120: training a large language model according to the instruction variant set, so that the translation texts output by the large language model corresponding to the plurality of prompt instructions in the prompt instruction group are the same.

[0073] In this embodiment, the instruction variant set may include multiple prompt instruction groups, each prompt instruction group includes multiple prompt instructions with the same target text. Different prompt instruction groups correspond to different target texts. The target text may be any text content that needs to be translated. For example, the target text may be a sentence, a paragraph, or a document. The language to which the target text belongs may be the source language. The specified language is the target language into which the target text needs to be translated, and the translated text is the result after the target text is translated.

[0074] In each prompt instruction group, the prompt instruction can be used to instruct the large language model to translate the target text into a translation text in a specified language. Among them, the prompt instruction words contained in the multiple prompt instructions in each prompt instruction group are at least partially different. It can be understood that the task indicated by the prompt instruction is to translate the same target text, but the expression, wording or style of the instruction prompt words in the prompt instruction may be different. For example, a prompt instruction group may include the following prompt instructions: "Please translate the following text into French: [target text]", "Convert this paragraph into French: [target text]" or "Can you express the following content in French? [target text]". By introducing a variety of prompt instruction words in the prompt instruction, the large language model can adapt to various translation request methods that users may use, so as to improve the accuracy of the translation.

[0075] In this embodiment, the training device trains the large language model according to the instruction variant set. During the training process, the large language model is optimized so that the large language model can output the same translation text when different prompt instructions in the same prompt instruction group are input. It can be understood that the large language model will involve adjusting the parameters of the large language model during the training process to minimize the differences between the translation texts generated by different prompt instructions in the same prompt instruction group. In this way, the large language model can learn that no matter how the wording of the prompt instruction changes, as long as the task indicated by the prompt instruction is to translate the same target text, a consistent translation result should be produced. In some professional fields, some words will have relatively fixed and professional translation texts. For example, the medical field. Medical terms will have corresponding fixed and professional expression texts in different languages. The large language model trained by the training method in this embodiment can be used by medical professionals to request translation using various different wordings during use, and the model can still provide consistent and accurate medical translations. For example, the English word "tissue". In the medical field, "tissue" is usually translated as "tissue", which refers to a structure composed of cells in an organism. In other fields, especially in daily life, "tissue" is usually translated as "paper towel" or "facial tissue". Through the training method in this embodiment, the large language model will receive multiple different prompt instructions during the training process, but these prompt instructions all require the translation of the same target text. Prompt instruction group example: Prompt instruction 1: Please translate the following term into Chinese: "tissue". Prompt instruction 2: Express "tissue" in Chinese in the medical profession. Prompt instruction 3: Can you tell me the Chinese translation of "tissue"? Prompt instruction 4: Please translate the medical term "tissue". And, "tissue" is adopted accordingly as the target translation text of the trained large language model. In this way, after training the large language model, the large language model can output a consistent translation result, namely "tissue", regardless of the translation instruction it receives for "tissue".

[0076] In some embodiments, the training method of the large language model is more suitable for training the translation large language model in the vertical knowledge field. So that, in a certain professional knowledge field, the translation large model can more accurately translate some professional vocabulary in this field. Furthermore, the large language model will have the "AI illusion" phenomenon, and may give wrong answers that seem correct. In multiple embodiments of the present application, multiple prompt instructions in the prompt instruction group have at least partially different prompt instruction words, so that the large language model can learn the differences between different prompt instructions, and understand that multiple expressions essentially express the same translation task, which can also reduce the translation errors caused by the "AI illusion" phenomenon of the large language model.

[0077] In the multiple implementations provided in this application, by constructing an instruction variant set including multiple prompt instruction groups, and using these prompt instruction sets to train a large language model, the large language model can output a consistent and accurate translation text corresponding to the target text when facing different forms of prompt instructions, thereby improving the accuracy of the translation result. Furthermore, the multiple implementations provided in this application are particularly suitable for training a large language model for translation in a vertical knowledge field, and can effectively improve the accuracy of the large language model for translation in a vertical knowledge field.

[0078] In some embodiments, the prompt instruction includes multiple instruction segments, each instruction segment corresponds to a specified instruction requirement dimension, and each instruction segment includes at least one prompt instruction word for indicating the specific requirements of the corresponding instruction requirement dimension; wherein, in each prompt instruction group, in instruction blocks corresponding to the same instruction requirement dimension by different prompt instructions, at least some of the prompt instruction words are different.

[0079] In this embodiment, the instruction element is used to represent a specific instruction requirement. The specific content of the instruction element is a component of the prompt instruction. Specifically, the instruction element may include, but is not limited to, role settings, task definitions or task requirements, etc. Specifically, in each prompt instruction group, although different prompt instructions are used to instruct the large language model to translate the same target text into a specified language, these prompt instructions are in the parts corresponding to the same instruction element, at least some of the prompt instruction words are different. That is, for the same instruction element, different prompt instructions may use different expressions or wordings.

[0080] By introducing different prompt instruction words in the parts corresponding to the same instruction elements, the large language model can adapt to the various expressions that users may use on each instruction element. This diversity of prompt instructions enables the trained large language model to better perform translation tasks. In some embodiments, it is particularly important for the medical field because the accurate translation of professional terms will affect the quality of clinical diagnosis and medical research. In addition, the training method also effectively reduces the "AI hallucination" phenomenon of the large language model. Since the large language model has learned that different prompt instruction words may express the same task requirements on different instruction elements, the model can correctly understand the task and output accurate translation results when faced with prompt instructions with diverse wording.

[0081] In summary, by introducing multiple instruction elements in the prompt instruction and using a variety of prompt instruction words in the corresponding instruction elements, this implementation effectively improves the performance of the large language model in vertical knowledge field translation tasks, especially in the medical field. The model can adapt to the various expressions of users in the prompt instructions and provide consistent and professional translation texts, thereby improving the accuracy of the translation results.

[0082] In some embodiments, the multiple instruction segments of the prompt instruction include a task definition instruction segment; the prompt instruction words included in the task definition instruction segment are used to express the need for a large language model to translate the target text into a specified language; wherein, among the task definition instruction segments of multiple prompt instructions belonging to the same prompt instruction group, at least some of the prompt instruction words are different.

[0083] In this embodiment, the multiple instruction elements of the prompt instruction include a task definition instruction element. The prompt instruction words contained in the task definition instruction element are used to express the need for the large language model to translate the target text into a specified language. Specifically, in each prompt instruction group, different prompt instructions are used to instruct the large language model to translate the same target text into a specified language, but in the task definition instruction elements of these prompt instructions, at least some of the prompt instruction words are different. That is, in the task definition instruction element, different prompt instructions may use different expressions or wordings to define the translation task.

[0084] In this embodiment, the prompt instruction words are different in the task definition instruction elements of multiple prompt instructions belonging to the same prompt instruction group. For example, the task definition instruction elements use different prompt instruction words such as "Please translate the following text into Chinese", "Convert the following content into Chinese", and "Please express the following content in Chinese". Although the wording is different, their core tasks are to require the large language model to translate the target text into a specified language.

[0085] In some embodiments, the multiple instruction segments of the prompt instruction include a role setting instruction segment; the prompt instruction words included in the role setting instruction segment are used to express the identity played by the large language model in the process of executing reasoning; wherein, among the role setting instruction segments of multiple prompt instructions belonging to the same prompt instruction group, at least some of the prompt instruction words are different and express the same or similar identities.

[0086] In this embodiment, the multiple instruction elements of the prompt instruction include a role setting instruction element. The prompt instruction words contained in the role setting instruction element are used to express the identity played by the large language model in the execution of the reasoning process. Specifically, in each prompt instruction group, although different prompt instructions are used to instruct the large language model to translate the same target text into a specified language, at least some of the prompt instruction words in the role setting instruction elements of these prompt instructions are different and express the same or similar identities. It can be understood that in the role setting instruction element, different prompt instructions may use different expressions or wordings to set the role identity of the large language model.

[0087] In this embodiment, the role setting instruction elements of multiple prompt instructions belonging to the same prompt instruction group have different prompt instruction words. For example, the role setting instruction elements use different expressions such as "as a medical translation expert", "you are a translator proficient in medicine", and "as a translation scholar in the medical field". Although the wording is different, the identities they express are the same or similar, and they all set the large language model to the role of a medical translator.

[0088] In this embodiment, by introducing different prompt words into the role setting instruction element, the training device enables the large language model to adapt to the various expressions that the user may use when setting the role identity. This variety of prompt instructions helps the model better understand its role positioning in the translation task.

[0089] In some embodiments, the multiple instruction segments of the prompt instruction include a task requirement instruction segment; the prompt instruction words included in the task requirement instruction segment are used to express the requirements for the translation text output by the large language model; wherein, among the task requirement instruction segments of the multiple prompt instructions belonging to the same prompt instruction group, at least some of the prompt instruction words are different.

[0090] In this embodiment, the multiple instruction elements of the prompt instruction include a task requirement instruction element. The prompt instruction words contained in the task requirement instruction element are used to express the requirements for the translation text output by the large language model. Specifically, in each prompt instruction group, although different prompt instructions are used to instruct the large language model to translate the same target text into a specified language, at least some of the prompt instruction words in the task requirement instruction elements of these prompt instructions are different. That is to say, in the task requirement instruction element, different prompt instructions may use different expressions or wordings to put forward requirements for the translation text.

[0091] In this embodiment, there are differences in the prompt instruction words in the task requirement instruction elements of multiple prompt instructions belonging to the same prompt instruction group. For example, the task requirement instruction elements use different expressions such as "please ensure the translation is accurate and professional", "please maintain the accuracy of medical terms", and "make sure the translation is professional and accurate". Although the wording is different, they all put forward requirements for the accuracy and professionalism of the translated text.

[0092] In this embodiment, by introducing different prompting words into the task requirement instruction element, the training device enables the large language model to adapt to the various expressions that the user may use when making translation requirements. This variety of prompting instructions helps the model better understand and meet the user's specific requirements for translation results.

[0093] In a specific implementation, for example, a prompt instruction group may include the following three prompt instructions.

[0094] Tips:

[0095] Instruction Element 1 (Role Setting): As a medical translation expert,

[0096] Instruction Element 2 (Task Definition): Please translate the following English text into Chinese.

[0097] Instruction Element 3 (Task Requirements): Please ensure that the translation is accurate and professional.

[0098] Target text: [target text].

[0099] Tip 2:

[0100] Instruction Element 1 (Role Setting): You are a translator who is proficient in medicine.

[0101] Instruction Element 2 (Task Definition): Express the following English content in Chinese.

[0102] Instruction Element 3 (Task Requirements): Please maintain accuracy in professional terminology.

[0103] Target text: [target text].

[0104] Tip instruction 3:

[0105] Instruction Element 1 (Role Setting): As a translator in the medical field,

[0106] Instruction Element 2 (Task Definition): Please translate the following into Chinese:

[0107] Instruction Element 3 (Task Requirement): Ensure correct translation of medical terms.

[0108] Target text: [target text].

[0109] In some embodiments, the prompt instruction also includes a standard translation text and an exclusion translation text; the standard translation text is the translation text expected to be obtained when the target text is translated; the exclusion translation text is the translation text not desired to be obtained when the target text is translated; wherein, multiple prompt instructions belonging to the same prompt instruction group have the same standard translation text.

[0110] In this embodiment, the prompt instruction also includes a standard translation text and an exclusion translation text. The standard translation text is the translation text expected to be obtained when translating the target text; the exclusion translation text is the translation text that is not desired to be obtained when translating the target text. Specifically, multiple prompt instructions belonging to the same prompt instruction group have the same standard translation text. That is to say, in the same prompt instruction group, although different prompt instructions differ in wording, the standard translation texts they correspond to are consistent. For example, the target text is an English sentence in the medical field: "The patient was admitted to the hospital with severe acute respiratory syndrome." In the medical field, the standard translation text that is more in line with the expression habits should be: "The patient was admitted to the hospital due to severe acute respiratory syndrome.", and the exclusion translation text that is not desired may be: "The patient was admitted to the hospital with severe acute respiratory syndrome." Although the two translations are similar in literal meaning, the standard translation text is more accurate in medical professional expression and conforms to the use habits of professional terms, such as the use of standardized terms such as "patient", "admission", and "severe acute respiratory syndrome". However, the exclusion translation text has the problem that the wording is not professional enough and the word order does not conform to the medical expression habits, such as the use of "the patient was admitted to the hospital" and "respiratory syndrome". In the prompt instruction group, multiple prompt instructions contain the same standard translation text "The patient was admitted to the hospital with severe acute respiratory syndrome.", and explicitly exclude the translation text as "The patient was admitted to the hospital with severe acute respiratory syndrome." Although the prompt instructions are expressed differently, they jointly instruct the large language model to translate the target text into the content shown in the standard translation text, avoiding the translation shown in the excluded translation text that does not conform to professional expression habits.

[0111] In a specific implementation, for example, the prompt instructions in the prompt instruction group may include the following prompt instructions.

[0112] Tips:

[0113] Instruction Element 1 (Role Setting): As a medical translation expert,

[0114] Instruction Element 2 (Task Definition): Please translate the following sentence into Chinese.

[0115] Instruction Element 3 (Task Requirements): Please ensure that the translation is professional and accurate, using standard medical terminology.

[0116] Target text: "The patient was admitted to the hospital with severe acute respiratory syndrome.",

[0117] Standard translation text: "The patient was admitted to the hospital with severe acute respiratory syndrome.",

[0118] Exclude translation text: "The patient was admitted to the hospital with severe acute respiratory syndrome.".

[0119] Tip 2:

[0120] Instruction Element 1 (Role Setting): You are a translator who is proficient in medicine.

[0121] Instruction Element 2 (Task Definition): Represent the following English sentence in Chinese.

[0122] Instruction Element 3 (Task Requirements): Please maintain the accuracy of medical terminology and conform to professional expression habits.

[0123] Target text: "The patient was admitted to the hospital with severe acute respiratory syndrome.",

[0124] Standard translation text: "The patient was admitted to the hospital with severe acute respiratory syndrome.",

[0125] Exclude translation text: "The patient was admitted to the hospital with severe acute respiratory syndrome.".

[0126] Tip instruction 3:

[0127] Instruction Element 1 (Role Setting): As a translator in the medical field,

[0128] Instruction Element 2 (Task Definition): Please translate the following into Chinese.

[0129] Instruction Element 3 (Task Requirements): Be sure to use standard medical expressions to ensure the professionalism and accuracy of the translation.

[0130] Target text: "The patient was admitted to the hospital with severe acute respiratory syndrome.",

[0131] Standard translation text: "The patient was admitted to the hospital with severe acute respiratory syndrome.",

[0132] Exclude translation text: "The patient was admitted to the hospital with severe acute respiratory syndrome.".

[0133] During the training process, the training device can train the large language model according to the prompt instruction set including the standard translation text and the excluded translation text. After the parameters of the large language model are optimized, when receiving different prompt instructions in the same prompt instruction set, it can output a translation text consistent with the standard translation text and avoid generating an undesired translation text indicated by the excluded translation text.

[0134] Through this implementation, the large language model can more accurately grasp the translation preferences in professional fields, especially when it comes to professional terms and expression habits. The large language model can output translation texts that conform to the expression habits of the corresponding professional fields when faced with different forms of prompt instructions, thereby improving the accuracy and reliability of the translation results. Furthermore, especially for the medical field, highly accurate and medical-compliant translation texts are required, so that the technical solution provided by this application can bring convenience to medical personnel.

[0135] See also Figure 4 One embodiment of the present application also provides a training device for a large language model. The training device may include: a construction module and a training module.

[0136] A construction module is used to construct an instruction variant set; wherein the instruction variant set includes a plurality of prompt instruction groups; the prompt instruction groups include a plurality of prompt instructions having the same target text, and different prompt instruction groups include different target texts; the prompt instructions in each prompt instruction group are used to instruct the large language model to translate the target text into a translation text in a specified language, and the prompt instruction words included in the plurality of prompt instructions in each prompt instruction group are at least partially different;

[0137] A training module is used to train a large language model according to the instruction variant set so that the translation texts output by the large language model corresponding to the multiple prompt instructions in the prompt instruction group are the same.

[0138] In this embodiment, the specific functions and effects achieved by the training device for a large language model can be explained with reference to other embodiments of the present application and will not be described in detail here.

[0139] The embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the processor implements the training method of the large language model as described above.

[0140] The embodiment of the present application also provides a computer program product comprising instructions, which, when executed by a processor, implements the training method of the large language model as described above.

[0141] See also Figure 5 The present description embodiment may provide a computer device, the computer device comprising: a memory, and one or more processors communicatively connected to the memory; the memory stores instructions executable by the one or more processors, the instructions are executed by the one or more processors, so that the one or more processors implement the training method of the large language model as described above.

[0142] In some embodiments, the computer device may include a processor, a non-volatile storage medium, an internal memory, a communication interface, a display device, and an input device connected by a system bus. The non-volatile storage medium may store an operating system and related computer programs.

[0143] The user information or user account information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, etc.) involved in multiple implementation methods of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0144] It should be understood that the specific examples in this article are only intended to help those skilled in the art to better understand the embodiments of the present application, rather than to limit the scope of the present invention.

[0145] It can be understood that in the various implementations of the present application, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the implementation methods of the present application.

[0146] It can be understood that the various embodiments described in this application can be implemented individually or in combination, and the embodiments of this application are not limited to this.

[0147] Unless otherwise stated, all technical and scientific terms used in the embodiments of the present application have the same meaning as those generally understood by those skilled in the art of the technical field of the present application. The terms used in the present application are only for the purpose of describing specific embodiments and are not intended to limit the scope of the present application. The term "and / or" used in the present application includes any and all combinations of one or more related listed items. The singular forms of "a kind of", "above" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0148] It can be understood that the processor of the embodiment of the present application can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method implementation can be completed by the hardware integrated logic circuit or software instructions in the processor. The above processor can be a general processor, a digital signal processor (DigitalSignal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiment of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor are combined and executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0149] It is understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (programmable ROM, PROM), an erasable programmable read-only memory (erasable PROM, EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory may be a random access memory (RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0150] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0151] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method implementation methods and will not be repeated here.

[0152] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0153] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0154] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0155] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0156] The above is only a specific implementation of the present application, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for training a large language model, characterized in that: include: Constructing an instruction variant set; wherein the instruction variant set includes a plurality of prompt instruction groups; the prompt instruction groups include a plurality of prompt instructions having the same target text, and different prompt instruction groups include different target texts; the prompt instructions in each prompt instruction group are used to instruct the large language model to translate the target text into a translation text in a specified language, and the prompt instruction words included in the plurality of prompt instructions in each prompt instruction group are at least partially different; The large language model is trained according to the instruction variant set so that the translation texts output by the large language model corresponding to the plurality of prompt instructions in the prompt instruction group are the same.

2. The method according to claim 1, characterized in that The prompt instruction includes a plurality of instruction segments, each instruction segment is used to represent an instruction element, and each instruction segment includes at least one prompt instruction word used to represent a specific requirement of a corresponding instruction element; Among them, in the instruction segments corresponding to the same instruction elements of different prompt instructions in each prompt instruction group, at least some of the prompt instruction words are different.

3. The method according to claim 2, characterized in that The multiple instruction segments of the prompt instruction include a task definition instruction segment; the prompt instruction words included in the task definition instruction segment are used to express that a large language model is required to translate the target text into a specified language; Among them, in the task definition instruction segments of multiple prompt instructions belonging to the same prompt instruction group, at least some prompt instruction words are different.

4. The method according to claim 2, characterized in that: The multiple instruction segments of the prompt instruction include a role setting instruction segment; the prompt instruction words included in the role setting instruction segment are used to express the identity played by the large language model in the reasoning process; Among the role setting instruction segments of multiple prompt instructions belonging to the same prompt instruction group, at least some of the prompt instruction words are different.

5. The method according to claim 2, characterized in that: The multiple instruction segments of the prompt instruction include a task requirement instruction segment; the prompt instruction words included in the task requirement instruction segment are used to express requirements for the translation text output by the large language model; Among them, in the task requirement instruction segments of multiple prompt instructions belonging to the same prompt instruction group, at least some of the prompt instruction words are different.

6. The method according to claim 1, characterized in that The prompt instruction also includes a standard translation text and an exclusion translation text; the standard translation text is a translation text expected to be obtained when translating the target text; the exclusion translation text is a translation text not desired to be obtained when translating the target text; Among them, multiple prompt instructions belonging to the same prompt instruction group have the same standard translation text.

7. A large language model training device, characterized in that: include: A construction module is used to construct an instruction variant set; wherein the instruction variant set includes a plurality of prompt instruction groups; the prompt instruction groups include a plurality of prompt instructions having the same target text, and different prompt instruction groups include different target texts; the prompt instructions in each prompt instruction group are used to instruct the large language model to translate the target text into a translation text in a specified language, and the prompt instruction words included in the plurality of prompt instructions in each prompt instruction group are at least partially different; A training module is used to train a large language model according to the instruction variant set so that the translation texts output by the large language model corresponding to the multiple prompt instructions in the prompt instruction group are the same.

8. A computer device, characterized in that: The computer device includes a memory and a processor, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor to implement the large language model training method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and when the at least one computer program is executed by the processor, it can implement the training method of the large language model according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product is used to implement the large language model training method according to any one of claims 1 to 6.

Citation Information

Cited By

  • Large language model machine translation optimization method and system

    CN121562641A

  • A large language model machine translation optimization method and system

    CN121562641B