Model training method, electronic equipment, storage medium and program product

By calculating the similarity of sample texts and filtering candidate texts for overall evaluation information, the problem of insufficient performance of the agenda extraction model is solved, and the diversity and quality of sample texts is improved, reducing the risk of overfitting, and improving model performance.

CN120409733AActive Publication Date: 2025-08-01HONOR DEVICE CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411822724.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-08-01
Estimated Expiration
2044-12-10

AI Technical Summary

Technical Problem

How to improve the model performance of the training-derived scheduled extraction model, especially in terms of the diversity and quality of sample texts.

Method used

By calculating the similarity between sample texts, determining the global and local data density, filtering out candidate texts with greater differences from existing sample texts as new sample texts, and combining the overall evaluation information, texts with high complexity and quality are selected from the text to be screened for model training.

Benefits of technology

It improves the diversity and quality of sample texts, reduces the probability of model overfitting, and improves the performance of the schedule extraction model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120409733A_ABST
    Figure CN120409733A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a model training method, electronic equipment, a storage medium and a program product, and relates to the technical field of artificial intelligence, the method comprises the following steps: determining the global data density of sample texts based on the first similarity between every two existing sample texts; selecting candidate texts from the first data set; determining a local data density of the candidate text based on a second similarity between the candidate text and each sample text; under the condition that the local data density is smaller than the global data density, determining the candidate text as a sample text; inputting the existing sample text into a preset model to obtain schedule information output by the preset model, and determining first loss according to the difference between the schedule information and expected output; and performing reverse gradient propagation according to the first loss, and updating a weight coefficient of the first preset model to obtain a schedule extraction model. By applying the scheme provided by the embodiment of the invention, the model performance of the schedule extraction model obtained by training can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular, to a model training method, an electronic device, a storage medium, and a program product. Background Art

[0002] When training a neural network model with sample texts, the model can learn knowledge from the sample texts and finally obtain a model that meets the requirements in a specific scenario. Taking a general large language model as an example, a staff member can collect texts in the schedule extraction scenario as sample texts, and use the sample texts to fine-tune (which can also be called secondary training) the large language model, so that the large language model learns the knowledge in the schedule extraction scenario and obtains a schedule extraction model applicable to the schedule extraction scenario.

[0003] Currently, how to improve the model performance of the trained schedule extraction model is an urgent problem to be solved. Summary of the Invention

[0004] In view of this, this application provides a model training method, an electronic device, a storage medium, and a program product to improve the model performance of the trained schedule extraction model.

[0005] In a first aspect, an embodiment of this application provides a model training method, and the method includes:

[0006] Obtain the first similarity between every two of the existing first sample texts, and based on the obtained first similarity, determine the global data density of the first sample texts, where the first sample texts include: a task description and an expected output, and the task description includes the text to be extracted and a schedule extraction instruction;

[0007] Select a first candidate text from a first dataset;

[0008] Obtain the second similarity between the first candidate text and each first sample text, and based on the obtained second similarity, determine the local data density of the first candidate text in the first sample texts;

[0009] In the case where the local data density is less than the global data density, determine the first candidate text as a first sample text;

[0010] Input the task description in the existing first sample texts into a first preset model, obtain the schedule information output by the first preset model after performing schedule extraction on the text to be extracted in the task description, and determine the first loss generated by the first preset model during schedule extraction according to the difference between the schedule information and the expected output in the first sample texts;

[0011] Perform backpropagation based on the first loss to update the weight coefficients of the first preset model, and obtain a schedule extraction model.

[0012] As can be seen from the above, when the local data density is less than the global data density, it indicates that the average distance between the first candidate text and the first sample text in the semantic space is large, or in other words, the average similarity between the first candidate text and the first sample text pairwise is small. At this time, it can be considered that the difference between the first candidate text and the existing first sample text is large. Therefore, the first candidate text can be determined as the first sample text. It can be seen that the solution provided by the embodiment of the present application can determine the candidate text with a large difference from the already determined sample text as the sample text, that is, add the candidate text with a large discrimination degree from the existing sample text to the sample text set, so that the discrimination degree between each sample added to the sample text set and the existing sample text is large, improving the diversity of the obtained sample text. Furthermore, when training the model with the above diverse sample texts, the model can learn diverse and comprehensive knowledge, reduce the probability of the model overfitting, and improve the model performance of the finally trained schedule extraction model.

[0013] In an embodiment of the present application, the determining the global data density of the first sample text based on the obtained first similarity includes:

[0014] Based on the obtained first similarity, determine a reference similarity;

[0015] For each first sample text, determine the first quantity of the first sample text whose first similarity with this first sample text is less than the reference similarity;

[0016] Based on the obtained first quantity, determine the global data density of the first sample text.

[0017] For each first sample text, the above first quantity is the number of first sample texts whose first similarity with this first sample text is less than the reference similarity, which actually represents the number of first sample texts with a relatively large distance from this first sample text in the semantic space. The first quantity can more accurately and intuitively reflect the global data density of the existing first sample texts.

[0018] In an embodiment of the present application, the determining the local data density of the first candidate text in the first sample text based on the obtained second similarity includes:

[0019] Based on the obtained first similarity, determine a reference similarity;

[0020] Determine the second quantity of the first sample text whose second similarity with the first candidate text is less than the reference similarity;

[0021] Based on the second quantity, determine the local data density of the first candidate text in the first sample texts.

[0022] For the first candidate text, the above-mentioned second quantity is the number of first sample texts whose second similarity with the first candidate text is less than the reference similarity, which actually represents the number of first sample texts that are far from the first candidate text in the semantic space. The second quantity can more accurately and intuitively reflect the local data density of the first candidate text in the existing first sample texts.

[0023] In an embodiment of the present application, the selecting the first candidate text from the set first data set includes:

[0024] Based on the overall evaluation information of the texts to be screened included in the set first data set, select the first candidate text from the texts to be screened, where the overall evaluation information is obtained based on the first evaluation information of the texts to be screened in multiple evaluation dimensions.

[0025] In this embodiment, when selecting the first candidate text from the first data set, the overall evaluation information of the texts to be screened in the first data set is considered. In this way, the texts to be screened with higher overall evaluation information can be preferentially selected from the first data set as the first candidate text, which is beneficial to making the selected first candidate text meet the requirements in terms of data quality, complexity, etc. In this way, when determining the sample texts based on the first candidate text, not only the diversity of the sample texts can be improved, but also the data quality of the sample texts can be improved, taking into account both the diversity and quality of the sample texts.

[0026] In an embodiment of the present application, the selecting the first candidate text from the texts to be screened based on the overall evaluation information of the texts to be screened included in the set first data set includes:

[0027] Based on the sorting result of the texts to be screened included in the set first data set, select the text to be screened with the highest overall evaluation information and not yet determined as a candidate text as the first candidate text, where the sorting result is determined based on the overall evaluation information of the text to be screened.

[0028] In this way, when selecting the candidate text, the text to be screened with the highest overall evaluation information can be preferentially determined as the first candidate text, improving the data quality of the sample texts determined based on the first candidate text subsequently.

[0029] In an embodiment of the present application, the multiple evaluation dimensions include:

[0030] Complexity evaluation dimension; and / or quality evaluation dimension.

[0031] It can be seen that when evaluating the text to be screened, it can be evaluated from the aspect of data complexity or from the aspect of data quality, which is conducive to obtaining more comprehensive and reasonable overall evaluation information.

[0032] In one embodiment of the present application, the complexity evaluation dimension includes at least two of the following:

[0033] The Q&A scenario that the text to be screened is suspected of reflecting;

[0034] The lexical complexity of the text to be screened;

[0035] The similarity between pairs of texts to be screened;

[0036] The output result generated by the pre-trained complexity evaluation model for the input text to be screened.

[0037] It can be seen that the complexity evaluation dimension can include multiple different dimensions such as the Q&A scenario that the text to be screened is suspected of reflecting and the lexical complexity of the text to be screened. In this way, the first data evaluation information of the text to be screened in a rich and diverse complexity evaluation dimension can be obtained, improving the diversity and flexibility of the obtained first data evaluation information. Furthermore, based on the first data evaluation information, more comprehensive and accurate overall evaluation information can be obtained.

[0038] In one embodiment of the present application, the following method is used to obtain the first evaluation information of the text to be screened in the similarity dimension between pairs:

[0039] Calculate the third similarity between pairs of texts to be screened;

