Information extraction method, device, equipment and storage medium using small sample learning

Through the combination of small sample learning methods and structured prompt words, the information extraction process is simplified, the existing methods are complex and dependent on the quality of target texts, and the accuracy and efficiency of information extraction are improved.

CN118734956BActive Publication Date: 2025-03-18NORTH CHINA DIGITAL HEALTH TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411223843.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2025-03-18
Estimated Expiration
2044-09-03

AI Technical Summary

Technical Problem

The existing information extraction method has a complex process and depends on the quality and integrity of the target text, making it difficult to effectively improve the information extraction rate and accuracy.

Method used

The small sample learning method is adopted to obtain Few-shot samples and build structured prompt words, and the model is fine-tuned and trained to simplify the information extraction process and improve the model's adaptability to the information extraction.

Benefits of technology

Through the combination of structured prompt words and forward propagation algorithm, the information extraction process is simplified, the accuracy and efficiency of information extraction are improved, and the dependence on the quality of input information is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734956B_ABST
    Figure CN118734956B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of natural language processing technology, and in particular to an information extraction method, device, equipment and storage medium using small sample learning. The method includes: S1, obtaining a small sample based on an information extraction task and constructing multiple structured prompt words; S2, matching prompt words for the small samples respectively, and embedding the small samples into corresponding prompt words respectively, and marking the correct extraction results of the small samples based on the prompt words; S3, fine-tuning a pre-trained large language model based on the small samples embedded in the prompt words and the correct extraction results corresponding to the small samples combined with a forward propagation algorithm; S4, inputting the information to be extracted embedded in the prompt words into the large language model to obtain the information extraction result. Using structured prompt words and fine-tuning the model with fewer samples combined with prompt words, the extraction process is relatively simple, and the dependence on the input information to be extracted is relatively small, which is conducive to improving the extraction rate and accuracy of information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing technology, and in particular to an information extraction method, device, equipment and storage medium using small sample learning. Background Art

[0002] In natural language processing, extracting key information from an input conversation is an important task. Traditional methods usually rely on a large amount of manually annotated data to train the model. This method is not only costly, but also lacks flexibility when facing new fields or environments with little data.

[0003] There have been attempts to use large pre-trained language models to assist in information extraction. The implementation scheme is as follows:

[0004] 1. Obtain the task type information and target text of the information extraction task;

[0005] 2. Based on the task type information, obtain the extraction requirements from the preset extraction requirement optional list to obtain the extraction requirement information of each task type information;

[0006] 3. Construct a target extraction instruction according to the extraction requirement information and the preset output format information, and construct a dictionary tree according to the target extraction instruction, the extraction requirement information and the target text to obtain a target dictionary tree that conforms to the output format information;

[0007] 4. Input the target text and target dictionary tree into the preset information extraction model to extract information and obtain the target extraction result.

[0008] In the entire information extraction process, building dictionary trees, executing complex instructions and model operations will further increase the computational burden. The accuracy depends largely on the quality and completeness of the input target text. In order to improve accuracy, existing methods usually require complex adjustments and a lot of fine-tuning, which makes it difficult to effectively improve the efficiency of information extraction. Summary of the invention

[0009] In order to solve the problem that the extraction process is complicated and it is difficult to effectively improve the information extraction rate and accuracy due to the dependence on the quality and completeness of the input target text, the present invention provides an information extraction method and device using small sample learning, including the following steps.

[0010] In a first aspect, the present invention provides an information extraction method using small sample learning, which adopts the following technical scheme: an information extraction method using small sample learning, comprising the following steps:

[0011] S1, based on the information extraction task, obtains few-shot samples and constructs multiple structured prompt words;

[0012] S2, match the prompt words for the few-shot samples respectively, embed the few-shot samples into the corresponding prompt words respectively, and annotate the correct extraction results of the few-shot samples based on the prompt words;

[0013] S3, based on the few-shot samples embedded in the prompt words and the correct extraction results corresponding to the few-shot samples combined with the forward propagation algorithm, fine-tune the pre-trained large language model;

[0014] S4, matching prompt words for the information to be extracted, and embedding the information to be extracted into the corresponding prompt words, and inputting the information to be extracted embedded in the prompt words into the large language model to obtain the information extraction result.

