A model training method, an electronic device, a storage medium and a program product

By calculating the similarity of sample texts and data density to select candidate texts, the schedule for extracting training samples for the model is optimized, thus solving the problem of improving model performance and achieving more efficient model training and performance improvement.

CN120409733BActive Publication Date: 2026-04-14HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In existing technologies, it is difficult to effectively improve the performance of the trained schedule extraction model.

Method used

By calculating the similarity between sample texts, determining the global and local data density, selecting candidate texts that differ significantly from existing sample texts as new samples, training the model, and combining multi-dimensional evaluation information to optimize the selection of candidate texts, thereby improving sample diversity and quality.

Benefits of technology

This improved the performance of the schedule extraction model, reduced the probability of overfitting, and enhanced the model's learning ability and applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120409733B_ABST
    Figure CN120409733B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a model training method, an electronic device, a storage medium and a program product, relating to the technical field of artificial intelligence, and the above method comprises: determining the global data density of sample texts based on the first similarity between each pair of existing sample texts; selecting a candidate text from the first data set; determining the local data density of the candidate text based on the second similarity between the candidate text and each sample text; in the case where the local data density is less 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 the first loss according to the difference between the schedule information and the expected output; performing reverse gradient propagation according to the first loss to update the weight coefficient of the first preset model to obtain a schedule extraction model. The scheme provided by the embodiments of the present application can improve the model performance of the schedule extraction model obtained by training.
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 more particularly to a model training method, electronic device, storage medium, and program product. Background Technology

[0002] When a neural network model is trained using sample text, the model can learn knowledge from the sample text and ultimately obtain a model that meets the needs of a specific scenario. Taking a general large language model as an example, staff can collect text from the schedule extraction scenario as sample text and use the sample text to fine-tune the large language model (also known as secondary training), so that the large language model learns the knowledge of the schedule extraction scenario and obtains a schedule extraction model suitable for the schedule extraction scenario.

[0003] Currently, improving the 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, electronic device, storage medium, and program product to improve the model performance of the trained schedule extraction model.

[0005] In a first aspect, embodiments of this application provide a model training method, the method comprising:

[0006] Obtain the first similarity between each pair of existing first sample texts, and determine the global data density of the first sample texts based on the obtained first similarity. The first sample texts include: task description and expected output, and the task description includes the text to be extracted and the schedule extraction instruction.

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

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

[0009] When the local data density is less than the global data density, the first candidate text is determined as the first sample text;

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

[0011] Backward gradient propagation is performed based on the first loss to update the weight coefficients of the first preset model, thereby obtaining the 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 each pair of the first candidate text and the first sample text is small. In this case, it can be considered that the first candidate text is significantly different from the existing first sample text; therefore, the first candidate text can be identified as the first sample text. Thus, the solution provided in this application can identify candidate texts that are significantly different from the already identified sample texts as sample texts, that is, add candidate texts with high distinguishability from existing sample texts to the sample text set. This ensures that each sample added to the sample text set has high distinguishability from existing sample texts, improving the diversity of the obtained sample texts. Furthermore, when training the model using the aforementioned diverse sample texts, the model can learn diverse and comprehensive knowledge, reducing the probability of overfitting and improving the performance of the final trained schedule extraction model.

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

[0014] Based on the obtained first similarity, a baseline similarity is determined;

[0015] For each first sample text, determine a first number of first sample texts whose first similarity to the first sample text is less than the benchmark similarity;

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

[0017] For each first sample text, the aforementioned first quantity is the number of first sample texts whose first similarity to the first sample text is less than the benchmark similarity. In fact, it represents the number of first sample texts in the semantic space that are far away from the first sample text. The first quantity can reflect the global data density of the existing first sample texts more accurately and intuitively.

[0018] In one embodiment of this application, 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, a baseline similarity is determined;

[0020] Determine a second number of first sample texts whose second similarity to the first candidate text is less than the baseline similarity;

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

[0022] For the first candidate text, the second quantity mentioned above is the number of first sample texts whose second similarity to the first candidate text is less than the benchmark similarity. In fact, it represents the number of 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.

[0023] In one embodiment of this application, selecting a first candidate text from a predefined first dataset includes:

[0024] Based on the overall evaluation information of the texts to be screened included in the first dataset, a first candidate text is selected from the texts to be screened, wherein 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 dataset, the overall evaluation information of the texts to be screened in the first dataset is considered. This allows for the priority selection of texts with higher overall evaluation information from the first dataset as the first candidate text, ensuring that the selected first candidate text meets requirements in terms of data quality and complexity. Thus, determining the sample text based on the first candidate text not only improves the diversity of the sample text but also enhances its data quality, balancing both diversity and quality.

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

[0027] Based on the ranking results of the texts to be screened included in the first dataset, the text with the highest overall evaluation information that has not been identified as a candidate text is selected from the texts to be screened as the first candidate text, wherein the ranking results are determined based on the overall evaluation information of the texts to be screened.

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

[0029] In one embodiment of this application, the plurality of evaluation dimensions include:

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

[0031] As can be seen, when evaluating the text to be screened, we can assess it from the perspective of data complexity or data quality, which helps to obtain more comprehensive and reasonable overall evaluation information.

[0032] In one embodiment of this application, the complexity evaluation dimensions include at least two of the following:

[0033] The text to be screened is suspected to reflect a question-and-answer scenario;

[0034] Lexical complexity of the text to be screened;

[0035] The pairwise similarity between the texts to be filtered;

[0036] The output of the pre-trained complexity evaluation model for the input text to be filtered.