[0040] Determine the top set number of target texts with the highest third similarity to each text to be screened;

[0041] Calculate the first average value of the third similarity between each text to be screened and the target text corresponding to the text to be screened, as the first evaluation information of the text to be screened in the similarity dimension between pairs.

[0042] In this way, for each text to be screened, the first evaluation information of the text to be screened in this complexity dimension can be accurately and reasonably determined based on the similarity average value of the set number of target texts with the highest similarity to the text to be screened.

[0043] In one embodiment of the present application, the quality evaluation dimension includes at least two of the following dimensions:

[0044] The difficulty level of the large language model for schedule extraction of the text to be extracted in the text to be screened, where the large language model is a pre-trained base model;

[0045] The quality of the schedule information generated by the large language model for the text to be extracted in the text to be screened;

[0046] The instruction-following difficulty of the large language model for the text to be screened, where the instruction-following difficulty is determined based on the ratio between the level of difficulty and the quality of the schedule information;

[0047] The output result generated by the pre-trained quality assessment model for the input text to be screened.

[0048] It can be seen that the quality assessment dimensions can include multiple different dimensions such as the level of difficulty of schedule extraction by the large language model for the text to be extracted in the text to be screened, the quality of the generated schedule information, etc. In this way, the first data evaluation information of the text to be screened in the quality assessment dimensions with rich and diverse types can be obtained, improving the diversity and flexibility of the obtained first data evaluation information. Furthermore, based on the first data evaluation information, more comprehensive and accurate overall evaluation information can be obtained.

[0049] In one embodiment of the present application, the following method is used to obtain the overall evaluation information of the text to be screened:

[0050] Input the first evaluation information of the text to be screened in multiple evaluation dimensions into a pre-trained overall evaluation model to obtain the overall evaluation information output by the overall evaluation model, where the overall evaluation model is trained in the following way:

[0051] Respectively obtain the second evaluation information of each second sample text included in multiple training data sets in multiple evaluation dimensions;

[0052] Based on the second evaluation information corresponding to each training data set, determine the first data set evaluation information of each training data set in the multiple evaluation dimensions;

[0053] Respectively use each training data set to fine-tune the large language model to obtain multiple fine-tuned models, where the large language model is a pre-trained base model;

[0054] Based on a set validation data set, evaluate the model performance of each fine-tuned model, and based on the evaluation results, obtain the second data set evaluation information of each training data set;

[0055] Input the first data set evaluation information and the second data set evaluation information of each training data set into a second preset model, so that the second preset model fits the conversion relationship between the first data set evaluation information and the second data set evaluation information of each training data set and outputs the predicted evaluation information of each training data set based on the fitted conversion relationship;

[0056] Calculate a second loss based on the difference between the prediction evaluation information of each training data set and the second data set evaluation information, and update the model parameters of the second preset model based on the obtained second loss to obtain an overall evaluation model.

[0057] In this embodiment, first, a large language model is fine-tuned using a training data set to obtain a fine-tuned model; then, the performance of the fine-tuned model is evaluated according to a validation data set, and the data quality of each training data set is indirectly determined according to the evaluation result; then, the training data set is used to train a second preset model based on the evaluation information in multiple evaluation dimensions and the data quality to obtain a final overall evaluation model. Based on the above training process, the second preset model can continuously learn and fit the conversion relationship between the evaluation information in multiple evaluation dimensions of the training data set and the data quality, and obtain an overall evaluation model for evaluating data.

[0058] In an embodiment of the present application, the model performance of each fine-tuned model is evaluated based on a set validation data set, and based on the evaluation result, the second data set evaluation information of each training data set is obtained, including:

[0059] The set validation data set is respectively input into each fine-tuned model to obtain the data processing results output by each fine-tuned model;

[0060] Based on the data processing results output by each fine-tuned model and the labels of the validation data set, the third loss generated when each fine-tuned model processes data is calculated;

[0061] Based on the third loss corresponding to each fine-tuned model, the second data set evaluation information of each training data set is calculated.

[0062] After the validation data set is input into the fine-tuned model, the third loss generated when the fine-tuned model processes data can reflect the model performance of the fine-tuned model. Specifically, the smaller the third loss, the better the model performance of the fine-tuned model, and thus the higher the quality of the training data set used when training the fine-tuned model; the larger the third loss, the worse the model performance of the fine-tuned model, and thus the lower the quality of the training data set used when training the fine-tuned model. Therefore, based on the third loss generated when the fine-tuned model processes data, the quality of the training data set used when training the fine-tuned model can be indirectly determined, so that the second data set evaluation information of the training data set can be obtained more accurately.

[0063] In a second aspect, an embodiment of the present application provides an electronic device, including:

[0064] One or more processors and a memory;

[0065] The memory is coupled to the one or more processors, and the memory is used to store computer program code, which includes computer instructions. The one or more processors invoke the computer instructions to cause the electronic device to execute the method described in the first aspect.

[0066] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, including a computer program. When the computer program runs on an electronic device, it causes the electronic device to execute the method described in the first aspect.

[0067] In a fourth aspect, an embodiment of the present application provides a computer program product. The computer program product contains executable instructions. When the executable instructions are executed on an electronic device, they cause the electronic device to execute the method described in the first aspect.

[0068] In a fifth aspect, an embodiment of the present application provides a chip system. The chip system is applied to an electronic device. The chip system includes one or more processors, and the processors are used to invoke computer instructions to cause the electronic device to input data into the chip system and execute the method described in the first aspect for model training.

[0069] For the beneficial effects of the solutions provided in the embodiments of the second to fifth aspects above, reference may be made to the beneficial effects of the solutions provided in the embodiments of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0071] Figure 1 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application;

[0072] Figure 2 It is a software structure block diagram of an electronic device provided by an embodiment of the present application;

[0073] Figure 3a 、 Figure 3b It is a schematic diagram of a model application scenario provided by an embodiment of the present application;

[0074] Figure 4 It is a schematic flowchart of the first model training method provided by an embodiment of the present application;

[0075] Figure 5 It is a schematic flowchart of the second model training method provided by an embodiment of the present application;

[0076] Figure 6 It is a schematic flowchart of the third model training method provided by the embodiment of the present application;

[0077] Figure 7 It is a schematic diagram of a model training process provided by the embodiment of the present application;

[0078] Figure 8 It is a schematic structural diagram of a chip system provided by the embodiment of the present application. Detailed implementation manners

[0079] In order to better understand the technical solution of the present application, the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0080] In order to facilitate a clear description of the technical solution of the embodiment of the present application, in the embodiments of the present application, terms such as "first" and "second" are used to distinguish identical items or similar items with basically the same functions and effects. For example, the first instruction and the second instruction are used to distinguish different user instructions, and their order is not limited. Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order, and "first", "second", etc. do not necessarily mean different.

[0081] It should be noted that in the present application, words such as "exemplarily" or "for example" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "exemplarily" or "for example" in the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplarily" or "for example" is intended to present relevant concepts in a specific manner.

[0082] The solution provided by the embodiment of the present application can be applied to any electronic device with functions such as data processing and storage. A possible hardware structure and software structure of the above-mentioned electronic device will be described below.

[0083] Exemplarily, Figure 1The structural schematic diagram of the electronic device 100 is shown. The electronic device 100 may include a processor 110, a display screen 120, a camera 130, an internal memory 140, a Subscriber Identification Module (SIM) card interface 150, a Universal Serial Bus (USB) interface 160, a charging management module 170, a battery management module 171, a battery 172, a sensor module 180, a mobile communication module 190, a wireless communication module 200, an antenna 1, an antenna 2, etc. The sensor module 180 may include a pressure sensor 180A, a touch sensor 180B, etc.

[0084] It can be understood that the structure schematically shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0085] The processor 110 may include one or more processing units. For example, the processor 110 may include a Central Processing Unit (CPU), an Application Processor (AP), a modem processor, a graphics processing unit (GPU), an Image Signal Processor (ISP), a controller, a video codec, a Digital Signal Processor (DSP), a baseband processor, and / or a Neural-network Processing Unit (NPU), etc. Among them, different processing units may be independent components or integrated in one or more processors. In some embodiments, the electronic device 100 may also include one or more processors 110. Among them, the controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions. In other embodiments, a memory may also be provided in the processor 110 for storing instructions and data. Exemplarily, the memory in the processor 110 may be a cache memory. This memory can save the instructions or data that the processor 110 has just used or recycled.

