Data matching method and device
By dynamically adjusting the proportion of large model training data and combining mixed training of domain and general data, the problem of performance degradation in large model fine-tuning is solved, achieving the effect of maintaining general performance while improving performance in specific fields.
Patent Information
- Application Number
- CN202411900845.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-11
AI Technical Summary
In the process of fine-tuning of large models, it is difficult for the prior art to maintain universal performance while strengthening field performance, and data proportions rely on manual experience, which is time-consuming and inefficient.
By proportioning the domain training data and general training data according to the first proportion, mixed training data are obtained, the large model is fine-tuned, and the proportion is adjusted to obtain the reference accuracy, and the data proportion is dynamically adjusted to optimize the model performance.
It realizes that while maintaining the universal performance of large models, it improves its performance in specific fields, simplifies the data proportioning process, improves efficiency, and reduces the dependence on professional experience.
Smart Images

Figure CN119808871A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method and device for data matching. Background Art
[0002] Large model fine-tuning refers to the process of performing additional training on a pre-trained large deep learning model using a dataset from a specific field, in order to quickly adapt the large model to that field. However, when a large model is fine-tuned for a specific scenario, it usually results in a decrease in the general capabilities of the large model, that is, while improving the domain performance, it also weakens the general performance. Therefore, a fine-tuning method is needed that can enhance the domain performance of the large model while maintaining its general performance.
[0003] In the existing technology, in the data matching stage of large model fine-tuning, the matching strategy is mainly based on manual experience. This process is time-consuming and inefficient, and relies on the subjective experience and quality of professionals. As a result, when facing domain tasks of different types and difficulties, the large model cannot achieve ideal performance after tuning. Therefore, how to efficiently and scientifically match data has become an urgent problem to be solved. Summary of the invention
[0004] Based on the above problems, the present application provides a method and device for data matching to perform data matching efficiently and scientifically.
[0005] The present application discloses a method for data matching, the method comprising:
[0006] The domain training data and the general training data are mixed according to a first ratio to obtain mixed training data; the first ratio is related to a first business requirement;
[0007] Fine-tune the large model using the mixed training data, and calculate the accuracy of the fine-tuned large model;
[0008] Adjusting the first ratio, and obtaining two reference accuracy rates based on the adjusted first ratio;
[0009] Based on the comparison between the reference accuracy rate and the accuracy rate, and between the two reference accuracy rates, a target ratio is obtained to perform data matching under the first business requirement.
[0010] Optionally, the reference accuracy rate includes the first reference accuracy rate and the second reference accuracy rate, and the adjusting the first ratio to obtain two reference accuracy rates based on the adjusted first ratio includes:
[0011] The first ratio is adjusted upward to obtain a first adjustment ratio, and the first ratio is adjusted downward to obtain a second adjustment ratio;
[0012] The domain training data and the general training data are matched according to the first adjustment ratio to obtain first adjustment data;
[0013] The domain training data and the general training data are matched according to the second adjustment ratio to obtain second adjustment data;
[0014] Fine-tune the large model using the first adjustment data, and calculate the accuracy of the fine-tuned large model as the first reference accuracy;
[0015] The large model is fine-tuned using the second adjustment data, and the accuracy of the fine-tuned large model is calculated as the second reference accuracy.
[0016] Optionally, obtaining a target ratio according to the reference accuracy rate and the accuracy rate, and comparing the two reference accuracy rates, includes:
[0017] Comparing the accuracy rate with the two reference accuracy rates to determine whether the accuracy rate is a target accuracy rate corresponding to the target ratio;
[0018] If yes, taking the first ratio corresponding to the accuracy rate as the target ratio;
[0019] If not, comparing the two reference accuracy rates to obtain a modification plan for the first ratio;
[0020] Modify the first ratio according to the modification scheme to obtain a new first ratio;
[0021] The accuracy rate corresponding to the new first ratio is re-obtained and compared with the reference accuracy rate until the target ratio is obtained.
[0022] Optionally, comparing the accuracy rate with the two reference accuracy rates to determine whether the accuracy rate is a target accuracy rate corresponding to the target ratio includes:
[0023] When the accuracy rate is greater than or equal to the two reference accuracy rates, the accuracy rate is the target accuracy rate;
[0024] When the accuracy rate is greater than or equal to a situation other than the two reference accuracy rates, the accuracy rate is not the target accuracy rate.
[0025] Optionally, comparing the two reference accuracy rates to obtain a modification scheme for the first ratio includes:
[0026] Compare the two reference accuracy rates to obtain an adjusted first ratio corresponding to the reference accuracy rate with a larger accuracy rate;
[0027] The modification scheme is to modify the first ratio to an adjusted first ratio corresponding to the reference accuracy with a larger accuracy.
[0028] Based on the above data matching method, the present application also discloses a data matching device, including: a matching unit, a fine-tuning unit, an adjusting unit and an acquiring unit;
[0029] The matching unit is used to match the domain training data and the general training data according to a first ratio to obtain mixed training data; the first ratio is related to the first business requirement;
[0030] The fine-tuning unit is used to fine-tune the large model using the mixed training data, and calculate the accuracy of the fine-tuned large model;
[0031] The adjusting unit is used to adjust the first ratio and obtain two reference accuracy rates based on the adjusted first ratio;
[0032] The acquisition unit is used to obtain a target ratio based on the comparison between the reference accuracy rate and the accuracy rate, and between the two reference accuracy rates, so as to perform data matching under the first business requirement.
[0033] Optionally, the reference accuracy includes the first reference accuracy and the second reference accuracy, and the adjustment unit includes:
[0034] An adjusting subunit, configured to increase the first ratio to obtain a first adjustment ratio, and decrease the first ratio to obtain a second adjustment ratio;
[0035] A first matching subunit, configured to match the domain training data and the general training data according to the first adjustment ratio to obtain first adjustment data;
[0036] A second matching subunit, configured to match the domain training data and the general training data according to the second adjustment ratio to obtain second adjustment data;
[0037] A first fine-tuning subunit is used to fine-tune the large model using the first adjustment data, and calculate the accuracy of the fine-tuned large model as the first reference accuracy;
[0038] The second fine-tuning subunit is used to fine-tune the large model using the second adjustment data, and calculate the accuracy of the fine-tuned large model as the second reference accuracy.
[0039] Optionally, the acquisition unit includes:
[0040] A comparison subunit, configured to compare the accuracy rate with the two reference accuracy rates to determine whether the accuracy rate is a target accuracy rate corresponding to the target ratio;
[0041] a determining subunit, configured to, if yes, use the first ratio corresponding to the accuracy rate as the target ratio;
[0042] a reference subunit, for comparing the two reference accuracy rates if no, to obtain a modification scheme for the first ratio;
[0043] a modification subunit, configured to modify the first ratio according to the modification scheme to obtain a new first ratio;
[0044] The repeating subunit is used to re-obtain the accuracy rate corresponding to the new first ratio and compare it with the reference accuracy rate until the target ratio is obtained.
[0045] Optionally, the comparison subunit includes:
[0046] A first comparison subunit, configured to compare the accuracy rate to the target accuracy rate when the accuracy rate is greater than or equal to the two reference accuracy rates;
[0047] The second comparison subunit is configured to determine that, when the accuracy rate is greater than or equal to any of the two reference accuracy rates, the accuracy rate is not the target accuracy rate.
[0048] Optionally, the reference subunit includes:
[0049] A first reference subunit, used for comparing the two reference accuracy rates to obtain an adjusted first ratio corresponding to the reference accuracy rate with a larger accuracy rate;
[0050] The second reference subunit is used to obtain the modification scheme, which is to modify the first ratio to an adjusted first ratio corresponding to the reference accuracy with a larger accuracy.
[0051] The present application discloses a method and device for data matching. Based on the principle of gradient estimation, the method is used to adjust the ratio of training data from different sources in the fine-tuning stage of a large model in a professional field. First, the domain training data and the general training data are matched according to a first ratio to obtain mixed training data. The first ratio is related to the needs of the first business, that is, the professional field. The large model is fine-tuned using the mixed training data, and the accuracy of the fine-tuned large model is calculated. The first ratio is adjusted, and two reference accuracy rates are obtained based on the adjusted first ratio. According to the comparison between the reference accuracy rate and the accuracy rate, and the two reference accuracy rates, the accuracy change trend of the large model after adjusting the ratio is analyzed to estimate the direction of the gradient. Based on the direction, the target ratio is obtained. Through scientific simulation and gradient change analysis, the most ideal ratio is efficiently determined to perform data matching under the first business demand, and the comprehensive accuracy of the large model in general and professional fields is maximized. While enhancing the performance in the professional field, the model can also maintain its high level of performance in a wide range of general tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0053] Figure 1 A flow chart of a data matching method disclosed in an embodiment of the present application;
[0054] Figure 2 A flowchart of another data matching method disclosed in an embodiment of the present application;
[0055] Figure 3 A schematic diagram of the structure of a data matching device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0057] Embodiment 1: This application discloses a method for data matching.
[0058] For details, please refer to Figure 1A data matching method disclosed in this embodiment includes the following steps:
[0059] Step 101: domain training data and general training data are mixed according to a first ratio to obtain mixed training data.
[0060] In the method described in this embodiment, first, according to the specific needs of the business, a base model that matches the business scenario is selected as the basis, that is, the large model to be fine-tuned. In order to effectively fine-tune the large model in the field and maintain its versatility, two sets of training data sets need to be prepared. Among them, one set is the field training data closely related to the professional field of the business, which usually comes from actual business scenarios and is professional and targeted. The other set is general training data, which covers a wider range of tasks and scenarios, and is intended to help the large model maintain and improve its performance in general tasks. These two sets of data will work together in the fine-tuning process of the large model to ensure that the large model will not significantly sacrifice its wide applicability in general tasks while strengthening its performance in the professional field. At the same time, as an optional method, field verification data and general verification data can also be prepared to verify the fine-tuned large model.
[0061] As an optional method, the first ratio is related to the first business requirement. In actual work, there may also be second and third business requirements, and corresponding second and third ratios, etc. In order to realize the automatic determination of the actual business requirements and the data ratio, when a certain business requirement needs to be realized, the data ratio corresponding to the business requirement can be directly obtained.
[0062] In the method described in this embodiment, as an optional method, the first ratio can be specifically expressed as α, where α is the ratio of the selected general training data to the domain training data. Among them, the domain training data is closely related to the business scenario, and is scarce and high-value, and the amount of data is usually relatively small. Therefore, in actual work, all available domain training data can be included in the training process to ensure that the large model can fully learn the key features and knowledge in the field. At the same time, in the process of adjusting and changing the first ratio, it can be mainly achieved by adjusting the size of the general training data. That is, the size of the first ratio can be mainly changed by selecting general training data.
[0063] In the method described in this embodiment, the general training data and the domain training data are matched according to the set first ratio to obtain mixed training data. The first ratio mentioned in this embodiment is only an exemplary description, which is intended to make the method described in this embodiment easier to understand. It should be emphasized that this embodiment does not make any strict restrictions on the content, specific values or calculation methods of the first ratio. As long as the method requirements described in step 101 can be met, that is, a reasonable data matching ratio can be determined according to actual business needs.
[0064] Step 102: Use the mixed training data to fine-tune the large model, and calculate the accuracy of the fine-tuned large model.
[0065] In the method described in this embodiment, the accuracy rate includes general accuracy rate and domain accuracy rate. Among them, the general accuracy rate refers to the performance of the large model on general tasks after the large model is fine-tuned using mixed training data at a first ratio. Specifically, it can be the result shown on the general verification data, which is an indicator used to measure the performance of the large model when processing general tasks. Correspondingly, the domain accuracy rate refers to the performance of the large model on domain tasks after the large model is fine-tuned using mixed training data at a first ratio. Specifically, it can be the result shown on the domain verification data, which is an indicator used to measure the performance of the large model when processing domain tasks.
[0066] As an alternative approach, the accuracy can be expressed as f(α), where f(α) is the product of the general accuracy and the domain accuracy times the hyperparameters.
[0067] Among them, the hyperparameter is a parameter that can be adjusted according to actual business needs, and its main function is to help adjust the accuracy function so that the large model focuses more on the development of domain capabilities during fine-tuning, or is more inclined to the improvement of general capabilities. This adjustment mechanism provides flexibility and adaptability for large model fine-tuning, and can flexibly adjust the learning direction and focus of the large model according to specific business needs. In the method described in this embodiment, the default value of the hyperparameter is set to 1, indicating that by default, the large model will treat the development of domain capabilities and general capabilities equally during the fine-tuning process. In actual work, the hyperparameter can be flexibly adjusted according to actual business needs and scenario changes, in order to achieve the optimal performance of the large model.
[0068] As an optional method, for example, when the business has higher requirements for the domain capabilities of the large model, the value of this hyperparameter can be appropriately increased so that the accuracy function can focus more on improving the domain capabilities during fine-tuning. On the contrary, if the business attaches more importance to the general capabilities of the large model, the value of this hyperparameter can be reduced accordingly so that the large model can learn and master more general knowledge during fine-tuning.
[0069] Step 103: Adjust the first ratio, and obtain two reference accuracy rates based on the adjusted first ratio.
[0070] In the method described in this embodiment, as an optional method, adjusting the first ratio may specifically be to increase the first ratio to obtain the first adjustment ratio, and to decrease the first ratio to obtain the second adjustment ratio. The increase and decrease processes may specifically be to set the data ratio step size, which is used to represent the size of each adjustment of the first ratio. For example, the data ratio step size is ε, ε=0.1, which means that each increase of α is α+0.1, and each decrease of α is α-0.1. As an optional method, α+ε is the first adjustment ratio, and α-ε is the second adjustment ratio.
[0071] In the method described in this embodiment, the domain training data and the general training data are matched according to the first adjustment ratio to obtain the first adjustment data, and the domain training data and the general training data are matched according to the second adjustment ratio to obtain the second adjustment data. The first adjustment data is then used to fine-tune the large model, and the accuracy of the fine-tuned large model is calculated as the first reference accuracy f(α+ε), and the second adjustment data is used to fine-tune the large model, and the accuracy of the fine-tuned large model is calculated as the second reference accuracy f(α-ε).
[0072] Step 104: According to the comparison between the reference accuracy rate and the accuracy rate, and between the two reference accuracy rates, a target ratio is obtained to perform data matching under the first business requirement.
[0073] In the method described in this embodiment, the accuracy is compared with two reference accuracy rates to determine whether the accuracy is the target accuracy rate corresponding to the target ratio. When the accuracy is greater than or equal to the two reference accuracy rates, the accuracy is the target accuracy rate. On the contrary, when the accuracy rate is greater than or equal to other than the two reference accuracy rates, the accuracy rate is not the target accuracy rate. Specifically, it can be expressed as, when f(α)≥f(α+ε) and f(α)≥f(α-ε), f(α) is the target accuracy rate.
[0074] In the method described in this embodiment, when the accuracy is the target accuracy, the first ratio corresponding to the accuracy is used as the target ratio. When the accuracy is not the target accuracy, the two reference accuracy rates are compared to obtain a modification scheme for the first ratio. As an optional method, specifically, two reference accuracy rates can be compared to obtain an adjusted first ratio corresponding to the reference accuracy rate with a larger accuracy, and the first ratio can be modified to the adjusted first ratio corresponding to the reference accuracy rate with a larger accuracy. Specifically, it can be expressed as, when f(α+ε)>f(α-ε), α=α+ε. Correspondingly, when f(α+ε)≤f(α-ε), α=α-ε.
[0075] In the method described in this embodiment, after the first ratio is modified to obtain a new first ratio, the accuracy rate corresponding to the new first ratio is re-obtained and compared with the reference accuracy rate until the target ratio is obtained.
[0076] In the method described in this embodiment, various initial (first) ratios can be used to start steps 101 to 104 to explore different areas of the problem space, thereby having the opportunity to find multiple local optimal solutions, that is, the target accuracy. In the optimization process, each initial ratio may guide the method described in this embodiment to converge to a specific local optimal solution. In order to select the best one from these local optimal solutions, all local optimal solutions can be compared, and the highest local optimal solution can be selected as the approximation of the global optimal solution, so as to get as close as possible to the actual global optimal state. Specifically, it can be expressed as using the initial ratio set {α 0 , α 1 ,...,α n}, and obtain the local optimal solution set {f 0 , f 1 ,...,f n}, select max{f 0 , f 1 ,...,f n} as an approximation to the global optimal solution.
[0077] The method described in this embodiment aims to dynamically evaluate the gradient change and flexibly adjust the ratio configuration of general data and domain data, so that the model can maintain its high level of performance on a wide range of general tasks while enhancing the performance of the professional field. Adaptive adjustment of data ratio is achieved, and the ratio of training data can be automatically determined according to the characteristics of actual business field data and general data, without relying on the experience judgment of model developers. By comparing the changes in accuracy under different data ratios, the gradient is scientifically and efficiently estimated, and the most ideal ratio is determined, without complex derivative calculations, thereby simplifying the optimization process. And by adjusting the hyperparameters to change the focus of the large model, it can adapt to diversified business needs and has high flexibility. At the same time, in order to get closer to the global optimal solution, a multi-starting point strategy is also adopted. Through multiple initial ratios, each local optimal solution is sought, and an approximate estimate of the global optimal solution is finally selected. And by adjusting the step size and the number of initial ratios, the size of the search space can also be dynamically adjusted to adapt to different computing resource constraints. The method described in this embodiment has good scalability, and only a simple extension of the objective function is required to easily cope with the challenges of multi-domain data ratio optimization.
[0078] Embodiment 2: This application discloses another method of data matching, please refer to Figure 2The method described in this embodiment introduces the whole process of data matching.
[0079] Step 201: Obtain mixed training data at a first scale.
[0080] Step 202: Fine-tune the large model based on the mixed training data, and calculate the accuracy of the fine-tuned large model.
[0081] Step 203: The first ratio is adjusted upward and downward respectively to obtain two adjustment ratios.
[0082] Step 204: Obtain two adjustment data according to the two adjustment ratios.
[0083] Step 205: Fine-tune the large model based on the two adjustment data, and calculate two reference accuracy rates of the fine-tuned large model.
[0084] Step 206: Determine whether the accuracy rates are not less than the two reference accuracy rates. If yes, proceed to step 207. If no, proceed to step 208.
[0085] Step 207: Obtain the first ratio corresponding to the accuracy rate as the target ratio.
[0086] Step 208: Obtain the larger one of the two reference accuracy rates, use the corresponding adjustment ratio as the new first ratio, and proceed to step 201.
[0087] Based on the data matching method disclosed in the above embodiment, this embodiment correspondingly discloses a data matching device. Figure 3 , the data matching device comprises: a matching unit 301, a fine-tuning unit 302, an adjusting unit 303 and an acquiring unit 304;
[0088] The matching unit 301 is used to match the domain training data and the general training data according to a first ratio to obtain mixed training data; the first ratio is related to the first business requirement;
[0089] The fine-tuning unit 302 is used to fine-tune the large model using the mixed training data and calculate the accuracy of the fine-tuned large model;
[0090] The adjusting unit 303 is used to adjust the first ratio and obtain two reference accuracy rates based on the adjusted first ratio;
[0091] The acquisition unit 304 is used to obtain a target ratio according to the reference accuracy rate and the accuracy rate, and a comparison between the two reference accuracy rates, so as to perform data matching under the first business requirement.
[0092] Optionally, the reference accuracy includes the first reference accuracy and the second reference accuracy, and the adjustment unit 303 includes:
[0093] An adjusting subunit, configured to increase the first ratio to obtain a first adjustment ratio, and decrease the first ratio to obtain a second adjustment ratio;
[0094] A first matching subunit, configured to match the domain training data and the general training data according to the first adjustment ratio to obtain first adjustment data;
[0095] A second matching subunit, configured to match the domain training data and the general training data according to the second adjustment ratio to obtain second adjustment data;
[0096] A first fine-tuning subunit is used to fine-tune the large model using the first adjustment data, and calculate the accuracy of the fine-tuned large model as the first reference accuracy;
[0097] The second fine-tuning subunit is used to fine-tune the large model using the second adjustment data, and calculate the accuracy of the fine-tuned large model as the second reference accuracy.
[0098] Optionally, the acquiring unit 304 includes:
[0099] A comparison subunit, configured to compare the accuracy rate with the two reference accuracy rates to determine whether the accuracy rate is a target accuracy rate corresponding to the target ratio;
[0100] a determining subunit, configured to, if yes, use the first ratio corresponding to the accuracy rate as the target ratio;
[0101] a reference subunit, for comparing the two reference accuracy rates if no, to obtain a modification scheme for the first ratio;
[0102] a modification subunit, configured to modify the first ratio according to the modification scheme to obtain a new first ratio;
[0103] The repeating subunit is used to re-obtain the accuracy rate corresponding to the new first ratio and compare it with the reference accuracy rate until the target ratio is obtained.
[0104] Optionally, the comparison subunit includes:
[0105] A first comparison subunit, configured to compare the accuracy rate to the target accuracy rate when the accuracy rate is greater than or equal to the two reference accuracy rates;
[0106] The second comparison subunit is configured to determine that, when the accuracy rate is greater than or equal to any of the two reference accuracy rates, the accuracy rate is not the target accuracy rate.
[0107] Optionally, the reference subunit includes:
[0108] A first reference subunit, used for comparing the two reference accuracy rates to obtain an adjusted first ratio corresponding to the reference accuracy rate with a larger accuracy rate;
[0109] The second reference subunit is used to obtain the modification scheme, which is to modify the first ratio to an adjusted first ratio corresponding to the reference accuracy with a larger accuracy.
[0110] The embodiments in this specification are described in a progressive manner. As for the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the methods.
[0111] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0112] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0113] The features described in the embodiments of this specification can be replaced or combined with each other, so that professional and technical personnel in this field can implement or use the present application.
[0114] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data matching method, characterized in that: include: The domain training data and the general training data are mixed according to a first ratio to obtain mixed training data; The first ratio is related to a first business requirement; Fine-tune the large model using the mixed training data, and calculate the accuracy of the fine-tuned large model; Adjusting the first ratio, and obtaining two reference accuracy rates based on the adjusted first ratio; Based on the comparison between the reference accuracy rate and the accuracy rate, and between the two reference accuracy rates, a target ratio is obtained to perform data matching under the first business requirement.
2. The method according to claim 1, characterized in that The reference accuracy rate includes the first reference accuracy rate and the second reference accuracy rate, and the adjusting the first ratio to obtain two reference accuracy rates based on the adjusted first ratio includes: The first ratio is adjusted upward to obtain a first adjustment ratio, and the first ratio is adjusted downward to obtain a second adjustment ratio; The domain training data and the general training data are matched according to the first adjustment ratio to obtain first adjustment data; The domain training data and the general training data are matched according to the second adjustment ratio to obtain second adjustment data; Fine-tune the large model using the first adjustment data, and calculate the accuracy of the fine-tuned large model as the first reference accuracy; The large model is fine-tuned using the second adjustment data, and the accuracy of the fine-tuned large model is calculated as the second reference accuracy.
3. The method according to claim 1, characterized in that The step of obtaining a target ratio based on the reference accuracy rate and the accuracy rate, and comparing the two reference accuracy rates, includes: Comparing the accuracy rate with the two reference accuracy rates to determine whether the accuracy rate is a target accuracy rate corresponding to the target ratio; If yes, taking the first ratio corresponding to the accuracy rate as the target ratio; If not, comparing the two reference accuracy rates to obtain a modification plan for the first ratio; Modify the first ratio according to the modification scheme to obtain a new first ratio; The accuracy rate corresponding to the new first ratio is re-obtained and compared with the reference accuracy rate until the target ratio is obtained.
4. The method according to claim 3, characterized in that The step of comparing the accuracy rate with the two reference accuracy rates to determine whether the accuracy rate is a target accuracy rate corresponding to the target ratio includes: When the accuracy rate is greater than or equal to the two reference accuracy rates, the accuracy rate is the target accuracy rate; When the accuracy rate is greater than or equal to a situation other than the two reference accuracy rates, the accuracy rate is not the target accuracy rate.
5. The method according to claim 3, characterized in that: The step of comparing the two reference accuracy rates to obtain a modification scheme for the first ratio includes: Compare the two reference accuracy rates to obtain an adjusted first ratio corresponding to the reference accuracy rate with a larger accuracy rate; The modification scheme is to modify the first ratio to an adjusted first ratio corresponding to the reference accuracy with a larger accuracy.
6. A data matching device, characterized in that: include: Proportioning unit, fine-tuning unit, adjustment unit and acquisition unit; The matching unit is used to match the domain training data and the general training data according to a first ratio to obtain mixed training data; The first ratio is related to a first business requirement; The fine-tuning unit is used to fine-tune the large model using the mixed training data, and calculate the accuracy of the fine-tuned large model; The adjusting unit is used to adjust the first ratio and obtain two reference accuracy rates based on the adjusted first ratio; The acquisition unit is used to obtain a target ratio based on the comparison between the reference accuracy rate and the accuracy rate, and between the two reference accuracy rates, so as to perform data matching under the first business requirement.
7. The device according to claim 6, characterized in that The reference accuracy includes the first reference accuracy and the second reference accuracy, and the adjustment unit includes: An adjusting subunit, configured to increase the first ratio to obtain a first adjustment ratio, and decrease the first ratio to obtain a second adjustment ratio; A first matching subunit, configured to match the domain training data and the general training data according to the first adjustment ratio to obtain first adjustment data; A second matching subunit, configured to match the domain training data and the general training data according to the second adjustment ratio to obtain second adjustment data; A first fine-tuning subunit is used to fine-tune the large model using the first adjustment data, and calculate the accuracy of the fine-tuned large model as the first reference accuracy; The second fine-tuning subunit is used to fine-tune the large model using the second adjustment data, and calculate the accuracy of the fine-tuned large model as the second reference accuracy.
8. The device according to claim 6, characterized in that The acquisition unit comprises: A comparison subunit, configured to compare the accuracy rate with the two reference accuracy rates to determine whether the accuracy rate is a target accuracy rate corresponding to the target ratio; a determining subunit, configured to, if yes, use the first ratio corresponding to the accuracy rate as the target ratio; a reference subunit, for comparing the two reference accuracy rates if no, to obtain a modification scheme for the first ratio; a modification subunit, configured to modify the first ratio according to the modification scheme to obtain a new first ratio; The repeating subunit is used to re-obtain the accuracy rate corresponding to the new first ratio and compare it with the reference accuracy rate until the target ratio is obtained.
9. The device according to claim 8, characterized in that The comparison subunit comprises: A first comparison subunit, configured to compare the accuracy rate to the target accuracy rate when the accuracy rate is greater than or equal to the two reference accuracy rates; The second comparison subunit is configured to determine that, when the accuracy rate is greater than or equal to any of the two reference accuracy rates, the accuracy rate is not the target accuracy rate.
10. The device according to claim 8, characterized in that The reference subunit comprises: A first reference subunit, used for comparing the two reference accuracy rates to obtain an adjusted first ratio corresponding to the reference accuracy rate with a larger accuracy rate; The second reference subunit is used to obtain the modification scheme, which is to modify the first ratio to an adjusted first ratio corresponding to the reference accuracy with a larger accuracy.
Citation Information
Cited By
Model knowledge injection method and device and electronic equipment
CN121436088A