[0037] As can be seen, the complexity assessment dimensions can include multiple different dimensions such as the question-and-answer scenario that the text to be screened may reflect and the lexical complexity of the text to be screened. In this way, we can obtain the first data assessment information of the text to be screened in a rich variety of complexity assessment dimensions, which improves the diversity and flexibility of the obtained first data assessment information. Furthermore, based on the first data assessment information, we can obtain more comprehensive and accurate overall assessment information.

[0038] In one embodiment of this application, the first evaluation information of the pairwise similarity dimension of the texts to be screened is obtained in the following manner:

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

[0040] Identify a pre-defined number of target texts that have the highest third similarity to each text to be filtered;

[0041] Calculate the first average of the third similarity between each text to be screened and the target text corresponding to that text, and use it as the first evaluation information of the similarity dimension between each pair of texts to be screened.

[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 average similarity of a set number of target texts with the highest similarity to the text to be screened.

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

[0044] The large language model assesses the difficulty of extracting schedules from the text to be filtered, wherein the large language model is a pre-trained base model.

[0045] The large language model is designed to improve the quality of the schedule information generated from the text to be extracted in the text to be filtered.

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

[0047] The output of a pre-trained quality assessment model to the input text to be screened.

[0048] As can be seen, the quality assessment dimensions can include multiple different dimensions such as the difficulty of extracting schedules from the text to be screened by the large language model and the quality of the generated schedule information. In this way, we can obtain first data assessment information of the text to be screened in a rich variety of quality assessment dimensions, which improves the diversity and flexibility of the obtained first data assessment information. Furthermore, based on the first data assessment information, we can obtain more comprehensive and accurate overall assessment information.

[0049] In one embodiment of this application, the overall evaluation information of the text to be screened is obtained in the following manner:

[0050] The first evaluation information of the text to be screened across multiple evaluation dimensions is input into a pre-trained overall evaluation model to obtain the overall evaluation information output by the overall evaluation model. The overall evaluation model is trained in the following manner:

[0051] Second evaluation information for each second sample text in multiple evaluation dimensions is obtained from multiple training datasets.

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

[0053] The large language model was fine-tuned using different training datasets to obtain multiple fine-tuned models, wherein the large language model is a pre-trained base model;

[0054] Based on the established validation dataset, the performance of each fine-tuned model is evaluated, and the evaluation information of the second dataset for each training dataset is obtained based on the evaluation results.

[0055] The evaluation information of the first dataset and the evaluation information of the second dataset of each training dataset are input into the second preset model so that the second preset model fits the transformation relationship between the evaluation information of the first dataset and the evaluation information of the second dataset of each training dataset, and outputs the predicted evaluation information of each training dataset based on the fitted transformation relationship.

[0056] Based on the difference between the prediction evaluation information of each training dataset and the evaluation information of the second dataset, a second loss is calculated, and the model parameters of the second preset model are updated based on the obtained second loss to obtain the overall evaluation model.

[0057] In this embodiment, a large language model is first fine-tuned using a training dataset to obtain a fine-tuned model. Then, the performance of the fine-tuned model is evaluated using a validation dataset, and the data quality of each training dataset is indirectly determined based on the evaluation results. Next, the evaluation information and data quality of the training dataset across multiple evaluation dimensions are used to train a second preset model, resulting in the final overall evaluation model. Based on this training process, the second preset model can continuously learn and fit the transformation relationship between evaluation information and data quality across multiple evaluation dimensions of the training dataset, thus obtaining an overall evaluation model for evaluating the data.

[0058] In one embodiment of this application, the step of evaluating the model performance of each fine-tuned model based on a set validation dataset, and obtaining second dataset evaluation information for each training dataset based on the evaluation results, includes:

[0059] Input the set validation dataset into each fine-tuning model to obtain the data processing results output by each fine-tuning model;

[0060] Based on the data processing results output by each fine-tuning model and the labels of the validation dataset, calculate the third loss generated by each fine-tuning model when processing data;

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

[0062] After inputting the validation dataset into the fine-tuning model, the third loss generated during data processing by the fine-tuning model reflects its performance. Specifically, a smaller third loss indicates better model performance, and consequently, a higher quality training dataset. Conversely, a larger third loss indicates worse model performance, and consequently, a lower quality training dataset. Therefore, based on the third loss generated during data processing by the fine-tuning model, the quality of the training dataset used for training the fine-tuning model can be indirectly determined, thus providing a relatively accurate second dataset evaluation of the training dataset.

[0063] Secondly, embodiments of this application provide an electronic device, including:

[0064] One or more processors and memory;

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

[0066] Thirdly, embodiments of this application provide a computer-readable storage medium including a computer program that, when run on an electronic device, causes the electronic device to perform the method described in the first aspect.

[0067] Fourthly, embodiments of this application provide a computer program product comprising executable instructions that, when executed on an electronic device, cause the electronic device to perform the method described in the first aspect.

[0068] Fifthly, embodiments of this application provide a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to input data into the chip system and perform model training as described in the first aspect.

[0069] The beneficial effects of the solutions provided in the embodiments of the second to fifth aspects above can be found in the beneficial effects of the solutions provided in the embodiments of the first aspect above. Attached Figure Description

[0070] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0071] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0072] Figure 2 A software structure block diagram of an electronic device provided in an embodiment of this application;

[0073] Figure 3a , Figure 3b A schematic diagram illustrating a model application scenario provided in an embodiment of this application;

[0074] Figure 4 A flowchart illustrating the first model training method provided in this application embodiment;