[0086] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a General-Purpose Input / Output (GPIO) interface, a SIM card interface, and / or a USB interface, etc. Among them, the USB interface 160 is an interface that conforms to the USB standard specification, and specifically may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 160 can be used to connect a charger to charge the electronic device 100, and can also be used for data transmission between the electronic device 100 and peripheral devices. The USB interface 160 can also be used to connect headphones to play audio through the headphones.

[0087] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are for illustrative purposes and do not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0088] The wireless communication function of the electronic device 100 can be implemented through antenna 1, antenna 2, a mobile communication module 190, a wireless communication module 200, a modulation and demodulation processor, and a baseband processor, etc.

[0089] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.

[0090] The electronic device 100 implements the display function through a GPU, a display screen 120, and an application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 120 and the application processor. The GPU is used to execute mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0091] The display screen 120 is used to display pictures, videos, etc. The display screen 120 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or more display screens 120.

[0092] In some embodiments of the present application, when the display panel adopts materials such as OLED, AMOLED, FLED, etc., the above Figure 1 display screen 120 can be bent. Here, the above display screen 120 can be bent means that the display screen can be bent to any angle at any part and can be maintained at that angle. For example, the display screen 120 can be folded in half left and right from the middle. It can also be folded in half up and down from the middle.

[0093] The display screen 120 of the electronic device 100 can be a flexible screen. Compared with the traditional screen, the flexible screen has the characteristics of strong flexibility and bendability, and can provide users with a new interaction method based on the bendable characteristics. For an electronic device configured with a foldable display screen, the foldable display screen on the electronic device can be switched between a small screen in the folded state and a large screen in the unfolded state at any time. Therefore, users can also use the split-screen function on an electronic device configured with a foldable display screen.

[0094] The above display screen 120 displays the desktop of the operating system to which the electronic device belongs, and application icons of various installed application programs are displayed in the desktop.

[0095] The electronic device 100 can implement the shooting function through an ISP, a camera 130, a video codec, a GPU, a display screen 120, an application processor, etc. Among them, the camera 130 includes a front camera and a rear camera.

[0096] The ISP is used to process the data fed back by the camera 130. For example, during shooting, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into an image visible to the naked eye. The ISP can optimize the noise, brightness, and color of the image through algorithms. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be provided in the camera 130.

[0097] The camera 130 is used to take photos or videos. An object forms an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a Charge Coupled Device (CCD) or a Complementary Metal-Oxide-Semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in standard formats such as Red Green Blue (RGB) and YUV. In some embodiments, the electronic device 100 may include one or N cameras 130, where N is a positive integer greater than 1.

[0098] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.

[0099] The video codec is used to compress or decompress digital videos. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.

[0100] The NPU is a Neural-Network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission pattern between human brain neurons, it can quickly process the input information and can also continuously learn on its own. Through the NPU, applications such as the intelligent cognition of the electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0101] The internal memory 140 can be used to store one or more computer programs, and the one or more computer programs include instructions. The processor 110 can cause the electronic device 100 to execute the picture preview method provided in some embodiments of the present application, as well as various applications and data processing, by running the above instructions stored in the internal memory 140. The internal memory 140 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system; the program storage area can also store one or more applications (such as a gallery, contacts, etc.). The data storage area can store data created during the use of the electronic device 100 (such as photos, contacts, etc.). In addition, the internal memory 140 can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more disk storage components, flash memory components, Universal Flash Storage (UFS), etc. In some embodiments, the processor 110 can cause the electronic device 100 to execute the picture preview method provided in the embodiments of the present application, as well as other applications and data processing, by running the instructions stored in the internal memory 140 and / or the instructions stored in the memory provided in the processor 110.

[0102] The internal memory 140 can be used to store the relevant program of the picture preview method provided in the embodiments of the present application, and the processor 110 can be used to call the relevant program of the picture preview method stored in the internal memory 140 when displaying information, and execute the picture preview method of the embodiments of the present application.

[0103] The sensor module 180 can include a pressure sensor 180A, a touch sensor 180B, etc.

[0104] The pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be disposed on the display screen 120. There are many types of pressure sensors 180A. For example, it may be a resistive pressure sensor, an inductive pressure sensor, or a capacitive pressure sensor. The capacitive pressure sensor may include at least two parallel plates with conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes, and the electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 120, the electronic device 100 detects the touch operation according to the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A and determine the application program or the control within the application program corresponding to the touch operation based on the position of the touch. In some embodiments, touch operations with the same touch position but different touch operation intensities may correspond to different operation instructions. For example, when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, the instruction to view the short message is executed; when a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.

[0105] The touch sensor 180B, also known as a touch control device. The touch sensor 180B may be disposed on the display screen 120, and the touch sensor 180B and the display screen 120 form a touch screen, which is also known as a touch control screen. The touch sensor 180B is used to detect touch operations acting on it or near it. The touch sensor 180B can transmit the detected touch operation to the application processor to determine the touch event type, and the touch event type may include click type, long press type, slide type, etc. Visual output related to the touch operation can be provided through the display screen 120. In some embodiments, different touch event types may correspond to different operation instructions. In other embodiments, the touch sensor 180B may also be disposed on the surface of the electronic device 100 and at a different position from the display screen 120.

[0106] Figure 2 This is a software structure block diagram of an electronic device applicable to the embodiments of this application. The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture.

[0107] The layered architecture divides the software system of an electronic device into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the software system can be divided into five layers, namely the application layer (applications), the application framework layer (application framework), the system library, the Hardware Abstract Layer (HAL), and the kernel layer (kernel).

[0108] The application layer can include a series of application packages, and the application layer runs applications by calling the application programming interfaces (APIs) provided by the application framework layer. As Figure 2 shown, the application packages can include applications such as cameras, videos, galleries, browsers, etc. It can be understood that the ports of each of the above applications can be used to receive data.

[0109] The application framework layer provides APIs and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions. As Figure 2 shown, the application framework layer can include a window manager, a content provider, a view system, a resource manager, a notification manager, and a Dynamic Host Configuration Protocol (DHCP) module, etc.

[0110] Among them, the window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0111] The content provider is used to store and obtain data, and make this data accessible to applications. The data can include videos, images, audio, etc.

[0112] The view system includes visible controls, such as controls for displaying application icons, controls for displaying text, controls for displaying buttons, etc.

[0113] The resource manager provides various resources for applications, such as localized strings, application icons, pictures, layout files, video files, and so on.

[0114] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages, and can automatically disappear after a short stay without user interaction.

[0115] The system library may include multiple functional modules, such as a surface manager, a 3D graphics processing library, a 2D graphics engine, and a file library, etc. The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is the drawing engine for 2D drawing.

[0116] The hardware abstraction layer may include multiple library modules, such as a hard disk library module and a display library module, etc. The electronic device system can load the corresponding library modules for the device hardware, and thus achieve the purpose of the process accessing the device hardware. For example, the electronic device system can load the corresponding library module for the hard disk, and thus achieve the process accessing the system configuration file stored in the hard disk, etc.

[0117] The kernel layer is the layer between the hardware and the software. The operating system is deployed in the kernel layer to drive the hardware and make the hardware work. The kernel layer at least includes a hard disk driver, a display driver, a camera driver, a sensor driver, and a motor driver, etc. The embodiments of the present application do not limit this. It can be understood that the hard disk driver, the display driver, the camera driver, the sensor driver, and the motor driver, etc. can all be regarded as a driver node. Each of the above driver nodes includes an interface that can be used to receive data.

[0118] The operating system deployed in the kernel layer of the electronic device can execute the model training solution provided by the embodiments of the present application in response to the user starting the model training function.

[0119] Next, the application scenarios of the solution provided by the embodiments of the present application will be introduced.

[0120] The application scenario of the solution provided by the embodiments of the present application is: the scenario of screening sample texts for training a model.

[0121] The above model can be any model that needs to be trained with sample texts, such as a machine learning model, a deep learning model, a natural language processing model, a reinforcement learning model, and a large language model.

[0122] In one case, the above large language model can be a large language model for extracting the summary information of the text, which can be called a summary large model; or it can be a large language model for analyzing the text and generating schedule information, which can be called a schedule extraction model.

[0123] Among them, the above schedule extraction model can be deployed in a mobile phone to analyze the text input by the user or on the Internet, extract the key information therein, and obtain the schedule information.