[0015] Through the above technical solution, structured prompt words are used to clearly explain the specific problems and goals to be solved for the model. The model is trained by combining prompt words with a small number of few-shot samples, and then the model is fine-tuned. The extraction process is relatively simple and has less dependence on the input information to be extracted. The combination of prompt words is conducive to improving the extraction rate and accuracy of information.

[0016] Optionally, the fine-tuning training of the pre-trained large language model in step S3 specifically includes:

[0017] S3-1, take the few-shot samples embedded in the prompt word and the correct extraction results corresponding to the few-shot samples as a data set, and divide the data set into a training set and a validation set;

[0018] S3-2, randomly select a set of data from the training set as the support set and a set of data related to the support set as the batch set;

[0019] S3-3, perform preliminary fine-tuning training on the large language model based on the support set. The model inputs multiple samples of the support set and outputs the information extraction results corresponding to all samples.

[0020] S3-4, using multiple samples in the batch set as input to the preliminarily fine-tuned model, the model performs a forward propagation algorithm on the multiple samples and outputs the corresponding prediction extraction results of the multiple samples;

[0021] S3-5, using a cross entropy loss function to calculate the loss value between the corresponding predicted extraction results of multiple samples and the corresponding actual extraction results of multiple samples, and when it is judged that the loss value is greater than a preset threshold, the optimization algorithm is used to adjust the model parameters, and when it is judged that the loss value is less than the preset threshold, no adjustment is required;

[0022] S3-6, return to S3-2, and repeat the process multiple times according to the preset number of times to obtain a large language model that has been fine-tuned and trained;

[0023] S3-7, evaluate the fine-tuned large language model based on the validation set. If the model evaluation fails, return to step S3-2. If the model evaluation passes, the fine-tuned model is used as the final large language model.

[0024] Optionally, the cross entropy loss function is used to calculate the loss value, specifically including:

[0025]

[0026] in, is the loss value, N is the number of training data, is the actual extraction result of the i-th sample, is the model prediction extraction result of the i-th sample.

[0027] Optionally, in step S3-2, the extraction of the support set specifically includes: randomly extracting a group of prompt word categories, each prompt word category includes the same number of few-shot samples embedded in the prompt word and the corresponding correct extraction results;

[0028] The extraction of the batch set specifically includes: extracting the same prompt word category as the support set, each prompt word category includes the same number of unextracted few-shot samples embedded in the prompt word and the corresponding correct extraction results.

[0029] Optionally, evaluating the fine-tuned large language model based on the validation set specifically includes:

[0030] Input the few-shot samples in the validation set into the fine-tuned large language model, and the model outputs the theoretical extraction results;

[0031] Combine the actual extraction results with the theoretical extraction results to calculate the accuracy of the model output:

[0032]

[0033] Combine the actual extraction results with the theoretical extraction results to calculate the recall rate of the model output:

[0034]

[0035] Combine precision P and recall R to calculate F1-score:

[0036]

[0037] Among them, TP is the number of samples in which the theoretical extraction results are consistent with the actual extraction results, FP is the number of samples in which the theoretical extraction results are different from the actual extraction results, and FN is the number of samples in which the theoretical extraction results are different from the actual extraction results;

[0038] The F1-score is compared with the evaluation threshold. When the F1-score is greater than or equal to the evaluation threshold, the model is evaluated as qualified. When the F1-score is less than the evaluation threshold, the model is evaluated as unqualified.

[0039] Optionally, before building the dataset, also include:

[0040] Perform data cleaning on the few-shot samples and correct extraction results: convert all the few-shot samples and correct extraction results to lowercase, and remove special characters and extra spaces;

[0041] Perform data splicing and data conversion on the cleaned few-shot samples and the corresponding correct extraction results: Use markers <s>and< / s> Concatenate the input and output texts and convert the concatenated texts into token IDs.

[0042] Optionally, the process of matching prompt words in step S2 and step S4 includes:

[0043] Build a bag-of-words model for each cue word template;

[0044] Build a bag-of-words model for few-shot samples or information to be extracted;

[0045] Calculate the cosine similarity between the bag-of-words model of the few-shot sample or the information to be extracted and the bag-of-words model of each prompt word template;