[0075] Figure 5 A flowchart illustrating the second model training method provided in this application embodiment;

[0076] Figure 6 A flowchart illustrating the third model training method provided in this application embodiment;

[0077] Figure 7 A schematic diagram of a model training process provided in an embodiment of this application;

[0078] Figure 8 This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation

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

[0080] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with essentially the same function and effect. For example, "first instruction" and "second instruction" are used to distinguish different user instructions and do not limit their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.

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

[0082] The solutions provided in the embodiments of this application can be applied to any electronic device with data processing, storage and other functions. The following describes a possible hardware structure and software structure of the above-mentioned electronic device.

[0083] For example, Figure 1A 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, 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, antenna 1, and antenna 2, etc. The sensor module 180 may include a pressure sensor 180A, a touch sensor 180B, etc.

[0084] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0085] Processor 110 may include one or more processing units, such as 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). Different processing units may be independent components or integrated into one or more processors. In some embodiments, electronic device 100 may also include one or more processors 110. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. In other embodiments, processor 110 may also include a memory for storing instructions and data. For example, the memory in processor 110 may be a cache memory. This memory can store instructions or data that processor 110 has recently used or is cyclically used.

[0086] In some embodiments, the processor 110 may include one or more interfaces. These 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. The USB interface 160 is a USB standard-compliant interface, specifically 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 transfer between the electronic device 100 and peripheral devices. The USB interface 160 can also be used to connect headphones for audio playback.

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

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

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

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

[0091] The display screen 120 is used to display images, videos, etc. The display screen 120 includes a display panel. The display panel can be 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 miniature LED, a microLED, 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 this application, when the display panel uses materials such as OLED, AMOLED, and FLED, the above-mentioned Figure 1 The display screen 120 can be bent. Here, "the display screen 120 can be bent" means that the display screen can be bent to any angle at any part and can maintain that angle. For example, the display screen 120 can be folded from the middle left to right. It can also be folded from the middle up and down.

[0093] The display screen 120 of the electronic device 100 can be a flexible screen. Compared with traditional screens, flexible screens are more flexible and bendable, providing users with new interaction methods based on their bendability. For electronic devices equipped with foldable displays, the foldable display can switch between a small screen in a folded state and a large screen in an unfolded state at any time. Therefore, users can also use the split-screen function on electronic devices equipped with foldable displays.

[0094] The aforementioned display screen 120 displays the desktop of the operating system installed on the electronic device, and the desktop displays application icons of various applications installed on the electronic device.

[0095] Electronic device 100 can perform shooting functions through ISP, camera 130, video codec, GPU, display 120 and application processor, wherein camera 130 includes a front camera and a rear camera.

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

[0097] Camera 130 is used to capture photos or videos. An object is projected onto a photosensitive element through a lens, generating an optical image. 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, which is then passed to an ISP (Internet Service Provider) for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP (Digital Signal Processor) for processing. The DSP converts the digital image signal into standard red-green-blue (RGB), YUV, or other image signals. In some embodiments, the electronic device 100 may include one or N cameras 130, where N is a positive integer greater than 1.

[0098] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.

[0099] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record video in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG 2, MPEG 3, and MPEG 4.

[0100] NPU stands for Neural Network (NN) computing processor. By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0101] The internal memory 140 can be used to store one or more computer programs, which include instructions. The processor 110 can execute the instructions stored in the internal memory 140, thereby causing the electronic device 100 to perform the image preview method, various applications, and data processing provided in some embodiments of this application. The internal memory 140 may include a program storage area and a data storage area. The program storage area may store the operating system; it may also store one or more applications (such as a gallery, contacts, etc.). The data storage area may store data created during the use of the electronic device 100 (such as photos, contacts, etc.). Furthermore, the internal memory 140 may include high-speed random access memory and 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 execute instructions stored in the internal memory 140 and / or instructions stored in memory disposed in the processor 110, thereby causing the electronic device 100 to perform the image preview method, other applications, and data processing provided in the embodiments of this application.

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

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

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

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

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

[0107] A layered architecture divides the software system of an electronic device into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the software system can be divided into five layers: applications, application framework, system libraries, hardware abstraction layer (HAL), and kernel.

[0108] The application layer can include a series of application packages. The application layer runs applications by calling the Application Programming Interface (API) provided by the application framework layer. For example... Figure 2 As shown, the application package may include applications such as camera, video, gallery, and browser. Understandably, the port of each of these applications can be used to receive data.

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

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

[0111] Content providers are used to store and retrieve data, making that data accessible to applications. This data may include video, images, audio, etc.

[0112] A view system includes visual controls, such as controls that display application icons, controls that display text, controls that display buttons, etc.

[0113] File Explorer provides applications with various resources, such as localized strings, application icons, images, layout files, video files, and more.

[0114] The notification manager allows applications to display notification information in the status bar. It can be used to convey informational messages and can disappear automatically after a short time without user interaction.

[0115] The system library can include multiple functional modules, such as a surface manager, a 3D graphics processing library, a 2D graphics engine, and a file library. The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The 3D graphics processing library implements 3D graphics drawing, image rendering, compositing, and layer processing. The 2D graphics engine is the drawing engine for 2D drawing.

[0116] The hardware abstraction layer can contain multiple library modules, such as hard drive library modules and display library modules. Electronic device systems can load the corresponding library modules for the device hardware, thereby enabling processes to access the device hardware. For example, an electronic device system can load the corresponding library modules for the hard drive, thereby enabling processes to access system configuration files stored on the hard drive.