[0124] Next, in combination with Figure 3a and Figure 3b, taking the schedule extraction model deployed in a mobile phone as an example, a specific application scenario of the above schedule extraction model will be introduced by way of example.

[0125] First, refer to Figure 3a , which shows the interface of an instant messaging software installed in a mobile phone. The user sent a message 301 in the work discussion group: "There will be a full-staff meeting in the XX office next Wednesday. The key content is the mobilization for May Day. Please attend on time." In this case, if the user wants to create schedule information, they can long-press on message 301. In this way, a thumbnail card 302 of message 301 can be generated at the long-press position of the user on the interface, and the card 302 is draggable; when the user drags the card 302 to the right, it can trigger Figure 3b the interface shown.

[0126] Refer to Figure 3b again. During the process of the user dragging the card 302, as the card 302 gets closer and closer to the right side of the interface, the card 302 keeps shrinking, and a sidebar 303 appears on the right side of the screen. The sidebar 303 can display application programs that support text processing functions, and the specific functions they support can be displayed below the application programs. For example, "Search" is displayed below the browser application program, "New Schedule" is displayed below the calendar application program, "Favorite" is displayed below the folder application program, etc. When the user drags the card 302 to the area 304 where the calendar application program is located, the schedule extraction function can be triggered, so that the schedule extraction model deployed in the mobile phone analyzes message 301 and outputs schedule information. As a result, the mobile phone can create a floating window on the screen and create an interface 305 in the floating window, and display the schedule information in the interface 305. The above schedule information can be:

[0127] "Full-staff meeting

[0128] Time: Wednesday, April 17th

[0129] Location: XX office

[0130] Content: May Day mobilization".

[0131] In this way, after the user clicks the confirmation button 306, the mobile phone can create a new schedule in the calendar application program according to the above schedule information.

[0132] It can be seen that the schedule extraction model deployed in the mobile phone can analyze the text, extract key information such as the theme, location, time, and content, and automatically output schedule information. Furthermore, a new schedule can be created based on the above schedule information, saving the time spent by the user in manually creating a schedule and bringing an intelligent and user-friendly experience to the user.

[0133] As a large language model, the above schedule extraction model needs to be trained using sample texts. Specifically, training texts can be collected as sample texts, and the sample texts can be used to fine-tune the base model of the large language model to obtain the schedule extraction model.

[0134] When fine-tuning the base model, the impact of the diversity of sample texts on model performance generally exceeds that of the quantity of sample texts on model performance. In other words, the diversity of sample texts largely determines the performance of the model after fine-tuning.

[0135] In view of the above situation, the embodiments of the present application provide a model training solution to improve the performance of the trained schedule extraction model.

[0136] The model training solution provided by the embodiments of the present application will be introduced in detail below.

[0137] See Figure 4 , which is a schematic flowchart of the first model training method provided by the embodiments of the present application. The above method includes the following steps S401 - S406.

[0138] Step S401: Obtain the first similarity between any two existing first sample texts, and based on the obtained first similarity, determine the global data density of the first sample texts.

[0139] The first sample texts are texts that have been screened out and used to train the first preset model.

[0140] The first sample texts may include a task description and an expected output. In this case, the first sample texts can also be referred to as instruction data.

[0141] For example, the task description may include the text to be extracted and a schedule extraction instruction. For instance, the schedule extraction instruction can be "Please extract the schedule information from the input text", and the expected output can be the expected schedule information.

[0142] Specifically, the above first similarity can be obtained in the following manner.

[0143] In one implementation, the text features of two first sample texts can be extracted first, and then, feature similarity calculation methods such as cosine similarity and Euclidean distance can be used to calculate the similarity between the obtained two text features pairwise as the first similarity between the two first sample texts.

[0144] In one case, a word embedding model can be used to convert the text into vectors, and then the similarity matrix between the vectors can be calculated to obtain the first similarity between the first sample texts.

[0145] In another implementation, a text similarity calculation method that does not require feature extraction can be directly adopted to calculate the first similarity between every two first sample texts.

[0146] For example, algorithms such as the edit distance algorithm can be used to directly calculate the similarity between two first sample texts as the first similarity.

[0147] The above-mentioned global data density reflects the average similarity between every two existing first sample texts, or in other words, reflects the average distance of the existing first sample texts in the semantic space.

[0148] The greater the global data density, the smaller the average distance of each first sample text in the semantic space and the greater the average similarity between every two first sample texts; conversely, the smaller the global data density, the greater the average distance of each first sample text in the semantic space and the smaller the average similarity between every two first sample texts.

[0149] The calculation method of the above-mentioned global data density will be introduced below.

[0150] Specifically, based on the obtained first similarity, a reference similarity can be determined, and then based on the obtained reference similarity, the global data density can be determined.

[0151] Among them, representative values such as the average value and median of the obtained first similarity can be calculated as the above-mentioned reference similarity; the quantile of the obtained first similarity can also be calculated as the above-mentioned reference similarity. The above-mentioned quantiles can be quartiles, sextiles, etc., and can be specifically set by the staff according to experience and will not be elaborated here.

[0152] After obtaining the reference similarity, the following method can be used to determine the global data density.

[0153] In one implementation, for each first sample text, the first quantity of the first sample texts whose first similarity with this first sample text is less than the reference similarity can be determined, and based on the obtained first quantity, the global data density of the first sample text can be determined. Among them, representative values such as the average value and median of the obtained first quantity can be calculated, and the reciprocal of the obtained representative value can be used as the global data density.

[0154] For example, the existing first sample texts are [S1, S2, S3, S4, S5]. For the first sample texts S1 - S5, the first quantities of the first sample texts whose first similarity with them is less than the reference similarity are 2, 3, 2, 2, and 1 respectively. The average value of the obtained first quantities is: (2 + 3 + 2 + 2 + 1) / 5 = 2, then the global data density is 1 / 2.

[0155] For each first sample text, the above-mentioned first quantity, which is the number of first sample texts with a first similarity less than the reference similarity to the first sample text, actually represents the number of first sample texts that are relatively far from the first sample text in the semantic space. The first quantity can accurately and intuitively reflect the global data density of the existing first sample texts.

[0156] In another implementation, the obtained reference similarity can be directly used as the global data density.

[0157] Step S402: Select a first candidate text from the first data set.

[0158] The above-mentioned first data set can be a pre-collected data set, which includes texts to be screened.

[0159] In one implementation, when selecting the first candidate text from the first data set, the overall evaluation information of the texts to be screened included in the first data set can be considered. For specific implementation manners, refer to the subsequent embodiments and will not be elaborated here.

[0160] In another implementation, the text to be screened can be randomly selected from the first data set as the first candidate text, or the text to be screened can be selected from the first data set in the recording order of the text to be screened in the first data set as the first candidate text, both of which are reasonable.

[0161] Step S403: Obtain the second similarity between the first candidate text and each first sample text, and based on the obtained second similarity, determine the local data density of the first candidate text among the first sample texts.

[0162] Among them, the calculation method of the second similarity between the first candidate text and the first sample text is similar to the calculation method of the first similarity between the first sample texts in the aforementioned step S401, with only specific data being different, and will not be elaborated here.

[0163] The above-mentioned local data density reflects the average similarity between the first candidate text and the first sample texts pairwise, or rather, reflects the average distance between the first candidate text and the first sample texts in the semantic space.

[0164] The greater the local data density, the smaller the average distance between the first candidate text and the first sample texts in the semantic space, and the greater the average similarity between the first candidate text and the first sample texts pairwise; conversely, the smaller the local data density, the greater the average distance between the first candidate text and the first sample texts in the semantic space, and the smaller the average similarity between the first candidate text and the first sample texts pairwise.

[0165] The calculation method of the above-mentioned local data density will be introduced below.

[0166] In one implementation, the reference similarity can be determined based on the obtained first similarity, and then the local data density can be determined based on the obtained reference similarity.

[0167] Among them, the determination method of the reference similarity has been described in the foregoing step S401, and will not be elaborated here.

[0168] After obtaining the reference similarity, the second quantity of the first sample texts whose second similarity with the first candidate text is less than the reference similarity can be determined, and then the local data density of the first candidate text in the first sample texts can be determined based on the second quantity.

[0169] Similarly, representative values such as the average value and median of the obtained second quantity can be calculated, and the reciprocal of the obtained representative value can be used as the local data density, and no specific examples will be given here.