[0046] The prompt word template with the highest cosine similarity is selected as the few-shot sample or the prompt word of the information to be extracted.

[0047] In a second aspect, an information extraction device using small sample learning is provided, comprising:

[0048] The prompt word construction module obtains few-shot samples based on the information extraction task and constructs multiple structured prompt words;

[0049] An acquisition module is used to acquire information to be extracted, prompt word matching information of the information to be extracted, Few-shot samples, prompt words corresponding to the Few-shot samples, and correct extraction results of the Few-shot samples labeled based on the prompt words;

[0050] Combine the modules, embed the few-shot samples into the corresponding prompt words, and embed the information to be extracted into the corresponding prompt words;

[0051] The information extraction module fine-tunes the pre-trained large language model based on the few-shot samples embedded in the prompt words and the correct extraction results corresponding to the few-shot samples combined with the forward propagation algorithm, and inputs the information to be extracted embedded in the prompt words into the large language model to obtain the information extraction results.

[0052] In a third aspect, an information extraction device for applying small sample learning is provided, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the memory is coupled to the processor, and the processor implements the above-mentioned information extraction method for applying small sample learning when executing the computer program.

[0053] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned information extraction method for applying small sample learning.

[0054] In summary, the present invention has the following beneficial technical effects:

[0055] The structured prompt words are used to clearly explain the specific problems and goals to be solved for the model. The model is fine-tuned and trained by combining prompt words with fewer Few-shot samples, so that an accurate model can be fine-tuned and trained with fewer Few-shot samples. The extraction process is relatively simple and has less dependence on the input information to be extracted. The forward propagation algorithm is used for fine-tuning and F1-score verification, which is conducive to improving the extraction rate and accuracy of information. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 It is a flowchart of an information extraction method using small sample learning according to an embodiment of the present invention.

[0057] Figure 2 It is a schematic diagram of the structure of an information extraction device applying small sample learning according to an embodiment of the present invention. DETAILED DESCRIPTION

[0058] The following is combined with Figure 1 -Attached Figure 2 The present invention is described in further detail.

[0059] Example 1

[0060] Reference Figure 1, an information extraction method using few-shot learning in this embodiment includes the following steps:

[0061] S1, based on the information extraction task, obtains few-shot samples and constructs multiple structured prompt words; the prompt words cover multiple tasks of the information extraction task such as entity extraction and relationship extraction. The prompt word construction includes:

[0062] Identify specific information extraction tasks, such as extracting conclusions and complications from medical records. Conceive a general prompt word framework, for example: "Please extract [specific information] from the following text: [input text]". Collect a small number of iconic samples, carefully study the characteristics, structure and language patterns of these samples, and determine the prompt word framework for different few-shot samples. In this example, one hundred different structured prompt words are used.

[0063] S2, match prompt words for the few-shot samples respectively, and embed the few-shot samples into the corresponding prompt words respectively, and annotate the correct extraction results of the few-shot samples based on the prompt words; the annotation process in this embodiment adopts manual annotation. Since the concept of few-shot is to conduct effective learning through a small number of samples, the few-shot samples in this embodiment are provided relative to the large amount of annotated data required for normal machine learning.

[0064] The steps of matching prompt words for Few-shot samples include:

[0065] Construct a bag-of-words model for each prompt word template; construct a bag-of-words model for the few-shot samples; calculate the cosine similarity between the bag-of-words model of the few-shot samples and the bag-of-words model of each prompt word template; select the prompt word template with the highest cosine similarity as the prompt word of the few-shot samples. By calculating the cosine similarity between the few-shot sample vectors generated by the bag-of-words model and the prompt word vector, the similarity between the few-shot samples and the prompt word can be accurately evaluated. This method combines the few-shot sample representation ability of the bag-of-words model and the similarity measurement advantage of cosine similarity, thereby improving the accuracy of matching.

[0066] Example 1: Please extract population information from the following text: Chiasmatic glioma: It mostly occurs in infants and young people, with headache and decreased vision as the main clinical diagnostic manifestations.

[0067] Correct extraction result: Population information: [children, young people].