[0117] The kernel layer is the layer between hardware and software. The kernel layer deploys the operating system, which drives the hardware to function. The kernel layer includes at least hard disk drivers, display drivers, camera drivers, sensor drivers, and motor drivers, etc., but this embodiment does not limit this. It is understood that hard disk drivers, display drivers, camera drivers, sensor drivers, and motor drivers can all be considered as driver nodes. 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 scheme provided in the embodiments of this application in response to the user initiating the model training function.

[0119] The application scenarios of the solutions provided in the embodiments of this application are described below.

[0120] The application scenario of the solution provided in this application embodiment is: the scenario of screening sample texts for training models.

[0121] The above model can be any model that requires training with sample text, such as machine learning models, deep learning models, natural language processing models, reinforcement learning models, and large language models.

[0122] In one scenario, the aforementioned large language model can be a large language model used to extract summary information from text, which can be called a summary large model; or it can be a large language model used to analyze text and generate schedule information, which can be called a schedule extraction model.

[0123] The aforementioned schedule extraction model can be deployed on a mobile phone to analyze user input or text from the internet, extract key information, and obtain schedule information.

[0124] The following is combined Figure 3a and Figure 3bTaking the schedule extraction model deployed on a mobile phone as an example, we will introduce a specific application scenario of the above schedule extraction model.

[0125] First see Figure 3a The image shows the interface of an instant messaging app installed on a mobile phone. A user sends message 301 in a work discussion group: "There will be an all-staff meeting next Wednesday in the XX office. The main topic is May Day mobilization. Please attend on time." In this case, if the user wants to create a schedule, they can long-press message 301. This will generate a thumbnail card 302 of message 301 at the long-press location on the interface. Card 302 is draggable; dragging card 302 to the right will trigger... Figure 3b The interface shown.

[0126] See also Figure 3b As the user drags card 302, it shrinks as it moves closer to the right side of the screen, and a sidebar 303 appears on the right side of the screen. The sidebar 303 can display applications that support text processing, with their specific supported functions displayed below each application. For example, a browser application might display "Search," a calendar application "Create Schedule," and a folder application "Favorites." Dragging card 302 to the calendar application's area 304 triggers the schedule extraction function, allowing the onboard schedule extraction model to analyze message 301 and output schedule information. This creates a floating window on the screen, within which an interface 305 is created, displaying the schedule information. This schedule information can include:

[0127] All-staff meeting

[0128] Date: 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 phone can create a new event in the calendar application according to the above schedule information.

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

[0133] The aforementioned schedule extraction model, as a large language model, requires training with sample texts. Specifically, training texts can be collected as sample texts, and these 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 a base model, the diversity of sample texts generally has a greater impact on model performance than the quantity of sample texts. In other words, the diversity of sample texts largely determines the performance of the fine-tuned model.

[0135] In view of the above, this application provides a model training scheme to improve the performance of the trained schedule extraction model.

[0136] The model training scheme provided in the embodiments of this application will be described in detail below.

[0137] See Figure 4 This is a flowchart illustrating the first model training method provided in this application embodiment, which includes the following steps S401-S406.

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

[0139] The first sample text is the text that has already been selected and used to train the first preset model.

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

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

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

[0143] In one implementation, 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 pairwise similarity between the two text features, which is used as the first similarity between the two first sample texts.

[0144] In one scenario, 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 used to calculate the first similarity between each pair of the first sample texts.

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

[0147] The aforementioned global data density reflects the average similarity between each pair of existing first sample texts, or in other words, the average distance between existing first sample texts in the semantic space.

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

[0149] The following section introduces the calculation method for the global data density.

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

[0151] The first similarity score can be calculated using representative values ​​such as the mean and median as the baseline similarity. Alternatively, the quantiles of the first similarity score can also be calculated as the baseline similarity. These quantiles can be quartiles, deciles, etc., and can be set by staff based on experience; details will not be elaborated here.

[0152] After obtaining the baseline similarity, the global data density can be determined in the following ways.

[0153] In one implementation, for each first sample text, a first number of first sample texts with a first similarity less than a benchmark similarity can be determined, and the global data density of the first sample texts can be determined based on the obtained first number. Specifically, representative values ​​such as the average and median of the obtained first number can be calculated, and the reciprocal of the obtained representative values ​​can be used as the global data density.

[0154] For example, if the existing first sample texts are [S1, S2, S3, S4, S5], the number of first sample texts with a first similarity less than the benchmark similarity for each of the first sample texts S1-S5 are 2, 3, 2, 2, and 1, respectively. The average of the first number is (2+3+2+2+1) / 5 = 2, so the global data density is 1 / 2.

[0155] For each first sample text, the aforementioned first quantity is the number of first sample texts whose first similarity to the first sample text is less than the benchmark similarity. In fact, it represents the number of first sample texts in the semantic space that are far away from the first sample text. The first quantity can reflect the global data density of the existing first sample texts more accurately and intuitively.

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

[0157] Step S402: Select the first candidate text from the first dataset.

[0158] The first dataset mentioned above can be a pre-collected dataset that includes the text to be filtered.

[0159] In one implementation, when selecting a first candidate text from a first dataset, the overall evaluation information of the texts to be screened included in the first dataset can be considered. Specific implementation details are provided in subsequent embodiments and will not be repeated here.

[0160] In another implementation, the text to be filtered can be randomly selected from the first dataset as the first candidate text, or the text to be filtered can be selected from the first dataset according to the recording order of the text to be filtered in the first dataset as the first candidate text. Both of these are reasonable.

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