[0170] For the first candidate text, the above-mentioned second quantity is the number of the first sample texts whose second similarity with the first candidate text is less than the reference similarity, which actually represents the number of the first sample texts that are far away from the first candidate text in the semantic space. The second quantity can more accurately and intuitively reflect the local data density of the first candidate text in the existing first sample texts.

[0171] In another implementation, the average value of the obtained second similarity can be directly used as the local data density.

[0172] Step S404: When the local data density is less than the global data density, determine the first candidate text as the first sample text.

[0173] Combined with the foregoing introduction, the above-mentioned global data density reflects the average distance of the existing first sample texts in the semantic space, or in other words, reflects the average similarity between the existing first sample texts pairwise; the above-mentioned local data density reflects the average distance between the first candidate text and the first sample texts in the semantic space, or in other words, reflects the average similarity between the first candidate text and the first sample texts pairwise.

[0174] Therefore, when the above-mentioned local data density is less than the global data density, it indicates that the average distance between the first candidate text and the first sample texts in the semantic space is large, or in other words, the average similarity between the first candidate text and the first sample texts pairwise is small.

[0175] It should be noted that the above steps S401 - S404 can be executed multiple times, so as to continuously screen the sample texts from the first dataset until the number of the screened sample texts reaches the set number or all the texts to be screened in the first dataset have participated in the screening.

[0176] Step S405: Input the task description in the existing first sample text into the first preset model, obtain the schedule information output by the first preset model after extracting the schedule from the text to be extracted in the task description, and determine the first loss generated by the first preset model during schedule extraction according to the difference between the schedule information and the expected output in the first sample text.

[0177] The first preset model can be a machine learning model, a deep learning model, a natural language processing model, a reinforcement learning model, and a large language model. The embodiments of the present application do not limit this. In one case, the above first preset model can be the base model of a large language model obtained by pre-training.

[0178] The above first loss can be calculated using algorithms such as cross-entropy loss and mean square error loss, which will not be elaborated here.

[0179] Step S406: Perform backpropagation of the gradient according to the first loss to update the weight coefficients of the first preset model, and obtain the schedule extraction model.

[0180] In this way, after executing the above steps S405 - S406, the weight coefficients of the first preset model are adjusted according to the processing results generated by the first preset model for the first sample text, and thus one round of model training is completed.

[0181] In an embodiment of the present application, multiple rounds of training can be performed until a model that meets the requirements is obtained. Specifically, after executing step S406, step S405 can be executed again until the set training end condition is met, and the first preset model with updated weight coefficients is determined as the schedule extraction model.

[0182] As can be seen from the above, when applying the solution provided by the embodiments of the present application for model training, first obtain the first similarity between every two existing first sample texts, and based on the obtained first similarity, determine the global data density of the first sample texts; then, select the first candidate text from the first dataset, and obtain the second similarity between the first candidate text and each first sample text, and based on the obtained second similarity, determine the local data density of the first candidate text in the first sample texts; in the case where the local data density is less than the global data density, determine the first candidate text as the first sample text; finally, use the obtained first sample text to train the first preset model to obtain the schedule extraction model.

[0183] When the local data density is less than the global data density, it indicates that the average distance between the first candidate text and the first sample text in the semantic space is relatively large. Or rather, the average similarity between the first candidate text and the first sample text pairwise is relatively small. At this time, it can be considered that the difference between the first candidate text and the existing first sample text is relatively large. Therefore, the first candidate text can be determined as the first sample text. It can be seen that the solution provided by the embodiment of the present application can determine the candidate text with a relatively large difference from the already determined sample text as the sample text, that is, add the candidate text with a relatively large discrimination degree from the existing sample text to the sample text set, so that the discrimination degree between the samples added to the sample text set each time and the existing sample text is relatively large, improving the diversity of the obtained sample text. Furthermore, when training the model with the above diverse sample texts, the model can learn diverse and comprehensive knowledge, reduce the probability of the model overfitting, and improve the model performance of the finally trained schedule extraction model.

[0184] Based on the Figure 4 embodiment shown, when selecting the first candidate text from the first data set in step S402, the overall evaluation information of the text to be screened included in the first data set can also be considered. In view of the above situation, the embodiment of the present application provides a second model training method.

[0185] See Figure 5 , which is a schematic flowchart of the second model training method provided by the embodiment of the present application. The above method includes the following steps S501 - step S506.

[0186] Step S501: Obtain the first similarity between the existing first sample texts pairwise, and based on the obtained first similarity, determine the global data density of the first sample texts.

[0187] The above step S501 is the same as step S401 in the Figure 4 embodiment shown above, and will not be elaborated here.

[0188] Step S502: Select the first candidate text from the texts to be screened based on the overall evaluation information of the texts to be screened included in the set first data set.

[0189] Among them, the above overall evaluation information is the information obtained after overall evaluation of the texts to be screened, and the overall evaluation information is obtained based on the first evaluation information of the texts to be screened in multiple evaluation dimensions. [[ID=2,6]]

[0190] The above multiple evaluation dimensions can include any dimension used for evaluating data, and the embodiment of the present application does not limit this.

[0191] In one embodiment of the present application, the above-mentioned multiple evaluation dimensions may include a complexity evaluation dimension or a quality evaluation dimension.

[0192] Among them, specific examples of the above-mentioned complexity evaluation dimension and quality evaluation dimension, as well as specific ways to obtain the first data evaluation information of each dimension, can be seen in the subsequent introduction, and will not be elaborated here for the time being.

[0193] It can be seen that when evaluating the text to be screened in this way, it is possible to evaluate from the aspect of data complexity or from the aspect of data quality, which is conducive to obtaining more comprehensive and reasonable overall evaluation information.

[0194] Among them, the overall evaluation information of the text to be screened can be obtained and stored in advance, so that in this step, the overall evaluation information of the text to be screened can be directly obtained.

[0195] The following introduces the way to obtain the overall evaluation information.

[0196] In one implementation manner, for each text to be screened, the first evaluation information of the text to be screened in multiple evaluation dimensions can be weighted and calculated according to a preset weight to obtain the overall evaluation information of the text to be screened.

[0197] In another implementation manner, the first evaluation information of the text to be screened in multiple evaluation dimensions can be input into a pre-trained overall evaluation model to obtain the overall evaluation information output by the overall evaluation model. The training method of the above overall evaluation model can be seen in the introduction in the subsequent embodiments, and will not be elaborated here for the time being.

[0198] Next, the specific method for selecting the first candidate text from the texts to be screened based on the overall evaluation information will be introduced.

[0199] In one implementation manner, based on the sorting result of the texts to be screened included in the set first data set, the text to be screened with the highest overall evaluation information and not yet determined as a candidate text can be selected from the texts to be screened as the first candidate text.

[0200] Among them, the above sorting result is determined based on the overall evaluation information of the text to be screened. Specifically, it can be obtained by sorting the texts to be screened in descending order of the overall evaluation information, or by sorting the texts to be screened in ascending order of the overall evaluation information.

[0201] In this way, when selecting candidate texts, the text to be screened with the highest overall evaluation information can be preferentially determined as the first candidate text, which improves the data quality of the sample texts determined based on the first candidate text.

[0202] In another implementation, the text to be screened with the overall evaluation information greater than the set evaluation information can be first determined from the first dataset, and then, data is selected from the determined text to be screened by means of random selection, selection in a determined order, etc. as the first candidate text.

[0203] Step S503: Obtain the second similarity between the first candidate text and each first sample text, and based on the obtained second similarity, determine the local data density of the first candidate text in the first sample text.

[0204] Step S504: When the local data density is less than the global data density, determine the first candidate text as the first sample text.

[0205] Step S505: Input the task description in the existing first sample text into the first preset model, obtain the schedule information output after the first preset model extracts the schedule from the text to be extracted in the task description, and determine the first loss generated by the first preset model during schedule extraction according to the difference between the schedule information and the expected output in the first sample text.

[0206] Step S506: Perform backpropagation of the gradient according to the first loss, update the weight coefficients of the first preset model, and obtain the schedule extraction model.

[0207] The above steps S503 - S506 are the same as steps S403 - S406 in the foregoing Figure 4 illustrated embodiment, and will not be elaborated here.