[0068] Example 2: Please extract the triples of conclusion / result, complication / accompanying, subcategory, and treatment relationship from the following medical record text: Six months before admission, the patient had irregular vaginal spotting with no obvious cause. The bleeding was bright red and accompanied by a small amount of vaginal discharge. There was no abdominal pain or bloating, chills or fever, cough or sputum, or vulvar itching. There was no discomfort such as frequent urination or urgency. The patient went to a local hospital for treatment and was given anti-infection and other treatments (the details are unknown) for one week. The above symptoms were slightly relieved at that time, but the treatment was not continued. Since then, irregular bleeding and discharge symptoms still occurred every month, and the amount gradually increased.

[0069] Correct extraction results: [{\"bright red\": \"observation result\", \"color\": \"observation item\", \"relationship\":\"conclusion / result\"}, {\"a small amount of vaginal discharge\": \"symptom\", \"irregular vaginal spotting\": \"symptom\", \"relationship\": \"concurrent / accompanied\"}, {\"chills\": \"symptom\", \"irregular vaginal spotting\": \"symptom\", \"relationship\": \"concurrent / accompanied\"}, {\"fever\": \"symptom\", \"irregular vaginal spotting\": \"symptom\", \"relationship\": \"concurrent / accompanied\"}, {\"cough\": \"symptom\", \"irregular vaginal spotting\": \"symptom\", \"relationship\": \"concurrent / accompanied\"}, {\"sputum\": \"symptom\", \"irregular vaginal spotting\": \"symptom\", \"relationship\": \"concurrent / accompanied\"} \"Concurrent / Accompanied\"}, {\"Vulvar Itching\": \"Symptoms\", \"Irregular Vaginal Spotting\": \"Symptoms\", \"Relationship\": \"Concurrent / Accompanied\"}, {\"Frequent Urination\": \"Symptoms\", \"Irregular Vaginal Spotting\": \"Symptoms\", \"Relationship\": \"Concurrent / Accompanied\"}, {\"Urgent Urination\":\"Symptoms\", \"Irregular Vaginal Spotting\": \"Symptoms\", \"Relationship\": \"Concurrent / Accompanied\"}, {\"Irregular Vaginal Spotting\": \"Symptoms\", \"Discomfort Symptoms\": \"Symptoms\", \"Relationship\": \"Sub-category\"}, {\"A small amount of vaginal discharge\": \"Symptoms\", \"Discomfort Symptoms\": \"Symptoms\", \"Relationship\": \"Sub-category\"}, {\"Abdominal Pain\": \"Symptoms\", \"Discomfort Symptoms\": \"Symptoms\", \"Relationship\": \"Sub-category\"} \"Subcategory\"}, {\"Abdominal distension\": \"Symptom\", \"Discomfort symptoms\": \"Symptom\", \"Relationship\": \"Subcategory\"}, {\"Chills\": \"Symptom\", \"Discomfort symptoms\": \"Symptom\", \"Relationship\": \"Subcategory\"}, {\"Fever\": \"Symptom\", \"Discomfort symptoms\":\"Symptom\", \"Relationship\": \"Subcategory\"}, {\"Cough\": \"Symptom\", \"Discomfort symptoms\": \"Symptom\",\"Relationship\": \"Subcategory\"}, {\"Coughing\": \"Symptom\", \"Discomfort symptoms\": \"Symptom\", \"Relationship\": \"Subcategory\"}, {\"Expectoration\": \"Symptom\", \"Discomfort symptoms\": \"Symptom\", \"Relationship\":\"Subcategory\"}, {\"Vulvar itching\": \"Symptom\",\"Discomfort symptoms\": \"symptoms\", \"relationship\": \"subcategory\"}, {\"Frequent urination\": \"symptom\", \"Discomfort symptoms\": \"symptom\", \"relationship\": \"subcategory\"}, {\"Urgent urination\": \"symptom\", \"Discomfort symptoms\": \"symptom\", \"relationship\": \"subcategory\"}, {\"Anti-infection\":\"treatment\", \"treatment\": \"treatment\", \"relationship\": \"subcategory\"}, {\"Slightly relieved\": \"Observation results\",\"symptom\": \"symptom\", \"relationship\": \"conclusion / result\"}, {\"Treatment\": \"treatment\", \"Discomfort symptoms\": \"symptom\", \"relationship\": \"treatment\"}, {\"Gradually increasing\": \"symptom\", \"amount\": \"observation item\", \"relationship\": \"conclusion / result\"}].

[0070] S3, based on the few-shot samples embedded in the prompt words and the correct extraction results corresponding to the few-shot samples combined with the forward propagation algorithm, fine-tune the pre-trained large language model; specifically, it includes:

[0071] S3-1, take the few-shot samples embedded in the prompt word and the correct extraction results corresponding to the few-shot samples as a data set, and divide the data set into a training set and a validation set;

[0072] Before building the dataset, include:

[0073] Perform data cleaning on the few-shot samples and correct extraction results, including: converting all the few-shot samples and correct extraction results to lowercase, and removing special characters and extra spaces;

[0074] The few-shot samples after data cleaning and the corresponding correct extraction results are concatenated and converted, and the labels are used <s> and< / s> Concatenate the input and output text, for example: <s> Enter text< / s> <s> Output Instructions< / s> "; Use the Tokenizer of the glm4-9b-chat model to convert the concatenated text into token IDs.

[0075] S3-2, randomly select a set of data from the training set as the support set and a set of data related to the support set as the batch set;

[0076] S3-3, preliminary fine-tuning training of the large language model is performed according to the support set, the model inputs multiple samples of the support set, and the model outputs the information extraction results corresponding to all samples; the extraction of the support set specifically includes: randomly extracting a group of prompt word categories, each prompt word category contains the same number of few-shot samples embedded in the prompt word and the corresponding correct extraction results; the extraction of the batch set specifically includes: extracting the same prompt word category as the support set, each prompt word category includes the same number of few-shot samples embedded in the prompt word that have not been extracted and the corresponding correct extraction results. In this embodiment, the glm4-9b-chat model based on the Transformer architecture is adopted, including position encoding, multi-head attention layer, multiple feedforward neural networks after each layer, normalization and residual connection;

[0077] Inputting multiple samples together can provide richer category information and feature representation, helping the model to more quickly capture the differences and commonalities between different categories; it can utilize the parallel processing capabilities of modern computing hardware to improve training efficiency. It can reduce the impact of randomness and noise brought by a single sample, allowing the model to learn more stable and universal features.

[0078] S3-4, using multiple samples in the batch set as input to the preliminarily fine-tuned model, the model performs a forward propagation algorithm on the multiple samples and outputs the corresponding prediction extraction results of the multiple samples;

[0079] S3-5, using a cross entropy loss function to calculate the loss value between the corresponding predicted extraction results of multiple samples and the corresponding actual extraction results of multiple samples, and when it is judged that the loss value is greater than a preset threshold, the optimization algorithm is used to adjust the model parameters, and when it is judged that the loss value is less than the preset threshold, no adjustment is required;

[0080] The calculation of loss value using cross entropy loss function specifically includes:

[0081]

[0082] in, is the loss value, N is the number of training data, is the actual extraction result of the i-th sample, is the model prediction extraction result of the i-th sample.

[0083] S3-6, return to S3-2, and repeat the process multiple times according to the preset number of times to obtain a large language model that has been fine-tuned and trained;

[0084] S3-7, evaluate the fine-tuned large language model based on the validation set. If the model evaluation fails, return to step S3-2. If the model evaluation passes, the fine-tuned model is used as the final large language model. Evaluating the fine-tuned large language model based on the validation set specifically includes:

[0085] Input the few-shot samples in the validation set into the fine-tuned large language model, and the model outputs the theoretical extraction results;

[0086] Combine the actual extraction results with the theoretical extraction results to calculate the accuracy of the model output:

[0087]

[0088] Combine the actual extraction results with the theoretical extraction results to calculate the recall rate of the model output:

[0089]

[0090] Combine precision P and recall R to calculate F1-score:

[0091]

[0092] Among them, TP is the number of samples in which the theoretical extraction results are consistent with the actual extraction results, FP is the number of samples in which the theoretical extraction results are different from the actual extraction results, and FN is the number of samples in which the theoretical extraction results are different from the actual extraction results;

[0093] The F1-score is compared with the evaluation threshold. When the F1-score is greater than or equal to the evaluation threshold, the model is evaluated as qualified. When the F1-score is less than the evaluation threshold, the model is evaluated as unqualified. The larger the F1-score value, the more accurate the model calculation.

[0094] S4, matching prompt words for the information to be extracted, and embedding the information to be extracted into the corresponding prompt words, and inputting the information to be extracted embedded in the prompt words into the large language model to obtain the information extraction result. The process of matching prompt words includes:

[0095] Build a bag-of-words model for each cue word template;

[0096] Build a bag-of-words model for few-shot samples or information to be extracted;

[0097] Calculate the cosine similarity between the bag-of-words model of the few-shot sample or the information to be extracted and the bag-of-words model of each prompt word template;

[0098] The prompt word template with the highest cosine similarity is selected as the few-shot sample or the prompt word of the information to be extracted.

[0099] Example 2

[0100] Reference Figure 2 The difference between this embodiment and embodiment 1 is that this embodiment provides an information extraction device using small sample learning, including:

[0101] The prompt word construction module obtains few-shot samples based on the information extraction task and constructs multiple structured prompt words;

[0102] An acquisition module is used to acquire information to be extracted, prompt word matching information of the information to be extracted, Few-shot samples, prompt words corresponding to the Few-shot samples, and correct extraction results of the Few-shot samples labeled based on the prompt words;

[0103] Combine the modules, embed the few-shot samples into the corresponding prompt words, and embed the information to be extracted into the corresponding prompt words;

[0104] The information extraction module fine-tunes the pre-trained large language model based on the few-shot samples embedded in the prompt words and the correct extraction results corresponding to the few-shot samples combined with the forward propagation algorithm, and inputs the information to be extracted embedded in the prompt words into the large language model to obtain the information extraction results.

[0105] Example 3

[0106] The difference of this embodiment is that this embodiment provides an information extraction device for applying small sample learning, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the memory is coupled to the processor, and the processor implements the above-mentioned information extraction method for applying small sample learning when executing the computer program.

[0107] Example 4

[0108] The difference of this embodiment is that this embodiment provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned information extraction method for applying small sample learning.

[0109] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the method disclosed in the embodiment, since it corresponds to the system disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0110] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0111] The above disclosure is only a preferred embodiment of the present invention, but the present invention is not limited thereto. Any non-creative changes that can be thought of by a person skilled in the art, as well as several improvements and modifications made without departing from the principle of the present invention, should fall within the protection scope of the present invention.

