Training dataset filtering for large language model
By calculating the degree of impact of the data to be screened on the target application scenarios, similar data sets are screened out, which solves the problems of low efficiency and insufficient accuracy of data set screening in the prior art, and achieves more efficient and accurate model training.
Patent Information
- Application Number
- PCT/CN2025/078950
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-29
- Filing Date
- 2025-02-25
- Publication Date
- 2025-09-04
AI Technical Summary
In the prior art, the training data set of large language models that manually determine keywords are inefficient and have insufficient accuracy, making it easy to miss non-keyword data, affecting the effect of the model in specific scenarios.
By entering the sample data set to be filtered and the target application scenarios into the model to be trained, the degree of impact of each data to be filtered on the target application scenarios is calculated, and the target data set with a high degree of similarity to the sample data is selected.
It improves training efficiency and the processing accuracy of the model in the target application scenario, ensures that the training data set is highly matched with the target scenario, and improves the application effect of the model.
Smart Images

Figure CN2025078950_04092025_PF_FP_ABST
Abstract
Description
Training dataset screening for large language models Technical Field
[0001] One or more embodiments of this specification relate to the field of language model technology, and specifically to methods, devices, electronic devices, and storage media for screening training data sets for large language models. Background Art
[0002] Large Language Models (LLMs) are deep learning models that use large amounts of text data as training datasets to learn patterns of language usage. Large language models can generate natural language text or understand the meaning of language text, thereby handling a variety of natural language tasks such as text classification, question-answering, and conversation. Large language models trained with different types of text data have different effects in different scenarios. For example, a large language model trained with financial task data has a stronger ability to understand and generate text in financial scenarios, but a weaker ability to understand and generate text in sports scenarios. Therefore, the screening of training datasets for large language models is an important factor affecting the effectiveness of large language models.
[0003] Related techniques filter training datasets by searching for keywords corresponding to various scenarios. For example, in a financial context, data containing keywords such as "finance," "economy," and "stocks" is used as training data. However, this method manually determines keywords, which is inefficient and lacks accuracy. Furthermore, it easily misses data from financial scenarios that don't contain keywords. Summary of the Invention
[0004] The embodiments of this specification provide a method, device, electronic device, and storage medium for screening a training data set for a large language model, and the technical solution is as follows.
[0005] In a first aspect, an embodiment of the present specification provides a method for screening a training data set for a large language model, comprising: determining a target application scenario of the model to be trained, and obtaining sample data corresponding to the data set to be screened and the target application scenario; inputting the sample data and the data set to be screened into the model to be trained, and respectively calculating the degree of influence of each piece of data to be screened in the data set to be screened on the model to be trained in the target application scenario; wherein the degree of influence is used to characterize the degree of similarity between each piece of data to be screened and the sample data; and screening out a target data set from the data set to be screened according to the degree of influence corresponding to each piece of data to be screened.
[0006] In a second aspect, an embodiment of the present specification provides a training data set screening device for a large language model, comprising: an acquisition unit for determining a target application scenario of the model to be trained, and obtaining sample data corresponding to the data set to be screened and the target application scenario; a calculation unit for inputting the sample data and the data set to be screened into the model to be trained, and respectively calculating the degree of influence of each piece of data to be screened in the data set to be screened on the model to be trained in the target application scenario; wherein the degree of influence is used to characterize the degree of similarity between each piece of data to be screened and the sample data; a screening unit for screening out a target data set from the data set to be screened according to the degree of influence corresponding to each piece of data to be screened.
[0007] In a third aspect, an embodiment of this specification provides an electronic device comprising a processor and a memory; the processor is connected to the memory; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the steps of the method for screening a training data set of a large language model described in the first aspect of the above embodiment.
[0008] In a fourth aspect, an embodiment of this specification provides a computer storage medium, which stores multiple instructions, and the instructions are suitable for being loaded by a processor and executing the steps of the method for screening a training data set for a large language model described in the first aspect of the above embodiment.
[0009] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least: screening a training data set for a to-be-trained model applied to a target application scenario, by inputting the to-be-trained data set and sample data in the target application scenario into the to-be-trained model, and respectively calculating the degree of influence of each to-be-trained data in the to-be-trained data set on the to-be-trained model in the target application scenario. Since the degree of influence can be used to characterize the degree of similarity between each to-be-trained data set and the sample data, the target data set filtered from the to-be-trained data set based on the degree of influence is more similar to the sample data. Compared with a general data set, training a to-be-trained model based on the target data set not only has higher training efficiency, but also produces more accurate processing results for the data of the target application scenario by the trained model. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of this specification, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0011] FIG1 is an architecture diagram of a data processing system for a large-scale language model provided in an embodiment of this specification.
[0012] FIG2 is a flow chart of a method for screening a training data set for a large language model provided in an embodiment of this specification.
[0013] FIG3 is a schematic diagram of a gradient in a feature encoder provided in an embodiment of this specification.
[0014] FIG4 is a block diagram of a large-scale language model training data set screening apparatus provided in an embodiment of this specification.
[0015] FIG5 is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0016] The technical solutions in the embodiments of this specification will be described clearly and completely below in conjunction with the drawings in the embodiments of this specification.
[0017] Throughout this specification, the claims, and the accompanying drawings, the terms "first," "second," and so forth are used to distinguish between different items, not to describe a particular order. Furthermore, the term "comprises" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may include other steps or elements inherent to the process, method, product, or apparatus.
[0018] Before this specification elaborates on the method for screening a training dataset for a large language model in combination with one or more embodiments, it first introduces the architecture of a large language model when processing data.
[0019] FIG1 is an architecture diagram of a data processing system for a large language model provided by an exemplary embodiment. As shown in FIG1 , the system may include a mobile phone 11 and a server 12 .
[0020] The mobile phone 11 is a type of electronic device that can be used by a user. Of course, the electronic devices used by the user are not limited to these. For example, they can also include: tablet devices, laptops, PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smart watches, etc.), etc. This specification does not limit this. During operation, the client program of the screening system runs on the mobile phone 11, so that the mobile phone 11 is configured as a client of the screening system. The client program can receive the data to be processed input by the user and forward the data to the server 12 so that the server 12 can process the data to be processed.
[0021] The server 12 may be a physical server containing an independent host, or the server 12 may be a virtual server carried by a host cluster. A model to be trained 121 and a large language model 122 are deployed on the server 12. The model to be trained 121 is a language model that has not been trained and cannot be used to process data; the large language model 122 is a language model that has been trained and can be used to process data. Multiple models can be deployed on the same server (such as server 12), so that during the model training process, the acquired training data can be used to train multiple models, thereby reducing the amount of data transmission and saving transmission costs; only one model can also be deployed on a server to avoid the situation where multiple models compete for the computing resources of the same server.
[0022] The server 12 runs a server program for the screening system, configuring the server 12 as the server for the screening system. The server program can cooperate with the client described above, for example, receiving data to be processed from the client and inputting the received data into the large language model 122 deployed by the server for processing. The interaction between the mobile phone 11 and the server 12 can include various types of wired or wireless interactions, which are not limited in this specification.
[0023] Large language models trained on different types of text data perform differently in different scenarios. For example, a large language model trained on financial task data has stronger understanding and generation capabilities for financial context text, but weaker capabilities for sports context text. Therefore, the selection of training datasets for large language models is a key factor affecting their effectiveness.
[0024] Related techniques filter training datasets by searching for keywords corresponding to various scenarios. For example, in a financial context, data containing keywords such as "finance," "economy," and "stocks" is used as training data. However, this method manually determines keywords, which is inefficient and lacks accuracy. Furthermore, it easily misses data from financial scenarios that don't contain keywords.
[0025] To solve the problems existing in the related art, this specification proposes a method for screening training data sets for large language models.
[0026] Please refer to Figure 2, which shows a flow chart of a method for screening a training dataset for a large language model provided in an embodiment of this specification. As shown in Figure 2, the method for screening a training dataset for a language model may include at least the following steps.
[0027] Step 202: Determine the target application scenario of the model to be trained, and obtain the data set to be screened and sample data corresponding to the target application scenario.
[0028] As mentioned above, large language models can be applied to different application scenarios, such as financial scenarios, sports scenarios, medical scenarios, etc. The target application scenario can be the application scenario corresponding to the training direction of the model to be trained specified by the user (the user mentioned in this specification can be the software developer of the model to be trained, or other personnel with management rights over the model to be trained).
[0029] The sample data corresponding to the target application scenario refers to the text data unique to the target application scenario. For example, if the target application scenario is a financial scenario, the sample data may be financial data (such as: the financing scale of a certain enterprise is further improved, and a certain enterprise is on the verge of bankruptcy); if the target application scenario is a sports scenario, the sample data may be sports data (such as: a certain athlete won the gold medal in the diving event, and a certain athlete broke the world record). The sample data can be manually determined in advance to correspond to the target application scenario. The sample data can be just one piece of text data or multiple pieces of text data. This specification does not limit the number of sample data.
[0030] The dataset to be screened contains multiple pieces of data to be screened. The data to be screened is typically text data, such as a word, a paragraph, or an article. Of course, the data to be screened can also be in other forms, such as speech data or image data. In this case, the large language model can extract feature information from the speech or image data and convert it into text data based on the extracted feature information.
[0031] There are many ways to obtain the dataset and sample data to be screened, for example, they can be obtained from a database that specifically stores training data for language models, or they can be manually input by the user. This specification does not limit this.
[0032] Step 204: input the sample data and the data set to be screened into the model to be trained, and calculate the degree of influence of each piece of data to be screened in the data set to be screened on the model to be trained in the target application scenario; wherein the degree of influence is used to characterize the degree of similarity between each piece of data to be screened and the sample data.
[0033] The degree of similarity between the data to be screened and the sample data is characterized by the degree of influence of the data to be screened on the training model in the target application scenario. When filtering the data set later, data that is more similar to the sample data can be screened out. Since the sample data is the data corresponding to the target application scenario, the screened data is also likely to correspond to the target application scenario.
[0034] The specific calculation process will be described in detail later and will not be repeated here.
[0035] Step 206: Filter out a target data set from the data sets to be filtered according to the influence levels corresponding to the respective pieces of data to be filtered.
[0036] The data to be screened that have a large impact can be added to the target data set. Specifically, the data to be screened that are ranked in the top fifty in terms of impact (the specific number of digits can be pre-set by the user) are added to the target data set; or, the data to be screened that are ranked in the top ten percent in terms of impact (the specific percentage can be pre-set by the user) are added to the target data set; or, a specific numerical value is used to represent the impact, and the data to be screened that have an impact exceeding a certain threshold (the specific numerical value can be pre-set by the user) are added to the target data set. This specification does not limit this.
[0037] In this embodiment, a training data set is screened for a model to be trained that is applied to a target application scenario. The training data set and sample data from the target application scenario are input into the model to be trained, and the degree of influence of each piece of data in the training data set on the model to be trained in the target application scenario is calculated. Since the degree of influence can be used to characterize the degree of similarity between each piece of data and the sample data, the target data set selected from the training data set based on the degree of influence is more similar to the sample data. Compared to a general data set, training the model to be trained based on this target data set not only increases training efficiency but also produces more accurate data processing results for the trained model.
[0038] In one embodiment, respectively calculating the degree of influence of each piece of to-be-screened data in the to-be-screened data set on the to-be-trained model in the target application scenario includes: respectively calculating the first gradient of the sample data in the feature encoder of the to-be-trained model, and the second gradient of each piece of to-be-screened data in the to-be-screened data set in the feature encoder; calculating the cosine similarity of the first gradient and the second gradient, and the cosine similarity is used to characterize the degree of influence of the corresponding to-be-screened data on the to-be-trained model in the target application scenario.
[0039] Furthermore, the degree of influence is the degree of influence of the corresponding data to be screened on the loss of the sample data during the iteration process; the respective calculations of the degree of influence of each piece of data to be screened in the data set to be screened on the model to be trained in the target application scenario include: using the first-order Taylor formula to expand the loss value of the sample data during the iteration process to obtain the loss formula of the sample data during the iteration process; optimizing the loss formula according to stochastic gradient descent, and determining, based on the optimization result, that the loss value is approximately equal to the cosine similarity when the learning rate during the iteration process is sufficiently small.
[0040] Because the sample data corresponds to the target application scenario, the impact of the to-be-screened data on the training model in the target application scenario can be considered as the impact of the to-be-screened data on the sample data during the iteration process. The impact of the sample data during the iteration process can be considered as the degree of loss of the sample data during the iteration process. Therefore, the degree of influence of the to-be-screened data on the training model in the target application scenario is the degree of loss of the sample data during the iteration process.
[0041] The following is a detailed calculation process of the impact degree using the calculation formula: I(z p ,z t )=l t (z p ,θ t )-l t (z p ,θ t+1 ).
[0042] Among them, z p is the data to be filtered, z t is the sample data, I(z p ,z t ) is the value of z after t iterations t The loss value, θ is the parameter of the feature encoder in the model to be trained (the data will affect the parameter when it is input into the model to be trained for iteration), z t The feature encoder parameters before and after iteration t are θ t and θ t+1 .
[0043] Expand l using the first-order Taylor formula t (z p ,θ t+1 ), as shown below:
[0044] The model in this manual uses stochastic gradient descent (SGD) as the optimizer. In this case, the parameter update of the feature encoder follows the following formula:
[0045] Among them, η t is the learning rate at the tth iteration.
[0046] Combining the formula of the first-order Taylor expansion and the formula for parameter update, the formula for the loss value can be simplified as follows.
[0047] The condition for applying Taylor's formula is to ensure that the update step size of θ is small enough, that is, the learning rate η of the tth iteration t Small enough. When η t With enough hours, we get:
[0048] And because η t is small enough, then O(|θ t+1 -θ t | 2 ), then we can conclude that:
[0049] and is the first gradient of the data to be screened in the feature encoder, is the second gradient of the sample data in the feature encoder. The dot product of the first and second gradients is the cosine similarity of the first and second gradients. Therefore, when the learning rate during the iteration is sufficiently small, the cosine similarity can represent the loss value of the sample data.
[0050] The cosine similarity is further introduced in conjunction with Figure 3. g1 and g2 are the gradients of two different sets of data to be screened in the feature encoder, and g′ is the gradient of the sample data in the feature encoder. Obviously, g2·g′ is greater than g1·g′, that is, the data to be screened corresponding to g2 is more similar to the sample data.
[0051] In this embodiment, the cosine similarity between the first gradient of the sample data in the feature encoder and the second gradient of the data to be screened in the feature encoder is used to characterize the degree of influence of the corresponding data to be screened on the target application scenario of the trained model. This not only quantifies the degree of influence, but also simplifies the calculation process. There is no need to specifically calculate the loss value of the sample data, but the cosine similarity between the gradients is directly used to characterize the loss value.
[0052] In one embodiment, the method further comprises the steps of: using the target data set as a training data set, and training the model to be trained based on the training data set.
[0053] After selecting the target dataset, the target dataset can be used as training data for the model to be trained. Since the data in the selected target dataset is highly similar to the sample data, using the target dataset to train the model to be trained is more efficient (this can also be reflected in the degree of influence: a greater degree of influence indicates faster training). Furthermore, since text data from other application scenarios is no longer used as training data, the trained model's processing results for the target application scenario's data are more accurate.
[0054] Furthermore, the sample data is added to the training data set.
[0055] Since the sample data also corresponds to the target application scenario, the sample data can also be added to the training data set to expand the training data set and thus improve the training effect.
[0056] In one embodiment, the method further includes the step of: in response to the acquired data to be processed in the target application scenario, inputting the data to be processed into the trained large language model so that the large language model processes the data to be processed.
[0057] The large language model obtained by training with the target data set can be used to process the data to be processed in the target application scenario. In this embodiment, the training data set is screened for the model to be trained that is applied to the target application scenario, by inputting the data set to be screened and the sample data in the target application scenario into the model to be trained, and respectively calculating the degree of influence of each piece of data to be screened in the data set to be screened on the model to be trained in the target application scenario. Since the degree of influence can be used to characterize the degree of similarity between each piece of data to be screened and the sample data, the target data set screened from the data set to be screened based on the degree of influence is more similar to the sample data. Compared with a general data set, training the model to be trained according to the target data set not only has higher training efficiency, but also the trained model has more accurate processing results for the data of the target application scenario.
[0058] Please refer to Figure 4, which is a block diagram of a training data set screening device for a large language model provided in an embodiment of this specification. The device includes: an acquisition unit 402, which is used to determine the target application scenario of the model to be trained, and obtain the data set to be screened and the sample data corresponding to the target application scenario; a calculation unit 404, which is used to input the sample data and the data set to be screened into the model to be trained, and respectively calculate the degree of influence of each piece of data to be screened in the data set to be screened on the model to be trained in the target application scenario; wherein the degree of influence is used to characterize the degree of similarity between each piece of data to be screened and the sample data; a screening unit 406, which is used to screen out the target data set from the data set to be screened according to the degree of influence corresponding to each piece of data to be screened.
[0059] Optionally, the calculation unit 404 is specifically used to: calculate the first gradient of the sample data in the feature encoder of the model to be trained, and the second gradient of each piece of data to be screened in the data set to be screened in the feature encoder; calculate the cosine similarity of the first gradient and the second gradient, and the cosine similarity is used to characterize the degree of influence of the corresponding data to be screened on the model to be trained in the target application scenario.
[0060] Optionally, the degree of influence is the degree of influence of the corresponding data to be screened on the loss of the sample data during the iteration process; the calculation unit 404 is specifically used to: use the first-order Taylor formula to expand the loss value of the sample data during the iteration process to obtain the loss formula of the sample data during the iteration process; optimize the loss formula according to stochastic gradient descent, and determine, based on the optimization result, that the loss value is approximately the cosine similarity when the learning rate during the iteration process is small enough.
[0061] Optionally, the target application scenario is a financial scenario, and the sample data is financial task data.
[0062] Optionally, the method further includes: a training unit 408, configured to use the target data set as a training data set and train the model to be trained based on the training data set.
[0063] Optionally, the method further includes: an adding unit 410, configured to add the sample data to the training data set.
[0064] Optionally, it also includes: an input unit 412, which is used to input the data to be processed into the trained large language model in response to the acquired data to be processed in the target application scenario, so that the large language model processes the data to be processed.
[0065] Based on the large-scale language model training data set screening device described in multiple embodiments of this specification, it can be known that the training data set is screened for the model to be trained for the target application scenario by inputting the data set to be screened and the sample data under the target application scenario into the model to be trained, and respectively calculating the degree of influence of each piece of data to be screened in the data set to be screened on the model to be trained in the target application scenario. Since the degree of influence can be used to characterize the degree of similarity between each piece of data to be screened and the sample data, the target data set screened from the data set to be screened based on the degree of influence is more similar to the sample data. Compared with a general data set, training the model to be trained based on the target data set not only has higher training efficiency, but also the trained model has more accurate processing results for the data of the target application scenario.
[0066] The various embodiments in this specification are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other. Each embodiment focuses on the differences from the other embodiments. In particular, the embodiment of the apparatus for screening a training dataset for a large language model is generally similar to the embodiment of the method for screening a training dataset for a large language model, so its description is relatively simple. For relevant details, refer to the description of the method embodiment.
[0067] Please refer to FIG5 , which shows a schematic structural diagram of an electronic device provided in an embodiment of this specification.
[0068] As shown in FIG. 5 , the electronic device 500 may include: at least one processor 501 , at least one network interface 504 , a user interface 503 , a memory 505 , and at least one communication bus 502 .
[0069] The communication bus 502 may be used to implement connection and communication among the above components.
[0070] The user interface 503 may include buttons, and the optional user interface may also include a standard wired interface or a wireless interface.
[0071] The network interface 504 may include, but is not limited to, a Bluetooth module, an NFC module, a Wi-Fi module, and the like.
[0072] Among them, the processor 501 may include one or more processing cores. The processor 501 uses various interfaces and lines to connect the various parts of the entire electronic device 500, and executes various functions of the electronic device 500 and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 505, and calling data stored in the memory 505. Optionally, the processor 501 can be implemented in at least one hardware form of DSP, FPGA, PLA. The processor 501 can integrate one or a combination of CPU, GPU and modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to handle wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 501, but may be implemented separately through a chip.
[0073] The memory 505 may include RAM or ROM. Optionally, the memory 505 includes a non-transitory computer-readable medium. The memory 505 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 505 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 505 may also be at least one storage device located away from the aforementioned processor 501. The memory 505 as a computer storage medium may include an operating system, a network communication module, a user interface module and a large language model training data set screening application. The processor 501 may be used to call the large language model training data set screening application stored in the memory 505 and perform the steps of screening and formulating the large language model training data set mentioned in the above-mentioned embodiments.
[0074] The embodiments of this specification also provide a computer-readable storage medium having instructions stored therein that, when executed on a computer or processor, cause the computer or processor to perform one or more steps of the embodiments shown in Figures 2 to 4 above. If the various component modules of the electronic device described above are implemented as software functional units and sold or used as independent products, they may be stored in the computer-readable storage medium.
[0075] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiments of this specification is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted via the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0076] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When executed, the program can include the processes of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. The technical features of this embodiment and the implementation scheme can be combined in any manner unless they conflict.
[0077] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Without departing from the design spirit of this specification, various modifications and improvements made to the technical solutions of this specification by ordinary technicians in this field should fall within the scope of protection determined by the claims of this specification.
Claims
1. A method for screening a training dataset for a large language model, comprising: Determine the target application scenario of the model to be trained, and obtain the dataset to be screened and sample data corresponding to the target application scenario; Inputting the sample data and the to-be-screened data set into the to-be-trained model, and respectively calculating the degree of influence of each to-be-screened data in the to-be-screened data set on the to-be-trained model in the target application scenario; wherein the degree of influence is used to characterize the degree of similarity between each to-be-screened data set and the sample data; A target data set is screened out from the data sets to be screened according to the influence levels corresponding to the respective pieces of data to be screened.
2. The method for screening a large language model training dataset according to claim 1, wherein the step of separately calculating the degree of influence of each piece of data to be screened in the dataset on the model to be trained in the target application scenario comprises: Respectively calculating a first gradient of the sample data in the feature encoder of the to-be-trained model and a second gradient of each portion of the to-be-screened data in the to-be-screened data set in the feature encoder; The cosine similarity between the first gradient and the second gradient is calculated, where the cosine similarity is used to characterize the degree of influence of the corresponding to-be-screened data on the to-be-trained model in the target application scenario.
3. The method for screening a training dataset for a large language model according to claim 2, wherein the degree of influence is the degree of influence of the corresponding to-be-screened data on the loss of the sample data during the iteration process; The separately calculating the influence of each piece of to-be-screened data in the to-be-screened data set on the to-be-trained model in the target application scenario includes: Expanding the loss value of the sample data during the iteration process using the first-order Taylor formula to obtain a loss formula for the sample data during the iteration process; The loss formula is optimized according to stochastic gradient descent, and the cosine similarity is determined according to the optimization result to characterize the loss value of the sample data when the learning rate in the iterative process is sufficiently small.
4. According to the method for screening a training data set for a large language model according to claim 1, the target application scenario is a financial scenario, and the sample data is financial data.
5. The method for screening a large-scale language model training data set according to claim 1, further comprising the steps of: The target data set is used as a training data set, and the model to be trained is trained according to the training data set.
6. The method for screening a large-scale language model training data set according to claim 5, further comprising the steps of: The sample data is added to the training data set.
7. The method for screening a large-scale language model training data set according to claim 5, further comprising the steps of: In response to the acquired data to be processed in the target application scenario, the data to be processed is input into the trained large-scale language model, so that the large-scale language model processes the data to be processed.
8. A device for screening a training data set for a large language model, comprising: An acquisition unit, configured to determine a target application scenario for the model to be trained, and to acquire a dataset to be screened and sample data corresponding to the target application scenario; a calculation unit, configured to input the sample data and the to-be-screened data set into the to-be-trained model, and respectively calculate the degree of influence of each to-be-screened data in the to-be-screened data set on the to-be-trained model in the target application scenario; wherein the degree of influence is used to characterize the degree of similarity between each to-be-screened data set and the sample data; The screening unit is configured to screen out a target data set from the data sets to be screened according to the influence levels corresponding to the respective pieces of data to be screened.
9. The apparatus for screening a large-scale language model training dataset according to claim 8, wherein the computing unit comprises: Respectively calculating a first gradient of the sample data in the feature encoder of the to-be-trained model and a second gradient of each portion of the to-be-screened data in the to-be-screened data set in the feature encoder; The cosine similarity between the first gradient and the second gradient is calculated, where the cosine similarity is used to characterize the degree of influence of the corresponding to-be-screened data on the to-be-trained model in the target application scenario.
10. The apparatus for screening a training data set for a large language model according to claim 9, wherein the degree of influence is the degree of influence of the corresponding to-be-screened data on the loss of the sample data during the iteration process; The computing unit comprises: Expanding the loss value of the sample data during the iteration process using the first-order Taylor formula to obtain a loss formula for the sample data during the iteration process; The loss formula is optimized according to stochastic gradient descent, and according to the optimization result, it is determined that the loss value is approximately equal to the cosine similarity when the learning rate in the iterative process is sufficiently small.
11. The device for screening a training data set for a large language model according to claim 8, wherein the target application scenario is a financial scenario, and the sample data is financial task data.
12. The apparatus for screening a large-scale language model training data set according to claim 8, further comprising: A training unit is used to use the target data set as a training data set and train the model to be trained according to the training data set.
13. The apparatus for screening a large-scale language model training data set according to claim 12, further comprising: An adding unit is used to add the sample data to the training data set.
14. The apparatus for screening a large-scale language model training data set according to claim 12, further comprising: An input unit is used to input the data to be processed into the trained large language model in response to the acquired data to be processed in the target application scenario, so that the large language model processes the data to be processed.
15. An electronic device comprising a processor and a memory; The processor is connected to the memory; The memory is used to store executable program code; The processor reads the executable program code stored in the memory to run a program corresponding to the executable program code, so as to execute the method according to any one of claims 1 to 7.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method for acquiring neural network training set and system thereof
CN108596338A
Method and device for generating training sample set, electronic equipment and storage medium
CN113642659A
Adversarial training method based on linear piecewise loss function
CN116012672A
Large language model training method and device, equipment and storage medium
CN117272052A
Training data set screening method and device of large language model, electronic equipment and storage medium
CN118114049A