[0162] The calculation method for the second similarity between the first candidate text and the first sample text is similar to the calculation method for the first similarity between pairs of the first sample text in the aforementioned step S401. The only difference is the specific data, which will not be elaborated here.

[0163] The aforementioned local data density reflects the average similarity between the first candidate text and the first sample text, or in other words, the average distance between the first candidate text and the first sample text in the semantic space.

[0164] The higher the local data density, the smaller the average distance between the first candidate text and the first sample text in the semantic space, and the greater the average similarity between each pair of the first candidate text and the first sample text; conversely, the lower the local data density, the larger the average distance between the first candidate text and the first sample text in the semantic space, and the smaller the average similarity between each pair of the first candidate text and the first sample text.

[0165] The following section introduces the calculation method for the aforementioned local data density.

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

[0167] The method for determining the benchmark similarity has been explained in step S401 above, and will not be repeated here.

[0168] After obtaining the baseline similarity, a second number of first sample texts with a second similarity less than the baseline similarity can be determined. Then, based on the second number, the local data density of the first candidate text in the first sample text can be determined.

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

[0170] For the first candidate text, the second quantity mentioned above is the number of first sample texts whose second similarity to the first candidate text is less than the benchmark similarity. In fact, it represents the number of 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, the first candidate text is determined as the first sample text.

[0173] As can be seen from the preceding text, the global data density reflects the average distance between the existing first sample texts in the semantic space, or in other words, the average similarity between each pair of existing first sample texts; the local data density reflects the average distance between the first candidate text and the first sample text in the semantic space, or in other words, the average similarity between each pair of the first candidate text and the first sample text.

[0174] Therefore, 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 each pair of the first candidate text and the first sample text is small.

[0175] It should be noted that steps S401-S404 can be executed multiple times to continuously filter sample texts from the first dataset until the number of filtered sample texts reaches the set number or all texts to be filtered in the first dataset have participated in the filtering.

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

[0177] The first preset model can be a machine learning model, a deep learning model, a natural language processing model, a reinforcement learning model, or a large language model, and this application does not limit this. In one case, the first preset model can be a base model of a pre-trained large language model.

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

[0179] Step S406: Perform back gradient propagation based on the first loss to update the weight coefficients of the first preset model and obtain the schedule extraction model.

[0180] Thus, after completing 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, thereby completing one round of model training.

[0181] In one embodiment of this application, multiple rounds of training can be performed until a model that meets the requirements is obtained. Specifically, after executing step S406, the process can return to executing step S405 until the set training termination condition is met, and the first preset model after updating the weight coefficients is determined as the schedule extraction model.

[0182] As can be seen from the above, when using the scheme provided in the embodiments of this application for model training, the first similarity between each pair of existing first sample texts is first obtained, and the global data density of the first sample texts is determined based on the obtained first similarity. Then, a first candidate text is selected from the first dataset, and a second similarity between the first candidate text and each first sample text is obtained. Based on the obtained second similarity, the local data density of the first candidate text in the first sample text is determined. If the local data density is less than the global data density, the first candidate text is determined as the first sample text. Finally, the obtained first sample text is used to train a 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 large, or in other words, the average similarity between each pair of the first candidate text and the first sample text is small. In this case, it can be considered that the first candidate text is significantly different from the existing first sample text, and therefore, the first candidate text can be identified as the first sample text. It is evident that the solution provided in this application can identify candidate texts that are significantly different from the already identified sample texts as sample texts, that is, add candidate texts with high distinguishability from existing sample texts to the sample text set, ensuring that each sample added to the sample text set has high distinguishability from existing sample texts, thus improving the diversity of the obtained sample texts. Furthermore, when training the model using the aforementioned diverse sample texts, the model can learn diverse and comprehensive knowledge, reducing the probability of overfitting and improving the performance of the final trained schedule extraction model.

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

[0185] See Figure 5 This is a flowchart illustrating the second model training method provided in this application embodiment. The method includes the following steps S501-S506.

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

[0187] The above step S501 is the same as the aforementioned Figure 4 Step S401 is the same in the illustrated embodiment, and will not be repeated here.

[0188] Step S502: Based on the overall evaluation information of the texts to be screened included in the first dataset, select the first candidate text from the texts to be screened.

[0189] The aforementioned overall evaluation information is obtained after conducting an overall evaluation of the texts to be screened. The overall evaluation information is based on the first evaluation information of the texts to be screened across multiple evaluation dimensions.

[0190] The aforementioned multiple evaluation dimensions may include any dimension used to evaluate the data, and this application embodiment does not limit this.

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

[0192] Specific examples of the aforementioned complexity assessment dimensions and quality assessment dimensions, as well as the specific methods for obtaining the first data assessment information for each dimension, can be found in the subsequent introduction, and will not be detailed here.

[0193] As can be seen, when evaluating the text to be screened, we can assess it from the perspective of data complexity or data quality, which helps to obtain more comprehensive and reasonable overall evaluation information.

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

[0195] The following section describes how the overall assessment information was obtained.

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

[0197] In another implementation, the first evaluation information of the text to be screened across 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 for the aforementioned overall evaluation model will be described in subsequent embodiments and will not be detailed here.

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

[0199] In one implementation, the first candidate text can be selected from the texts to be screened based on the ranking results of the texts to be screened included in the first dataset, and the text with the highest overall evaluation information that has not been identified as a candidate text.

[0200] The sorting results are determined based on the overall evaluation information of the texts to be screened. Specifically, the texts to be screened can be sorted in descending order of overall evaluation information, or in ascending order of overall evaluation information.