[0208] In this embodiment, when selecting the first candidate text from the first dataset, the overall evaluation information of the text to be screened in the first dataset is considered. In this way, the text to be screened with a higher overall evaluation information can be preferentially selected from the first dataset as the first candidate text, which is beneficial to making the selected first candidate text meet the requirements in terms of data quality, complexity, etc. In this way, when determining the sample text based on the first candidate text, not only the diversity of the sample text can be improved, but also the data quality of the sample text is improved, taking into account both the diversity and quality of the sample text; furthermore, when training the model with the screened sample text, the model performance of the finally trained schedule extraction model is further improved.

[0209] Next, the complexity evaluation dimension and quality evaluation dimension mentioned above are introduced by way of example, and the obtaining method of the first evaluation information of each evaluation dimension is described.

[0210] For the complexity dimension:

[0211] The complexity evaluation dimension includes at least two of the following:

[0212] 1. The Q&A scenario that the text to be screened is suspected of reflecting.

[0213] The text to be screened includes text with a task description and an expected output. Among them, the above task description can be used as a question, the expected output can be used as an answer, and the above Q&A scenario can be understood as the Q&A scenario reflected by the above question and answer. The above question scenario can include a Q&A field, a Q&A type, etc. Among them, the Q&A field can include the literary field, the mathematical field, the computer field, etc., and the Q&A type can include knowledge Q&A, entertainment Q&A, etc.

[0214] Specifically, the text data to be screened can be input into a trained scenario prediction model to obtain the number of labels output by the model. The more the number of labels, the more diverse the Q&A scenario suspected to be reflected by the text to be screened. Then, based on the above number of labels, the first complexity information of the text to be screened in this dimension is calculated, such as directly using the number of labels as the above first complexity information.

[0215] The first evaluation information of the text to be screened in this dimension can also be referred to as the Scene Tags Num information.

[0216] 2. The lexical complexity of the text to be screened.

[0217] Specifically, a relevant complexity calculation algorithm can be used to obtain the lexical complexity of the above text to be screened as the first complexity information of the text to be screened in this dimension, such as the Mean Term Length in Discourse (MTLD) algorithm, etc. The embodiments of the present application do not limit this.

[0218] In the case of determining the first complexity information based on the MTLD algorithm, the first evaluation information of the text to be screened in this dimension can also be referred to as the MTLD information.

[0219] 3. The similarity between pairs of texts to be screened.

[0220] Specifically, the following method can be used to determine the first evaluation information of the text to be screened in this dimension.

[0221] In one implementation, the third similarity between pairs of texts to be screened can be calculated, then the top set number of target texts with the highest third similarity to each text to be screened can be determined, and finally, the first average value of the third similarity between each text to be screened and the target text corresponding to the text to be screened is calculated as the first evaluation information of the text to be screened in this dimension.

[0222] The above set number can be set by the staff according to experience and / or actual needs and will not be elaborated here.

[0223] For example, if the set number is 5, for the text T1 to be screened, the top 5 target texts with the third highest similarity to T1 are T2 - T6, and the third similarities between T1 and T2 - T6 are s1 - s5 respectively. Then, the average value among s1 - s5 can be calculated as the first evaluation information of T1 in this dimension.

[0224] In this case, the first evaluation information of the text to be screened in this dimension can also be referred to as the K-Nearest Neighbor (KNN-i) information.

[0225] In this way, for each text to be screened, based on the average similarity of the set number of target texts with the highest similarity to the text to be screened, the first evaluation information of the text to be screened in this complexity dimension can be accurately and reasonably determined.

[0226] In another implementation, for each text to be screened, the average value of the corresponding third similarity of the text to be screened can be directly calculated as the first evaluation information of the text to be screened in this dimension.

[0227] 4. The output result generated by the pre-trained complexity evaluation model for the input text to be screened.

[0228] Specifically, the text to be screened can be input into the above complexity evaluation model to obtain the first evaluation information of the text to be screened in this dimension output by the complexity evaluation model.

[0229] The first evaluation information of the text to be screened in this dimension can also be referred to as the PredictComplexityScore information.

[0230] It can be seen that the complexity evaluation dimension can include multiple different dimensions such as the Q&A scenario suspected to be reflected by the text to be screened and the lexical complexity of the text to be screened. In this way, the first data evaluation information of the text to be screened in rich and diverse complexity evaluation dimensions can be obtained, improving the diversity and flexibility of the obtained first data evaluation information. Furthermore, based on the first data evaluation information, a more comprehensive and accurate overall evaluation information can be obtained.

[0231] Regarding the quality dimension:

[0232] 1. The difficulty level of the large language model in extracting the schedule from the text to be extracted in the text to be screened.

[0233] Among them, the large language model is a pre-trained base model.

[0234] Specifically, the task description in the text to be screened can be input into a large language model. Based on the difference between the schedule information output by the large language model and the expected output in the text to be screened, the loss is calculated. Then, according to the conversion relationship between the set loss and the data evaluation information, the data evaluation information corresponding to the above loss is determined as the first evaluation information of the text to be screened in this dimension.

[0235] The first evaluation information of the text to be screened in this dimension can also be the ConditionedAnswerScore information.

[0236] 2. The quality of the schedule information generated by the large language model for the questions in the text to be screened.

[0237] Similarly, after obtaining the above loss, the data evaluation information corresponding to the above loss can be determined according to the conversion relationship between the set loss and the data evaluation information as the first evaluation information of the text to be screened in this dimension.

[0238] The first evaluation information of the text to be screened in this dimension can also be the DirectAnswerScore (DAS) information.

[0239] 3. The instruction-following difficulty of the large language model for the text to be screened, where the instruction-following difficulty is determined based on the ratio between the level of difficulty and the quality of the predicted answer.

[0240] Specifically, the ratio between the first evaluation information of the text to be screened in the above level of difficulty dimension and the first evaluation information in the quality dimension of the predicted answer can be calculated as the first evaluation information of the text to be screened in the instruction-following difficulty dimension.

[0241] The first evaluation information of the text to be screened in this dimension can also be the Instruction-Following Difficulty Score (IFDScore) information.

[0242] 4. The output result generated by the pre-trained quality evaluation model for the input text to be screened.

[0243] Specifically, the text to be screened can be input into the above quality evaluation model to obtain the first evaluation information of the text to be screened in this dimension output by the quality evaluation model.

[0244] The above quality evaluation model can be a reinforcement learning model (also known as a reward model). In this case, the first evaluation information of the text to be screened in this dimension can also be called the Rewardscore information.

[0245] It can be seen that the quality evaluation dimensions can include multiple different dimensions such as the difficulty of the large language model in extracting schedules from the text to be extracted in the text to be screened and the quality of the generated schedule information. In this way, the first data evaluation information of the text to be screened in the rich and diverse quality evaluation dimensions can be obtained, improving the diversity and flexibility of the obtained first data evaluation information. Furthermore, based on the first data evaluation information, more comprehensive and accurate overall evaluation information can be obtained.

[0246] In one embodiment of the present application, the evaluation information of the text to be screened in the complexity evaluation dimension can be obtained only based on the task description of the text to be screened. Or, when obtaining the evaluation information of the text to be screened in the complexity evaluation dimension, the importance of the task description of the text to be screened is greater than the importance of the expected output. Similarly, the evaluation information of the text to be screened in the quality evaluation dimension can be obtained only based on the expected output of the text to be screened. Or, when obtaining the evaluation information of the text to be screened in the quality evaluation dimension, the importance of the expected output of the text to be screened is greater than the importance of the task description.

[0247] Next, the training method of the overall evaluation model for obtaining the overall evaluation information of the text to be screened mentioned above will be introduced.

[0248] See Figure 6 , which is a schematic flowchart of the third model training method provided by the embodiments of the present application. The above method includes the following steps S601 - step S606.

[0249] Step S601: Obtain the second evaluation information of each second sample text included in multiple training data sets in multiple evaluation dimensions respectively.

[0250] The above training data sets can be pre - collected training data sets, or can be small data sets sampled from a large data set.

[0251] In one case, the number of samples included in the above multiple training data sets is the same.

[0252] Among them, the method for obtaining the second evaluation information of each second sample text in multiple evaluation dimensions can refer to the method for obtaining the first evaluation information of the text to be screened in multiple evaluation dimensions mentioned above. The difference is only the specific sample text, which will not be elaborated here.

[0253] Step S602: Based on the second evaluation information corresponding to each training data set, determine the first data set evaluation information of each training data set in multiple evaluation dimensions.

[0254] For each training data set, the average value of the second evaluation information of all the second sample texts included in the training data set in each evaluation dimension can be calculated to obtain the first data set evaluation information including the average values in each dimension.

