WO2025251675A1 - 文本处理模型的训练方法、文本处理方法、问答处理方法及装置 - Google Patents

文本处理模型的训练方法、文本处理方法、问答处理方法及装置

Info

Publication number
WO2025251675A1
WO2025251675A1 PCT/CN2025/077048 CN2025077048W WO2025251675A1 WO 2025251675 A1 WO2025251675 A1 WO 2025251675A1 CN 2025077048 W CN2025077048 W CN 2025077048W WO 2025251675 A1 WO2025251675 A1 WO 2025251675A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
text processing
model
training
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2025/077048
Other languages
English (en)
French (fr)
Inventor
陈祖龙
李成林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Alibaba China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Publication of WO2025251675A1 publication Critical patent/WO2025251675A1/zh
Pending legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • G06F40/16Automatic learning of transformation rules, e.g. from examples
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/09Supervised learning
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/096Transfer learning
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation
    • G06N5/022Knowledge engineering; Knowledge acquisition
    • G06N5/025Extracting rules from data
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models
    • G06N5/041Abduction

Definitions

  • This application relates to the fields of artificial intelligence and natural language processing technology, and in particular to a training method for a text processing model, a text processing method, a question-answering processing method, and an apparatus.
  • LLMs Large Language Models
  • LLMs are deep learning models trained on large amounts of text data that can generate natural language text or understand the meaning of language text. Since their introduction, LLMs have demonstrated better performance across various tasks. They are typically better able to capture complex relationships within the data, thus improving performance. Furthermore, LLMs usually possess stronger generalization capabilities, better adapting to new data and contexts, thereby enhancing their practicality and stability. Due to the increased model capabilities and the larger number of parameters, they can learn more abstract and deeper features and representations, helping the model better understand the underlying patterns and meanings of the data. Based on these advantages, LLMs have been widely applied and developed in various fields.
  • This application provides a training method and apparatus for a text processing model, so as to reduce the consumption of computing and storage resources by text processing while ensuring text processing capabilities.
  • a method for training a text processing model comprising:
  • training samples include at least text samples
  • the large language model is distilled as a teacher model to obtain a text processing model as a student model.
  • the parameter size of the text processing model is smaller than that of the large language model.
  • the large language model uses the thought process (POT) information and thought chain (COT) information predicted for the text sample to guide the training of the text processing model.
  • POT thought process
  • COT thought chain
  • the distillation of the large language model as a teacher model to obtain a text processing model as a student model includes:
  • the text sample is input into the large language model, and the first POT information and the first COT information obtained by the large language model for the text sample are obtained respectively.
  • the text sample is input into the text processing model, and the second POT information and the second COT information obtained by the text processing model for the text sample are obtained respectively.
  • the parameters of the text processing model are updated using the value of the loss function corresponding to the training objective until a preset iteration stopping condition is met.
  • the training objective includes minimizing the difference between the second POT information and the first POT information, as well as the difference between the second COT information and the first COT information.
  • the training samples further include annotation results for the text samples
  • the training objective also includes minimizing the difference between the text processing result predicted by the text processing model for the text sample and the corresponding annotation result.
  • the distillation of the large language model as a teacher model to obtain a text processing model as a student model further includes:
  • the training objective also includes minimizing the difference between the second text processing result and the first text processing result.
  • a text processing method comprising:
  • the text processing model is used to predict the text processing result for the input text, wherein the text processing model is pre-trained using the method described in the first aspect above.
  • the step of using a text processing model to predict the text processing result for the input text includes:
  • the input text is used to generate prompts, which are then input into the text processing model.
  • the text processing model uses COT and POT methods to perform inference to predict the text processing result.
  • the text processing model uses COT and POT methods to perform inference to predict the text processing result, including:
  • the text processing model predicts COT information and POT information for the input text, respectively.
  • the output text processing result is determined.
  • the text processing result includes at least one of the following:
  • the knowledge graph construction result based on the input text.
  • a question-answering processing method applied to a cloud server, the method comprising:
  • the input text is obtained using the user's question
  • the text processing model is used to predict the text processing result for the input text, wherein the text processing model is pre-trained using the method described in the first aspect above;
  • the text processing results are used to obtain a response to the user's question.
  • the response is then returned to the user terminal.
  • a training device for a text processing model comprising:
  • the sample acquisition unit is configured to acquire multiple training samples, wherein the training samples include at least text samples.
  • the model training unit is configured to use the multiple training samples to distill the large language model as a teacher model to obtain a text processing model as a student model, wherein the parameter size of the text processing model is smaller than that of the large language model; wherein during the distillation process, the training of the text processing model is guided by the thought process (POT) information and thought chain (COT) information predicted by the large language model for the text samples.
  • POT thought process
  • COT thought chain
  • a text processing apparatus comprising:
  • the text acquisition unit is configured to acquire input text
  • the text processing unit is configured to predict a text processing result for the input text using a text processing model, wherein the text processing model is pre-trained using the training apparatus described in the fourth aspect above.
  • a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in any one of the first to third aspects.
  • an electronic device comprising:
  • One or more processors are One or more processors.
  • a memory associated with the one or more processors the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any one of the first to third aspects.
  • a computer program product comprising a computer program, characterized in that, when executed by a processor, the computer program implements the steps of the method described in any one of the first to third aspects.
  • This application uses a large language model as a teacher model to train a text processing model as a student model.
  • the POT (Program-of-Thought) information and COT (Chain-of-Thought) information predicted by the large language model are used to jointly guide the text processing model, thereby optimizing the model training process and obtaining a text processing model with fewer parameters but with the capabilities of a large language model. This reduces the consumption of computing and storage resources by text processing while ensuring text processing capabilities.
  • This application takes minimizing the difference between POT and COT obtained by the text processing model and the large language model for the same text sample as the training objective.
  • POT is used as supervision, so that the text processing model, as the student model, can learn the reasoning ability of the large model in both COT and POT, thereby improving the reasoning accuracy of the trained text processing model.
  • the objective of this application also includes minimizing the difference between the text processing result predicted by the text processing model for the text sample and the corresponding annotation result or the result obtained by the large language model for the training sample.
  • the prediction result of the model is combined with POT and COT to jointly guide the training of the text processing model and ensure the text processing effect of the text processing model.
  • this application employs COT and POT methods to perform inference to predict the text processing results, and combines the text processing results obtained from multiple predictions to determine the output text processing result, thereby improving the accuracy of text processing.
  • Figure 1 is a system architecture diagram applicable to the embodiments of this application.
  • FIG. 2 is a flowchart of the training method for the text processing model provided in the embodiments of this application;
  • Figure 3 is a schematic diagram illustrating the principle of the training method for the text processing model provided in the embodiments of this application;
  • Figure 4 is a schematic diagram illustrating the principle of the training method for the text processing model using annotation results provided in the embodiments of this application;
  • Figure 5 is a schematic diagram of the principle of the training method of the text processing model when using the first text processing result provided in the embodiment of this application;
  • Figure 6 is a schematic block diagram of the training device for the text processing model provided in an embodiment of this application.
  • Figure 7 is a schematic block diagram of a text processing device provided in an embodiment of this application.
  • Figure 8 is a schematic block diagram of an electronic device provided in an embodiment of this application.
  • the word “if” as used here can be interpreted as “when,” “when,” “in response to determination,” or “in response to detection.”
  • the phrase “if determination” or “if detection (of the stated condition or event)” can be interpreted as “when determination,” “in response to determination,” “when detection (of the stated condition or event),” or “in response to detection (of the stated condition or event).”
  • Figure 1 illustrates an exemplary system architecture to which embodiments of this application can be applied.
  • the system architecture may include: a user terminal and a text processing device, a text processing model, and a model training device located on the server side.
  • User terminals can include, but are not limited to, smart mobile terminals, smart home devices, wearable devices, and PCs (Personal Computers).
  • Smart mobile devices can include mobile phones, tablets, laptops, PDAs (Personal Digital Assistants), and connected cars.
  • Smart home devices can include smart TVs, smart refrigerators, etc.
  • Wearable devices can include smartwatches, smart glasses, virtual reality devices, augmented reality devices, and mixed reality devices (devices that support both virtual and augmented reality).
  • the text processing device can generate text processing results using the methods provided in the embodiments of this application.
  • the text processing process involves the use of a text processing model, which is pre-trained by a model training device using the model training methods provided in the embodiments of this application.
  • the text processing device and model training device can be configured as independent servers, within server clusters, or on cloud servers.
  • Cloud servers also known as cloud computing servers or cloud hosts, are a host product within the cloud computing service system, designed to address the management difficulties and weak service scalability inherent in traditional physical hosts and Virtual Private Servers (VPS) services.
  • the text processing device and model training device can also be configured on computer terminals with strong computing capabilities.
  • One possible approach is for users to input questions via a user terminal, which then sends the questions to a server over the network.
  • the server uses the user questions to obtain the input text, which is then fed into a text processing device.
  • the text processing device generates a text processing result based on the input text, and the server uses the text processing result to obtain a response to the user questions, which is then returned to the user terminal over the network.
  • the user terminal, text processing device, text processing model, and model training device in Figure 1 are merely illustrative. Depending on the implementation requirements, any number of user terminals, text processing devices, text processing models, and model training devices can be included.
  • FIG 2 is a flowchart of a training method for a text processing model provided in an embodiment of this application. This method can be executed by the model training device in the system shown in Figure 1. As shown in Figure 2, the method may include the following steps:
  • Step 201 Obtain multiple training samples, which must include at least text samples.
  • Step 203 Using multiple training samples, the large language model is used as the teacher model for distillation to obtain a text processing model as the student model.
  • the parameter size of the text processing model is smaller than that of the large language model.
  • the POT and COT information predicted by the large language model for the text samples are used to guide the training of the text processing model.
  • this application uses a large language model as a teacher model to train a text processing model as a student model.
  • the POT and COT information predicted by the large language model are used to jointly guide the text processing model, thus optimizing the model training process and obtaining a text processing model with fewer parameters but with the capabilities of a large language model.
  • first and second involved in this disclosure do not have limitations in terms of size, order, or quantity, but are only used to distinguish them by name.
  • first POT information and “second POT information” are used to distinguish two POT information by name.
  • step 201 namely "acquiring multiple training samples, the training samples including at least text samples", will be described in detail with reference to the embodiments.
  • the method described in this application is used to train a text processing model, employing multiple training samples. These training samples can be obtained from existing datasets or created by the user through manual annotation or other methods.
  • the training samples include text samples. These text samples can be used for various task types, such as text classification, natural language reasoning, and question answering. For example, a text sample could be: "Peppa and her mother are planting flowers in 45 flower beds. If they plant 10 seeds in each flower bed, how many seeds did they plant in total?"
  • Training samples can also include annotations for text samples, which can be used as prediction targets for the text processing model during model training.
  • the annotations for text samples can be existing annotations already included in the training set, such as each training sample in the existing training set including both text samples and their annotations.
  • the annotations for text samples can be manually generated or generated using a large language model.
  • the dataset D in this application can be represented as:
  • x ⁇ sub>i ⁇ /sub> is the i-th text sample
  • y ⁇ sub>i ⁇ /sub> is its corresponding annotation result
  • N is the number of samples in the dataset.
  • step 203 namely, "using multiple training samples, the large language model is used as a teacher model for distillation to obtain a text processing model as a student model, the parameter scale of the text processing model is smaller than that of the large language model; wherein, during the distillation process, the POT information and COT information predicted by the large language model for the text samples are used to guide the training of the text processing model".
  • Knowledge distillation is a deep learning technique designed to improve the performance and generalization ability of a student model by transferring knowledge from a complex model (the teacher model) to a simplified model (the student model).
  • the teacher model is typically a complex, large model used to guide the student model, improving its performance by passing on its knowledge.
  • the teacher model helps the student model learn and improve performance by providing richer knowledge and information.
  • the student model is usually a simplified version of the teacher model, with a simpler structure and fewer parameters.
  • the training objective of the student model is to distill the essence from the teacher model, learning its knowledge while reducing model complexity and computational cost while maintaining high performance.
  • the teacher model is a large language model
  • the student model is a text processing model with a smaller parameter scale than the large language model used as the teacher model.
  • the structure of the text processing model can be the same as or similar to that of the large language model, but the parameter scale is significantly reduced.
  • the large language model uses a parameter scale of billions or tens of billions
  • the text processing model uses a parameter scale of trillions or tens of millions.
  • LLMs Large Language Models
  • MLs Large Language Models
  • These are deep learning models trained on massive amounts of text data that can generate natural language text or understand the meaning of language text. They are characterized by their enormous scale and massive number of parameters (typically exceeding tens of billions), and are usually based on deep learning architectures such as the Transformer architecture.
  • the difference between LLMs and ordinary pre-trained language models lies in the scale of their parameters.
  • the parameter scale exceeds a certain level, the model achieves significant performance improvements and exhibits capabilities that smaller models lack, such as in-context learning capabilities. They can learn complex patterns in language and perform a wide range of tasks, including text summarization, translation, sentiment analysis, multi-turn dialogue, and more.
  • LLMs models with a parameter scale exceeding a certain level are called LLMs.
  • language models with a parameter scale exceeding tens of billions implemented based on deep learning architectures can be considered large language models.
  • Common LLMs include: GPT-3 (Generative Pre-trained Transformer 3), T5 (Text-to-Text Transfer Transformer), GPT-4, PaLM (a large language model proposed by Google), LLaMA (Large Language Model Meta AI, a large language model released by Meta AI), and so on.
  • this application utilizes POT and COT information predicted by a large language model for text samples to guide the training of the text processing model.
  • POT Positive Reasoning Theory
  • Python a program interpreter
  • the execution of this program is not necessarily aimed at the final answer, but rather serves as an intermediate step towards it.
  • the POT information predicted by the model can be a series of programming language statements. These statements can be input into an interpreter such as Python and executed to obtain the final answer.
  • COT Cognitive Order
  • the thought chain represents the model's thought process and information transmission path when understanding or generating text.
  • COT can describe the model's thought process and chain of thought when performing reasoning, generating coherent text, or solving problems. If a user inputs a question into a large language model, the COT information predicted by the large language model can be a series of natural language statements describing the reasoning logic.
  • POT and COT are two different ways of thinking and reasoning.
  • POT is procedural reasoning, which focuses on specific calculation methods and techniques; COT focuses on logical steps and thinking processes, which is closer to human reasoning.
  • a text sample could be: "Peppa and her mom are planting flowers in the flower beds. There are 45 flower beds in total. If they plant 10 seeds in each flower bed, how many seeds do they plant in total?"
  • the POT predicted by the large language model is:
  • the COT predicted by the large language model is:
  • the POT (Point of Interest) information obtained from a large language model can be one or more POTs, and the COT (Consideration of Interest) information can also be one or more COTs.
  • This application combines COT and POT information for text processing model training. On the one hand, this allows the text processing model to better learn the reasoning ability of the large language model from both COT and POT perspectives, improving the model training effect.
  • the model only generates COT or POT information during reasoning. In this case where only one reasoning process is generated, the model can still be effectively trained on that text sample, thereby further improving the model's training efficiency and effect.
  • Figure 3 is a schematic diagram of the training method of the text processing model provided in this application embodiment. As shown in Figure 3, in each iteration, the text sample is input into the large language model, and the first POT information and the first COT information obtained by the large language model for the text sample are obtained respectively. The text sample is then input into the text processing model, and the second POT information and the second COT information obtained by the text processing model for the text sample are obtained respectively.
  • first POT information first COT information
  • second POT information second COT information
  • second COT information is suitable for model training.
  • Each of these information may contain one or more COTs or POTs.
  • the parameters of the text processing model are updated using the loss function values corresponding to the training objectives until a preset iteration stopping condition is met.
  • the training objectives include minimizing the differences between the second POT information and the first POT information, as well as the differences between the second COT information and the first COT information.
  • the distribution of POT information output by the text processing model should be as close as possible to the distribution of POT information output by the large language model
  • the distribution of COT information output by the text processing model should be as close as possible to the distribution of COT information output by the large language model.
  • a loss function can be constructed based on the above training objectives.
  • the text processing model parameters are updated using methods such as gradient descent, based on the value of the loss function, until a preset training termination condition is met.
  • This termination condition may include, for example, the value of the loss function being less than or equal to a preset loss function threshold, or the number of iterations reaching a preset threshold.
  • the loss function constructed by combining COT and POT in this application can be obtained by adding the loss function between the second COT information and the first COT information to the loss function between the second POT information and the first POT information, or by performing some operation on both.
  • L path_CoT is a loss function obtained by utilizing the difference between the second COT information and the first COT information
  • L path_PoT is a loss function obtained by utilizing the difference between the second POT information and the first POT information.
  • the annotation results can be used to guide the training of the text processing model.
  • the annotation results are related to the specific type of text processing task. For example, if the text processing task is a text classification task, the annotation results are text category labels, and the text processing result predicted by the text processing model is the text category; as another example, if the text processing task is a knowledge reasoning task, the annotation results are the reasoning results, and the text processing result predicted by the text processing model is the reasoning result, and so on.
  • Figure 4 is a schematic diagram of the principle of the text processing model training method using annotation results provided in this application embodiment. As shown in Figure 4, the training objective can also include: minimizing the difference between the text processing result predicted by the text processing model for a text sample and the corresponding annotation result.
  • L path_CoT and L path_PoT are calculated as follows:
  • FIG. 5 is a schematic diagram illustrating the principle of the text processing model training method using the first text processing result provided in this embodiment. As shown in Figure 5, the first text processing result predicted by the large language model for the text sample is obtained; the second text processing result predicted by the text processing model for the text sample is obtained, where the first and second text processing results correspond to the same text processing type.
  • the training objective also includes minimizing the difference between the second and first text processing results.
  • V( ⁇ ) represents a voting function
  • concat(A COT ,A POT ) concatenates the answer lists A COT and A POT .
  • the voting function can select the answer with the highest frequency in A COT and A POT as the text processing result, or it can integrate multiple answers and use model fusion techniques (such as Bagging, Boosting, Stacking, etc.) to combine the prediction results of multiple models to obtain a more robust and accurate final result.
  • the model trained according to the text processing model training method given in this application can be used for text processing. That is, after obtaining the input text, the text processing model can predict the text processing result based on the input text. Specifically, a prompt instruction can be generated using the input text, and the prompt instruction can be input into the text processing model. The text processing model then uses COT and POT methods to perform inference to predict the text processing result, thereby obtaining the text processing result predicted by the text processing model.
  • the text processing model predicts COT information and POT information for the input text, and based on the predicted COT information and POT information, predicts multiple candidate text processing results; and combines the candidate text processing results to determine the output text processing result.
  • the input text can be used to generate a first prompt instruction, which is used to instruct the text processing model to use the COT method for reasoning to predict the text processing results.
  • the first prompt instruction can use prompt phrases such as "Please think step by step” to indicate that the COT method is used for reasoning.
  • a second prompt instruction can be generated using the input text.
  • This second prompt instruction is used to instruct the text processing model to use the POT method for inference to predict the text processing results.
  • the second prompt instruction can use prompt phrases such as "Please break down the code step by step" to indicate that the POT method is used for inference.
  • the text processing result is P final , and the answers obtained from the answer list can be voted on using the above formula (4) to obtain the final text processing result.
  • the text processing model provided in this application can be used for various types of text processing tasks, and can include, but is not limited to:
  • the text processing result corresponding to a text classification task is the text classification result.
  • the text classification result refers to the category or label predicted by the model based on the input text. This result is commonly used in applications such as sentiment analysis, spam filtering, and news classification.
  • the text processing results corresponding to knowledge reasoning tasks are called knowledge reasoning results. These results refer to the conclusions drawn by the model when understanding text and inferring new knowledge. Such results can be applied to reasoning in tasks involving legal knowledge, scientific and technological knowledge, and criminal investigation knowledge.
  • the text processing result corresponding to the mathematical reasoning task is the mathematical reasoning result.
  • the mathematical reasoning result refers to the conclusion or solution reached by the model when solving mathematical problems or performing mathematical reasoning. This result can be applied to fields such as mathematics education and mathematical problem-solving.
  • the text processing result corresponding to the knowledge graph construction task is the knowledge graph construction result.
  • the knowledge graph construction result refers to the graph structure between entities and relationships built by the model based on the text content. This result can be applied to tasks such as information retrieval, question answering systems, and knowledge graph completion.
  • This application conducted experiments on the methods described in the embodiments.
  • the experiments trained a text processing model and tested the performance of the trained model.
  • the training and test sets used in the experiments were mainly from the datasets SVAMP (Single Variable Math Problems), GSM8K (Grade School Math 8K dataset), ASDIV (A Synthetic Dataset of Algebraic Word Problems Involving Division), and StrategyQA.
  • SVAMP, GSM8K, and ASDIV are mathematics-related datasets, which are commonly used to train and evaluate natural language processing models, especially in their ability to solve mathematical problems; StrategyQA focuses on strategic problems, and examples from StrategyQA were used to evaluate the model's ability in commonsense reasoning.
  • the experiment first employed a traditional fine-tuning training method based on annotation results to train LLaMA2-7B, CodeLlama-7B, and T5-Large, with each model having a parameter size of 770M.
  • the accuracy of the resulting text processing models on each dataset is shown in Table 1.
  • GPT-3.5-Turbo was used as the teacher model to train various student models.
  • the student models included LLaMA2-7B, CodeLlama-7B, and T5-Large, with parameter sizes of 160M, 160M, and 770M, respectively. If the text processing models are trained solely based on COT information using distillation, the accuracy of the resulting text processing models on various datasets is shown in Table 2.
  • GPT-3.5-Turbo was then used as the teacher model to train various student models.
  • the student models included LLaMA2-7B, CodeLlama-7B, and T5-Large, with parameter sizes of 160M, 160M, and 770M, respectively. If the text processing models are trained using only POT information through distillation, the accuracy of the resulting text processing models on various datasets is shown in Table 3.
  • GPT-3.5-Turbo was used as the teacher model to train various student models.
  • the student models included LLaMA2-7B, CodeLlama-7B, and T5-Large, with parameter sizes of 160M, 160M, and 770M, respectively.
  • the student models were trained using the distillation training method combining COT and POT provided in this application embodiment. The accuracy of the resulting text processing models on various datasets is shown in Table 4.
  • the text processing model obtained by the distillation training method combining COT and POT provided in the embodiments of this application has achieved a high level of inference accuracy.
  • the distillation training method based solely on COT information and the distillation training method based solely on POT information, the accuracy has been significantly improved.
  • FIG. 6 shows a schematic block diagram of the training apparatus for the text processing model according to one embodiment, which is disposed on the server side of the architecture shown in Figure 1.
  • the apparatus 600 includes:
  • the sample acquisition unit 601 is configured to acquire multiple training samples, which include at least text samples.
  • the model training unit 602 is configured to use multiple training samples to distill the large language model as a teacher model to obtain a text processing model as a student model.
  • the parameter size of the text processing model is smaller than that of the large language model.
  • the POT and COT information predicted by the large language model for the text samples are used to guide the training of the text processing model.
  • the model training unit 602 when distilling the large language model as a teacher model to obtain the text processing model as a student model, can be configured as follows: In each iteration, a text sample is input into the large language model, and the first POT information and the first COT information obtained by the large language model for the text sample are obtained respectively; the text sample is input into the text processing model, and the second POT information and the second COT information obtained by the text processing model for the text sample are obtained respectively; the parameters of the text processing model are updated using the value of the loss function corresponding to the training objective, until the preset iteration stopping condition is met.
  • the training objective includes minimizing the difference between the second POT information and the first POT information, as well as the difference between the second COT information and the first COT information.
  • the training samples also include the labeled results for the text samples
  • the training objective adopted by the model training unit 602 also includes minimizing the difference between the text processing results predicted by the text processing model for the text samples and the corresponding labeled results.
  • FIG7 shows a schematic block diagram of the text processing apparatus according to one embodiment, which is disposed on the server side of the architecture shown in FIG1.
  • the apparatus 700 includes:
  • the text acquisition unit 701 is configured to acquire input text
  • the text processing unit 702 is configured to predict the text processing result for the input text using a text processing model, wherein the text processing model is pre-trained using the training device in the embodiments of this application.
  • the text processing unit 702 when the text processing unit 702 uses the text processing model to predict the text processing result for the input text, it can be configured to: generate a prompt instruction using the input text, input the prompt instruction into the text processing model, and have the text processing model use COT and POT methods to perform reasoning to predict the text processing result; and obtain the text processing result predicted by the text processing model.
  • the text processing model can be configured to: predict COT information and POT information for the input text respectively; predict multiple candidate text processing results based on the predicted COT information and POT information respectively; and determine the output text processing result by combining the candidate text processing results.
  • the text processing results include at least one of the following: text classification results for the input text; knowledge reasoning results for the input text; mathematical reasoning results for the input text; and knowledge graph construction results for the input text.
  • the various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments.
  • the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
  • the device embodiments described above are merely illustrative.
  • the units described as separate components may or may not be physically separate.
  • the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
  • the user information including but not limited to user terminal information, user personal information, etc.
  • data including but not limited to data used for analysis, data stored, data displayed, etc.
  • the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
  • embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.
  • an electronic device comprising:
  • One or more processors are One or more processors.
  • a memory associated with the one or more processors the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any of the foregoing method embodiments.
  • This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.
  • Figure 8 illustrates the architecture of an electronic device, which may include a processor 810, a video display adapter 811, a disk drive 812, an input/output interface 813, a network interface 814, and a memory 820.
  • the processor 810, video display adapter 811, disk drive 812, input/output interface 813, network interface 814, and memory 820 can communicate with each other via a communication bus 830.
  • the processor 810 can be implemented using a general-purpose CPU, microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs and implement the technical solution provided in this application.
  • ASIC application-specific integrated circuit
  • the memory 820 can be implemented in the form of ROM (Read-Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc.
  • the memory 820 can store the operating system 821 for controlling the operation of the electronic device 800, and the basic input/output system (BIOS) 822 for controlling the low-level operations of the electronic device 800. Additionally, it can store a web browser 823, a data storage management system 824, and a text processing model training device/text processing device 825, etc.
  • the aforementioned text processing model training device/text processing device 825 can be the application program that specifically implements the aforementioned steps in the embodiments of this application.
  • the relevant program code is stored in the memory 820 and is called and executed by the processor 810.
  • the input/output interface 813 is used to connect input/output modules to enable information input and output.
  • Input/output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions.
  • Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc.
  • output devices may include displays, speakers, vibrators, indicator lights, etc.
  • Network interface 814 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices.
  • the communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
  • Bus 830 includes a pathway for transmitting information between various components of the device, such as processor 810, video display adapter 811, disk drive 812, input/output interface 813, network interface 814, and memory 820.
  • the above-described device only shows the processor 810, video display adapter 811, disk drive 812, input/output interface 813, network interface 814, memory 820, bus 830, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.
  • this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer program product.
  • This computer program product can be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Evolutionary Computation (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Molecular Biology (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Machine Translation (AREA)

Abstract

本申请实施例公开了一种文本处理模型的训练方法、文本处理方法、问答处理方法及装置,涉及人工智能技术领域。方法包括:获取多个训练样本,训练样本至少包括文本样本;利用多个训练样本,将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型,文本处理模型的参数规模小于所述大语言模型;其中在蒸馏的过程中,利用大语言模型针对文本样本预测的POT(思维程序)信息和COT(思维链)信息指导文本处理模型的训练。本申请通过利用大语言模型预测的POT信息和COT信息共同指导文本处理模型的训练,提高了模型训练的准确率。

Description

文本处理模型的训练方法、文本处理方法、问答处理方法及装置
本申请要求了2024年6月3日提交的、申请号为202410711037.9、发明名称为“文本处理模型的训练方法、文本处理方法、问答处理方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能和自然语言处理技术领域,特别是涉及一种文本处理模型的训练方法、文本处理方法、问答处理方法及装置。
背景技术
大型语言模型(LLM,Large Language Model),是指利用大量文本数据训练的深度学习模型,可以生成自然语言文本或理解语言文本的含义。大语言模型提出之后,在各项任务中展示出更好的性能,大语言模型通常能够更好地捕捉数据中的复杂关系,从而提升模型的性能。另外,大语言模型通常具有更强的泛化能力,能够更好地适应新的数据和情境,从而提高模型的实用性和稳定性。由于模型能力提升和参数量的增加,它能够学习到更抽象、更深层次的特征和表示,从而帮助模型更好地理解数据背后的规律和含义。基于大语言模型的这些优势,大语言模型在各种领域得到了广泛的应用和发展。
然而,大语言模型在实际应用中是非常消耗计算和存储资源的,这就给实际的应用部署带来了巨大的挑战。因此需要考虑如何在保留大语言模型能力的同时,又要减小参数规模,从而降低对计算和存储资源的消耗。
发明内容
本申请提供了一种文本处理模型的训练方法及装置,以在保证文本处理能力的同时,降低文本处理对计算和存储资源的消耗。
本申请提供了如下方案:
第一方面,提供了一种文本处理模型的训练方法,所述方法包括:
获取多个训练样本,所述训练样本至少包括文本样本;
利用所述多个训练样本,将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型,所述文本处理模型的参数规模小于所述大语言模型;
其中在所述蒸馏的过程中,利用所述大语言模型针对所述文本样本预测的思维程序POT信息和思维链COT信息指导所述文本处理模型的训练。
根据本申请实施例中一可实现的方式,所述将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型包括:
在每一轮迭代中,将所述文本样本输入所述大语言模型,分别获取所述大语言模型针对所述文本样本得到的第一POT信息和第一COT信息;
将所述文本样本输入所述文本处理模型,分别获取所述文本处理模型针对所述文本样本得到的第二POT信息和第二COT信息;
利用与训练目标对应的损失函数的取值,更新所述文本处理模型的参数,直至满足预设的迭代停止条件,所述训练目标包括:最小化所述第二POT信息与所述第一POT信息之间的差异以及所述第二COT信息与所述第一COT信息之间的差异。
根据本申请实施例中一可实现的方式,所述训练样本还包括针对所述文本样本的标注结果;
所述训练目标还包括:最小化所述文本处理模型针对所述文本样本预测的文本处理结果与对应标注结果之间的差异。
根据本申请实施例中一可实现的方式,所述将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型还包括:
获取所述大语言模型针对所述文本样本预测的第一文本处理结果;
获取所述文本处理模型针对所述文本样本预测的第二文本处理结果,所述第一文本处理结果和所述第二文本处理结果对应相同的文本处理类型;
所述训练目标还包括:最小化所述第二文本处理结果与所述第一文本处理结果之间的差异。
第二方面,提供了一种文本处理方法,所述方法包括:
获取输入文本;
利用文本处理模型针对所述输入文本预测文本处理结果,其中,所述文本处理模型是采用如上第一方面所述的方法预先训练得到的。
根据本申请实施例中一可实现的方式,所述利用文本处理模型针对所述输入文本预测文本处理结果包括:
利用所述输入文本生成提示指令,将所述提示指令输入所述文本处理模型,由所述文本处理模型采用COT和POT方式分别进行推理以预测文本处理结果;
获取所述文本处理模型预测的文本处理结果。
根据本申请实施例中一可实现的方式,由所述文本处理模型采用COT和POT方式分别进行推理以预测文本处理结果包括:
所述文本处理模型针对所述输入文本分别预测COT信息和POT信息;
分别基于预测得到的COT信息和POT信息,预测得到多个候选文本处理结果;
综合所述候选文本处理结果,确定输出的文本处理结果。
根据本申请实施例中一可实现的方式,所述文本处理结果包括以下至少之一:
针对所述输入文本的文本分类结果;
针对所述输入文本的知识推理结果;
针对所述输入文本的数学推理结果;
针对所述输入文本的知识图谱构建结果。
第三方面,提供了一种问答处理方法,应用于云端服务器,所述方法包括:
获取来自用户终端的用户问题;
利用所述用户问题得到输入文本;
利用文本处理模型针对所述输入文本预测文本处理结果,其中,所述文本处理模型是采用如上第一方面所述的方法预先训练得到的;
利用所述文本处理结果得到针对所述用户问题的回复;
将所述回复返回给所述用户终端。
第四方面,提供了一种文本处理模型的训练装置,所述装置包括:
样本获取单元,被配置为获取多个训练样本,所述训练样本至少包括文本样本;
模型训练单元,被配置为利用所述多个训练样本,将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型,所述文本处理模型的参数规模小于所述大语言模型;其中在所述蒸馏的过程中,利用所述大语言模型针对所述文本样本预测的思维程序POT信息和思维链COT信息指导所述文本处理模型的训练。
第五方面,提供了一种文本处理装置,所述装置包括:
文本获取单元,被配置为获取输入文本;
文本处理单元,被配置为利用文本处理模型针对所述输入文本预测文本处理结果,其中,所述文本处理模型是采用如上第四方面所述的训练装置预先训练得到的。
根据第六方面,提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述第一方面至第三方面中任一项所述的方法的步骤。
根据第七方面,提供了一种电子设备,包括:
一个或多个处理器;以及
与所述一个或多个处理器关联的存储器,所述存储器用于存储程序指令,所述程序指令在被所述一个或多个处理器读取执行时,执行上述第一方面至第三方面中任一项所述的方法的步骤。
根据第八方面,提供了一种计算机程序产品,包括计算机程序,其特征在于,该计算机程序被处理器执行时实现上述第一方面至第三方面中任一项所述方法的步骤。
根据本申请提供的具体实施例,本申请公开了以下技术效果:
1)本申请将大语言模型作为教师模型,对作为学生模型的文本处理模型进行训练,在训练中利用大语言模型预测的POT(Program-of-Thought,思维程序)信息和COT(Chain-of-Thought,思维链)信息共同指导文本处理模型,优化了模型训练的过程,得到了一个参数规模较少且具备大语言模型的能力的文本处理模型,从而在保证文本处理能力的同时,降低了文本处理对计算和存储资源的消耗。
2)本申请以最小化文本处理模型与大语言模型针对同一文本样本得到的POT的差异和COT的差异作为训练目标,在COT的基础之上,以POT作为监督,使得作为学生模型的文本处理模型能够学习到大模型在COT和POT两个方面的推理能力,提高了训练得到的文本处理模型的推理准确率。
3)本申请的训练时,目标还包括最小化文本处理模型针对文本样本预测的文本处理结果与对应标注结果或由大语言模型针对训练样本得到结果之间的差异,在模型训练时将模型的预测结果与POT和COT结合,共同指导文本处理模型的训练,保证了文本处理模型的文本处理效果。
4)本申请在利用文本处理模型进行文本处理时,采用COT和POT方式分别进行推理以预测文本处理结果,综合多个预测得到的文本处理结果,确定输出的文本处理结果,提升了文本处理的准确率。
当然,实施本申请的任一产品并不一定需要同时达到以上所述的所有优点。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例所适用的系统架构图;
图2为本申请实施例提供的文本处理模型的训练方法的流程图;
图3为本申请实施例提供的文本处理模型的训练方法的原理示意图;
图4为本申请实施例提供的利用标注结果时文本处理模型的训练方法的原理示意图;
图5为本申请实施例提供的利用第一文本处理结果时文本处理模型的训练方法的原理示意图;
图6为本申请实施例提供的文本处理模型的训练装置的示意性框图;
图7为本申请实施例提供的文本处理装置的示意性框图;
图8为本申请实施例提供的电子设备的示意性框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员所获得的所有其他实施例,都属于本申请保护的范围。
在本发明实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本发明。在本发明实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。
应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”或“响应于检测”。类似地,取决于语境,短语“如果确定”或“如果检测(陈述的条件或事件)”可以被解释成为“当确定时”或“响应于确定”或“当检测(陈述的条件或事件)时”或“响应于检测(陈述的条件或事件)”。
文本处理模型预测结果的准确性依赖于其中间的推理过程,目前已经存在一些利用大模型中间推理过程提取知识来训练小模型的技术,例如利用大模型的文本处理结果的分布来指导文本处理模型训练。然而,这些模型往往难以与大模型的性能相匹配,特别是在执行推理任务中。
有鉴于此,本申请提供了一种新的思路。为了方便对本申请的理解,首先对本申请所基于的系统架构进行描述。图1示出了可以应用本申请实施例的示例性系统架构,如图1中所示,该系统架构可以包括:用户终端和位于服务器端的文本处理装置、文本处理模型和模型训练装置。
用户可以通过用户终端将用户问题发送给服务器端,服务器端利用用户问题得到输入文本。其中用户终端可以包括但不限于诸如:智能移动终端、智能家居设备、可穿戴式设备、PC(Personal Computer,个人计算机)等。其中智能移动设备可以包括诸如手机、平板电脑、笔记本电脑、PDA(Personal Digital Assistant,个人数字助理)、互联网汽车等。智能家居设备可以包括智能电视、智能冰箱等等。可穿戴式设备可以包括诸如智能手表、智能眼镜、虚拟现实设备、增强现实设备、混合现实设备(即可以支持虚拟现实和增强现实的设备)等等。
文本处理装置可以采用本申请实施例中提供的方法,生成文本处理结果。其中,文本处理装置的文本处理过程中会涉及对文本处理模型的利用,文本处理模型由模型训练装置采用本申请实施例提供的模型训练方法预先训练得到。
文本处理装置和模型训练装置可以设置为独立的服务器,也可以设置于服务器群组,还可以设置于云服务器。云服务器又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决传统物理主机与虚拟专用服务器(VPS,Virtual Private Server)服务中存在的管理难度大,服务扩展性弱的缺陷。除了图1所示架构之外,文本处理装置和模型训练装置还可以设置于具有较强计算能力的计算机终端。
作为其中一种可实现的方式,用户可以通过用户终端输入用户问题,由用户终端将用户问题通过网络发送至服务器端,服务器端利用用户问题得到输入文本,将输入文本输入文本处理装置,文本处理装置针对该输入文本生成文本处理结果后,服务器端利用文本处理结果得到针对用户问题的回复,将该回复通过网络返回给用户终端。
应该理解,图1中的用户终端、文本处理装置、文本处理模型和模型训练装置仅仅是示意性的。根据实现需要,可以具有任意数目的用户终端、文本处理装置、文本处理模型和模型训练装置。
图2为本申请实施例提供的文本处理模型的训练方法流程图,该方法可以由图1所示系统中的模型训练装置执行。如图2中所示,该方法可以包括以下步骤:
步骤201:获取多个训练样本,训练样本至少包括文本样本。
步骤203:利用多个训练样本,将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型,文本处理模型的参数规模小于大语言模型;其中在蒸馏的过程中,利用大语言模型针对文本样本预测的POT信息和COT信息指导文本处理模型的训练。
由上述流程可以看出,本申请将大语言模型作为教师模型,对作为学生模型的文本处理模型进行训练,在训练中利用大语言模型预测的POT信息和COT信息共同指导文本处理模型,优化了模型训练的过程,从而得到了一个参数规模较少且具备大语言模型的能力的文本处理模型。
下面结合实施例分别对上述流程中的各步骤以及能够进一步产生的效果进行详细描述。需要说明的是,本公开中涉及的“第一”、“第二”等限定并不具备大小、顺序和数量等方面的限制,仅仅用以在名称上加以区分,例如“第一POT信息”和“第二POT信息”用以在名称上区分两个POT信息。
首先结合实施例对上述步骤201即“获取多个训练样本,训练样本至少包括文本样本”进行详细描述。
本申请的方法用于对文本处理模型的训练,采用多个训练样本对模型进行训练。训练样本可以从已有的数据集中获取,也可以由用户通过人工标注等方式创建。
其中,训练样本包括文本样本。文本样本可以用于多种任务类型,如文本分类、自然语言推理、问题回答等。例如,文本样本可以为:“佩奇和妈妈在花坛种花,一共有45个花坛,如果每个花坛种10个种子,那么他们共种了多少粒种子?”
训练样本还可以包括针对文本样本的标注结果,可用于在模型训练中,作为文本处理模型的预测目标。文本样本的标注结果可以是已有训练集中自带的标注结果,例如已有训练集中各训练样本包括文本样本及其标注结果。文本样本的标注结果也可以是人工标注得到的,或者采用大语言模型进行标注得到的。
本申请的数据集D可以表示为:
其中,xi为第i个文本样本,yi是其对应的标注结果,N为数据集中的样本数量。
下面结合实施例对上述步骤203即“利用多个训练样本,将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型,文本处理模型的参数规模小于大语言模型;其中在蒸馏的过程中,利用大语言模型针对文本样本预测的POT信息和COT信息指导文本处理模型的训练”进行详细描述。
知识蒸馏(Knowledge Distillation)是一种深度学习技术,旨在通过从一个复杂模型(教师模型)向一个简化模型(学生模型)传递知识,以提高学生模型的性能和泛化能力。教师模型通常是一个复杂、大型的模型,教师模型被用来指导学生模型,通过将其知识传递给学生模型来提高学生模型的性能。教师模型通过提供更丰富的知识和信息,以帮助学生模型学习并提高性能。学生模型通常是一个简化版本的模型,它的结构比教师模型更简单,参数更少。学生模型的训练目标是从教师模型那里蒸馏出精华,学习到教师模型的知识并在保持较高性能的同时减少模型的复杂度和计算成本。
本申请中,教师模型为大语言模型,学生模型为参数规模小于作为教师模型的大语言模型的文本处理模型。文本处理模型的结构可以采用与大语言模型相同或相似的结构,但参数规模明显减小,例如大语言模型采用十亿或百亿级别的参数规模,文本处理模型采用兆或数千万的级别的参数规模。
大语言模型即LLM,是指利用大量文本数据训练的深度学习模型,可以生成自然语言文本或理解语言文本的含义。其特点是规模庞大、参数量巨大(通常达到百亿级别以上),通常基于深度学习架构例如Transformer(转化器)架构。LLM与普通预训练语言模型的差别在于参数规模,当参数规模超过一定水平时,模型实现了显著的性能提升,并展现出小模型不存在的能力,例如上下文学习(in-context learning)能力,能够学习语言中的复杂模式,并执行广泛的任务,包括文本总结、翻译、情感分析、多轮对话等等。因此为了与传统预训练语言模型进行区分,将这类参数规模超过一定水平的模型称为LLM。总得来说,可以认为基于深度学习架构实现的参数规模在百亿以上的语言模型称为大语言模型。常见的LLM包括:GPT-3(Generative Pre-trained Transformer 3,生成式预训练转换器版本3)、T5(Text-to-Text Transfer Transformer,文本到文本转化器)、GPT-4、PaLM(谷歌提出的一种大语言模型)、LLaMA(Large Language Model Meta AI,一种Meta AI发布的大语言模型)等等。
本申请在蒸馏的过程中,利用大语言模型针对文本样本预测的POT信息和COT信息指导文本处理模型的训练。
POT是一种特殊的推理方法,与模型直接生成自然语言答案的方式不同,POT需要创造可在程序解释器(例如Python)上运行的可执行程序的推理过程。强调将推理过程分解为一系列的程序步骤,并将语义与变量的关联能力融入其中,其程序执行并不一定针对最终答案,而是可以作为达到最终答案的中间步骤。若用户向大语言模型输入问题后,大语言模型预测的POT信息可以为一系列的编程语言语句,该编程语言语句可以被输入诸如Python解释器运行,进而得到最终的答案。
COT为模型在处理信息时形成的一系列中间步骤,从而构成一个“思维链”,最终引导模型得到正确的结果。其主要思想是模仿人类的推理过程,思维链代表了模型在理解文本或生成文本时的思维过程和信息传递路径。COT可以描述模型在进行推理、生成连贯文本或解决问题时的思维流程和思考链条。若用户向大语言模型输入问题后,大语言模型预测的COT信息可以为一系列描述推理逻辑的自然语言语句。
可以看出,POT和COT是两种不同思维的推理方式,POT是程序推理思维,侧重于具体的计算方法和技巧;COT关注于逻辑步骤和思考过程,更接近人类的推理思维。
例如,文本样本可以为:“佩奇和妈妈在花坛种花,一共有45个花坛,如果每个花坛种10个种子,那么他们共种了多少粒种子?”
大语言模型预测的POT为:
def solution():
"""佩奇和妈妈在花坛种花,一共有45个花坛,如果每个花坛种10个种子,那么他们共种了多少粒种子?"""
seeds_per_flower_bed=10
num_flower_beds=45
total_seeds=seeds_per_flower_bed*num_flower_beds
result=total_seeds
return result
大语言模型预测的COT为:
“佩奇和她的妈妈在每个花坛上种了10颗种子。共有45个花坛。所以他们种了10x45=450颗种子。答案是450。”
大语言模型得到的POT信息可以为一个或多个POT,得到的COT信息也可以为一个或多个COT。本申请结合COT和POT信息共同用于文本处理模型训练,一方面可以使得文本处理模型更好地从COT和POT两方面学习大语言模型的推理能力,提升模型训练的效果。另一方面,对于某些类型的文本样本,模型在进行推理时仅生成COT信息或POT信息,在这种仅生成一种推理过程的情况下,针对该文本样本也可以对模型进行有效训练,从而进一步提升模型的训练效率和效果。
图3为本申请实施例提供的文本处理模型的训练方法的原理示意图,如图3所示,在每一轮迭代中,将文本样本输入大语言模型,分别获取大语言模型针对文本样本得到的第一POT信息和第一COT信息。将文本样本输入文本处理模型,分别获取文本处理模型针对文本样本得到的第二POT信息和第二COT信息。
其中,对于一个文本样本,通过大语言模型和文本处理模型均可能获取的多个COT或POT。针对这些COT和POT,可以进行基于规则的过滤,例如将生成的过短的或者不符合预设逻辑的COT和POT过滤掉,最后得到适用于模型训练的第一POT信息、第一COT信息、第二POT信息和第二COT信息。其中,第一POT信息、第一COT信息、第二POT信息和第二COT信息中可以包含一条或多条COT或POT。
利用与训练目标对应的损失函数的取值,更新文本处理模型的参数,直至满足预设的迭代停止条件。训练目标包括:最小化第二POT信息与第一POT信息之间的差异以及第二COT信息与第一COT信息之间的差异。也就是说,让文本处理模型输出的POT信息分布尽可能接近大语言模型输出的POT信息分布,以及让文本处理模型输出的COT信息分布尽可能接近大语言模型输出的COT信息分布。
可以依据上述训练目标构造损失函数,在每一轮迭代中利用损失函数的取值,采用诸如梯度下降等方式更新文本处理模型参数,直至满足预设的训练结束条件。其中训练结束条件可以包括诸如损失函数的取值小于或等于预设的损失函数阈值,迭代次数达到预设的次数阈值等。
本申请的结合COT和POT构造的损失函数,可以通过将第二COT信息与第一COT信息之间的损失函数与第二POT信息与第一POT信息之间的损失函数相加得到,也可以对两者进行某种运算后得到。作为一种具体的实施方式,本申请中的损失函数L可以表示为:
L=(1-λ)Lpath_CoT+λLpath_PoT           (2)
其中,λ为权重系数,用于控制COT和POT在模型训练中的权重占比,可以采用经验值或实验值,例如取0.5。Lpath_CoT是利用第二COT信息与第一COT信息之间的差异得到的损失函数,Lpath_PoT是利用第二POT信息与第一POT信息之间的差异得到的损失函数。
作为一种可实施方式,当训练样本还包括针对文本样本的标注结果时,可以利用标注结果指导文本处理模型的训练。其中标注结果与具体的文本处理任务的类型相关,例如,若文本处理任务为文本分类任务,则标注结果为文本类别标签,文本处理模型预测的文本处理结果为文本类别;再例如,若文本处理任务为知识推理任务,则标注结果为推理结果,文本处理模型预测的文本处理结果为推理结果等等。图4为本申请实施例提供的利用标注结果时文本处理模型的训练方法的原理示意图,如图4所示,此时训练目标还可以包括:最小化文本处理模型针对文本样本预测的文本处理结果与对应标注结果之间的差异。
在该实施例中,Lpath_CoT和Lpath_PoT的计算方式如下:
其中,分别表示大语言模型针对xi生成的第一COT信息或第一POT信息,xi为文本样本,是文本样本xi对应的标注结果,f(xi)表示文本处理模型针对xi的预测结果,包括第二COT信息、第二POT信息和文本处理结果。
本申请在利用POT信息和COT信息指导文本处理模型的训练的同时,还可以利用模型输出结果指导文本处理模型的训练,这种方式可以适用于训练样本中不包含标注结果的情形。图5为本申请实施例提供的利用第一文本处理结果时文本处理模型的训练方法的原理示意图,如图5所示,获取大语言模型针对文本样本预测的第一文本处理结果;获取文本处理模型针对文本样本预测的第二文本处理结果,第一文本处理结果和第二文本处理结果对应相同的文本处理类型。训练目标还包括:最小化第二文本处理结果与第一文本处理结果之间的差异。
当文本处理模型针对一个文本样本得到多个COT或POT时,基于这些COT和POT进而得到多个针对文本样本的文本处理结果,可以表示为答案列表ACOT={a1,a2,...,am},APOT={b1,b2,...,bn},其中m和n分别为基于COT和POT推理得到的答案数量。则文本处理结果Pfinal可以表示为:
Pfinal=V(concat(ACOT,APOT))              (4)
其中,V(·)表示一个投票函数,concat(ACOT,APOT)表示将答案列表ACOT和APOT进行拼接。投票函数可以选择ACOT和APOT中出现频率最高的答案作为文本处理结果,也可以对多个答案进行集成,采用模型融合技术(如Bagging、Boosting、Stacking等)来综合多个模型的预测结果,得到更稳健和准确的最终结果。
根据本申请给出的文本处理模型训练方法训练得到的模型即可用于文本处理,即获取输入文本后,利用文本处理模型针对该输入文本可以预测得到文本处理结果。具体地,可以利用输入文本生成提示指令,将提示指令输入文本处理模型,由文本处理模型采用COT和POT方式分别进行推理以预测文本处理结果,进而获取文本处理模型预测的文本处理结果。
优选地,文本处理模型针对输入文本分别预测COT信息和POT信息,基于预测得到的COT信息和POT信息,预测得到多个候选文本处理结果;综合候选文本处理结果,确定输出的文本处理结果。
其中,可以利用输入文本生成第一提示指令,该第一提示指令用以指示文本处理模型采用COT方式进行推理以预测文本处理结果,其中第一提示指令中可以采用诸如“请一步一步的思考”等提示短语用以指示采用COT方式进行推理。
可以利用输入文本生成第二提示指令,该第二提示指令用以指示文本处理模型采用POT方式进行推理以预测文本处理结果,其中第二提示指令中可以采用诸如“请一步一步分解代码”等提示短语用以指示采用POT方式进行推理。
同样地,针对输入文本分别通过COT推理和POT推理可以得到多个候选文本处理结果,可以表示分别为答案列表,ACOT={a1,a2,...,am},APOT={b1,b2,...,bn}。则文本处理结果为Pfinal,可以采用上述公式(4)对答案列表中得到的答案进行投票,以得到最终的文本处理结果。
本申请实施例提供的文本处理模型,可以用于多种类型的文本处理任务,可以采用包括但不限于:
1)文本分类任务
文本分类任务对应的文本处理结果为文本分类结果。其中,文本分类结果指的是模型根据输入文本所预测的类别或标签,这种结果常用于情感分析、垃圾邮件过滤、新闻分类等应用中。
2)知识推理任务
知识推理任务对应的文本处理结果为知识推理结果。其中,知识推理结果指的是模型在理解文本并推断新知识时得出的结论,这种结果可以应用于法律知识、科技知识和刑侦知识等任务的推理。
3)数学推理任务
数学推理任务对应的文本处理结果为数学推理结果。其中,数学推理结果指的是模型在解决数学问题或进行数学推理时得出的结论或解答,这种结果可以应用于数学教育、数学问题求解等领域。
4)知识图谱构建任务
知识图谱构建任务对应的文本处理结果为知识图谱构建结果。其中,知识图谱构建结果指的是模型根据文本内容构建的实体和关系之间的图谱结构,这种结果可以应用于信息检索、问答系统、知识图谱补全等任务。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
本申请针对实施例给出的方法进行了实验,实验对文本处理模型进行了训练,并对训练得到的文本处理模型的效果进行了测试。实验采用的训练集和测试集主要来自数据集SVAMP(Single Variable Math Problems,单变量数学问题)、GSM8K(Grade School Math 8K dataset,小学数学问题数据集)、ASDIV(A Synthetic Dataset of Algebraic Word Problems Involving Division,包含除法的代数文字问题合成数据集)和StrategyQA。其中,SVAMP、GSM8K和ASDIV这三个数据集是与数学相关的数据集,它们通常用于训练和评估自然语言处理模型,尤其是在解决数学问题方面的能力;StrategyQA专注于策略性问题,用来自StrategyQA中的样例来评估模型在常识推理方面的能力。
实验首先采用传统基于标注结果的Fine-tuning(微调)训练方式对LLaMA2-7B,CodeLlama-7B和T5-Large进行训练,其中各模型的参数规模在770M。得到的文本处理模型在各数据集上的准确率如表1中所示。
表1
然后,采用GPT-3.5-Turbo作为教师模型,对多种学生模型进行了训练。学生模型包括LLaMA2-7B,CodeLlama-7B和T5-Large,参数规模分别在160M、160M和770M。如果仅基于COT信息对文本处理模型进行蒸馏训练,得到的文本处理模型在各数据集上的准确率如表2中所示。
表2
再采用GPT-3.5-Turbo作为教师模型,对多种学生模型进行了训练。学生模型包括LLaMA2-7B,CodeLlama-7B和T5-Large,参数规模分别在160M、160M和770M。如果仅基于POT信息对文本处理模型进行蒸馏训练,得到的文本处理模型在各数据集上的准确率如表3中所示。
表3
采用GPT-3.5-Turbo作为教师模型,对多种学生模型进行了训练。学生模型包括LLaMA2-7B,CodeLlama-7B和T5-Large,参数规模分别在160M、160M和770M。通过本申请实施例提供的结合COT和POT的蒸馏训练方法对学生模型进行训练,得到的文本处理模型在各数据集上的准确率如表4中所示。
表4
可以看出,通过本申请实施例提供的结合COT和POT的蒸馏训练方法得到的文本处理模型达到了较高水平的推理准确率,相比较传统监督式的Fine-tuning训练方式、单纯基于COT信息的蒸馏训练方式以及单纯基于POT信息的蒸馏训练方式得到的文本处理模型,准确率均得到了显著提高。
根据另一方面的实施例,提供了一种文本处理模型的训练装置。图6示出根据一个实施例的该文本处理模型的训练装置的示意性框图,该装置设置于图1所示架构中的服务器端。如图6所示,该装置600包括:
样本获取单元601,被配置为获取多个训练样本,训练样本至少包括文本样本。
模型训练单元602,被配置为利用多个训练样本,将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型,文本处理模型的参数规模小于大语言模型;其中在蒸馏的过程中,利用大语言模型针对文本样本预测的POT信息和COT信息指导文本处理模型的训练。
作为其中一种可实现的方式,模型训练单元602在将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型时可以被配置为:在每一轮迭代中,将文本样本输入大语言模型,分别获取大语言模型针对文本样本得到的第一POT信息和第一COT信息;将文本样本输入文本处理模型,分别获取文本处理模型针对文本样本得到的第二POT信息和第二COT信息;利用与训练目标对应的损失函数的取值,更新文本处理模型的参数,直至满足预设的迭代停止条件,训练目标包括:最小化第二POT信息与第一POT信息之间的差异以及第二COT信息与第一COT信息之间的差异。
作为其中一种可实现的方式,训练样本还包括针对文本样本的标注结果,模型训练单元602采用的训练目标还包括:最小化文本处理模型针对文本样本预测的文本处理结果与对应标注结果之间的差异。
作为其中一种可实现的方式,模型训练单元602在将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型时还可以被配置为:获取大语言模型针对文本样本预测的第一文本处理结果;获取文本处理模型针对文本样本预测的第二文本处理结果,第一文本处理结果和第二文本处理结果对应相同的文本处理类型;训练目标还包括:最小化第二文本处理结果与第一文本处理结果之间的差异。
根据另一方面的实施例,提供了一种文本处理装置。图7示出根据一个实施例的该文本处理装置的示意性框图,该装置设置于图1所示架构中的服务器端。如图7所示,该装置700包括:
文本获取单元701,被配置为获取输入文本;
文本处理单元702,被配置为利用文本处理模型针对输入文本预测文本处理结果,其中,文本处理模型是采用本申请实施例中的训练装置预先训练得到的。
作为其中一种可实现的方式,文本处理单元702在利用文本处理模型针对输入文本预测文本处理结果时,可以被配置为:利用输入文本生成提示指令,将提示指令输入文本处理模型,由文本处理模型采用COT和POT方式分别进行推理以预测文本处理结果;获取文本处理模型预测的文本处理结果。
作为其中一种可实现的方式,文本处理单元702在由文本处理模型采用COT和POT方式分别进行推理以预测文本处理结果时,可以被配置为:文本处理模型针对输入文本分别预测COT信息和POT信息;分别基于预测得到的COT信息和POT信息,预测得到多个候选文本处理结果;综合候选文本处理结果,确定输出的文本处理结果。
作为其中一种可实现的方式,文本处理结果包括以下至少之一:针对输入文本的文本分类结果;针对输入文本的知识推理结果;针对输入文本的数学推理结果;针对输入文本的知识图谱构建结果。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
需要说明的是,本申请所涉及的用户信息(包括但不限于用户终端信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据,并且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准,并提供有相应的操作入口,供用户选择授权或者拒绝。
另外,本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现前述方法实施例中任一项所述的方法的步骤。
以及一种电子设备,包括:
一个或多个处理器;以及
与所述一个或多个处理器关联的存储器,所述存储器用于存储程序指令,所述程序指令在被所述一个或多个处理器读取执行时,执行前述方法实施例中任一项所述的方法的步骤。
本申请还提供了一种计算机程序产品,包括计算机程序,该计算机程序在被处理器执行时实现前述方法实施例中任一项所述的方法的步骤。
其中,图8示例性的展示出了电子设备的架构,具体可以包括处理器810,视频显示适配器811,磁盘驱动器812,输入/输出接口813,网络接口814,以及存储器820。上述处理器810、视频显示适配器811、磁盘驱动器812、输入/输出接口813、网络接口814,与存储器820之间可以通过通信总线830进行通信连接。
其中,处理器810可以采用通用的CPU、微处理器、应用专用集成电路(Application Specific Integrated Circuit,ASIC)、或者一个或多个集成电路等方式实现,用于执行相关程序,以实现本申请所提供的技术方案。
存储器820可以采用ROM(Read Only Memory,只读存储器)、RAM(Random Access Memory,随机存取存储器)、静态存储设备,动态存储设备等形式实现。存储器820可以存储用于控制电子设备800运行的操作系统821,用于控制电子设备800的低级别操作的基本输入输出系统(BIOS)822。另外,还可以存储网页浏览器823,数据存储管理系统824,以及文本处理模型训练装置/文本处理装置825等等。上述文本处理模型训练装置/文本处理装置825就可以是本申请实施例中具体实现前述各步骤操作的应用程序。总之,在通过软件或者固件来实现本申请所提供的技术方案时,相关的程序代码保存在存储器820中,并由处理器810来调用执行。
输入/输出接口813用于连接输入/输出模块,以实现信息输入及输出。输入输出/模块可以作为组件配置在设备中(图中未示出),也可以外接于设备以提供相应功能。其中输入设备可以包括键盘、鼠标、触摸屏、麦克风、各类传感器等,输出设备可以包括显示器、扬声器、振动器、指示灯等。
网络接口814用于连接通信模块(图中未示出),以实现本设备与其他设备的通信交互。其中通信模块可以通过有线方式(例如USB、网线等)实现通信,也可以通过无线方式(例如移动网络、WIFI、蓝牙等)实现通信。
总线830包括一通路,在设备的各个组件(例如处理器810、视频显示适配器811、磁盘驱动器812、输入/输出接口813、网络接口814,与存储器820)之间传输信息。
需要说明的是,尽管上述设备仅示出了处理器810、视频显示适配器811、磁盘驱动器812、输入/输出接口813、网络接口814,存储器820,总线830等,但是在具体实施过程中,该设备还可以包括实现正常运行所必需的其他组件。此外,本领域的技术人员可以理解的是,上述设备中也可以仅包含实现本申请方案所必需的组件,而不必包含图中所示的全部组件。
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以计算机程序产品的形式体现出来,该计算机程序产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例或者实施例的某些部分所述的方法。
以上对本申请所提供的技术方案进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处。综上所述,本说明书内容不应理解为对本申请的限制。

Claims (14)

  1. 一种文本处理模型的训练方法,其特征在于,所述方法包括:
    获取多个训练样本,所述训练样本至少包括文本样本;
    利用所述多个训练样本,将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型,所述文本处理模型的参数规模小于所述大语言模型;
    其中在所述蒸馏的过程中,利用所述大语言模型针对所述文本样本预测的思维程序POT信息和思维链COT信息指导所述文本处理模型的训练。
  2. 根据权利要求1所述的方法,其特征在于,所述将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型包括:
    在每一轮迭代中,将所述文本样本输入所述大语言模型,分别获取所述大语言模型针对所述文本样本得到的第一POT信息和第一COT信息;
    将所述文本样本输入所述文本处理模型,分别获取所述文本处理模型针对所述文本样本得到的第二POT信息和第二COT信息;
    利用与训练目标对应的损失函数的取值,更新所述文本处理模型的参数,直至满足预设的迭代停止条件,所述训练目标包括:最小化所述第二POT信息与所述第一POT信息之间的差异以及所述第二COT信息与所述第一COT信息之间的差异。
  3. 根据权利要求2所述的方法,其特征在于,所述训练样本还包括针对所述文本样本的标注结果;
    所述训练目标还包括:最小化所述文本处理模型针对所述文本样本预测的文本处理结果与对应标注结果之间的差异。
  4. 根据权利要求2所述的方法,其特征在于,所述将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型还包括:
    获取所述大语言模型针对所述文本样本预测的第一文本处理结果;
    获取所述文本处理模型针对所述文本样本预测的第二文本处理结果,所述第一文本处理结果和所述第二文本处理结果对应相同的文本处理类型;
    所述训练目标还包括:最小化所述第二文本处理结果与所述第一文本处理结果之间的差异。
  5. 一种文本处理方法,其特征在于,所述方法包括:
    获取输入文本;
    利用文本处理模型针对所述输入文本预测文本处理结果,其中,所述文本处理模型是采用如权利要求1至4中任一项所述的方法预先训练得到的。
  6. 根据权利要求5所述的方法,其特征在于,所述利用文本处理模型针对所述输入文本预测文本处理结果包括:
    利用所述输入文本生成提示指令,将所述提示指令输入所述文本处理模型,由所述文本处理模型采用COT和POT方式分别进行推理以预测文本处理结果;
    获取所述文本处理模型预测的文本处理结果。
  7. 根据权利要求6所述的方法,其特征在于,由所述文本处理模型采用COT和POT方式分别进行推理以预测文本处理结果包括:
    所述文本处理模型针对所述输入文本分别预测COT信息和POT信息;
    分别基于预测得到的COT信息和POT信息,预测得到多个候选文本处理结果;
    综合所述候选文本处理结果,确定输出的文本处理结果。
  8. 根据权利要求5至7中任一项所述的方法,其特征在于,所述文本处理结果包括以下至少之一:
    针对所述输入文本的文本分类结果;
    针对所述输入文本的知识推理结果;
    针对所述输入文本的数学推理结果;
    针对所述输入文本的知识图谱构建结果。
  9. 一种问答处理方法,应用于云端服务器,其特征在于,所述方法包括:
    获取来自用户终端的用户问题;
    利用所述用户问题得到输入文本;
    利用文本处理模型针对所述输入文本预测文本处理结果,其中,所述文本处理模型是采用如权利要求1至4中任一项所述的方法预先训练得到的;
    利用所述文本处理结果得到针对所述用户问题的回复;
    将所述回复返回给所述用户终端。
  10. 一种文本处理模型的训练装置,其特征在于,所述装置包括:
    样本获取单元,被配置为获取多个训练样本,所述训练样本至少包括文本样本;
    模型训练单元,被配置为利用所述多个训练样本,将大语言模型作为教师模型进行蒸馏,得到作为学生模型的文本处理模型,所述文本处理模型的参数规模小于所述大语言模型;其中在所述蒸馏的过程中,利用所述大语言模型针对所述文本样本预测的思维程序POT信息和思维链COT信息指导所述文本处理模型的训练。
  11. 一种文本处理装置,其特征在于,所述装置包括:
    文本获取单元,被配置为获取输入文本;
    文本处理单元,被配置为利用文本处理模型针对所述输入文本预测文本处理结果,其中,所述文本处理模型是采用如权利要求10所述的训练装置预先训练得到的。
  12. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现权利要求1至9中任一项所述的方法的步骤。
  13. 一种电子设备,其特征在于,包括:
    一个或多个处理器;以及
    与所述一个或多个处理器关联的存储器,所述存储器用于存储程序指令,所述程序指令在被所述一个或多个处理器读取执行时,执行权利要求1至9中任一项所述的方法的步骤。
  14. 一种计算机程序产品,包括计算机程序,其特征在于,该计算机程序被处理器执行时实现权利要求1至9中任一项所述方法的步骤。
PCT/CN2025/077048 2024-06-03 2025-02-12 文本处理模型的训练方法、文本处理方法、问答处理方法及装置 Pending WO2025251675A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202410711037.9A CN118627543A (zh) 2024-06-03 2024-06-03 文本处理模型的训练方法、文本处理方法、问答处理方法及装置
CN202410711037.9 2024-06-03

Publications (1)

Publication Number Publication Date
WO2025251675A1 true WO2025251675A1 (zh) 2025-12-11

Family

ID=92604827

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2025/077048 Pending WO2025251675A1 (zh) 2024-06-03 2025-02-12 文本处理模型的训练方法、文本处理方法、问答处理方法及装置

Country Status (2)

Country Link
CN (1) CN118627543A (zh)
WO (1) WO2025251675A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118627543A (zh) * 2024-06-03 2024-09-10 阿里巴巴(中国)有限公司 文本处理模型的训练方法、文本处理方法、问答处理方法及装置
CN120146180B (zh) * 2025-02-11 2025-12-12 浙江大学 基于链式推理与程序推理融合的解题方法及系统
CN120315724B (zh) * 2025-06-12 2025-09-02 上海阶跃星辰智能科技有限公司 数据处理方法、电子设备、介质及产品
CN120780815B (zh) * 2025-08-28 2026-01-30 杭州通义实验室科技有限公司 文本处理模型训练方法、文本处理方法及对话处理方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116739110A (zh) * 2023-06-21 2023-09-12 山东慧智博视数字科技有限公司 一种基于思维链的大语言模型蒸馏方法
CN117743950A (zh) * 2024-02-20 2024-03-22 浙江口碑网络技术有限公司 相关性判断方法及基于llm的相关性判断模型构建方法
CN117933360A (zh) * 2023-08-24 2024-04-26 中国科学院信息工程研究所 一种基于知识蒸馏和提示工程的模型生成方法及系统
CN118627543A (zh) * 2024-06-03 2024-09-10 阿里巴巴(中国)有限公司 文本处理模型的训练方法、文本处理方法、问答处理方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116739110A (zh) * 2023-06-21 2023-09-12 山东慧智博视数字科技有限公司 一种基于思维链的大语言模型蒸馏方法
CN117933360A (zh) * 2023-08-24 2024-04-26 中国科学院信息工程研究所 一种基于知识蒸馏和提示工程的模型生成方法及系统
CN117743950A (zh) * 2024-02-20 2024-03-22 浙江口碑网络技术有限公司 相关性判断方法及基于llm的相关性判断模型构建方法
CN118627543A (zh) * 2024-06-03 2024-09-10 阿里巴巴(中国)有限公司 文本处理模型的训练方法、文本处理方法、问答处理方法及装置

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LI CHENGLIN, CHEN QIANGLONG, LI LIANGYUE, WANG CAIYU, TAO FENG, LI YICHENG, CHEN ZULONG, ZHANG YIN: "Mixed Distillation Helps Smaller Language Models Reason Better", 25 February 2024 (2024-02-25), pages 1 - 18, XP093379065 *
ZHU XUNYU, LI JIAN, LIU YONG, MA CAN, WANG WEIPING: "Distilling mathematical reasoning capabilities into Small Language Models", NEURAL NETWORKS., ELSEVIER SCIENCE PUBLISHERS, BARKING., GB, vol. 179, 1 November 2024 (2024-11-01), GB , pages 106594, XP093379067, ISSN: 0893-6080, DOI: 10.1016/j.neunet.2024.106594 *

Also Published As

Publication number Publication date
CN118627543A (zh) 2024-09-10

Similar Documents

Publication Publication Date Title
CN111259142B (zh) 基于注意力编码和图卷积网络的特定目标情感分类方法
CN112131366B (zh) 训练文本分类模型及文本分类的方法、装置及存储介质
US12182191B2 (en) Text classification method and apparatus, device, and computer-readable storage medium
CN114565104A (zh) 语言模型的预训练方法、结果推荐方法及相关装置
WO2025251675A1 (zh) 文本处理模型的训练方法、文本处理方法、问答处理方法及装置
CN113761220B (zh) 信息获取方法、装置、设备及存储介质
WO2021159714A1 (zh) 一种数据处理方法及相关设备
Ince Automatic and intelligent content visualization system based on deep learning and genetic algorithm
WO2022001724A1 (zh) 一种数据处理方法及装置
CN113961679A (zh) 智能问答的处理方法、系统、电子设备及存储介质
CN113392640B (zh) 一种标题确定方法、装置、设备及存储介质
O'Neill et al. Amplifying limitations, harms and risks of large language models
CN116662496A (zh) 信息抽取方法、训练问答处理模型的方法及装置
CN110781302A (zh) 文本中事件角色的处理方法、装置、设备及存储介质
CN113821527B (zh) 哈希码的生成方法、装置、计算机设备及存储介质
US20250342215A1 (en) Content search method and apparatus, electronic device, storage medium, and program product
CN118193741A (zh) 一种融合多模态常识知识的反事实类隐式情感分析系统
CN116956866A (zh) 剧情数据处理方法、装置、设备、存储介质及程序产品
CN121094099A (zh) 采用逻辑推理的生成式ai
Zhang et al. Exploring coevolution of emotional contagion and behavior for microblog sentiment analysis: a deep learning architecture
CN113590803B (zh) 一种数据处理方法、装置、存储介质和计算机设备
Gan et al. Enhancing microblog sentiment analysis through multi-level feature interaction fusion with social relationship guidance: C. Gan et al.
Park et al. An integrated approach to Bayesian weight regulations and multitasking learning methods for generating emotion-based content in the metaverse
Liashenko Bibliometric analysis of chatbot training research: Key concepts and trends
CN117021114A (zh) 机器人的控制方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 25818739

Country of ref document: EP

Kind code of ref document: A1