[0201] In this way, when selecting candidate texts, the text with the highest overall evaluation information can be prioritized 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, texts to be screened with overall evaluation information greater than the set evaluation information can be determined from the first dataset first. Then, data can be selected from the determined texts to be screened using methods such as random selection or selection in a predetermined order, as the first candidate texts.

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

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

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

[0206] Step S506: Perform back gradient propagation based on the first loss to update the weight coefficients of the first preset model and obtain the schedule extraction model.

[0207] Steps S503-S506 above are the same as those described above. Figure 4 In the illustrated embodiment, steps S403-S406 are the same and will not be repeated here.

[0208] In this embodiment, when selecting the first candidate text from the first dataset, the overall evaluation information of the texts to be screened in the first dataset is considered. This allows for the priority selection of texts with higher overall evaluation information as the first candidate text, ensuring that the selected first candidate text meets requirements in terms of data quality and complexity. Thus, determining the sample text based on the first candidate text not only improves the diversity of the sample text but also enhances its data quality, balancing both. Furthermore, using the screened sample text to train the model further improves the performance of the final trained schedule extraction model.

[0209] The following section provides examples of the complexity assessment dimensions and quality assessment dimensions mentioned above, and explains how the first assessment information for each assessment dimension is obtained.

[0210] Regarding the complexity dimension:

[0211] Complexity evaluation dimensions include at least two of the following:

[0212] 1. The question-and-answer scenarios that the text to be screened may reflect.

[0213] The text to be filtered includes a task description and expected output. The task description can be considered a question, and the expected output can be considered an answer. The question-and-answer scenario can be understood as the context in which the question and answer reflect the situation. This scenario can include question-and-answer domains and types. Specifically, question-and-answer domains can include literature, mathematics, computer science, etc., and question-and-answer types can include knowledge-based questions, entertainment-based questions, etc.

[0214] Specifically, the text data to be screened can be input into the training scene prediction model to obtain the number of labels output by the model. The more labels there are, the more diverse the question-and-answer scenarios that the text to be screened may reflect. Then, the first complexity information of the text to be screened in this dimension can be calculated based on the number of labels, such as directly using the number of labels as the first complexity information.

[0215] The first evaluation information of the text to be screened in this dimension can also be called the scene tag number (SceneTagsNum) information.

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

[0217] Specifically, the lexical complexity of the text to be screened can be obtained by using relevant complexity calculation algorithms, which can be used 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. This application embodiment does not limit this.

[0218] When the first complexity information is determined by the situation-based MTLD algorithm, the first evaluation information of the text to be screened in this dimension can also be called MTLD information.

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

[0220] Specifically, the first evaluation information for the text to be screened in this dimension can be determined in the following ways.

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

[0222] The above-mentioned quantities can be set by staff based on experience and / or actual needs, which will not be elaborated here.

[0223] For example, if the number is set to 5, for the text T1 to be screened, the top 5 target texts with the highest third similarity to T1 are T2-T6, and the third similarity between T1 and T2-T6 are s1-s5 respectively. Then the average value between 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 filtered in this dimension can also be called K-nearest neighbor (KNN-i) information.

[0225] 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 average similarity of a set number of target texts with the highest similarity to the text to be screened.

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

[0227] 4. The output of the pre-trained complexity evaluation model to the input text to be filtered.

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

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

[0230] As can be seen, the complexity assessment dimensions can include multiple different dimensions such as the question-and-answer scenario that the text to be screened may reflect and the lexical complexity of the text to be screened. In this way, we can obtain the first data assessment information of the text to be screened in a rich variety of complexity assessment dimensions, which improves the diversity and flexibility of the obtained first data assessment information. Furthermore, based on the first data assessment information, we can obtain more comprehensive and accurate overall assessment information.

[0231] Regarding the quality dimension:

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

[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 set conversion relationship between the loss and the data evaluation information, the data evaluation information corresponding to the loss is determined as the first evaluation information of the text to be screened in this dimension.

[0235] The first evaluation information for the text to be screened in this dimension can also be the conditional answer score.

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

[0237] Similarly, after obtaining the above losses, the data evaluation information corresponding to the above losses can be determined according to the established conversion relationship between the losses and data evaluation information, and used 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 Direct Answer Score (DAS) information.

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

[0240] Specifically, the ratio between the first evaluation information of the text to be screened in the aforementioned difficulty level dimension and the first evaluation information in the predicted answer quality dimension 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 filtered in this dimension can also be used to instruct the text to follow the difficulty score (IFDScore) information.

[0242] 4. The output results of the pre-trained quality assessment model for the input text to be screened.

[0243] Specifically, the text to be screened can be input into the quality assessment model mentioned above to obtain the first assessment information of the text to be screened in that dimension, which is output by the quality assessment model.

[0244] The quality assessment model mentioned above 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 reward score information.

[0245] As can be seen, the quality assessment dimensions can include multiple different dimensions such as the difficulty of extracting schedules from the text to be screened by the large language model and the quality of the generated schedule information. In this way, we can obtain first data assessment information of the text to be screened in a rich variety of quality assessment dimensions, which improves the diversity and flexibility of the obtained first data assessment information. Furthermore, based on the first data assessment information, we can obtain more comprehensive and accurate overall assessment information.

[0246] In one embodiment of this application, the evaluation information of the text to be screened in the complexity evaluation dimension can be obtained solely 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 solely 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] The training method for the overall evaluation model mentioned above, used to obtain overall evaluation information of the text to be screened, will be introduced below.