[0255] Step S603: Fine-tune the large language model using each training data set respectively to obtain multiple fine-tuned models.

[0256] Among them, the large language model is a pre-trained base model.

[0257] Specifically, according to the set model training process, each training data set can be used to perform secondary training on the large language model to obtain multiple fine-tuned models.

[0258] Step S604: Based on the set validation data set, evaluate the model performance of each fine-tuned model, and based on the evaluation results, obtain the second data set evaluation information of each training data set.

[0259] The above-mentioned set validation data set can be a data set collected from the above-mentioned large data set, or other data sets that do not belong to the above-mentioned large data set; the number of samples included in the validation data set can be the same as that of the training data set or different from that of the training data set.

[0260] In this step, the set validation data set can be input into each fine-tuned model respectively to obtain the data processing results output by each fine-tuned model. Then, based on the data processing results output by each fine-tuned model and the labels of the validation data set respectively, calculate the third loss generated when each fine-tuned model performs data processing. Finally, based on the third loss corresponding to each fine-tuned model, calculate the second data set evaluation information of each training data set.

[0261] Specifically, the third loss corresponding to each fine-tuned model can be directly used as the second data set evaluation information of each training data set, or according to the set conversion method, the third loss corresponding to each fine-tuned model can be converted into the second data set evaluation information of each training data set.

[0262] After the validation data set is input into the fine-tuned model, the third loss generated when the fine-tuned model performs data processing can reflect the model performance of the fine-tuned model. Specifically, the smaller the third loss, the better the model performance of the fine-tuned model, and thus the higher the quality of the training data set used when training the fine-tuned model; the larger the third loss, the worse the model performance of the fine-tuned model, and thus the lower the quality of the training data set used when training the fine-tuned model. Therefore, based on the third loss generated when the fine-tuned model performs data processing, the quality of the training data set used when training the fine-tuned model can be indirectly determined, so that the second data set evaluation information of the training data set can be obtained more accurately.

[0263] Step S605: Input the first dataset evaluation information and the second dataset evaluation information of each training dataset into the second preset model, so that the second preset model fits the conversion relationship between the first dataset evaluation information and the second dataset evaluation information of each training dataset, and outputs the predicted evaluation information of each training dataset based on the fitted conversion relationship.

[0264] The above-mentioned second preset model can be a Gradient Boosting Decision Tree (GBDT) model, a Light Gradient Boosting Machine (Light GBM) model, etc.

[0265] Among them, the Light GBM model is a model implemented based on the GBDT algorithm. It iteratively constructs decision trees to fit the residuals of the data, thereby continuously improving the prediction ability of the model.

[0266] In this step, the Light GBM model can fit the conversion relationship between the first dataset evaluation information and the second dataset evaluation information of each training dataset, and convert the first dataset evaluation information of each training dataset according to the conversion relationship, and output the predicted evaluation information of each training dataset.

[0267] Step S606: Calculate the second loss based on the difference between the predicted evaluation information of each training dataset and the second dataset evaluation information, and update the model parameters of the second preset model based on the obtained second loss to obtain the overall evaluation model.

[0268] In this step, the model parameters are adjusted according to the loss value so that the model learns a conversion relationship that meets the requirements and is close to the actual situation.

[0269] In this embodiment, first, a large language model is fine-tuned using a training dataset to obtain a fine-tuned model; then, the performance of the fine-tuned model is evaluated according to a validation dataset, and the data quality of each training dataset is indirectly determined according to the evaluation results; then, the evaluation information and data quality of the training dataset in multiple evaluation dimensions are used to train the second preset model to obtain the final overall evaluation model. Based on the above training process, the second preset model can continuously learn and fit the conversion relationship between the evaluation information and data quality of the training dataset in multiple evaluation dimensions, and obtain an overall evaluation model for evaluating data.

[0270] Next, combined with Figure 7 , an intuitive introduction to the model training process of the above overall evaluation model will be given. Figure 7 The model training process shown can be divided into the following stages:

[0271] Phase 1: Sample the training dataset.

[0272] Sampling data from the original dataset can obtain each training dataset D1, training dataset D2, …, training dataset Dn.

[0273] Among them, the data included in the original dataset can be unfiltered data or a dataset that has been preliminarily screened. From the original dataset, various training datasets D1 - Dn can be obtained by means such as random sampling.

[0274] Phase 2: Fine-tune the large language model using the training dataset to obtain each fine-tuned model.

[0275] In this phase, the training datasets D1 - Dn obtained by sampling are respectively used to fine-tune the large language models m1, large language models m2, …, large language models mn, so that the large language models learn the knowledge of the training dataset and obtain models applicable to the current scenario.

[0276] Phase 3: Obtain the multi-dimensional features of the training dataset.

[0277] Specifically, for the method of obtaining the multi-dimensional features of the training dataset, refer to steps S601 - S602 in the foregoing Figure 6 Embodiment, which will not be elaborated here.

[0278] Phase 4: Use the validation dataset to evaluate the performance of each fine-tuned model, and obtain label information according to the evaluation results.

[0279] Specifically, after inputting the validation dataset into each fine-tuned model, the data processing results of each fine-tuned model for the validation dataset can obtain losses L1, L2, …, Ln. The above losses can be the average of the loss values generated by the fine-tuned model for each sample text included in the validation dataset; the above label information can include the loss values L1 - Ln generated by each fine-tuned model for the validation dataset.

[0280] Phase 5: Input the multi-dimensional features and label information into the second preset model so that the second preset model fits the conversion relationship between the multi-dimensional features and the label information, and finally obtain the overall evaluation model.

[0281] In this phase, the second preset model can continuously learn and fit the conversion relationship between the multi-dimensional features of the training dataset and the label information, and obtain an overall evaluation model for evaluating data.

[0282] Furthermore, by adopting the above overall evaluation model, it is possible to comprehensively evaluate the complexity and quality of data, perform diversity screening on the data based on the semantic space and local data density, and then screen the sample texts based on complexity, quality, and diversity during data screening to obtain diverse, high-quality, and complex sample texts.

[0283] It can be seen that the solution provided by the embodiments of the present application can accurately evaluate the diversity and complexity of data, ensure the effectiveness and applicability of the data in actual applications, not only improve the monitoring ability of instruction data, but also provide a solid foundation for subsequent data processing and analysis. It is applicable to a wide range of natural language processing (NLP) applications, especially scenarios that require fine-tuning large language models. For example, the best combination of the quality and quantity of data can be selected, and diversity can be used to ensure the richness of the screened data, and the model can be efficiently fine-tuned based on the screened data.

[0284] It should be noted that the user information involved in the embodiments of the present application is all information authorized by the user. The acquisition, storage, use, processing, transmission, provision, and disclosure of user information and other processes all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.

[0285] In specific implementation, the present application also provides a computer storage medium. The computer storage medium can store a program. When the above program runs, it controls the device where the computer-readable storage medium is located to execute some or all of the steps in the above embodiments. The above storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.

[0286] In specific implementation, the embodiments of the present application also provide a computer program product. The computer program product includes executable instructions that, when executed on an electronic device, cause the electronic device to execute some or all of the steps in the above method embodiments.

[0287] In specific implementation, the embodiments of the present application also provide an electronic device, including: one or more processors and a memory;

[0288] The memory is coupled to the one or more processors, and the memory is used to store computer program code. The computer program code includes computer instructions. The one or more processors call the computer instructions to cause the electronic device to execute the model training method provided by the embodiments of the present application.

[0289] As Figure 8As shown in the figure, the present application also provides a chip system, which is applied to an electronic device. The chip system includes one or more processors 801. The processors 801 are used to call computer instructions to cause the electronic device to input data to be processed into the chip system, and the chip system performs model training based on the model training method provided in the embodiments of the present application.

[0290] In a possible implementation manner, the chip system further includes an input and output interface for inputting and outputting data.

[0291] Embodiments of the mechanisms disclosed in the present application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memories and / or storage elements), at least one input device, and at least one output device.

[0292] The program code can be applied to the input instructions to perform the various functions described in the present application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of the present application, the processing system includes any system having a processor such as, for example, a Digital Signal Processor (DSP), a microcontroller, an Application Specific Integrated Circuit (ASIC), or a microprocessor.