Claims

1. An information extraction method using small sample learning, characterized in that: The following steps are involved: S1, based on the information extraction task, obtains few-shot samples and constructs multiple structured prompt words; S2, match the prompt words for the few-shot samples respectively, embed the few-shot samples into the corresponding prompt words respectively, and annotate the correct extraction results of the few-shot samples based on the prompt words; S3, based on the few-shot samples embedded in the prompt words and the correct extraction results corresponding to the few-shot samples combined with the forward propagation algorithm, fine-tune the pre-trained large language model; The fine-tuning training of the pre-trained large language model in step S3 specifically includes: S3-1, take the few-shot samples embedded in the prompt word and the correct extraction results corresponding to the few-shot samples as a data set, and divide the data set into a training set and a validation set; S3-2, randomly select a set of data from the training set as the support set and a set of data related to the support set as the batch set; S3-3, perform preliminary fine-tuning training on the large language model based on the support set. The model inputs multiple samples of the support set and outputs the information extraction results corresponding to all samples. S3-4, using multiple samples in the batch set as input to the preliminarily fine-tuned model, the model performs a forward propagation algorithm on the multiple samples and outputs the corresponding prediction extraction results of the multiple samples; S3-5, using a cross entropy loss function to calculate the loss value between the corresponding predicted extraction results of multiple samples and the corresponding actual extraction results of multiple samples, and when it is judged that the loss value is greater than a preset threshold, the optimization algorithm is used to adjust the model parameters, and when it is judged that the loss value is less than the preset threshold, no adjustment is required; S3-6, return to S3-2, and repeat the process multiple times according to the preset number of times to obtain a large language model that has been fine-tuned and trained; S3-7, evaluating the fine-tuned large language model based on the validation set. If the model evaluation fails, return to step S3-2. If the model evaluation passes, the fine-tuned model is used as the final large language model. S4, matching prompt words for the information to be extracted, and embedding the information to be extracted into the corresponding prompt words, and inputting the information to be extracted embedded in the prompt words into the large language model to obtain the information extraction result.