[0248] See Figure 6 This is a flowchart illustrating the third model training method provided in this application embodiment. The method includes the following steps S601-S606.

[0249] Step S601: Obtain the second evaluation information of each second sample text in multiple evaluation dimensions from multiple training datasets.

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

[0251] In one scenario, the number of samples included in the aforementioned training datasets is the same.

[0252] The method for obtaining the second evaluation information of each second sample text in multiple evaluation dimensions can be referred to the method for obtaining the first evaluation information of the text to be screened in multiple evaluation dimensions mentioned above. The only difference is that the specific sample texts are different, so it will not be repeated here.

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

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

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

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

[0257] Specifically, following the established model training process, the large language model can be trained a second time using various training datasets to obtain multiple fine-tuned models.

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

[0259] The validation dataset can be a dataset collected from the aforementioned large dataset, or it can be another dataset that does not belong to the aforementioned large dataset; the number of samples included in the validation dataset can be the same as the training dataset, or it can be different from the training dataset.

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

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

[0262] After inputting the validation dataset into the fine-tuning model, the third loss generated during data processing by the fine-tuning model reflects its performance. Specifically, a smaller third loss indicates better model performance, and consequently, a higher quality training dataset. Conversely, a larger third loss indicates worse model performance, and consequently, a lower quality training dataset. Therefore, based on the third loss generated during data processing by the fine-tuning model, the quality of the training dataset used for training the fine-tuning model can be indirectly determined, thus providing a relatively accurate second dataset evaluation of the training dataset.

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

[0264] The second preset model mentioned above 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 based on the GBDT algorithm. It continuously improves the model's predictive ability by iteratively building decision trees to fit the residuals of the data.

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

[0267] Step S606: Based on the difference between the prediction evaluation information of each training dataset and the evaluation information of the second dataset, 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.

[0268] In this step, the model parameters are adjusted based on the loss value so that the model learns a transformation relationship that meets the requirements and closely reflects reality.

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

[0270] Next, let's combine... Figure 7 This section provides an intuitive introduction to the model training process of the overall evaluation model described above. Figure 7 The model training process shown can be divided into the following stages:

[0271] Phase 1: Sampling the training dataset.

[0272] By sampling data from the original dataset, we can obtain various training datasets D1, D2, ..., Dn.

[0273] The original dataset can contain either unfiltered data or pre-filtered data. The training datasets D1-Dn can be obtained from the original dataset through random sampling or other methods.

[0274] Phase Two: Fine-tuning the large language model using the training dataset to obtain various fine-tuned models.

[0275] In this stage, the large language models m1, m2, ..., mn are fine-tuned using the sampled training datasets D1-Dn, respectively, so that the large language models learn the knowledge of the training dataset and obtain models suitable for the current scenario.

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

[0277] Specifically, the methods for obtaining the multi-dimensional features of the training dataset are described above. Figure 6 Steps S601-S602 in the embodiment will not be repeated here.

[0278] Phase 4: Evaluate the performance of each fine-tuned model using the validation dataset and obtain label information based on the evaluation results.

[0279] Specifically, after inputting the validation dataset into each fine-tuning model, the data processing results of each fine-tuning model for the validation dataset can yield losses L1, L2, ..., Ln. The aforementioned losses can be the average of the loss values ​​generated by the fine-tuning models for each sample text included in the validation dataset; the aforementioned label information can include the loss values ​​L1-Ln generated by each fine-tuning 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 transformation relationship between the multi-dimensional features and label information, and finally obtains the overall evaluation model.

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

[0282] Furthermore, by adopting the above-mentioned overall evaluation model, we can comprehensively assess the complexity and quality of data, and perform diversity screening of data based on semantic space and local data density. In this way, we can select sample texts based on complexity, quality and diversity during data screening, and obtain diverse, high-quality and complex sample texts.

[0283] As can be seen, the solution provided in this application can accurately assess the diversity and complexity of data, ensuring the effectiveness and applicability of data in practical applications. It not only enhances the monitoring capability of instruction data but also provides a solid foundation for subsequent data processing and analysis. It is suitable for a wide range of Natural Language Processing (NLP) applications, especially scenarios requiring fine-tuning of large language models. For example, it can select the optimal combination of data quality and quantity, and use diversity to ensure the richness of the filtered data, enabling efficient fine-tuning of the model based on the filtered data.

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

[0285] In a specific implementation, this application also provides a computer storage medium, wherein the computer storage medium may store a program, wherein when the 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 storage medium may be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0286] In a specific implementation, this application also provides a computer program product, which includes executable instructions. When the executable instructions are executed on an electronic device, the electronic device performs some or all of the steps in the above method embodiments.

[0287] In a specific implementation, this application also provides 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 including computer instructions, and the one or more processors call the computer instructions to cause the electronic device to execute the model training method provided in the embodiments of this application.

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

[0290] In one possible implementation, the chip system also includes input and output interfaces for inputting and outputting data.

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

[0292] Program code can be applied to input instructions to execute the functions described in this 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 this 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 using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either 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 thereon on one or more temporary or non-temporary 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 through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, compact disc read-only memory (CD-ROMs), magneto-optical disks, read-only memory, random access memory, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0295] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the accompanying drawings. Furthermore, including structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0296] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

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

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

Claims