[0293] The program code can be implemented in a high-level procedural language or an object-oriented programming language to communicate with the processing system. When needed, the program code can also be implemented in assembly language or machine language. In fact, the mechanisms described in the present application are not limited to the scope of any specific programming language. In any case, the language can be a compiled language or an interpreted language.

[0294] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more transient or non-transitory machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or via other computer-readable media. Thus, machine-readable media may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including but not limited to, floppy disks, optical disks, optical discs, compact disc read only memories (CD-ROMs), magneto-optical disks, read only memories, random access memories, erasable programmable read only memories (EPROMs), electrically erasable programmable read only memories (EEPROMs), magnetic or optical cards, flash memory, or tangible machine-readable memories for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) in electrical, optical, acoustic, or other forms via the Internet. Thus, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).

[0295] In the drawings, some structural or method features may be shown in a particular arrangement and / or order. However, it should be understood that such a particular arrangement and / or ordering may not be required. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the accompanying drawings of the specification. Additionally, the inclusion of a structural or method feature in a particular figure does not imply that such a feature is required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.

[0296] It should be noted that each unit / module mentioned in the device embodiments of the present application is a logical unit / module. Physically, a logical unit / module may be a physical unit / module, may be a part of a physical unit / module, or may also be implemented as a combination of multiple physical units / module. The physical implementation manner of these logical units / module themselves is not the most important. The combination of the functions implemented by these logical units / module is the key to solving the technical problems proposed by the present application. In addition, to highlight the innovative part of the present application, the above device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application. This does not mean that there are no other units / modules in the above device embodiments.

[0297] It should be noted that in the examples and description of this patent, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one" does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.

[0298] Although this application has been illustrated and described by reference to certain preferred embodiments thereof, those of ordinary skill in the art should understand that various changes may be made in form and detail without departing from the spirit and scope of this application.

Claims

1. A model training method, characterized in that, The method includes: Obtaining a first similarity between existing first sample texts pairwise, and determining a global data density of the first sample texts based on the obtained first similarity, where the first sample texts include: a task description and an expected output, and the task description includes a text to be extracted and a schedule extraction indication; Selecting a first candidate text from a first dataset; Obtaining a second similarity between the first candidate text and each first sample text, and determining a local data density of the first candidate text in the first sample texts based on the obtained second similarity; When the local data density is less than the global data density, determining the first candidate text as a first sample text; Inputting the task description in the existing first sample texts into a first preset model, obtaining schedule information output by the first preset model after performing schedule extraction on the text to be extracted in the task description, and determining a first loss generated by the first preset model during schedule extraction according to the difference between the schedule information and the expected output in the first sample texts; Performing backpropagation of gradients according to the first loss, and updating weight coefficients of the first preset model to obtain a schedule extraction model.

2. The method according to claim 1, wherein The determining the global data density of the first sample texts based on the obtained first similarity includes: Determining a reference similarity based on the obtained first similarity; For each first sample text, determining a first quantity of first sample texts whose first similarity with this first sample text is less than the reference similarity; Determining the global data density of the first sample text based on the obtained first quantity.

3. The method according to claim 1, characterized in that, The determining the local data density of the first candidate text in the first sample texts based on the obtained second similarity includes: Determining a reference similarity based on the obtained first similarity; Determining a second quantity of first sample texts whose second similarity with the first candidate text is less than the reference similarity; Determining the local data density of the first candidate text in the first sample texts based on the second quantity.

4. The method according to any one of claims 1 to 3, characterized in that, The selecting the first candidate text from the set first dataset includes: Selecting the first candidate text from the texts to be screened based on overall evaluation information of the texts to be screened included in the set first dataset, where the overall evaluation information is obtained based on first evaluation information of the texts to be screened in multiple evaluation dimensions.

5. The method according to claim 4, characterized in that, The selecting the first candidate text from the texts to be screened based on overall evaluation information of the texts to be screened included in the set first dataset includes: Based on the sorting result of the texts to be screened included in the set first dataset, selecting the text to be screened with the highest overall evaluation information and not determined as a candidate text from the texts to be screened as the first candidate text, where the sorting result is determined based on the overall evaluation information of the texts to be screened.

6. The method according to claim 4, characterized in that, The multiple evaluation dimensions include: A complexity evaluation dimension; And / or A quality evaluation dimension.

7. The method according to claim 6, wherein The complexity evaluation dimension includes at least two of the following: The Q&A scenario suspected to be reflected by the text to be screened; The lexical complexity of the text to be screened; The similarity between the texts to be screened pairwise. The output result generated by the pre-trained complexity evaluation model for the input text to be screened.

8. The method according to claim 7, characterized in that, The first evaluation information of the text to be screened in the similarity dimension between each pair is obtained in the following manner: Calculate the third similarity between each pair of the texts to be screened. Determine the top set number of target texts with the highest third similarity to each text to be screened. Calculate the first average value of the third similarity between each text to be screened and the target text corresponding to this text to be screened, and use it as the first evaluation information of this text to be screened in the similarity dimension between each pair.

9. The method according to claim 6, wherein The quality evaluation dimension includes at least two of the following dimensions: The difficulty level of the large language model for schedule extraction of the text to be extracted in the text to be screened, where the large language model is a pre-trained base model. The quality of the schedule information generated by the large language model for the text to be extracted in the text to be screened. The instruction following difficulty of the large language model for the text to be screened, where the instruction following difficulty is determined based on the ratio between the difficulty level and the quality of the schedule information. The output result generated by the pre-trained quality evaluation model for the input text to be screened.

10. The method according to claim 4, wherein The overall evaluation information of the text to be screened is obtained in the following manner: Input the first evaluation information of the text to be screened in multiple evaluation dimensions into a pre-trained overall evaluation model to obtain the overall evaluation information output by the overall evaluation model, where the overall evaluation model is trained in the following manner: Respectively obtain the second evaluation information of each second sample text included in multiple training data sets in multiple evaluation dimensions. Based on the second evaluation information corresponding to each training data set, determine the first data set evaluation information of each training data set in the multiple evaluation dimensions. Respectively fine-tune the large language model with each training data set to obtain multiple fine-tuned models, where the large language model is a pre-trained base model. Based on a set validation data set, evaluate the model performance of each fine-tuned model, and based on the evaluation results, obtain the second data set evaluation information of each training data set. Input the first data set evaluation information and the second data set evaluation information of each training data set into a second preset model, so that the second preset model fits the conversion relationship between the first data set evaluation information and the second data set evaluation information of each training data set, and outputs the predicted evaluation information of each training data set based on the fitted conversion relationship. Based on the difference between the predicted evaluation information and the second data set evaluation information of each training data set, calculate the second loss, and update the model parameters of the second preset model based on the obtained second loss to obtain the overall evaluation model.

11. The method according to claim 10, wherein, The evaluation of the model performance of each fine-tuned model based on the set validation data set, and based on the evaluation results, obtaining the second data set evaluation information of each training data set includes: Respectively input the set validation data set into each fine-tuned model to obtain the data processing results output by each fine-tuned model. Respectively calculate the third loss generated by each fine-tuned model during data processing based on the data processing results output by each fine-tuned model and the labels of the validation data set. Calculate the second dataset evaluation information of each training dataset based on the third loss corresponding to each fine-tuning model.

12. An electronic device, characterized in that, Including: One or more processors and a memory; The memory is coupled to the one or more processors. The memory is used to store computer program code, and the computer program code includes computer instructions. The one or more processors call the computer instructions to cause the electronic device to execute the method according to any one of claims 1 to 11.

13. A computer-readable storage medium, characterized in that, Including a computer program, when the computer program runs on an electronic device, it causes the electronic device to execute the method according to any one of claims 1 to 11.

14. A computer program product, characterized in that, The computer program product contains executable instructions, when the executable instructions are executed on an electronic device, it causes the electronic device to execute the method according to any one of claims 1 to 11.

15. A chip system, characterized in that, The chip system is applied to an electronic device. The chip system includes one or more processors, and the processors are used to call computer instructions to cause the electronic device to input data into the chip system and execute the method according to any one of claims 1 to 10 for model training.

Citation Information

Patent Citations

  • Chinese text error correction method and device and computer equipment

    CN115496074A

  • Large language model training method and device and text processing method and device

    CN117149989A

  • Sample generation method and device, computer equipment and storage medium

    CN118210870A

  • Text data quality evaluation method and device, electronic equipment and storage medium

    CN118535886A

  • Information processing system, information processing method and information processing device

    US20220198337A1