2. The information extraction method using small sample learning according to claim 1, characterized in that: In step S3-2, the extraction of the support set specifically includes: randomly extracting a group of prompt word categories, each prompt word category contains the same number of few-shot samples embedded in the prompt word and the corresponding correct extraction results; The extraction of the batch set specifically includes: extracting the same prompt word category as the support set, each prompt word category includes the same number of unextracted few-shot samples embedded in the prompt word and the corresponding correct extraction results.

3. The information extraction method using small sample learning according to claim 1, characterized in that: The calculation of loss value using cross entropy loss function specifically includes: in, is the loss value, N is the number of training data, is the actual extraction result of the i-th sample, is the model prediction extraction result of the i-th sample.

4. The information extraction method using small sample learning according to claim 1, characterized in that: The evaluation of the fine-tuned large language model based on the validation set specifically includes: Input the few-shot samples in the validation set into the fine-tuned large language model, and the model outputs the theoretical extraction results; Combine the actual extraction results with the theoretical extraction results to calculate the accuracy of the model output: Combine the actual extraction results with the theoretical extraction results to calculate the recall rate of the model output: Combine precision P and recall R to calculate F1-score: Among them, TP is the number of samples in which the theoretical extraction results are consistent with the actual extraction results, FP is the number of samples in which the theoretical extraction results are different from the actual extraction results, and FN is the number of samples in which the theoretical extraction results are different from the actual extraction results; The F1-score is compared with the evaluation threshold. When the F1-score is greater than or equal to the evaluation threshold, the model is evaluated as qualified. When the F1-score is less than the evaluation threshold, the model is evaluated as unqualified.

