Model training method and device, electronic equipment and storage medium
Through consistency scoring and data purification processing, the problem of low accuracy of small models after the migration of large model inference capabilities is solved, and the inference ability and result accuracy of small models are improved.
Patent Information
- Application Number
- CN202411332502.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2024-12-24
AI Technical Summary
After the inference capability of large models is transferred in resource-constrained environments, the inference results of small models are relatively accurate, and it is difficult for existing technologies to effectively improve the inference capability and result accuracy of small models.
By obtaining sample data, input it to the first inference model to generate initial thinking chain data, determine its consistency score with the sample data, filter candidate thinking chain data, perform data purification processing, obtain target thinking chain data, and input it to train The second inference model is trained to optimize thinking chain data to improve inference ability.
Through consistency scoring and data purification processing, the thinking chain data is optimized, so that the trained second inference model can learn the reasoning ability that is consistent with the first inference model and improve the accuracy of its inference results.
Smart Images

Figure CN119180341A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a model training method, device, electronic device and storage medium. Background Art
[0002] With the development of artificial intelligence technology, models have shown significant results in many fields such as natural language processing, computer vision, and multimodal tasks. Large models can simulate human cognitive processes through large-scale training data, thereby achieving the understanding and processing of complex problems.
[0003] In the related art, taking the financial field as an example, when users manage investments through financial applications, the large model will provide users with reasonable investment plans based on multiple factors, while the small model will only provide users with investment plans based on a certain factor. This is because although the large models are powerful, they require a lot of computing resources when running, which is particularly problematic in resource-constrained environments. Therefore, the reasoning ability of the large model will be migrated to the small model to avoid the problem of computing resource occupation during reasoning. However, in actual use, the small model after the reasoning ability is migrated has a low accuracy of the inferred results due to the limited scale of the model. Therefore, the related art urgently needs to provide a model training method to solve the above technical problems. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a model training method, device, electronic device and storage medium, which can improve the reasoning ability of the small model after the reasoning ability is migrated, and further improve the accuracy of the inference results.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application proposes a model training method, the method comprising:
[0006] Acquire multiple sample data, input each sample data into the first reasoning model, and output multiple initial thinking chain data;
[0007] Determine the consistency score between each of the initial thought chain data and the corresponding sample data;
[0008] Based on the consistency score of each of the initial thought chain data, screening out candidate thought chain data from the plurality of the initial thought chain data;
[0009] Performing data purification processing on the candidate thought chain data to obtain target thought chain data;
[0010] The target thinking chain data is input into the second reasoning model to be trained to obtain the trained second reasoning model.
[0011] In some embodiments, the data purification process of the candidate thought chain data to obtain the target thought chain data includes:
[0012] Perform preliminary data purification on candidate thought chain data that are inconsistent with the sample data to obtain purified thought chain data;
[0013] Inputting the purified thought chain data into the second reasoning model to be trained to obtain output thought chain data;
[0014] When the output thinking chain data is inconsistent with the purified thinking chain data, the purified thinking chain data is iteratively purified, and the purified thinking chain data after the iterative purification is determined as the purified thinking chain data, and the step of inputting the purified thinking chain data into the second reasoning model to be trained to obtain the output thinking chain data is returned to execute, until the output thinking chain data is consistent with the purified thinking chain data, and the purified thinking chain data is determined as the target thinking chain data.
[0015] In some embodiments, the preliminary purification of candidate thought chain data that is inconsistent with the sample data to obtain purified thought chain data includes:
[0016] Performing word replacement on candidate thought chain data that does not match the semantic consistency of the sample data; and\or
[0017] Perform logical adjustments on candidate thought chain data that are inconsistent with the logical consistency of sample data to obtain purified thought chain data;
[0018] The iterative purification of the purified thought chain data and determining the purified thought chain data after the iterative purification as the purified thought chain data includes:
[0019] Performing word replacement on the purified thought chain data that does not match the semantic consistency of the output thought chain data; and\or
[0020] Perform logical adjustments on the purified thinking chain data that are inconsistent with the logical consistency of the output thinking chain data, and determine the purified thinking chain data after word replacement and / or word replacement as the purified thinking chain data.
[0021] In some embodiments, before replacing the words of the candidate thought chain data that does not match the semantic consistency of the sample data, the method further includes:
[0022] Extracting candidate semantic features and candidate logical features of the candidate thought chain data;
[0023] Extracting sample semantic features and sample logical features of the sample data;
[0024] Determine the candidate thought chain data whose semantic feature similarity between the candidate semantic feature and the sample semantic feature does not reach the preset semantic similarity as the candidate thought chain data that does not conform to the semantic consistency of the sample data;
[0025] The candidate thinking chain data whose logical feature similarity between the candidate logical feature and the sample logical feature does not reach the preset logical similarity is determined as the candidate thinking chain data that does not conform to the logical consistency of the sample data.
[0026] In some embodiments, before replacing the words of the purified thought chain data that does not conform to the semantic consistency of the output thought chain data, the method further includes:
[0027] Extracting purified semantic features and purified logical features of the purified thought chain data;
[0028] Extracting output semantic features and output logical features of the output thought chain data;
[0029] The purified thinking chain data whose semantic feature similarity between the purified semantic feature and the output semantic feature does not reach the preset semantic similarity is determined as the purified thinking chain data that does not conform to the semantic consistency of the output thinking chain data;
[0030] The purified thinking chain data whose logical feature similarity between the purified logical feature and the output logical feature does not reach the preset logical similarity is determined as the purified thinking chain data that is inconsistent with the logical consistency of the output thinking chain data.
[0031] In some embodiments, determining the consistency score between each of the initial thought chain data and the corresponding sample data includes:
[0032] Acquire the initial logical features and initial semantic features of each of the initial thought chain data, and the sample logical features and sample semantic features of the sample data corresponding to each of the initial thought chain data;
[0033] Determine the similarity between the initial semantic feature of each of the initial thought chain data and the target semantic feature of the sample semantic feature of the corresponding sample data;
[0034] Determine the similarity between the initial logical feature of each of the initial thought chain data and the target logical feature of the sample logical feature of the corresponding sample data;
[0035] Based on the target semantic feature similarity and the target logical feature similarity of each of the initial thought chain data, a consistency score of each of the initial thought chain data is determined.
[0036] In some embodiments, the step of selecting candidate thought chain data from a plurality of the initial thought chain data based on the consistency score of each of the initial thought chain data comprises:
[0037] The initial thought chain data whose consistency score is greater than or equal to the preset consistency score in each of the initial thought chain data are determined as candidate thought chain data.
[0038] In some embodiments, after inputting the target thinking chain data into the second reasoning model to be trained to obtain the trained second reasoning model, the method further includes:
[0039] Obtain target data, and input the target data into the trained second inference model to obtain a prediction result.
[0040] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application proposes a model training device, comprising:
[0041] A first input unit is used to obtain a plurality of sample data, input each sample data into a first reasoning model, and output a plurality of initial thinking chain data;
[0042] A determination unit, used to determine a consistency score between each of the initial thought chain data and the corresponding sample data;
[0043] A screening unit, configured to screen candidate thought chain data from a plurality of the initial thought chain data based on a consistency score of each of the initial thought chain data;
[0044] A data purification unit, used for performing data purification processing on the candidate thought chain data to obtain target thought chain data;
[0045] The second input unit is used to input the target thinking chain data into the second reasoning model to be trained for training, so as to obtain the trained second reasoning model.
[0046] In some embodiments, the data purification unit includes:
[0047] The first data purification subunit is used to perform preliminary data purification on candidate thought chain data that is inconsistent with the sample data to obtain purified thought chain data;
[0048] An input subunit, used for inputting the purified thought chain data into a second reasoning model to be trained to obtain output thought chain data;
[0049] The second data purification sub-unit, when the output thinking chain data is inconsistent with the purified thinking chain data, performs data iterative purification on the purified thinking chain data, and determines the purified thinking chain data after the data iterative purification as the purified thinking chain data, and returns to execute the step of inputting the purified thinking chain data into the second reasoning model to be trained to obtain the output thinking chain data, until the output thinking chain data is consistent with the purified thinking chain data, and determines the purified thinking chain data as the target thinking chain data.
[0050] In some embodiments, the first data purification subunit is used to:
[0051] Performing word replacement on candidate thought chain data that does not match the semantic consistency of the sample data; and\or
[0052] Perform logical adjustments on candidate thought chain data that are inconsistent with the logical consistency of sample data to obtain purified thought chain data;
[0053] The second data purification subunit is used to:
[0054] Performing word replacement on the purified thought chain data that does not match the semantic consistency of the output thought chain data; and\or
[0055] Perform logical adjustments on the purified thinking chain data that are inconsistent with the logical consistency of the output thinking chain data, and determine the purified thinking chain data after word replacement and / or word replacement as the purified thinking chain data.
[0056] In some embodiments, the first data purification subunit is further used to:
[0057] Extracting candidate semantic features and candidate logical features of the candidate thought chain data;
[0058] Extracting sample semantic features and sample logical features of the sample data;
[0059] Determine the candidate thought chain data whose semantic feature similarity between the candidate semantic feature and the sample semantic feature does not reach the preset semantic similarity as the candidate thought chain data that does not conform to the semantic consistency of the sample data;
[0060] The candidate thinking chain data whose logical feature similarity between the candidate logical feature and the sample logical feature does not reach the preset logical similarity is determined as the candidate thinking chain data that does not conform to the logical consistency of the sample data.
[0061] In some embodiments, the second data purification subunit is further used to:
[0062] Extracting purified semantic features and purified logical features of the purified thought chain data;
[0063] Extracting output semantic features and output logical features of the output thought chain data;
[0064] The purified thinking chain data whose semantic feature similarity between the purified semantic feature and the output semantic feature does not reach the preset semantic similarity is determined as the purified thinking chain data that does not conform to the semantic consistency of the output thinking chain data;
[0065] The purified thinking chain data whose logical feature similarity between the purified logical feature and the output logical feature does not reach the preset logical similarity is determined as the purified thinking chain data that is inconsistent with the logical consistency of the output thinking chain data.
[0066] In some embodiments, the determining unit is used to:
[0067] Acquire the initial logical features and initial semantic features of each of the initial thought chain data, and the sample logical features and sample semantic features of the sample data corresponding to each of the initial thought chain data;
[0068] Determine the similarity between the initial semantic feature of each of the initial thought chain data and the target semantic feature of the sample semantic feature of the corresponding sample data;
[0069] Determine the similarity between the initial logical feature of each of the initial thought chain data and the target logical feature of the sample logical feature of the corresponding sample data;
[0070] Based on the target semantic feature similarity and the target logical feature similarity of each of the initial thought chain data, a consistency score of each of the initial thought chain data is determined.
[0071] In some embodiments, the screening unit is used to:
[0072] The initial thought chain data whose consistency score is greater than or equal to the preset consistency score in each of the initial thought chain data are determined as candidate thought chain data.
[0073] In some embodiments, the device is further used for:
[0074] Obtain target data, and input the target data into the trained second inference model to obtain a prediction result.
[0075] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0076] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0077] The model training method and device, electronic device and storage medium proposed in the present application obtain multiple sample data, input each sample data into the first reasoning model, and output multiple initial thinking chain data; determine the consistency score of each initial thinking chain data and the corresponding sample data; based on the consistency score of each initial thinking chain data, screen out candidate thinking chain data from multiple initial thinking chain data; perform data purification processing on the candidate thinking chain data to obtain target thinking chain data; input the target thinking chain data into the second reasoning model to be trained for training, and obtain the trained second reasoning model. In this way, by optimizing the thinking chain data through consistency scoring and data purification processing in the process of reasoning ability transfer, the target thinking chain data for training the second reasoning model to be trained is finally obtained, so that the trained second reasoning model can learn the reasoning ability consistent with the first reasoning model, and further improve the accuracy of the results it infers. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] Figure 1 is a flow chart of the model training method provided in an embodiment of the present application;
[0079] Figure 2 yes Figure 1 Flow chart of step S102 in FIG.
[0080] Figure 3 yes Figure 1 Flow chart of step S103 in FIG.
[0081] Figure 4 yes Figure 1 Flow chart of step S104 in FIG.
[0082] Figure 5 yes Figure 4 Flowchart of step S401 and step S403 in FIG.
[0083] Figure 6 yes Figure 5 The flowchart before step S501 in FIG.
[0084] Figure 7 yes Figure 5 Before step S502 in;
[0085] Figure 8 yes Figure 1 Flowchart after step S104 in .
[0086] Fig. 9 It is a structural schematic diagram of a model training device provided in an embodiment of the present application;
[0087] Fig.10 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0088] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0089] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0090] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0091] First, some nouns involved in this application are analyzed:
[0092] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0093] Reasoning model: a tool for inference and decision-making based on data and logical rules. Structurally, the reasoning model usually consists of a data input layer, a reasoning engine, and a result output layer. Data input can be information in various forms, such as text, numbers, images, etc. The reasoning engine is the core part of the model, which uses specific algorithms and logical rules to analyze and process the input data. The result output layer presents the result of the reasoning, which may be a conclusion, prediction, suggestion or decision. The reasoning model can be used for a variety of tasks. In knowledge reasoning, it can derive new knowledge or relationships based on existing knowledge graphs or databases.
[0094] For example, in the financial field, inference models can analyze market data, company financial statements, and economic indicators to predict price trends of financial products, assess investment risks, or develop investment strategies.
[0095] The construction of inference models usually relies on technologies such as machine learning, deep learning, logical reasoning, and statistical analysis. By learning from a large amount of training data, the model can automatically extract features, discover patterns, and establish inference rules. At the same time, the knowledge and experience of human experts can also be integrated into the inference model to improve the accuracy and reliability of the model.
[0096] Thinking chain data: is a collection of information that includes a step-by-step reasoning process. Thinking chain data usually consists of a problem statement, intermediate reasoning steps, and a final conclusion. The problem statement specifies the problem or task to be solved, and the intermediate reasoning steps show in detail the path from the problem to the final conclusion through a series of thinking, analysis, and logical deduction processes.
[0097] For example, for a math problem “If two sides of a triangle are 3 and 4 respectively, find the value range of the third side”, the thinking chain data includes the problem statement itself, followed by the reasoning steps using the relationship between the three sides of the triangle, such as “Based on the fact that the sum of two sides of a triangle is greater than the third side, and the difference between the two sides is less than the third side, we can get 4-3<third side<4+3”, and finally the conclusion “1<third side<7”.
[0098] Thought chain data plays many important roles. First, it helps improve the transparency and explainability of problem solving. By showing the reasoning process, people can better understand how the conclusion is reached, thereby increasing trust in the results. Second, thought chain data is very valuable for education and learning. By studying thought chains, students can learn problem-solving methods and strategies and improve their logical thinking ability. In the field of artificial intelligence, thought chain data can be used to train and improve models, so that the models can learn more reasonable and effective reasoning methods and improve their performance and intelligence level.
[0099] Data purification: When purifying the thinking chain data, data purification mainly refers to the following series of operations: 1. Identify and delete incomplete or erroneous thinking chains. 2. Filter out irrelevant information. The thinking chain data may contain some descriptions or interference items that are irrelevant to the main reasoning process. 3. Unify the format and expression. Unify the format of thinking chain data from different sources or styles, such as using specific symbols, terms or expressions. 4. Standardize the description of reasoning steps. Ensure that each reasoning step clearly and accurately expresses its logical relationship and basis. Some standardized templates or requirements can be formulated to make the reasoning steps in the thinking chain data more standardized. 5. Check and correct logical inconsistencies. There may be logical contradictions or inconsistencies in the thinking chain data, which need to be checked and corrected. 6. Label and classify key information. In order to make better use of the purified thinking chain data, the extracted key information can be labeled and classified.
[0100] Based on this, the embodiments of the present application provide a model training method, device, electronic device and storage medium, which aim to improve the reasoning ability of the small model after the reasoning ability is migrated, and further improve the accuracy of the inference results.
[0101] The model training method, device, electronic device and storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the model training method in the embodiments of the present application is described.
[0102] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0103] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0104] The model training method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The model training method provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server side, and can also be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, and can also be configured to provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms; the software can be an application that implements the model training method, etc., but is not limited to the above forms.
[0105] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0106] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0107] Figure 1 is an optional flowchart of the model training method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S105.
[0108] Step S101, obtain multiple sample data, input each sample data into the first reasoning model, and output multiple initial thinking chain data.
[0109] The sample data is used to provide input for the subsequent first reasoning model. By processing and analyzing these sample data, the first reasoning model can perform effective reasoning to output the initial thinking chain data corresponding to each sample data. The initial thinking chain data is the complete reasoning process from the sample data to the final result output by the first reasoning model when reasoning for each sample data.
[0110] Specifically, the first reasoning model is a large model with reasoning capabilities after training, that is, after the sample data is input into the first reasoning model, the first reasoning model can reason about the sample data according to its own reasoning capabilities, and output the initial thinking chain data obtained due to its reasoning capabilities.
[0111] For example, taking the user investment scenario as an example, the sample data can be the historical performance data of different investment products, macroeconomic data, industry development data, and the user's own risk preference data. The first reasoning model is the investment analysis model. For example, the sample data for a certain wealth management product includes its return fluctuations in the past year, the development trend of the industry to which it belongs, and the expected performance of the industry under the macroeconomic environment. After inputting these data into the first reasoning model, the initial thinking chain data that may be output is: "The market demand for the industry to which this wealth management product belongs has grown rapidly recently. Judging from the historical return trend, the fluctuations are large but the overall trend is upward. Considering the current macroeconomic stability and low interest rate level, it is conducive to corporate financing and expansion. The user's risk preference is moderate, and this wealth management product may be suitable for appropriate configuration to obtain higher returns."
[0112] Step S102, determining the consistency score between each initial thought chain data and the corresponding sample data.
[0113] Among them, the consistency score is intended to evaluate the consistency between the initial thinking chain data and the sample data in terms of logic, semantics, etc. A high consistency score means that the reasoning process and conclusions in the thinking chain data are highly consistent with the information provided by the sample data, otherwise it means that there are large differences or inconsistencies.
[0114] For example, in a user investment scenario, if the sample data is information about the return trend, industry trends, and macroeconomic environment of a certain financial product, then the initial thinking chain data may be an inferential analysis of the investment prospects of the financial product based on this information.
[0115] Step S103, based on the consistency score of each initial thought chain data, select candidate thought chain data from multiple initial thought chain data.
[0116] Among them, in order to avoid the problem of low reasoning accuracy caused by using the initial thinking chain data that is inconsistent with the sample data as training samples for training the second reasoning model, the consistency score is used for screening to remove the initial thinking chain data that is less consistent with the sample data and may have erroneous reasoning or inaccurate analysis. Only candidate thinking chain data with high consistency is retained to ensure that the thinking chain data used in subsequent processing is more accurate, thereby improving the quality of the overall thinking chain data.
[0117] For example, in an investment scenario, if the judgment of a certain initial thinking chain data on market trends is seriously inconsistent with the actual sample data, it will be eliminated during the screening process to avoid misleading the analysis of the subsequent second inference model.
[0118] Step S104, purifying the candidate thought chain data to obtain the target thought chain data.
[0119] Among them, after retaining the candidate thinking chain data with high consistency with the sample data in step S103, the candidate thinking chain data will be further purified to improve the quality of the candidate thinking chain data in terms of accuracy, logic, etc., so as to obtain higher-quality target thinking chain data.
[0120] Step S105, inputting the target thinking chain data into the second reasoning model to be trained for training, and obtaining the trained second reasoning model.
[0121] Among them, the target thinking chain data is input into the second reasoning model to be trained for training. The target thinking chain data can enable the second reasoning model to better learn the correct patterns and rules, reduce the risk of overfitting, and improve the ability of prediction and reasoning.
[0122] For example, in the financial field, using purified target thinking chain data to train investment forecasting models can improve the model's prediction accuracy of market trends and provide users with more valuable reference information.
[0123] Steps S101 to S105 shown in the embodiment of the present application are to obtain multiple sample data, input each sample data into the first reasoning model, and output multiple initial thinking chain data; determine the consistency score of each initial thinking chain data and the corresponding sample data; based on the consistency score of each initial thinking chain data, screen out candidate thinking chain data from multiple initial thinking chain data; perform data purification on the candidate thinking chain data to obtain target thinking chain data; input the target thinking chain data into the second reasoning model to be trained for training, and obtain the trained second reasoning model. In this way, in the process of reasoning ability transfer, the thinking chain data is optimized by consistency scoring and data purification, and finally the target thinking chain data for training the second reasoning model to be trained is obtained, so that the trained second reasoning model can learn the reasoning ability consistent with the first reasoning model, and further improve the accuracy of its reasoning results.
[0124] See also Figure 2 In some embodiments, step S102 may include but is not limited to steps S201 to S204:
[0125] Step S201, obtaining the initial logical features and initial semantic features of each of the initial thought chain data, and the sample logical features and sample semantic features of the sample data corresponding to each of the initial thought chain data.
[0126] Among them, with respect to logical features, the logical features may include initial thought chain data and logical connectives in sample data, etc.
[0127] For example, the initial thought chain data is "Because the sales volume of Company A's products has increased and the market demand has continued to expand, the company's profits are expected to increase." It can be determined that the logical connectives are "because, so".
[0128] Based on this, the corresponding initial logic features and sample logic features can be extracted from the initial thinking chain data and sample data respectively.
[0129] As for the semantic features, the semantic features may be the sentence vectors of the words in the initial thought chain data and the sample data. The sentence vectors may be determined by obtaining the average value, weighted average value, etc. of the word vectors of each word in the sentence.
[0130] For example, for the sentence "The company's performance is constantly improving", the word vectors of "company", "performance" and "improvement" can be averaged to obtain the sentence vector of the sentence.
[0131] Step S202, determining the similarity between the initial semantic feature of each of the initial thought chain data and the target semantic feature of the sample semantic feature of the corresponding sample data.
[0132] Among them, by determining the target semantic feature similarity between the initial semantic features of each initial thinking chain data and the sample semantic features of the corresponding sample data, the difference between each initial thinking chain data and the sample data in the dimension of semantic consistency is determined.
[0133] Specifically, the method for calculating the target semantic feature similarity between the initial semantic feature and the sample semantic feature includes: calculating the cosine distance between the initial semantic feature and the sample semantic feature to obtain a calculation result in which the cosine distance is between [-1,1]. The closer the calculation result is to 1, the closer the directions of the two vectors are, and the higher the similarity is; the closer the value is to -1, the opposite directions of the two vectors, and the lower the similarity is; a value of 0 indicates that the two vectors are orthogonal and unrelated. In this way, the similarity between the initial semantic feature and the sample semantic feature is calculated.
[0134] Specifically, the calculation method of the cosine distance can refer to the following formula:
[0135]
[0136] Among them, A·B represents the dot product (inner product) of vector A and vector B, ‖A‖ and ‖B‖ represent the modulus (length) of vector A and vector B respectively, and d cos (A,B) is the cosine distance between vector A and vector B.
[0137] Step S203, determining the similarity between the initial logical feature of each of the initial thought chain data and the target logical feature of the sample logical feature of the corresponding sample data.
[0138] Among them, by determining the target logical feature similarity between the initial logical features of each initial thinking chain data and the sample logical features of the corresponding sample data, the difference between each initial thinking chain data and the sample data in the dimension of logical consistency is determined.
[0139] Specifically, the calculation method of the target logical feature similarity between the initial logical feature and the sample logical feature includes: calculating the similarity between logical connectives and / or calculating the similarity between reasoning methods. For the similarity between logical connectives, the number of occurrences of the logical connectives in each logical feature is counted, and then the ratio of the number of elements in the intersection of the two sets to the number of elements in the union is used as the logical similarity.
[0140] For example, in the initial logic features and sample logic features, the sets of connectives are {1("because, so"), 3("and")} and {1("because, so"), 2("if, then")} respectively. The intersection is {1("because, so")}, and the union is {1("because, so"), 2("if, then"), 3("and")}. Then the similarity of the logical connectives is 1 / 3.
[0141] Step S204, determining the consistency score of each of the initial thought chain data based on the target semantic feature similarity and the target logical feature similarity of each of the initial thought chain data.
[0142] Among them, after respectively determining the target semantic feature similarity between each initial thought chain data and the corresponding sample data in the semantic consistency dimension, and the target logical feature similarity in the logical consistency dimension in step S202 and step S203, the consistency score between each initial thought chain data and the corresponding sample data can be determined through comprehensive evaluation.
[0143] Specifically, the specific method of comprehensive evaluation can be weighted average, which is to assign different weights to the target semantic feature similarity and the target logical feature similarity in advance, and then calculate the weighted average as the consistency score.
[0144] In this way, by determining the consistency score of the initial thinking chain data based on the target semantic feature similarity and the target logical feature similarity, and adopting comprehensive evaluation methods such as weighted average, the consistency score of the initial thinking chain data and the sample data can be more accurately measured. The consistency score can ensure that the thinking chain data used in subsequent processing is more accurate, thereby improving the quality of the thinking chain data.
[0145] See also Figure 3 In some embodiments, step S103 may include but is not limited to step S301:
[0146] Step S301 , determining the initial thought chain data whose consistency score is greater than or equal to the preset consistency score in each of the initial thought chain data as candidate thought chain data.
[0147] The purpose of this step is to eliminate the initial thinking chain data with low consistency with the sample data, and only retain the initial thinking chain data with high consistency with the sample data as candidate thinking chain data.
[0148] Specifically, after obtaining the consistency score of each initial thinking chain data, since the consistency score is to characterize the consistency between the initial thinking chain data and the sample data, a consistency score threshold can be set, that is, a preset consistency score, and the initial thinking chain data with a consistency score greater than or equal to the preset consistency score in the initial thinking chain data can be determined as candidate thinking chain data.
[0149] For example, the consistency score of the initial thinking chain data A is 90, the consistency score of the initial thinking chain data B is 40, the consistency score of the initial thinking chain data A is 60, and the preset consistency score is 70, then the initial thinking chain data A is determined as the candidate thinking chain data, and the initial thinking chain data B and the initial thinking chain data C are eliminated.
[0150] In this way, by determining the initial thinking chain data with a consistency score greater than or equal to the preset consistency score as the candidate thinking chain data, the initial thinking chain data with low consistency with the sample data can be effectively eliminated. This reduces the errors and uncertainties caused by low-quality data and ensures that the candidate thinking chain data used in the subsequent data purification process has a higher quality.
[0151] See also Figure 4 In some embodiments, step S104 may include but is not limited to steps S401 to S403:
[0152] Step S401, preliminarily purify the candidate thought chain data that is inconsistent with the sample data to obtain purified thought chain data.
[0153] Among them, although the candidate thought chain data with high consistency with the corresponding sample data are retained through consistency scoring, there will also be some candidate thought chain data with semantic consistency and / or logical consistency that deviates from the sample data, that is, candidate thought chain data that is inconsistent with the consistency of the sample data. For this part of the data, the consistency between it and the corresponding sample data can be improved through preliminary data purification to obtain purified thought chain data.
[0154] Step S402, inputting the purified thought chain data into the second reasoning model to be trained to obtain output thought chain data.
[0155] Among them, the purified thinking chain data that has undergone preliminary data purification is input into the second reasoning model to be trained, so that the second reasoning model can reason on the purified thinking chain data according to its own reasoning ability and generate output thinking chain data.
[0156] Step S403, when the output thinking chain data is inconsistent with the purified thinking chain data, the purified thinking chain data is iteratively purified, and the purified thinking chain data after the iterative purification is determined as the purified thinking chain data, and the step of inputting the purified thinking chain data into the second reasoning model to be trained to obtain the output thinking chain data is returned to execute, until the output thinking chain data is consistent with the purified thinking chain data, and the purified thinking chain data is determined as the target thinking chain data.
[0157] Among them, for each purified thinking chain data input into the second reasoning model to be trained, by comparing the consistency of the output thinking chain data of the corresponding output, the purified thinking chain data that is inconsistent with the consistency is iteratively purified, so as to continue to improve the data content of the purified thinking chain data, and the purified thinking chain data after data iterative purification is determined as the purified thinking chain data, and the step of inputting the purified thinking chain data into the second reasoning model to be trained is re-executed to obtain the output thinking chain data, so as to iteratively improve the purified thinking chain data that is inconsistent with the output thinking chain data of the corresponding output in a cyclic manner until the purified thinking chain data is consistent with the output thinking chain data output by the second reasoning model, thereby ending the loop process and obtaining the target thinking chain data after iterative purification.
[0158] For example, the purified thinking chain data obtained by purifying the initial data is "The current macro-economy is growing steadily, industry X is supported, and has good development prospects. Company C is a front-end enterprise in industry X, with advanced technology and a strong market share and strong profitability. Company C is worthy of cooperation." It is first input into the second inference model to be trained, and the output thinking chain data obtained is "Because the current macro-economy is growing steadily, industry X is supported, and has good development prospects, Company C is a front-end enterprise in industry X, with advanced technology and a strong market share and strong profitability. Company C is worthy of cooperation." By comparing the consistency of the output thinking chain data with the purified thinking chain data, if the consistency is inconsistent, the purified thinking chain data is iteratively purified, and the logical connectives "because, so" are added to it to obtain "because the current macro-economy is growing steadily, industry X is supported, and the development prospects are good, Company C is the front-end enterprise of industry X, with advanced technology and strong market share, and strong profitability, so Company C is worth cooperating with", and re-input the second reasoning model to be trained to obtain the output thinking chain data as "due to the current macro-economy is growing steadily, industry X is supported, and the development prospects are good, Company C is the front-end enterprise of industry X, with advanced technology and strong market share, and strong profitability, so Company C is worth cooperating with", at this time, the consistency of the output thinking chain data and the purified thinking chain data is consistent, and the purified thinking chain data obtained after the last data iterative purification is determined as the target thinking chain data.
[0159] In this way, by preliminarily purifying the candidate thinking chain data that is inconsistent with the sample data, the deviation in consistency can be removed, making the data closer to the characteristics and requirements of the sample data, thereby improving the accuracy and reliability of the candidate thinking chain data. And by iteratively purifying the purified thinking chain data until it is consistent with the output thinking chain data, the high quality of the data is further ensured. By continuously optimizing the problems in the purified thinking chain data, the final target thinking chain data is more rigorous and accurate in both semantics and logic.
[0160] See also Figure 5 In some embodiments, step S401 may include but is not limited to step S501, and step S403 may include but is not limited to step S502:
[0161] Step S501, replace the candidate thought chain data that does not match the semantic consistency of the sample data with words; and\or
[0162] Logically adjust the candidate thinking chain data that does not match the logical consistency of the sample data to obtain purified thinking chain data.
[0163] Among them, since consistency includes two consistency dimensions, namely semantic consistency and logical consistency, the purification methods are different when the corresponding data are initially purified for different consistency dimensions. For the semantic consistency dimension, the words in the candidate thinking chain data will be adjusted; for the logical consistency dimension, the candidate thinking chain data will be logically adjusted.
[0164] For example, in the case of semantic inconsistency, the sample data is "Current real estate market regulation has been strengthened, and housing prices have tended to stabilize. For buyers who have urgent needs, now is a good time to buy a house", and the candidate thinking chain data is "Current real estate market adjustments have intensified, and housing prices have tended to stabilize. For people who are in urgent need of housing, now is a good time to buy a house." Although the candidate thinking chain data is similar to the sample data, some semantic inconsistencies will be found. For example, there are semantic differences between "people who are in urgent need of housing" and "buyers who have urgent needs." Therefore, it is necessary to replace "people who are in urgent need of housing" in the candidate thinking chain data with "buyers who are in urgent need of independent housing."
[0165] For the case of logical consistency inconsistency, the sample data is "economic growth has slowed down, and corporate profitability has declined. In order to reduce costs, companies will reduce the number of new employees hired", and the candidate thinking chain data is "economic growth has slowed down, and corporate profitability has declined. However, companies will optimize internal processes to reduce costs." It can be seen that the logical connectives of the sample data are "because, so", while the logical connectives of the candidate thinking chain data are "although, but", which leads to inconsistency between the logic and the sample data. Therefore, the candidate thinking chain data needs to be adjusted to "economic growth has slowed down, and corporate profitability has declined. In order to cope with difficulties, companies will optimize internal processes to reduce costs."
[0166] Step S502, replacing the words of the purified thought chain data that do not match the semantic consistency of the output thought chain data; and\or
[0167] Perform logical adjustments on the purified thinking chain data that are inconsistent with the logical consistency of the output thinking chain data, and determine the purified thinking chain data after word replacement and / or word replacement as the purified thinking chain data.
[0168] Among them, when iteratively purifying the purified thinking chain data, the method of iterative purification is also to process the semantic consistency dimension and the logical consistency dimension. The processing method is similar to step S501 and will not be repeated here.
[0169] Therefore, through the two consistency dimensions of semantic consistency and logical consistency, the candidate thinking chain data and the purified thinking chain data are respectively subjected to preliminary data purification and iterative data purification, thereby improving the data quality.
[0170] See also Figure 6 , before step S501 in some embodiments, it also includes but is not limited to steps S601 to S604:
[0171] Step S601, extracting candidate semantic features and candidate logical features of the candidate thought chain data.
[0172] Among them, in order to determine whether there is a consistency difference between each candidate thinking chain data and the corresponding sample data, and when there is a difference, which specific consistency dimension is the difference, the semantic features and logical features of the candidate thinking chain data and the sample data are extracted and determined by similarity comparison. Therefore, it is necessary to extract the candidate semantic features and candidate logical features of the candidate thinking chain data.
[0173] Step S602: extracting sample semantic features and sample logical features of the sample data.
[0174] In order to compare the similarity, it is also necessary to extract the sample semantic features and sample logical features of the sample data.
[0175] Step S603, determining the candidate thought chain data whose semantic feature similarity between the candidate semantic feature and the sample semantic feature does not reach the preset semantic similarity as the candidate thought chain data that does not conform to the semantic consistency of the sample data.
[0176] Among them, a preset semantic similarity is set, for example 80. If the semantic feature similarity of candidate thinking chain data A is 70, and the semantic feature similarity of candidate thinking chain data B is 85, then candidate thinking chain data A is determined as candidate thinking chain data that is inconsistent with the semantic consistency of the sample data.
[0177] Step S604, determining the candidate thinking chain data whose logical feature similarity between the candidate logical feature and the sample logical feature does not reach the preset logical similarity as the candidate thinking chain data that does not conform to the logical consistency of the sample data.
[0178] Among them, a preset logical similarity is set, for example, 75. If the logical feature similarity of the candidate thinking chain data C is 60, and the semantic feature similarity of the candidate thinking chain data D is 90, then the candidate thinking chain data C is determined as a candidate thinking chain data that is inconsistent with the logical consistency of the sample data.
[0179] In this way, by extracting the semantic features and logical features of candidate thinking chain data and sample data and comparing the similarity to determine the consistency between the two, it is possible to accurately find out the candidate thinking chain data that is different from the sample data in the two consistency dimensions of semantics and logic, and to quickly and effectively identify the candidate thinking chain data that does not meet the requirements.
[0180] See also Figure 7 , before step S502 in some embodiments, it also includes but is not limited to steps S701 to S704:
[0181] Step S701, extracting the purified semantic features and purified logical features of the purified thought chain data.
[0182] Among them, in order to determine whether there is a consistency difference between the purified thinking chain data and the corresponding output thinking chain data, and when there is a difference, which specific consistency dimension is the difference, the semantic features and logical features of the purified thinking chain data and the output semantic features are extracted and determined by similarity comparison. Therefore, it is necessary to extract candidate semantic features and candidate logical features of the purified thinking chain data.
[0183] Step S702, extracting output semantic features and output logical features of the output thought chain data.
[0184] In order to compare the similarity, it is also necessary to extract the output semantic features and output logical features of the output thinking chain data.
[0185] Step S703, the purified thinking chain data whose semantic feature similarity between the purified semantic feature and the output semantic feature does not reach the preset semantic similarity is determined as the purified thinking chain data that does not conform to the semantic consistency of the output thinking chain data.
[0186] Among them, if the preset semantic similarity is 80, the semantic feature similarity of the purified thinking chain data E is 70, and the semantic feature similarity of the purified thinking chain data F is 85, then the purified thinking chain data E is determined to be purified thinking chain data that is inconsistent with the semantic consistency of the sample data.
[0187] Step S704, the purified thinking chain data whose logical feature similarity between the purified logical feature and the output logical feature does not reach the preset logical similarity is determined as the purified thinking chain data that does not conform to the logical consistency of the output thinking chain data.
[0188] Among them, if the preset logical similarity is 75, the logical feature similarity of the purified thinking chain data G is 60, and the semantic feature similarity of the purified thinking chain data H is 90, then the candidate thinking chain data G is determined as a candidate thinking chain data that is inconsistent with the logical consistency of the output thinking chain data.
[0189] In this way, by extracting the semantic features and logical features of the purified thinking chain data and the output thinking chain data, and comparing the similarities to determine the consistency between the two, it is possible to accurately find out the purified thinking chain data that is different from the output thinking chain data in the two consistency dimensions of semantics and logic, and to quickly and effectively identify the purified thinking chain data that does not meet the requirements, so as to provide high-quality training data for the second reasoning model to be trained.
[0190] See also Figure 8 In some embodiments, after step S105, the process further includes but is not limited to step S801:
[0191] Step S801, obtaining target data, and inputting the target data into the trained second inference model to obtain a prediction result.
[0192] Among them, after the second inference model to be trained is trained with the target data link data to obtain the trained second inference model, the target data is input into the trained second inference model, and the prediction result is output through the reasoning ability of the trained second inference model.
[0193] The embodiment of the present application obtains multiple sample data, inputs each sample data into the first reasoning model, and outputs multiple initial thinking chain data; determines the consistency score of each of the initial thinking chain data and the corresponding sample data; based on the consistency score of each of the initial thinking chain data, screens out candidate thinking chain data from the multiple initial thinking chain data; performs data purification processing on the candidate thinking chain data to obtain target thinking chain data; inputs the target thinking chain data into the second reasoning model to be trained for training, and obtains the trained second reasoning model. In this way, in the process of reasoning ability transfer, the thinking chain data is optimized by consistency scoring and data purification processing, and finally the target thinking chain data for training the second reasoning model to be trained is obtained, so that the trained second reasoning model can learn the reasoning ability consistent with the first reasoning model, and further improve the accuracy of its reasoning results.
[0194] See also Fig. 9 The embodiment of the present application also provides a model training device, which can implement the above-mentioned model training method, and the device includes:
[0195] A first input unit is used to obtain a plurality of sample data, input each sample data into a first reasoning model, and output a plurality of initial thinking chain data;
[0196] A determination unit, used to determine a consistency score between each of the initial thought chain data and the corresponding sample data;
[0197] A screening unit, configured to screen candidate thought chain data from a plurality of the initial thought chain data based on a consistency score of each of the initial thought chain data;
[0198] A data purification unit, used for performing data purification processing on the candidate thought chain data to obtain target thought chain data;
[0199] The second input unit is used to input the target thinking chain data into the second reasoning model to be trained for training, so as to obtain the trained second reasoning model.
[0200] In some embodiments, the data purification unit includes:
[0201] The first data purification subunit is used to perform preliminary data purification on candidate thought chain data that is inconsistent with the sample data to obtain purified thought chain data;
[0202] An input subunit, used for inputting the purified thought chain data into a second reasoning model to be trained to obtain output thought chain data;
[0203] The second data purification sub-unit, when the output thinking chain data is inconsistent with the purified thinking chain data, performs data iterative purification on the purified thinking chain data, and determines the purified thinking chain data after the data iterative purification as the purified thinking chain data, and returns to execute the step of inputting the purified thinking chain data into the second reasoning model to be trained to obtain the output thinking chain data, until the output thinking chain data is consistent with the purified thinking chain data, and determines the purified thinking chain data as the target thinking chain data.
[0204] In some embodiments, the first data purification subunit is used to:
[0205] Performing word replacement on candidate thought chain data that does not match the semantic consistency of the sample data; and\or
[0206] Perform logical adjustments on candidate thought chain data that are inconsistent with the logical consistency of sample data to obtain purified thought chain data;
[0207] The second data purification subunit is used to:
[0208] Performing word replacement on the purified thought chain data that does not match the semantic consistency of the output thought chain data; and\or
[0209] Perform logical adjustments on the purified thinking chain data that are inconsistent with the logical consistency of the output thinking chain data, and determine the purified thinking chain data after word replacement and / or word replacement as the purified thinking chain data.
[0210] In some embodiments, the first data purification subunit is further used to:
[0211] Extracting candidate semantic features and candidate logical features of the candidate thought chain data;
[0212] Extracting sample semantic features and sample logical features of the sample data;
[0213] Determine the candidate thought chain data whose semantic feature similarity between the candidate semantic feature and the sample semantic feature does not reach the preset semantic similarity as the candidate thought chain data that does not conform to the semantic consistency of the sample data;
[0214] The candidate thinking chain data whose logical feature similarity between the candidate logical feature and the sample logical feature does not reach the preset logical similarity is determined as the candidate thinking chain data that does not conform to the logical consistency of the sample data.
[0215] In some embodiments, the second data purification subunit is further used to:
[0216] Extracting purified semantic features and purified logical features of the purified thought chain data;
[0217] Extracting output semantic features and output logical features of the output thought chain data;
[0218] The purified thinking chain data whose semantic feature similarity between the purified semantic feature and the output semantic feature does not reach the preset semantic similarity is determined as the purified thinking chain data that does not conform to the semantic consistency of the output thinking chain data;
[0219] The purified thinking chain data whose logical feature similarity between the purified logical feature and the output logical feature does not reach the preset logical similarity is determined as the purified thinking chain data that is inconsistent with the logical consistency of the output thinking chain data.
[0220] In some embodiments, the determining unit is used to:
[0221] Acquire the initial logical features and initial semantic features of each of the initial thought chain data, and the sample logical features and sample semantic features of the sample data corresponding to each of the initial thought chain data;
[0222] Determine the similarity between the initial semantic feature of each of the initial thought chain data and the target semantic feature of the sample semantic feature of the corresponding sample data;
[0223] Determine the similarity between the initial logical feature of each of the initial thought chain data and the target logical feature of the sample logical feature of the corresponding sample data;
[0224] Based on the target semantic feature similarity and the target logical feature similarity of each of the initial thought chain data, a consistency score of each of the initial thought chain data is determined.
[0225] In some embodiments, the screening unit is used to:
[0226] The initial thought chain data whose consistency score is greater than or equal to the preset consistency score in each of the initial thought chain data are determined as candidate thought chain data.
[0227] In some embodiments, the device is further used for:
[0228] Obtain target data, and input the target data into the trained second inference model to obtain a prediction result.
[0229] The specific implementation of the model training device is basically the same as the specific implementation of the above-mentioned model training method, and will not be repeated here.
[0230] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above model training method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0231] See also Fig.10 , Fig.10 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0232] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0233] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other applications. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the model training method of the embodiment of this application;
[0234] Input / output interface 903, used to implement information input and output;
[0235] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0236] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0237] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0238] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned model training method is implemented.
[0239] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor 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.
[0240] The model training method, model training device, electronic device and storage medium provided in the embodiment of the present application obtain multiple sample data, input each sample data into the first reasoning model respectively, and output multiple initial thinking chain data; determine the consistency score of each initial thinking chain data and the corresponding sample data; based on the consistency score of each initial thinking chain data, screen out candidate thinking chain data from multiple initial thinking chain data; perform data purification processing on the candidate thinking chain data to obtain target thinking chain data; input the target thinking chain data into the second reasoning model to be trained for training, and obtain the trained second reasoning model. In this way, in the process of reasoning ability transfer, the thinking chain data is optimized by consistency scoring and data purification processing, and finally the target thinking chain data for training the second reasoning model to be trained is obtained, so that the trained second reasoning model can learn the reasoning ability consistent with the first reasoning model, and further improve the accuracy of the results it infers.
[0241] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0242] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0243] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0244] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0245] The terms "first", "second", "third", "fourth", etc. (if any) in the specification 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 sequence. 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 an order 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.
[0246] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0247] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0248] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0249] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0250] 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 is essentially 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, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0251] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A model training method, characterized in that: include: Acquire multiple sample data, input each sample data into the first reasoning model, and output multiple initial thinking chain data; Determine the consistency score between each of the initial thought chain data and the corresponding sample data; Based on the consistency score of each of the initial thought chain data, screening out candidate thought chain data from the plurality of the initial thought chain data; Performing data purification processing on the candidate thought chain data to obtain target thought chain data; The target thinking chain data is input into the second reasoning model to be trained to obtain the trained second reasoning model.
2. The model training method according to claim 1, characterized in that: The data purification process of the candidate thought chain data to obtain the target thought chain data includes: Perform preliminary data purification on candidate thought chain data that are inconsistent with the sample data to obtain purified thought chain data; Inputting the purified thought chain data into the second reasoning model to be trained to obtain output thought chain data; When the output thinking chain data is inconsistent with the purified thinking chain data, the purified thinking chain data is iteratively purified, and the purified thinking chain data after the iterative purification is determined as the purified thinking chain data, and the step of inputting the purified thinking chain data into the second reasoning model to be trained to obtain the output thinking chain data is returned to execute, until the output thinking chain data is consistent with the purified thinking chain data, and the purified thinking chain data is determined as the target thinking chain data.
3. The model training method according to claim 2, characterized in that: The preliminary purification of candidate thought chain data that does not match the consistency of sample data to obtain purified thought chain data includes: Performing word replacement on candidate thought chain data that does not match the semantic consistency of the sample data; and\or Perform logical adjustments on candidate thought chain data that are inconsistent with the logical consistency of sample data to obtain purified thought chain data; The iterative purification of the purified thought chain data and determining the purified thought chain data after the iterative purification as the purified thought chain data includes: Performing word replacement on the purified thought chain data that does not match the semantic consistency of the output thought chain data; and\or Perform logical adjustments on the purified thinking chain data that are inconsistent with the logical consistency of the output thinking chain data, and determine the purified thinking chain data after word replacement and / or word replacement as the purified thinking chain data.
4. The model training method according to claim 3, characterized in that: Before replacing the words of the candidate thought chain data that does not match the semantic consistency of the sample data, the method further includes: Extracting candidate semantic features and candidate logical features of the candidate thought chain data; Extracting sample semantic features and sample logical features of the sample data; Determine the candidate thought chain data whose semantic feature similarity between the candidate semantic feature and the sample semantic feature does not reach the preset semantic similarity as the candidate thought chain data that does not conform to the semantic consistency of the sample data; The candidate thinking chain data whose logical feature similarity between the candidate logical feature and the sample logical feature does not reach the preset logical similarity is determined as the candidate thinking chain data that does not conform to the logical consistency of the sample data.
5. The model training method according to claim 3, characterized in that: Before replacing the words of the purified thinking chain data that does not conform to the semantic consistency of the output thinking chain data, the method further includes: Extracting purified semantic features and purified logical features of the purified thought chain data; Extracting output semantic features and output logical features of the output thought chain data; The purified thinking chain data whose semantic feature similarity between the purified semantic feature and the output semantic feature does not reach the preset semantic similarity is determined as the purified thinking chain data that does not conform to the semantic consistency of the output thinking chain data; The purified thinking chain data whose logical feature similarity between the purified logical feature and the output logical feature does not reach the preset logical similarity is determined as the purified thinking chain data that is inconsistent with the logical consistency of the output thinking chain data.
6. The model training method according to any one of claims 1 to 5, characterized in that: Determining the consistency score between each of the initial thought chain data and the corresponding sample data includes: Acquire initial logical features and initial semantic features of each of the initial thought chain data, and sample logical features and sample semantic features of sample data corresponding to each of the initial thought chain data; Determine the similarity between the initial semantic feature of each of the initial thought chain data and the target semantic feature of the sample semantic feature of the corresponding sample data; Determine the similarity between the initial logical feature of each of the initial thought chain data and the target logical feature of the sample logical feature of the corresponding sample data; Based on the target semantic feature similarity and the target logical feature similarity of each of the initial thought chain data, a consistency score of each of the initial thought chain data is determined.
7. The model training method according to any one of claims 1 to 5, characterized in that: The step of selecting candidate thought chain data from a plurality of the initial thought chain data based on the consistency score of each of the initial thought chain data comprises: The initial thought chain data whose consistency score is greater than or equal to the preset consistency score in each of the initial thought chain data are determined as candidate thought chain data.
8. A model training device, characterized in that: include: A first input unit is used to obtain a plurality of sample data, input each sample data into a first reasoning model, and output a plurality of initial thinking chain data; A determination unit, used to determine a consistency score between each of the initial thought chain data and the corresponding sample data; A screening unit, configured to screen candidate thought chain data from a plurality of the initial thought chain data based on a consistency score of each of the initial thought chain data; A data purification unit, used for performing data purification processing on the candidate thought chain data to obtain target thought chain data; The second input unit is used to input the target thinking chain data into the second reasoning model to be trained for training, so as to obtain the trained second reasoning model.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the model training method described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the model training method described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Thinking chain data construction method and device, electronic equipment and storage medium
CN117633170A
Model training method and device based on thinking chain
CN118114770A
Cited By
Mathematical inference-oriented visual thinking operation system and mathematical inference method
CN119808967A
Question and answer model training method and system based on thinking chain
CN120670558A
Big language model-based reasoning method, training method, device and equipment
CN121279469A
Inference method, training method, device and equipment based on large language model
CN121279469B