1. A model training method, characterized in that, The method includes: Obtain the first similarity between each pair of existing first sample texts; Based on the obtained first similarity, a benchmark similarity is determined; for each first sample text, a first number of first sample texts with a first similarity less than the benchmark similarity is determined; based on the obtained first number, the global data density of the first sample text is determined, wherein the first sample text includes: a task description and an expected output, and the task description includes the text to be extracted and a schedule extraction instruction; Select the first candidate text from the first dataset; Obtain the second similarity between the first candidate text and each first sample text; Determine a second number of first sample texts whose second similarity to the first candidate text is less than the baseline similarity; based on the second number, determine the local data density of the first candidate text in the first sample text; When the local data density is less than the global data density, the first candidate text is determined as the first sample text; Input the task description in the existing first sample text into the first preset model to obtain the schedule information output by the first preset model after extracting the schedule from the text to be extracted in the task description. Based on the difference between the schedule information and the expected output in the first sample text, determine the first loss generated by the first preset model during schedule extraction. Backward gradient propagation is performed based on the first loss to update the weight coefficients of the first preset model, thereby obtaining the schedule extraction model.

2. The method according to claim 1, characterized in that, The step of selecting the first candidate text from the first dataset includes: Based on the overall evaluation information of the texts to be screened included in the first dataset, a first candidate text is selected from the texts to be screened, wherein the overall evaluation information is obtained based on the first evaluation information of the texts to be screened in multiple evaluation dimensions.

3. The method according to claim 2, characterized in that, The process of selecting a first candidate text from the text to be screened based on the overall evaluation information of the texts included in the first dataset includes: Based on the ranking results of the texts to be screened included in the first dataset, the texts to be screened with the highest overall evaluation information that have not been determined as candidate texts are selected as first candidate texts, wherein the ranking results are determined based on the overall evaluation information of the texts to be screened.

4. The method according to claim 2, characterized in that, The multiple evaluation dimensions include: Complexity evaluation dimensions; and / or Quality assessment dimensions.

5. The method according to claim 4, characterized in that, The complexity evaluation dimensions include at least two of the following: The text to be screened is suspected to reflect a question-and-answer scenario; Lexical complexity of the text to be screened; The pairwise similarity between the texts to be filtered; The output of the pre-trained complexity evaluation model for the input text to be filtered.

6. The method according to claim 5, characterized in that, The first evaluation information of the pairwise similarity dimension of the texts to be screened is obtained using the following method: Calculate the third similarity between each pair of the texts to be screened; Identify a pre-defined number of target texts that have the highest third similarity to each text to be filtered; Calculate the first average of the third similarity between each text to be screened and the target text corresponding to that text, and use it as the first evaluation information of the similarity dimension between each pair of texts to be screened.

7. The method according to claim 4, characterized in that, The quality assessment dimensions include at least two of the following dimensions: The large language model assesses the difficulty of extracting schedules from the text to be filtered, wherein the large language model is a pre-trained base model. The large language model is designed to improve the quality of the schedule information generated from the text to be extracted in the text to be filtered. The large language model targets the instruction following difficulty of the text to be filtered, wherein the instruction following difficulty is determined based on the ratio between the difficulty level and the quality of the schedule information. The output of the pre-trained quality assessment model to the input text to be screened.

8. The method according to claim 2, characterized in that, The overall evaluation information of the texts to be screened is obtained using the following methods: The first evaluation information of the text to be screened across multiple evaluation dimensions is input into a pre-trained overall evaluation model to obtain the overall evaluation information output by the overall evaluation model. The overall evaluation model is trained in the following manner: Second evaluation information for each second sample text in multiple evaluation dimensions is obtained from multiple training datasets. Based on the second evaluation information corresponding to each training dataset, determine the first dataset evaluation information of each training dataset in the multiple evaluation dimensions. The large language model was fine-tuned using different training datasets to obtain multiple fine-tuned models, wherein the large language model was a pre-trained base model; Based on the established validation dataset, the performance of each fine-tuned model is evaluated, and based on the evaluation results, the evaluation information of the second dataset for each training dataset is obtained. The evaluation information of the first dataset and the evaluation information of the second dataset of each training dataset are input into the second preset model so that the second preset model fits the transformation relationship between the evaluation information of the first dataset and the evaluation information of the second dataset of each training dataset, and outputs the predicted evaluation information of each training dataset based on the fitted transformation relationship. Based on the difference between the prediction evaluation information of each training dataset and the evaluation information of the second dataset, a second loss is calculated, and the model parameters of the second preset model are updated based on the obtained second loss to obtain the overall evaluation model.

9. The method according to claim 8, characterized in that, Based on the defined validation dataset, the performance of each fine-tuned model is evaluated. Based on the evaluation results, second dataset evaluation information for each training dataset is obtained, including: Input the set validation dataset into each fine-tuning model to obtain the data processing results output by each fine-tuning model; Based on the data processing results output by each fine-tuning model and the labels of the validation dataset, calculate the third loss generated by each fine-tuning model when processing data; Based on the third loss corresponding to each fine-tuned model, the second dataset evaluation information of each training dataset is calculated.

10. An electronic device, characterized in that, include: One or more processors and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 9.

11. A computer-readable storage medium, characterized in that, Includes a computer program that, when run on an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 9.

12. A computer program product, characterized in that, The computer program product includes executable instructions that, when executed on an electronic device, cause the electronic device to perform the method of any one of claims 1 to 9.

13. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the processors being used to invoke computer instructions to cause the electronic device to input data into the chip system and perform model training using the method of any one of claims 1 to 9.

Citation Information

Patent Citations

  • Chinese text error correction method and device and computer equipment

    CN115496074A

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

    CN118210870A