5. The information extraction method using small sample learning according to claim 1, characterized in that: Before building the dataset, it also includes: Perform data cleaning on the few-shot samples and correct extraction results: convert all the few-shot samples and correct extraction results to lowercase, and remove special characters and extra spaces; Perform data splicing and data conversion on the cleaned few-shot samples and the corresponding correct extraction results: Use markers <s> and< / s> Concatenate the input and output texts and convert the concatenated texts into token IDs.

6. The information extraction method using small sample learning according to claim 1, characterized in that: The process of matching prompt words in step S2 and step S4 includes: Build a bag-of-words model for each cue word template; Build a bag-of-words model for few-shot samples or information to be extracted; Calculate the cosine similarity between the bag-of-words model of the few-shot sample or the information to be extracted and the bag-of-words model of each prompt word template; The prompt word template with the highest cosine similarity is selected as the few-shot sample or the prompt word of the information to be extracted.

7. An information extraction device using small sample learning, characterized in that: When the device is running, the method for extracting information by applying small sample learning as claimed in any one of claims 1 to 6 is executed, comprising: The prompt word construction module obtains few-shot samples based on the information extraction task and constructs multiple structured prompt words; An acquisition module is used to acquire information to be extracted, prompt word matching information of the information to be extracted, Few-shot samples, prompt words corresponding to the Few-shot samples, and correct extraction results of the Few-shot samples labeled based on the prompt words; Combine the modules, embed the few-shot samples into the corresponding prompt words, and embed the information to be extracted into the corresponding prompt words; The information extraction module fine-tunes the pre-trained large language model based on the few-shot samples embedded in the prompt words and the correct extraction results corresponding to the few-shot samples combined with the forward propagation algorithm, and inputs the information to be extracted embedded in the prompt words into the large language model to obtain the information extraction results.

8. An information extraction device using small sample learning, characterized in that: It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the memory is coupled to the processor, and when the processor executes the computer program, it implements the information extraction method for applying small sample learning as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the information extraction method using small sample learning as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Adaptive small sample learning intelligent error correction method based on ALBERT model

    CN114757169A

  • Prompt-based building entity identification and classification method and system

    CN115859164A