Text processing model training method, device and storage medium
By generating training sample data containing thinking paths to train the initial text processing model, the problem of low model output accuracy caused by manual labeling is solved, and the accuracy of the model in logical reasoning and information generation is improved.
Patent Information
- Application Number
- CN202510464871.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-04-14
AI Technical Summary
In the existing technology, the initial text processing model is trained based on manually labeled training samples, resulting in low accuracy of the model's output response information, especially poor performance in logical reasoning and complex problem processing.
By obtaining a sample generation model, training sample data containing thinking paths is generated, and the initial text processing model is trained using an unsupervised learning method to generate a target text processing model, reducing dependence on manual labeling and providing problem-solving steps and logical reasoning processes.
It improves the model's understanding of the logical structure of problems and its ability to use tools, enhances the accuracy of the model's logical reasoning and information generation when facing new problems, and improves the quality of output response information.
Smart Images

Figure CN120012942B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and more specifically, to a training method, device, and storage medium for a text processing model. Background Art
[0002] Advances in natural language processing, particularly the rise of large-scale language models, have revolutionized how machines understand and generate human language. However, despite their outstanding performance in many natural language processing tasks, these models still exhibit limitations when handling tasks that require deep logical reasoning and the use of external tools. The root cause of this can be traced back to deficiencies in the model's training data and methods.
[0003] Traditional training data relies on manual annotation. To improve a model's logical reasoning capabilities, researchers tend to use data samples that incorporate a step-by-step reasoning process. This step-by-step reasoning process is designed to help the model learn how to gradually develop its thinking and conduct structured logical analysis, which is crucial for improving the model's logical reasoning and problem-solving skills. However, relying on manual annotation to construct such data samples has significant drawbacks. Manual annotation is not only time-consuming but also requires specialized knowledge from the annotator. This requirement is particularly stringent for complex logical reasoning tasks, resulting in extremely high data preparation costs. Manual annotation also struggles to quickly adapt to new domains and types of problems, limiting the model's adaptability to diverse scenarios. Furthermore, the efficiency and scale of manual annotation cannot meet the urgent need for large amounts of data in the pre-training phase of large-scale language models. These issues directly hinder the model's performance on logical reasoning tasks. Initial text processing models may perform poorly in deep understanding, cross-document information retrieval, and reasoning that integrates knowledge from multiple domains. Especially when dealing with complex questions, the accuracy and logical coherence of their responses are often unsatisfactory.
[0004] Currently, no effective solution has been proposed to the problem that the initial text processing model is trained using manually annotated training samples, resulting in low accuracy of the response information output by the model. Summary of the Invention
[0005] The main purpose of this application is to provide a training method, device and storage medium for a text processing model to solve the problem in related technologies of using manually annotated training samples to train the initial text processing model, resulting in low accuracy of the response information output by the obtained model.
[0006] To achieve the above objectives, according to one aspect of the present application, a method for training a text processing model is provided. The method comprises: obtaining a sample generation model, wherein the sample generation model is used to generate training sample data containing a thought path; using the sample generation model to generate training sample data containing a thought path; and training an initial text processing model based on the training sample data to obtain a target text processing model, wherein the target text processing model is used to perform retrieval enhancement processing on question information and output response information based on the processing results.
[0007] Furthermore, the sample generation model is obtained through the following steps: extracting paragraph samples from a text sample set; identifying keywords in the paragraph samples, and using a preset method to mask at least one keyword in the paragraph samples to obtain a target paragraph; determining an initial training sample based on the target paragraph; training the sample model based on the initial training sample to obtain a sample generation model.
[0008] Furthermore, determining the initial training sample based on the target paragraph includes: determining the prompt word corresponding to the target paragraph; inputting the target paragraph and the prompt word into the initial text processing model, outputting the first thinking path for the target paragraph and the first reply information for the target paragraph; when the content of the first reply information and the paragraph sample is the same, using the target paragraph, the prompt word corresponding to the target paragraph, the first thinking path and the first reply information as the initial training sample.
[0009] Furthermore, the initial training sample includes a target paragraph, a prompt word corresponding to the target paragraph, a first thinking path and a first reply information. The sample model is trained based on the initial training sample to obtain a sample generation model including: inputting the target paragraph and the prompt word corresponding to the target paragraph into the sample model, outputting a second thinking path for the target paragraph and a second reply information for the target paragraph; calculating a first loss value of the first thinking path and the second thinking path based on a first loss function, and calculating a second loss value of the first reply information and the second reply information based on the first loss function; updating the parameters of the sample model based on the first loss value and the second loss value, and repeatedly executing the steps of inputting the target paragraph and the prompt word corresponding to the target paragraph into the updated sample model, and calculating the loss value between the thinking path output by the updated sample model and the first thinking path, and the loss value between the reply information output by the updated sample model and the first reply information based on the first loss function, until the calculated loss value meets the first preset condition, and the updated sample model is used as the sample generation model.
[0010] Furthermore, using the sample generation model to generate training sample data containing thinking paths includes: using the sample generation model to generate preset training samples, wherein the preset training samples include preset prompt words, preset text samples, processed preset text samples, preset thinking paths and preset reply information; when the preset text samples and the preset reply information are consistent, the preset prompt words, processed preset text samples, preset thinking paths and preset reply information are used as training sample data.
[0011] Furthermore, the training sample data includes preset prompt words, processed preset text samples, preset thinking paths and preset reply information. Training the initial text processing model based on the training sample data includes: inputting the preset prompt words and the processed preset text samples into the initial text processing model, outputting a third thinking path for the processed preset text samples and a third reply information for the processed preset text samples; calculating a third loss value of the preset thinking path and the third thinking path based on the second loss function, and calculating a fourth loss value of the preset reply information and the third reply information based on the second loss function; updating the parameters of the initial text processing model based on the third loss value and the fourth loss value, and repeatedly executing the steps of inputting the preset prompt words and the processed preset text samples into the updated initial text processing model, calculating the loss value between the thinking path output by the updated initial text processing model and the preset thinking path, and the loss value between the reply information output by the updated initial text processing model and the preset reply information, until the calculated loss value meets the second preset condition, and the updated initial text processing model is used as the target text processing model.
[0012] To achieve the above objectives, according to another aspect of the present application, an information processing method based on a target text processing model is provided. The method comprises: receiving question information; inputting the question information into the target text processing model; and outputting response information corresponding to the question information through the target text processing model.
[0013] Furthermore, outputting reply information corresponding to the question information through the target text processing model includes: generating a target thinking chain corresponding to the question information through the target text processing model; obtaining requirement description information based on the target thinking chain and the question information through the target text processing model, wherein the requirement description information is used to indicate the information that needs to be supplemented in the target thinking chain; calling an external information source to obtain target requirement information corresponding to the requirement description information; filling the target requirement information into the target thinking chain to obtain the target thinking path; and generating reply information based on the target thinking path.
[0014] To achieve the above objectives, according to another aspect of the present application, a text processing model training device is provided. The device comprises: an acquisition unit for acquiring a sample generation model, wherein the sample generation model is used to generate training sample data containing a thought path; a generation unit for using the sample generation model to generate training sample data containing a thought path; and a first training unit for training an initial text processing model based on the training sample data to obtain a target text processing model, wherein the target text processing model is used to perform retrieval enhancement processing on question information and output response information based on the processing results.
[0015] To achieve the above objectives, according to another aspect of the present application, an information processing device based on a target text processing model is provided. The device comprises: a receiving unit for receiving question information; an input unit for inputting the question information into the target text processing model; and an output unit for outputting, via the target text processing model, a response corresponding to the question information.
[0016] According to another aspect of the present application, a computer-readable storage medium is provided, which includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute a training method for any text processing model.
[0017] According to another aspect of the present application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a training method for executing any one of the text processing models.
[0018] According to another aspect of the present application, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the steps of any one of the above-mentioned methods for training a text processing model.
[0019] In an embodiment of the present application, a sample generation model is obtained, wherein the sample generation model is used to generate training sample data containing a thinking path; the sample generation model is used to generate training sample data containing a thinking path; the initial text processing model is trained based on the training sample data to obtain a target text processing model, wherein the target text processing model is used to perform retrieval enhancement processing on question information and output reply information based on the processing results. Generating training data through the sample production model significantly reduces the dependence on manual labeling, thereby solving the technical problem that the initial text processing model is trained using manually labeled training samples, resulting in low accuracy of the reply information output by the obtained model.
[0020] In this application, the initial text processing model is trained using training sample data containing thinking paths because these sample data provide the steps and logical reasoning process for problem solving. During the training process, the initial text processing model gradually masters the method of solving the problem by learning these steps and reasoning process. This not only enhances the model's understanding of the logical structure of the problem, but also improves its ability to apply different tools and strategies. Therefore, the target text processing model obtained through this training performs retrieval enhancement processing when faced with new problems, can better perform logical reasoning and tool use, and generate content that is more in line with logical and practical needs, thereby improving the accuracy of the model's output response information. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:
[0022] Figure 1 A hardware structure block diagram of a computer terminal for implementing a training method for a text processing model is shown;
[0023] Figure 2 is a flowchart of a method for training a text processing model according to an embodiment of the present application;
[0024] Figure 3 Schematic diagram of the training process of the text processing model provided in accordance with an embodiment of the present application;
[0025] Figure 4 is a flowchart of an information processing method based on a target text processing model provided in an embodiment of the present application;
[0026] Figure 5 is a schematic diagram of an information processing device based on a target text processing model provided according to an embodiment of the present application;
[0027] Figure 6 is a schematic diagram of a training device for a text processing model provided in an embodiment of the present application;
[0028] Figure 7 This is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display and analysis, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving the consent information provided by the aforementioned user or organization.
[0032] Example 1
[0033] According to an embodiment of the present application, an embodiment of a training method for a text processing model is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0034] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or mobile device) for implementing a training method for a text processing model is shown. Figure 1As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (illustrated as 102a, 102b, ..., 102n in the figure) (the processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0035] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry." This data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuitry may be a single, independent processing module, or may be fully or partially integrated into any of the other components of the computer terminal 10 (or mobile device). As discussed in the embodiments of this application, this data processing circuitry functions as a processor control (e.g., selecting a variable resistor terminal path connected to an interface).
[0036] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0037] Transmission device 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of computer terminal 10. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module configured to communicate with the Internet wirelessly.
[0038] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0039] In the above operating environment, this application also provides Figure 2 The training method of the text processing model shown. Figure 2 This is a flowchart of the training method of the text processing model according to Example 1 of the present application.
[0040] Step S201: Obtain a sample generation model, wherein the sample generation model is used to generate training sample data containing a thinking path.
[0041] The aforementioned thought process can refer to the logical flow, decision-making process, or series of steps involved in solving a problem or completing a task. In machine learning, such examples help the model understand how to achieve a final goal or result through a series of logical steps. By using training examples containing thought processes, the model can extract useful information from data through unsupervised learning and mimic human thinking, thereby making more informed decisions on complex problems.
[0042] Step S202: Generate training sample data containing thinking paths using a sample generation model.
[0043] The training sample data generated by the sample generation model is training sample data that has not been manually labeled. For example, the training sample data generated by the sample generation model includes processed paragraphs, prompt words, thinking paths, and final answers. For example, the original text is "The frequency of smart speaker usage in the home is mainly affected by its functional diversity and user-friendliness. With the continuous advancement of technology, the voice recognition accuracy of smart speakers has improved year by year, allowing users to interact with them more naturally and smoothly. In addition, the improvement in accuracy also means that smart speakers can more accurately understand user intentions and provide more personalized services, thereby attracting more users to use them as home entertainment and life assistance devices." The processed paragraph is "The frequency of smart speaker usage in the home is mainly affected by its functional... and user... With the continuous advancement of technology, the... accuracy of smart speakers has improved year by year, allowing users to interact with them more naturally and smoothly. In addition, the improvement in... also means that smart speakers can more accurately understand user intentions and provide more personalized services, thereby attracting more users to use them as home entertainment and life assistance devices." The prompt is "Combined with the text content, supplement the content of... in the text,... represents several deleted keywords." For example, the thinking path includes the following steps:
[0044] 1. Define and prioritize the functional diversity and user-friendliness of smart speakers.
[0045] 2. Analyze the evolution of speech recognition technology and identify key technological breakthroughs;
[0046] 3. Explore the specific impact of improved speech recognition accuracy on user interaction experience;
[0047] 4. How improved evaluation accuracy can promote the popularity and use of smart speakers in homes;
[0048] 5. Study the smart speaker market report to understand the relationship between accuracy, user satisfaction, and usage frequency;
[0049] 6. Simulate the use cases of smart speakers in home scenarios at different accuracy levels and predict the changing trend of usage frequency.
[0050] The final answer is "Increasing voice recognition accuracy will significantly increase the frequency of smart speaker usage in homes. Improved accuracy means smoother user interaction, reduces the frequency of incorrect commands, and thus improves user satisfaction and dependence. In addition, more accurate voice recognition enables smart speakers to better understand users' personalized needs and provide customized services, further enhancing their appeal in home environments. According to market trends, as technology matures, the frequency of smart speaker usage is positively correlated with voice recognition accuracy. It is expected that improved accuracy will directly lead to an increase in usage frequency, especially in high-frequency usage scenarios such as daily inquiries, home entertainment, and smart home control."
[0051] Step S203 , training the initial text processing model based on the training sample data to obtain a target text processing model, wherein the target text processing model is used to perform retrieval enhancement processing on the question information and output reply information based on the processing result.
[0052] Optionally, the initial text processing model is trained using an unsupervised learning method based on the training sample data in step S202, because these sample data provide the steps and logical reasoning process for problem solving. The above-mentioned initial text processing model can be a large language model or other models, which is not limited in this application. During the training process, the initial text processing model gradually masters the method of solving the problem by learning these steps and reasoning processes. This not only enhances the model's understanding of the logical structure of the problem, but also improves its ability to apply different tools and strategies. Therefore, the target text processing model obtained through this training performs retrieval enhancement processing when facing new problems, can better perform logical reasoning and tool use, and generate content that is more in line with logic and actual needs. This improves the accuracy of the model output reply information.
[0053] In order to train a sample generation model capable of generating a large amount of training data without relying on manual annotation, optionally, in the training method of the text processing model provided in the embodiment of the present application, the sample generation model is obtained by the following steps:
[0054] The first step is to extract paragraph samples from the text sample set.
[0055] Optionally, the text sample collection can include encyclopedias, professional literature, news reports, and other sources. By extracting paragraphs from texts in different fields, the training samples can cover a wide range of textual knowledge, helping the model learn cross-disciplinary comprehension and expression capabilities. By randomly selecting paragraph samples, the diversity of the training data can be ensured, avoiding over-reliance on a single type of text and the resulting bias in the model.
[0056] For example, a sample paragraph about "quantum computing" is "Quantum computing is a type of computing that uses quantum mechanical phenomena, such as superposition and entanglement, to process information. Unlike traditional binary bits, quantum computers use quantum bits (qubits) as the basic unit of information, which can be in multiple states at the same time, thereby greatly accelerating the solution of certain computing tasks."
[0057] The second step is to identify keywords in the paragraph sample and use a preset method to mask at least one keyword in the paragraph sample to obtain the target paragraph.
[0058] Optionally, the aforementioned preset method can select words that appear frequently (e.g., greater than a preset frequency) in a paragraph sample as keywords. Masking these words can help the sample generation model learn key information from the context. The preset method can also leverage natural language processing techniques (such as part-of-speech tagging or named entity recognition) to identify nouns, proper nouns, and numbers, which often carry specific information. Masking these words can train the model's ability to understand and infer entity information. The preset method can also simply randomly select a certain percentage of words for masking. This approach maintains data diversity while training the model's ability to cope with randomly missing information.
[0059] For example, after masking the keywords in the sample paragraph, the content of the target paragraph is "Quantum computing is a computing method that uses...phenomena, such as... and..., to process information. Unlike traditional..., quantum computers use... as the basic unit of information and can be in multiple states at the same time, thereby greatly accelerating the solution of certain...." The... in the content represents the masked keywords.
[0060] The third step is to determine the initial training samples based on the target paragraph.
[0061] For example, based on the target paragraph, a prompt word is designed: "Please explain the concept of quantum computing and complete the missing key information." Based on the above prompt word, the target text processing model generates a thinking path, and the final answer is "Quantum computing is a computing method that uses quantum mechanical phenomena, such as superposition and entanglement, to process information. Unlike traditional binary bits, quantum computers use quantum bits (qubits) as the basic unit of information and can be in multiple states at the same time, thereby greatly accelerating the solution of certain computing tasks." Check whether the output answer is consistent with the content of the original sample paragraph. If the content is consistent, determine the target paragraph, prompt word, thinking path and final answer as the initial training sample.
[0062] The fourth step is to train the sample model based on the initial training samples to obtain a sample generation model.
[0063] For example, the sample model is trained using the initial training samples generated in the second and third steps to obtain a sample generation model. The sample generation model will be used to generate more training data containing thinking paths for subsequent text processing model training.
[0064] In summary, the sample generation model constructed through these steps can significantly improve the efficiency of generating training data and reduce the dependence on manually labeled training data.
[0065] In order to obtain initial training samples with high data quality, optionally, in the text processing model training method provided in the embodiment of the present application, determining the initial training samples based on the target paragraph includes:
[0066] The first step is to determine the prompt words corresponding to the target paragraph.
[0067] Optionally, the target paragraph refers to a paragraph obtained by masking at least one keyword in a paragraph sample using a preset method. A prompt word needs to be designed for the target paragraph with the keyword masked to guide the initial text processing model in generating a thinking path. The prompt word can enable the initial text processing model to understand the relevance of the missing keywords and the required task type. The designed prompt word can require the initial text processing model to complete information or understand the logical relationship between information. The prompt word helps the initial text processing model learn how to construct a coherent thinking path and reasoning chain.
[0068] For example, the target paragraph might be, "On the moon, scientists used... technology to discover new evidence proving the existence of... on the lunar surface. This discovery may change our understanding of the moon's origin..." The "..." represents the masked keyword. The prompt for this target paragraph might be, "Please provide the name of the technology mentioned in the paragraph, the specific content of the discovery, and the impact of this discovery on theories of the moon's origin."
[0069] In the second step, the target paragraph and prompt words are input into the initial text processing model, and the first thinking path for the target paragraph and the first response information for the target paragraph are output.
[0070] Optionally, the above-mentioned initial text processing model can be an existing, mature language model, or a large language model pre-trained for generating thinking paths. The target paragraph and prompt words determined in the first step are input into the initial text processing model. The task of the initial text processing model is to generate thinking paths and response information based on the prompt words to complete the masked keywords. The goal of this step is to generate preliminary thinking path samples through the existing initial text processing model to provide a learning benchmark for subsequent training. It should be noted that the initial text processing model and the sample model are different in functional positioning and processing goals. The sample generation model is obtained based on the sample model training, while the initial text processing model is used to output the first thinking path and the first response information for the target paragraph.
[0071] For example, input the target paragraph and prompt words in the first step above into the initial text processing model. The thinking path generated by the initial text processing model is "I need to identify what technology is used for lunar exploration. I will search recent aerospace news and scientific journals. Then, I need to determine what was discovered through this technology, which may involve the geological structure of the lunar surface. Finally, I need to analyze the potential impact of this discovery on the theory of the origin of the moon, which may point to new theories or evidence of the formation of the moon." The first response information is: "On the moon, scientists used laser spectroscopy analysis technology to discover new evidence of the existence of water ice on the lunar surface. This discovery may change our theory of the origin of the moon and support the hypothesis that the moon may have been formed by fragments of the earth after a huge impact."
[0072] In the third step, when the content of the first reply information and the paragraph sample is the same, the target paragraph, the prompt word corresponding to the target paragraph, the first thinking path and the first reply information are used as the initial training sample.
[0073] Optionally, by verifying the consistency of the generated response information with the original paragraph, we ensure that only correct thought paths and response information are used for training, thereby improving the high quality of the initial training samples and avoiding the negative impact of inaccurate or irrelevant thought paths on model training.
[0074] For example, after verifying that the response information generated in step 2 and the sample paragraph content are identical, the target paragraph "On the moon, scientists used... technology to discover new evidence proving the presence of... on the lunar surface. This discovery may change our understanding of the lunar origin..." can be used as the initial training sample. The... represents the masked keyword. The corresponding prompt for the target paragraph is "Please provide the name of the technology mentioned in the paragraph, the specific content of the discovery, and the impact of this discovery on theories of the lunar origin." The first thinking path is "I need to identify which technology was used for lunar exploration. I will search recent aerospace news and scientific journals. Then, I need to determine what was discovered using this technology, which may involve the geological structure of the lunar surface. Finally, I need to analyze the potential impact of this discovery on theories of the lunar origin, which may point to new theories or evidence of the lunar formation." and the first response information is "On the moon, scientists used laser spectroscopy to discover new evidence proving the presence of water ice on the lunar surface. This discovery may change our theories of the lunar origin and support the hypothesis that the moon may have been formed from Earth debris after a giant impact."
[0075] In summary, through the above steps, the data quality of the initial training samples can be ensured, providing high-quality training materials for the initial text processing model, and improving the capabilities of the target text processing model in information completion, logical reasoning, and tool use.
[0076] In order to obtain a sample generation model that can provide high-quality training data for training the initial text processing model, optionally, in the text processing model training method provided in the embodiment of the present application, the initial training sample includes a target paragraph, a prompt word corresponding to the target paragraph, a first thinking path, and a first reply message. The sample model is trained based on the initial training sample to obtain the sample generation model, including:
[0077] In the first step, the target paragraph and the prompt words corresponding to the target paragraph are input into the sample model, and the second thinking path for the target paragraph and the second response information for the target paragraph are output.
[0078] Optionally, at the beginning of the training process, the sample model can be a pre-trained initial model, but its capabilities in retrieval enhancement and thinking path generation have not yet been optimized by the training method for the text processing model provided in the embodiment of the present application. By inputting the target paragraph and prompt words into this initial model, the second thinking path and second reply information generated by it are obtained, and then compared with the output of the sample model, which is used as a benchmark to guide the updating of parameters and the optimization of the model. As the training process proceeds, the performance of the sample model will gradually improve, and eventually, after meeting specific preset conditions, it will evolve into a sample generation model with the ability to generate high-quality thinking paths and reply information.
[0079] For example, the initial training sample identified is: the target paragraph, "On the moon, scientists used... technology to discover new evidence proving the presence of... on the lunar surface. This discovery may change our understanding of...." The... represents the masked keyword. The corresponding prompt for the target paragraph is "Please provide the name of the technology mentioned in the paragraph, the specific content of the discovery, and the impact of this discovery on theories of the lunar origin." The first thinking path is, "I need to identify which technology was used for lunar exploration. I will search recent aerospace news and scientific journals. Then, I need to determine what was discovered using this technology, which may involve the geological structure of the lunar surface. Finally, I need to analyze the potential impact of this discovery on theories of the lunar origin, which may point to new theories or evidence of the lunar formation." The first response is, "On the moon, scientists used laser spectroscopy to discover new evidence proving the presence of water ice on the lunar surface. This discovery may change our theories of the lunar origin and support the hypothesis that the moon may have been formed from Earth debris after a giant impact." Input this target paragraph and the corresponding prompt words into the sample model, and output the second thinking path for the target paragraph: "I need to guess the technology used for lunar exploration. It may be some advanced technology, but I am not sure. Then, I have to speculate what this technology discovered, which may be related to a certain feature on the surface of the moon. Finally, I try to understand the impact of this discovery on the theory of the origin of the moon. This may involve some scientific theory, but I don’t know which one it is." The second response information for the target paragraph is "On the moon, scientists used high-tech technology to discover new evidence proving the existence of some unidentified substance on the surface of the moon. This discovery may have an impact on the theory of the origin of the moon, but I don’t know the specific impact."
[0080] The second step is to calculate the first loss value of the first thinking path and the second thinking path based on the first loss function, and calculate the second loss value of the first reply information and the second reply information based on the first loss function.
[0081] Optionally, a first loss function can be used to measure the difference between the second thought path and the second reply, and the first thought path and the first reply. This first loss function can include an assessment of the logical consistency of the thought path, the accuracy of keyword completion, and the consistency of the reply with the target paragraph. The first loss value provides feedback on the quality of the generated content in the current state of the model and guides subsequent parameter updates.
[0082] For example, the first loss function can be used to calculate the structural differences between the first and second thought paths in the first step, the accuracy of keyword completion, and the consistency between the first and second responses. Assume that the first loss function includes the following aspects: logical consistency (i.e., the rationality of the thought path), keyword completion accuracy (i.e., whether all masked keywords are correctly completed), and response accuracy (i.e., whether the response matches the target paragraph content). By calculating these metrics, we obtain a first loss value of 0.2 and a second loss value of 0.18.
[0083] The third step is to update the parameters of the sample model based on the first loss value and the second loss value, repeatedly input the target paragraph and the prompt word corresponding to the target paragraph into the updated sample model, and calculate the loss value between the thinking path output by the updated sample model and the first thinking path based on the first loss function, and the loss value between the reply information output by the updated sample model and the first reply information, until the calculated loss value meets the first preset condition, and the updated sample model is used as the sample generation model.
[0084] Optionally, the first and second loss values can be used to guide parameter updates for the sample model. The model parameters are adjusted through a backpropagation algorithm to reduce the two loss values until the preset optimization criteria are met. This process may require multiple iterations, with each iteration re-executing the first and second steps based on the model state updated in the previous iteration to gradually improve the model's ability to generate thought paths and respond to information, until the first loss value meets the preset optimization criteria. At this point, the sample model evolves into a sample generation model.
[0085] For example, if the first loss value is 0.2 and the second loss value is 0.18, the backpropagation algorithm is used to update the parameters and optimize the sample model. The input, output, and loss calculation process is repeated until both loss values drop to a preset threshold, such as 0.01, indicating that the thought paths and responses generated by the model are highly consistent with the output of the sample model. At this point, the updated sample model is officially designated as the sample generation model and can be used to generate high-quality thought path data on a large scale for further pre-training.
[0086] In summary, the sample generation model obtained through training through the above steps provides rich, high-quality training data for the subsequent training of the initial text processing model, thereby promoting the overall performance improvement of the target text processing model, especially in terms of tool usage and logical reasoning.
[0087] In order to obtain more accurate generation of training sample data, optionally, in the text processing model training method provided in the embodiment of the present application, using the sample generation model to generate training sample data containing thinking paths includes:
[0088] In the first step, a sample generation model is used to generate preset training samples, wherein the preset training samples include preset prompt words, preset text samples, processed preset text samples, preset thinking paths and preset response information.
[0089] For example, the preset training samples generated by the trained sample generation model include: the preset text sample "The distance between the Earth and Mars varies as they orbit the sun, with the closest being approximately 55 million kilometers and the farthest being approximately 401 million kilometers. This change cycle is approximately 15 months, and scientists use this opportunity to launch probes during this period." The processed preset text sample "The distance between the Earth and Mars varies as they orbit the sun, with the closest being approximately... and the farthest being approximately.... This change cycle is approximately..., and scientists use this opportunity to launch probes during this period.", where ... represents the masked content. The preset prompt words are "Please fill in the range of the distance change between the Earth and Mars, that is, the closest and farthest distances, and the length of this change cycle." The preset thinking path is "I need to determine the closest and farthest distances between the Earth and Mars, as well as the cycle of distance change. I can obtain this information by querying astronomical data." And the preset reply information is "The distance between the Earth and Mars will change as they revolve around the sun. The closest distance is about 55 million kilometers, and the farthest distance is about 401 million kilometers. This change cycle is about 15 months. Every time this happens, scientists will take this opportunity to launch a probe."
[0090] In the second step, when the preset text sample and the preset reply information are consistent, the preset prompt words, the processed preset text sample, the preset thinking path and the preset reply information are used as training sample data.
[0091] Optionally, after obtaining the preset response information, it is necessary to verify whether it correctly fills in the blanks in the processed preset text sample. You can check whether the preset text sample and the preset response information are consistent. In the above example, verify whether the completed "55 million kilometers", "401 million kilometers" and "15 months" are correct. If the preset text sample and the preset response information are consistent, the preset prompt words, the processed preset text sample, the preset thinking path and the preset response information can be used as training sample data.
[0092] In summary, through the above steps, effective and identical preset training samples are used to train the initial text processing model, so that the obtained target text processing model can correctly learn how to reason and answer questions in the absence of information, thereby improving the reasoning ability of the target text processing model.
[0093] In order to train a target text processing model with stronger logical reasoning ability, optionally, in the text processing model training method provided in the embodiment of the present application, the training sample data includes preset prompt words, processed preset text samples, preset thinking paths and preset response information. Training the initial text processing model based on the training sample data includes:
[0094] In the first step, the preset prompt words and the processed preset text sample are input into the initial text processing model, and a third thinking path for the processed preset text sample and third response information for the processed preset text sample are output.
[0095] For example, the processed preset text sample "The distance between Earth and Mars varies as they orbit the sun, reaching approximately... at their closest point and approximately... at their farthest point. This variation period is approximately..., and scientists use this opportunity to launch probes." is input into the initial text processing model along with the preset prompt "Please provide the range of variation in the distance between Earth and Mars, i.e., the closest and furthest distances, and the duration of this variation period." Based on its current learning state, the initial text processing model generates a third thought path and a third response. The generated third thought path is "I will try to recall information about the orbital periods of Earth and Mars, and then infer the closest and furthest distances based on this period." The third response is: "The distance between Earth and Mars varies as they orbit the sun, but I need to further research the specific closest and furthest distances and the period."
[0096] The second step is to calculate the third loss value of the preset thinking path and the third thinking path based on the second loss function, and calculate the fourth loss value of the preset reply information and the third reply information based on the second loss function.
[0097] Optionally, a second loss function is used to calculate the difference between the preset thinking path and the third thinking path, that is, the third loss value. The difference between the preset reply information and the third reply information is calculated, that is, the fourth loss value. The second loss function can take into account the logical coherence of the thinking path, the accuracy of the reply information, and the correctness of the keyword completion. Assuming that in the preliminary output of the model, the correctness of the keyword completion is low, and the logical structure of the thinking path is relatively reasonable, the second loss value is calculated comprehensively based on these indicators. For example, the third loss value calculated between the preset thinking path and the third thinking path using the second loss function is 0.15, and the fourth loss value calculated between the preset reply information and the third reply information is 0.3.
[0098] The third step is to update the parameters of the initial text processing model based on the third loss value and the fourth loss value, and repeatedly perform the steps of inputting the preset prompt words and the processed preset text samples into the updated initial text processing model, calculating the loss value between the thinking path output by the updated initial text processing model and the preset thinking path, and the loss value between the reply information output by the updated initial text processing model and the preset reply information, until the calculated loss value meets the second preset condition, and the updated initial text processing model is used as the target text processing model.
[0099] Optionally, based on the calculated third loss value and fourth loss value, the backpropagation algorithm can be used to update the parameters of the initial text processing model to reduce the third loss value and the fourth loss value. In this step, the model gradually adjusts its internal parameters through continuous iterative learning to more accurately generate outputs that are consistent with the preset thinking path and preset response information. The updated initial text processing model will again accept the same preset prompt words and processed preset text samples, output a new third thinking path and third response information, and recalculate the third loss value and the fourth loss value until the two loss values meet the second preset condition, that is, reach a set threshold (for example, less than 0.1), indicating that the model output is highly consistent with the preset answer. At this time, the updated initial text processing model is considered to be trained.
[0100] In summary, through the above training steps, the initial text processing model can learn how to perform effective reasoning and keyword completion in the presence of missing information. This enables the resulting target text processing model to demonstrate stronger performance in natural language processing tasks, more accurately understanding and generating complex and diverse text information, and meeting the needs of a wide range of intelligent applications, especially in scenarios requiring enhanced retrieval and logical reasoning capabilities.
[0101] Optional, Figure 3 This article provides a diagram of the training process for a text processing model. Follow the steps below to train the target text processing model:
[0102] The first step is data preparation. Randomly extract paragraphs from unlabeled text sources. Identify keywords such as named entities and numbers in the paragraphs and randomly mask 1-10 keywords in the paragraphs.
[0103] The second step is to prepare initial data. Specifically design prompt words, invoke the initial text processing model, and generate a thought path with search calls and a final answer. This initial data is used to train a small model (i.e., a sample generation model) for production data, reducing costs. Furthermore, the sample generation model can outperform the untrained initial text processing model in inference performance.
[0104] The third step is to train the sample generation model. The sample generation model is trained using the initial data generated in the second step. The sample generation model has the ability to call search tools and perform inference.
[0105] The fourth step is to prepare training data with thinking paths. Use the sample generation model obtained in the third step to generate a large amount of training data with thinking paths.
[0106] Step 5: Data Filtering. The sample generation model from Step 4 generates a large amount of training data with thought paths, which is then filtered to verify the correctness of the responses (i.e., whether they are consistent with the original content). Only training data with correct responses is retained to form the final training dataset, ensuring the reliability and accuracy of the reasoning paths.
[0107] Step 6: Train the target text processing model. Use the filtered training data obtained in step 5 to train the target text processing model.
[0108] In summary, the target text processing model is trained through the steps in the above example, which makes the logical reasoning ability of the target text processing model stronger, thereby improving the accuracy of the response information output by the target text processing model.
[0109] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0110] Example 2
[0111] Under the above operating environment, this application provides Figure 4 The information processing method based on the target text processing model shown. Figure 4 This is a flowchart of an information processing method based on a target text processing model according to Example 2 of the present application.
[0112] Step S401: Receive question information.
[0113] Optionally, the question can be textual input from the user or system, intended to elicit a response or processing result. Questions can be expressed in any natural language, including questions, commands, statements, or requests. Questions are the initial input to the information processing process and directly determine the nature and direction of subsequent processing and responses. For example, a question might be, "Which astronomical events have had a measurable impact on Earth's climate in the past decade?"
[0114] Step S402: input question information into the target text processing model.
[0115] Optionally, the target text processing model is a model trained using training samples containing thought paths generated by a sample generation model, and has improved logical reasoning and external tool invocation capabilities. The thought path described above can refer to the logical flow, decision-making process, or a series of steps involved in solving a problem or completing a task. When faced with new problems, the target text processing model generated from this training is better able to perform logical reasoning and utilize tools, generating content that is more logical and practical.
[0116] Step S403: Outputting reply information corresponding to the question information through the target text processing model.
[0117] Optionally, the above-mentioned reply information may include a complete thinking path and final answer constructed by the target text processing model based on the content of the question information, internal knowledge and external retrieval information.
[0118] In summary, the accuracy of the reply information output by the target text processing model in the above steps is higher. This is because the target text processing model is trained with training samples generated by the sample generation model. The target text processing model has stronger logical reasoning and information retrieval capabilities, which can provide users with more accurate and rich information replies, meeting the growing demand for natural language processing.
[0119] In order to utilize the reasoning capability of the target text processing model to generate more accurate reply information, optionally, in the information processing method based on the target text processing model provided in the embodiment of the present application, the reply information corresponding to the question information output by the target text processing model includes:
[0120] The first step is to generate the target thinking link corresponding to the question information through the target text processing model.
[0121] Optionally, the target thinking chain represents a series of step-by-step reasoning steps used by the target text processing model when solving a problem. These steps can clearly demonstrate how the model starts from known information and uses logical analysis, information retrieval, calculation, and other means to ultimately arrive at an answer. The target thinking chain not only improves the reasoning transparency of the target text processing model, but also helps the target text processing model learn more complex logical structures and reasoning strategies, thereby performing better when faced with tasks that require multi-step reasoning. The target text processing model can first deeply understand the problem information and construct an initial framework for the target thinking chain. After retrieval and filling in this initial framework, the target thinking chain described above is obtained.
[0122] For example, a user asks the question, "Which astronomical events in the last decade have had a measurable impact on Earth's climate?" The target text processing model first constructs an initial framework, identifying the three key concepts of "last decade," "astronomical events," and "Earth's climate impact." The target text processing model then retrieves information to populate this initial framework. The resulting target thought chain might involve the type of astronomical event (such as solar activity, comet impacts, and asteroid flybys), an analysis of the direct and indirect impacts of the event on Earth's climate, and the scientific community's assessment and measurement of these impacts.
[0123] In the second step, the target text processing model is used to obtain the requirement description information based on the target thinking chain and problem information, wherein the requirement description information is used to indicate the information that needs to be supplemented in the target thinking chain.
[0124] For example, after analyzing the target thinking chain and problem information in the above example, it is found that the information that needs to be supplemented in the target thinking chain (corresponding to the above-mentioned demand information) is a list of major astronomical events that have occurred in the past ten years, an analysis of the theoretical impact of each event on the earth's climate, etc.
[0125] The third step is to call the external information source to obtain the target requirement information corresponding to the requirement description information.
[0126] Optionally, the external information source refers to an information database or service stored outside the target text processing model. This external information source provides information that is not included in the target text processing model's own training data, or is not rich or specific enough. Examples of external information sources include web search engines, databases and knowledge bases, and API services.
[0127] For example, the target text processing model in the above example will call on astronomical databases, climatological research materials, data from global weather stations, scientific journals and news reports to collect detailed records of astronomical events such as solar flare activities, close asteroid flybys, and lunar orbit changes, as well as theoretical predictions and actual observational data on these events' impact on Earth's climate patterns.
[0128] The fourth step is to fill the target demand information into the target thinking link to obtain the target thinking path.
[0129] For example, after gathering target demand information, this information is integrated into the constructed thinking chain to form a complete target thinking path that includes event identification and climate change impact analysis. The target thinking path details how the solar activity cycle affects the Earth's temperature and radiation balance, how asteroid flybys affect the climate by changing the particle distribution in the Earth's atmosphere, and the long-term impact of the moon's orbital changes on tides and ocean temperatures.
[0130] Step 5: Generate response information based on the target thinking path.
[0131] For example, the target text processing model can generate a response message based on its complex reasoning process: "In the past decade, abnormalities in the solar activity cycle, including the outbreak of multiple strong solar flares, have affected the Earth's radiation levels and temperature patterns. Asteroid A flew close to the Earth in February 2013. Although it did not directly impact the Earth, its particles and dust entered the atmosphere, causing slight changes in local light and temperature in the short term. In addition, the long-term slight changes in the moon's orbit indirectly affect the Earth's tidal patterns and ocean circulation, and have subtle but long-term effects on the global climate system."
[0132] In summary, the target thinking path is generated through the above steps, and then the reply information is generated based on the target thinking path. This process fully demonstrates the advantages of the target text processing model in information mining and integration, as well as its excellent performance in logical reasoning and expression ability, thereby providing users with a scientific, comprehensive and accurate reply information.
[0133] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0134] Example 3
[0135] The present application also provides an information processing device based on a target text processing model. It should be noted that the information processing device based on a target text processing model in the present application can be used to execute the information processing method based on a target text processing model provided in the present application. The following describes the information processing device based on a target text processing model provided in the present application.
[0136] According to an embodiment of the present application, a device for implementing the above-mentioned information processing method based on the target text processing model is also provided, such as Figure 5 As shown, the device includes: a receiving unit 501, an input unit 502 and an output unit 503.
[0137] Specifically, the receiving unit 501 is used to receive question information;
[0138] Input unit 502, used to input question information into the target text processing model;
[0139] The output unit 503 is used to output the reply information corresponding to the question information through the target text processing model.
[0140] In the information processing device based on the target text processing model in the embodiment of the present application, question information is received by receiving unit 501; input unit 502 inputs the question information into the target text processing model; and output unit 503 outputs the reply information corresponding to the question information through the target text processing model. This solves the technical problem that the accuracy of the reply information output by the model obtained by training the initial text processing model with manually annotated training samples is low. The target text processing model generated by training content with training sample data containing thinking paths can better perform logical reasoning and tool use, and generate content that is more logical and in line with actual needs. This improves the accuracy of the reply information output by the target text processing model.
[0141] Optionally, in the information processing device based on the target text processing model provided in the embodiment of the present application, the output unit 502 includes: a first generation module, used to generate a target thinking link corresponding to the problem information through the target text processing model; a first determination module, used to obtain requirement description information based on the target thinking link and the problem information through the target text processing model, wherein the requirement description information is used to indicate the information that needs to be supplemented in the target thinking chain; an acquisition module, used to call an external information source to obtain target requirement information corresponding to the requirement description information; a filling module, used to fill the target requirement information into the target thinking chain to obtain the target thinking path; a second generation module, used to generate reply information based on the target thinking path.
[0142] It should be noted that the receiving unit 501, input unit 502, and output unit 503 correspond to steps S401 to S403 in Example 1. The examples and application scenarios implemented by the three units and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules or units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also be part of a device and can be run in the computer terminal 10 provided in Example 1.
[0143] Example 4
[0144] According to an embodiment of the present application, a device for implementing the above-mentioned text processing model training method is also provided. The text processing model training device of the embodiment of the present application can be used to execute the training method for the text processing model provided in the embodiment of the present application. Figure 6 As shown, the device includes: an acquisition unit 601, a generation unit 602 and a first training unit 603.
[0145] Specifically, the acquisition unit 601 is used to acquire a sample generation model, wherein the sample generation model is used to generate training sample data containing a thinking path;
[0146] A generating unit 602 is configured to generate training sample data including a thinking path using a sample generation model;
[0147] The first training unit 603 is used to train the initial text processing model based on the training sample data to obtain a target text processing model, wherein the target text processing model is used to perform retrieval enhancement processing on the question information and output reply information based on the processing result.
[0148] The training device for a text processing model provided in an embodiment of the present application obtains a sample generation model through an acquisition unit 601, wherein the sample generation model is used to generate training sample data containing a thinking path; a generation unit 602 uses the sample generation model to generate training sample data containing a thinking path; and a first training unit 603 trains the initial text processing model based on the training sample data to obtain a target text processing model. This solves the technical problem that the accuracy of the response information output by the obtained model is low when the initial text processing model is trained using manually annotated training samples. The target text processing model generated by training content using training sample data containing a thinking path can better perform logical reasoning and tool use, and generate content that is more logical and in line with actual needs. This improves the accuracy of the response information output by the target text processing model.
[0149] Optionally, in the training device of the text processing model provided in the embodiment of the present application, the device also includes: an extraction unit for extracting paragraph samples from a text sample set; an identification unit for identifying keywords in the paragraph samples, and using a preset device to mask at least one keyword in the paragraph sample to obtain a target paragraph; a determination unit for determining an initial training sample based on the target paragraph; and a second training unit for training the sample model based on the initial training sample to obtain a sample generation model.
[0150] Optionally, in the training device of the text processing model provided in the embodiment of the present application, the determination unit includes: a second determination module, used to determine the prompt word corresponding to the target paragraph; an input module, used to input the target paragraph and the prompt word into the initial text processing model, and output a first thinking path for the target paragraph and a first reply information for the target paragraph; a third determination module, used to use the target paragraph, the prompt word corresponding to the target paragraph, the first thinking path and the first reply information as the initial training sample when the content of the first reply information and the paragraph sample is the same.
[0151] Optionally, in the training device of the text processing model provided in the embodiment of the present application, the second training unit includes: a first output module, used to input the target paragraph and the prompt words corresponding to the target paragraph into the sample model, and output the second thinking path for the target paragraph and the second reply information for the target paragraph; a first calculation module, used to calculate the first loss value of the first thinking path and the second thinking path based on the first loss function, and calculate the second loss value of the first reply information and the second reply information based on the first loss function; a second calculation module, used to update the parameters of the sample model based on the first loss value and the second loss value, and repeatedly execute the steps of inputting the target paragraph and the prompt words corresponding to the target paragraph into the updated sample model, and calculating the loss value between the thinking path output by the updated sample model and the first thinking path, and the loss value between the reply information output by the updated sample model and the first reply information based on the first loss function, until the calculated loss value meets the first preset condition, and the updated sample model is used as the sample generation model.
[0152] Optionally, in the training device of the text processing model provided in the embodiment of the present application, the generation unit 602 includes: a third generation module, used to generate preset training samples using a sample generation model, wherein the preset training samples include preset prompt words, preset text samples, processed preset text samples, preset thinking paths and preset reply information; a fourth determination module, used to use the preset prompt words, processed preset text samples, preset thinking paths and preset reply information as training sample data when the preset text samples and the preset reply information are consistent.
[0153] Optionally, in the training device of the text processing model provided in the embodiment of the present application, the first training unit 603 includes: a second output module, used to input the preset prompt word and the processed preset text sample into the initial text processing model, and output a third thinking path for the processed preset text sample and a third reply information for the processed preset text sample; a third calculation module, used to calculate the third loss value of the preset thinking path and the third thinking path based on the second loss function, and calculate the fourth loss value of the preset reply information and the third reply information based on the second loss function; a fourth calculation module, used to update the parameters of the initial text processing model based on the third loss value and the fourth loss value, and repeatedly perform the steps of inputting the preset prompt word and the processed preset text sample into the updated initial text processing model, calculating the loss value between the thinking path output by the updated initial text processing model and the preset thinking path, and the loss value between the reply information output by the updated initial text processing model and the preset reply information, until the calculated loss value meets the second preset condition, and the updated initial text processing model is used as the target text processing model.
[0154] It should be noted that the acquisition unit 601, generation unit 602, and first training unit 603 described above correspond to steps S201 to S203 in Example 1. The examples and application scenarios implemented by the three units and the corresponding steps are the same, but are not limited to the contents disclosed in Example 2. It should be noted that the modules or units described above can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The modules can also be part of a device and can be run in the computer terminal 10 provided in Example 1.
[0155] Example 5
[0156] The embodiment of the present application may provide a computer terminal, which may be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal may also be replaced by a terminal device such as a mobile terminal or an electronic device.
[0157] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of a computer network.
[0158] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the training method of the text processing model: obtaining a sample generation model, wherein the sample generation model is used to generate training sample data containing a thinking path; using the sample generation model to generate training sample data containing a thinking path; training the initial text processing model based on the training sample data to obtain a target text processing model, wherein the target text processing model is used to perform retrieval enhancement processing on the question information, and output reply information based on the processing results.
[0159] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the training method of the text processing model: the sample generation model is obtained by the following steps: extracting paragraph samples from a text sample set; identifying keywords in the paragraph samples, and using a preset method to mask at least one keyword in the paragraph samples to obtain a target paragraph; determining an initial training sample based on the target paragraph; training the sample model based on the initial training sample to obtain a sample generation model.
[0160] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the training method of the text processing model: determining the initial training sample based on the target paragraph includes: determining the prompt word corresponding to the target paragraph; inputting the target paragraph and the prompt word into the initial text processing model, and outputting the first thinking path for the target paragraph and the first reply information for the target paragraph; when the content of the first reply information and the paragraph sample is the same, the target paragraph, the prompt word corresponding to the target paragraph, the first thinking path and the first reply information are used as the initial training sample.
[0161] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the training method of the text processing model: the initial training sample includes a target paragraph, a prompt word corresponding to the target paragraph, a first thinking path and a first reply information, and the sample model is trained based on the initial training sample to obtain a sample generation model including: inputting the target paragraph and the prompt word corresponding to the target paragraph into the sample model, outputting a second thinking path for the target paragraph and a second reply information for the target paragraph; calculating a first loss value of the first thinking path and the second thinking path based on a first loss function, and calculating a second loss value of the first reply information and the second reply information based on the first loss function; updating the parameters of the sample model based on the first loss value and the second loss value, and repeatedly executing the steps of inputting the target paragraph and the prompt word corresponding to the target paragraph into the updated sample model, and calculating the loss value between the thinking path output by the updated sample model and the first thinking path, and the loss value between the reply information output by the updated sample model and the first reply information based on the first loss function, until the calculated loss value meets the first preset condition, and the updated sample model is used as the sample generation model.
[0162] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the training method of the text processing model: using the sample generation model to generate training sample data containing the thinking path includes: using the sample generation model to generate preset training samples, wherein the preset training samples include preset prompt words, preset text samples, processed preset text samples, preset thinking paths and preset reply information; when the preset text samples and the preset reply information are consistent, the preset prompt words, processed preset text samples, preset thinking paths and preset reply information are used as training sample data.
[0163] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the training method of the text processing model: the training sample data includes preset prompt words, processed preset text samples, preset thinking paths and preset reply information, and training the initial text processing model based on the training sample data includes: inputting the preset prompt words and the processed preset text samples into the initial text processing model, outputting a third thinking path for the processed preset text samples and a third reply information for the processed preset text samples; calculating a third loss value of the preset thinking path and the third thinking path based on the second loss function, and calculating a fourth loss value of the preset reply information and the third reply information based on the second loss function; updating the parameters of the initial text processing model based on the third loss value and the fourth loss value, and repeatedly executing the steps of inputting the preset prompt words and the processed preset text samples into the updated initial text processing model, calculating the loss value between the thinking path output by the updated initial text processing model and the preset thinking path, and the loss value between the reply information output by the updated initial text processing model and the preset reply information, until the calculated loss value meets the second preset condition, and the updated initial text processing model is used as the target text processing model.
[0164] In this embodiment, the above-mentioned computer terminal can also execute the program code of the following steps in the information processing method based on the target text processing model: receiving question information; inputting the question information into the above-mentioned target text processing model; and outputting reply information corresponding to the question information through the target text processing model.
[0165] Optionally, the above-mentioned computer terminal can execute the program code of the following steps in the information processing method based on the target text processing model: outputting reply information corresponding to the question information through the target text processing model includes: generating a target thinking chain corresponding to the question information through the target text processing model; obtaining requirement description information based on the target thinking chain and the question information through the target text processing model, wherein the requirement description information is used to indicate the information that needs to be supplemented in the target thinking chain; calling an external information source to obtain the target requirement information corresponding to the requirement description information; filling the target requirement information into the target thinking chain to obtain the target thinking path; generating reply information based on the target thinking path.
[0166] Optionally, Figure 7 This is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 7 As shown, the electronic device may include: one or more ( Figure 7 Only one is shown) processor 702, memory 704, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0167] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the training method and device of the text processing model in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned training method of the text processing model. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, corporate intranet, local area network, mobile communication network and combinations thereof.
[0168] The processor can call the information and application programs stored in the memory through the transmission device to execute the above steps in the training method of the above text processing model.
[0169] An embodiment of the present application provides a method for training a text processing model. This method involves obtaining a sample generation model, wherein the sample generation model is used to generate training sample data containing a thought path; using the sample generation model to generate training sample data containing a thought path; and training an initial text processing model based on the training sample data to obtain a target text processing model. This method solves the technical problem of using manually annotated training samples to train an initial text processing model, resulting in low accuracy of the response information output by the resulting model. This method thereby improves the accuracy of the response information output by the target text processing model.
[0170] It can be understood by those skilled in the art that Figure 7 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Figure 7 It does not limit the structure of the above electronic device. For example, the electronic device may also include Figure 7 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 7 Different configurations shown.
[0171] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0172] Example 6
[0173] The embodiment of the present application further provides a computer-readable storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the information processing method based on the target text processing model or the training method of the text processing model provided in the first embodiment.
[0174] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0175] Optionally, the storage medium is configured to store program code for performing the following steps: obtaining a sample generation model, wherein the sample generation model is used to generate training sample data containing a thinking path; using the sample generation model to generate training sample data containing a thinking path; training an initial text processing model based on the training sample data to obtain a target text processing model, wherein the target text processing model is used to perform retrieval enhancement processing on question information and output reply information based on the processing results.
[0176] Optionally, the storage medium is also configured to store program code for executing the following steps: the sample generation model is obtained by the following steps: extracting paragraph samples from a text sample set; identifying keywords in the paragraph samples, and masking at least one keyword in the paragraph samples using a preset method to obtain a target paragraph; determining an initial training sample based on the target paragraph; and training the sample model based on the initial training sample to obtain a sample generation model.
[0177] Optionally, the storage medium is also configured to store program code for executing the following steps: determining an initial training sample based on a target paragraph includes: determining a prompt word corresponding to the target paragraph; inputting the target paragraph and the prompt word into an initial text processing model, and outputting a first thinking path for the target paragraph and a first reply information for the target paragraph; when the content of the first reply information and the paragraph sample is the same, using the target paragraph, the prompt word corresponding to the target paragraph, the first thinking path and the first reply information as the initial training sample.
[0178] Optionally, the storage medium is also configured to store program code for executing the following steps: the initial training sample includes a target paragraph, a prompt word corresponding to the target paragraph, a first thinking path and a first reply message, and the sample model is trained based on the initial training sample to obtain a sample generation model including: inputting the target paragraph and the prompt word corresponding to the target paragraph into the sample model, outputting a second thinking path for the target paragraph and a second reply message for the target paragraph; calculating a first loss value of the first thinking path and the second thinking path based on a first loss function, and calculating a second loss value of the first reply message and the second reply message based on the first loss function; updating the parameters of the sample model based on the first loss value and the second loss value, and repeatedly executing the steps of inputting the target paragraph and the prompt word corresponding to the target paragraph into the updated sample model, and calculating the loss value between the thinking path output by the updated sample model and the first thinking path, and the loss value between the reply message output by the updated sample model and the first reply message based on the first loss function, until the calculated loss value meets the first preset condition, and the updated sample model is used as the sample generation model.
[0179] Optionally, the storage medium is also configured to store program code for executing the following steps: using a sample generation model to generate training sample data containing a thinking path includes: using a sample generation model to generate a preset training sample, wherein the preset training sample includes a preset prompt word, a preset text sample, a processed preset text sample, a preset thinking path and a preset reply information; when the preset text sample and the preset reply information are consistent, the preset prompt word, the processed preset text sample, the preset thinking path and the preset reply information are used as training sample data.
[0180] Optionally, the storage medium is also configured to store program code for executing the following steps: the training sample data includes preset prompt words, processed preset text samples, preset thinking paths and preset reply information, and training the initial text processing model based on the training sample data includes: inputting the preset prompt words and the processed preset text samples into the initial text processing model, outputting a third thinking path for the processed preset text samples and a third reply information for the processed preset text samples; calculating a third loss value of the preset thinking path and the third thinking path based on the second loss function, and calculating a fourth loss value of the preset reply information and the third reply information based on the second loss function; updating the parameters of the initial text processing model based on the third loss value and the fourth loss value, and repeatedly executing the steps of inputting the preset prompt words and the processed preset text samples into the updated initial text processing model, calculating the loss value between the thinking path output by the updated initial text processing model and the preset thinking path, and the loss value between the reply information output by the updated initial text processing model and the preset reply information, until the calculated loss value meets the second preset condition, and the updated initial text processing model is used as the target text processing model.
[0181] Optionally, in this embodiment, the storage medium is further configured to store program codes for executing the following steps: receiving question information; inputting the question information into the above-mentioned target text processing model; and outputting reply information corresponding to the question information through the target text processing model.
[0182] Optionally, the storage medium is also configured to store program code for executing the following steps: outputting reply information corresponding to the question information through the target text processing model includes: generating a target thinking link corresponding to the question information through the target text processing model; obtaining requirement description information based on the target thinking link and the question information through the target text processing model, wherein the requirement description information is used to indicate the information that needs to be supplemented in the target thinking link; calling an external information source to obtain target requirement information corresponding to the requirement description information; filling the target requirement information into the target thinking link to obtain the target thinking path to generate reply information.
[0183] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the program steps of the information processing method based on the target text processing model or the training method steps of the text processing model.
[0184] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0185] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0186] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, 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 units or modules, which can be electrical or other forms.
[0187] The units described as separate components may or may not be physically separate, and 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 these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0188] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0189] If the integrated unit 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, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program code.
[0190] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A training method for a text processing model, characterized in that: include: Obtaining a sample generation model, wherein the sample generation model is used to generate training sample data including a thinking path; Using the sample generation model to generate training sample data containing thinking paths; Training the initial text processing model based on the training sample data to obtain a target text processing model, wherein the target text processing model is used to perform retrieval enhancement processing on the question information and output reply information based on the processing result; The sample generation model is obtained by the following steps: Extracting paragraph samples from a text sample collection; Identifying keywords in the paragraph sample, and masking at least one keyword in the paragraph sample using a preset method to obtain a target paragraph; Determining an initial training sample based on the target paragraph; Training the sample model based on the initial training sample to obtain a sample generation model; The preset method at least includes: masking words with a frequency greater than a preset frequency; using natural language processing technology to perform part-of-speech tagging or named entities, masking the identified words, and randomly selecting a certain proportion of words for masking.
2. The method according to claim 1, characterized in that Determining an initial training sample based on the target paragraph includes: Determining the prompt word corresponding to the target paragraph; Inputting the target paragraph and the prompt word into an initial text processing model, and outputting a first thinking path for the target paragraph and first response information for the target paragraph; In the case where the content of the first reply information is the same as that of the paragraph sample, the target paragraph, the prompt word corresponding to the target paragraph, the first thinking path and the first reply information are used as the initial training sample.
3. The method according to claim 1, characterized in that The initial training sample includes the target paragraph, the prompt word corresponding to the target paragraph, the first thinking path, and the first reply information. The sample model is trained based on the initial training sample to obtain a sample generation model including: Inputting the target paragraph and the prompt words corresponding to the target paragraph into the sample model, and outputting a second thinking path for the target paragraph and second response information for the target paragraph; Calculating first loss values of the first thinking path and the second thinking path based on a first loss function, and calculating second loss values of the first reply information and the second reply information based on the first loss function; Based on the first loss value and the second loss value, the parameters of the sample model are updated, and the steps of inputting the target paragraph and the prompt word corresponding to the target paragraph into the updated sample model are repeated. Based on the first loss function, the loss value between the thinking path output by the updated sample model and the first thinking path, and the loss value between the reply information output by the updated sample model and the first reply information are calculated, until the calculated loss value meets the first preset condition, and the updated sample model is used as the sample generation model.
4. The method according to any one of claims 1 to 3, characterized in that Generating training sample data containing thinking paths using the sample generation model includes: The sample generation model is used to generate preset training samples, wherein the preset training samples include preset prompt words, preset text samples, processed preset text samples, preset thinking paths, and preset response information; In the case where the preset text sample and the preset reply information are consistent, the preset prompt word, the processed preset text sample, the preset thinking path and the preset reply information are used as the training sample data.
5. The method according to claim 1, wherein The training sample data includes preset prompt words, processed preset text samples, preset thinking paths, and preset response information. Training the initial text processing model based on the training sample data includes: Inputting the preset prompt word and the processed preset text sample into the initial text processing model, and outputting a third thinking path for the processed preset text sample and third reply information for the processed preset text sample; Calculating a third loss value of the preset thinking path and the third thinking path based on a second loss function, and calculating a fourth loss value of the preset reply information and the third reply information based on the second loss function; Based on the third loss value and the fourth loss value, the parameters of the initial text processing model are updated, and the steps of inputting the preset prompt word and the processed preset text sample into the updated initial text processing model, calculating the loss value between the thinking path output by the updated initial text processing model and the preset thinking path, and the loss value between the reply information output by the updated initial text processing model and the preset reply information are repeated until the calculated loss value meets the second preset condition, and the updated initial text processing model is used as the target text processing model.
6. An information processing method based on a target text processing model, characterized in that: include: Receive problem information; Inputting the question information into the target text processing model according to any one of claims 1 to 5; Outputting reply information corresponding to the question information through the target text processing model.
7. The method according to claim 6, characterized in that Outputting the reply information corresponding to the question information through the target text processing model includes: Generate a target thinking link corresponding to the question information through the target text processing model; Obtaining requirement description information based on the target thought chain and the question information through the target text processing model, wherein the requirement description information is used to indicate information that needs to be supplemented in the target thought chain; Calling an external information source to obtain target requirement information corresponding to the requirement description information; Filling the target demand information into the target thinking link to obtain the target thinking path; The reply information is generated according to the target thinking path.
8. A training device for a text processing model, characterized in that: include: an acquisition unit, configured to acquire a sample generation model, wherein the sample generation model is configured to generate training sample data containing a thinking path; A generating unit, configured to generate training sample data containing a thinking path using the sample generation model; A first training unit is configured to train an initial text processing model based on the training sample data to obtain a target text processing model, wherein the target text processing model is configured to perform retrieval enhancement processing on the question information and output reply information based on the processing result; The device further comprises: an extraction unit for extracting paragraph samples from a text sample set; an identification unit for identifying keywords in the paragraph samples and masking at least one keyword in the paragraph samples using a preset method to obtain a target paragraph; a determination unit for determining an initial training sample based on the target paragraph; and a second training unit for training a sample model based on the initial training sample to obtain a sample generation model. The preset method at least includes: masking words with a frequency greater than a preset frequency; using natural language processing technology to perform part-of-speech tagging or named entities, masking the identified words, and randomly selecting a certain proportion of words for masking.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored executable program, wherein, when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the text processing model training method according to any one of claims 1 to 5.
10. An electronic device, characterized in that: include: a memory storing an executable program; A processor, configured to run the program, wherein the program, when running, executes the text processing model training method described in any one of claims 1 to 5.
11. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the text processing model training method described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Question and answer model training method, data processing method, text processing method and video processing method
CN119539071A