Network message text element extraction method based on large language model integration, electronic equipment and computer readable storage medium

Through the method of evidence theory and ensemble learning, multiple large language models are used to output candidate elements in parallel and calculate confidence and weights, the granular integration and error recognition problems in the extraction of text elements of online political question comments are solved, and the accuracy of the extraction results is improved Sex and robustness.

CN118886428AActive Publication Date: 2024-11-01DALIAN UNIV OF TECH

Patent Information

Application Number
CN202410908999.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-11-01
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

The existing large language model has poor granular integration, difficulty in identifying error elements, and difficulty in model integration caused by different vocabulary lists in the extraction of text elements of online political questioning messages, resulting in inaccurate extraction results.

Method used

Using an approach based on evidence theory and ensemble learning, candidate elements are output in parallel through multiple large language models, confidence and weight are calculated using evidence reasoning rules and NSGA-II algorithm, and the results are fused to improve the accuracy of factor extraction and reproduction. Great.

Benefits of technology

The accuracy and diversity of integration in the granularity of the factor is achieved, error transmission is avoided, and the overall quality and accuracy of the extraction results are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118886428A_ABST
    Figure CN118886428A_ABST
Patent Text Reader

Abstract

The invention discloses a network message text element extraction method based on large language model integration, electronic equipment and a computer readable storage medium, belongs to the field of text information element extraction, and aims to solve the problems of integrating element granularity, filtering and identifying error elements in time and improving the accuracy of generated elements. According to the technical key points, the confidence coefficient of any candidate element on any base model and the confidence coefficient of a termination token are used as the confidence coefficient of a proposition of an identification framework of an evidence reasoning rule, and evidence of any base model is generated according to the confidence coefficient of the proposition of any base model on the identification framework; according to the evidence of any base model and the weight of any base model, calculating weighted reliability distribution of the evidence of any base model; according to the weighted reliability distribution of the evidence of any base model, the evidences of all the base models are fused to obtain fused evidences, and the element with the maximum probability in the fused evidences is used as an integration result, so that the effect of improving the accuracy of the extraction result is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of text information element extraction, and relates to a network message text element extraction method based on large language model integration, an electronic device and a computer-readable storage medium. Background Art

[0002] Online political consultation refers to the process by which citizens submit opinions, suggestions, or requests to government agencies through internet platforms, and the government listens to and responds to public concerns through online channels. In an era of rapid development in online information technology, online political consultation has become a new channel for communication and interaction between the government and the public. The establishment of online political consultation platforms such as local government portals and government Weibo accounts has greatly broadened the channels for public participation in political life and established an efficient information bridge between the government and the public. The vast amount of online political consultation data is like a mirror, truly reflecting hot social and livelihood issues and the needs and expectations of the people. Processing and mining the key elements of this political consultation data can provide a scientific basis for government decision-making and effectively improve the effectiveness of public services.

[0003] Information extraction is a key technology in natural language processing, aiming to extract specific information from vast amounts of unstructured or semi-structured data. In government message data, key elements such as complaints, core demands, and solutions, contained in citizen messages and department responses, can help staff quickly understand the specific content and nature of messages, facilitate problem classification and location, and provide a data foundation for applications such as recommending similar messages. However, the vast amount of message data accumulated on online government platforms often lacks label information, making it difficult to directly apply traditional information extraction models, which require large-scale data training, to extract elements. Furthermore, unlike formal text, government messages exhibit colloquial characteristics such as complex sentence components and informal expressions, posing certain challenges in extracting information from such informal text. When text contains missing components, redundancy, or non-standard wording, traditional information extraction methods based on sequence classification or pointer networks perform poorly due to their inability to identify valid information fragments. Generative information extraction methods based on large language models have shown some advantages when using small amounts of data, but the lack of training data still limits model performance. In addition, when a large language model generates a response sequence, the extraction effect of the preceding elements will affect the generation of the subsequent elements, and the resulting error transmission and error accumulation will also affect the final extraction result.

[0004] Existing language model integration strategies primarily involve three aspects: First, a large language model is fed with the generation results of multiple base models to generate the final result. Second, the results of each base model are scored and voted to select the optimal result. Third, the conditional probabilities of the next word from each base model are weighted and integrated to generate the final result. Regarding the first and second aspects, existing research on large language model integration typically integrates the generation results of different models. However, this approach presents several issues with the granularity of the generated results. First, if none of the models in the ensemble generate the correct result, the ensemble result cannot be correct either. The resulting extraction result is only optimal overall, not necessarily optimal for each individual feature. Second, for feature extraction tasks, the model generation results contain multiple different features with dependencies between them. If a preceding feature is generated incorrectly, the correct generation of subsequent features will be affected. Therefore, simply integrating the generation results of different models fails to identify and correct erroneous features, thus affecting the accuracy of subsequent feature generation. Regarding the third aspect, this method is used in the field of text generation, and the conditional probability of the next word of each base model is weightedly integrated to generate the final result. This requires that the vocabulary of different base models is the same. Otherwise, if the vocabulary is different, for the same generated front word, different base models cannot all have the possibility of generating the same back word, and integration cannot be performed. Open source large language models usually have different vocabulary. The method of the third aspect mentioned above cannot perform model integration due to the different vocabulary of different base models. This usually means that multiple different base models must be trained using a single large language model, which makes it difficult to fully utilize the advantages of different large language models through integration. Therefore, this method has not been used in the field of text feature extraction. Summary of the Invention

[0005] In order to solve the problem of integrating at the element granularity, timely filtering and identifying erroneous elements, and improving the accuracy of generated elements, according to some embodiments of the present application, a network message text element extraction method based on large language model integration is used to perform a task of extracting elements from political messages, wherein the elements include entity elements and / or relationship elements, and the extraction task includes an entity recognition task and / or a relationship recognition task;

[0006] The extraction method is applied to a large language model, the large language model comprising at least two base models with different vocabularies, wherein the text describes the text of the element to be extracted, the instruction describes the type and output format of the element in the text of the element to be extracted, and the answer describes the extracted element output by the base model according to the instruction;

[0007] The network message text element extraction method based on large language model integration includes:

[0008] S100. Input a sample token sequence into the base model, wherein the sample token sequence includes an instruction, text, and a token sequence of an extracted element;

[0009] The input sample token sequences of different base models are the same, but the vocabulary of different base models is different;

[0010] If the sample token sequence does not have an extracted element, the token sequence of the extracted element is empty;

[0011] S200. Any base model outputs a token sequence of k candidate elements based on the input sample token sequence;

[0012] S300. Calculate the confidence of any candidate element in all candidate elements output by all base models on any base model, and calculate the confidence of the termination token;

[0013] S400. Assign weights to any base model;

[0014] S500. Using the confidence of any candidate element on any base model and the confidence of the termination token as the confidence of the proposition of the identification framework of the evidence reasoning rule, and generating evidence for any base model according to the confidence of the proposition of any base model in the identification framework;

[0015] S600. Calculate the weighted confidence distribution of the evidence of any base model based on the evidence of any base model and the weight of any base model;

[0016] S700. According to the weighted confidence distribution of the evidence of any base model, the evidence of all base models is integrated to obtain integrated evidence, and the element with the highest probability in the integrated evidence is taken as the integration result.

[0017] If the integration result is a candidate element, the candidate element is taken as an extracted element and recorded in the answer, and steps S100-S700 are iteratively performed;

[0018] If the integration result is a termination token, the loop is stopped, and the extracted elements recorded in the answer are output as the extracted elements output by the large language model.

[0019] In a second aspect, an embodiment of the present application further provides an electronic device, comprising: one or more processors, a memory, and one or more programs; wherein the one or more programs are stored in the memory, and the one or more programs include instructions, which, when executed by the electronic device, enable the electronic device to execute the first aspect and any possible technical solution of the first aspect thereof.

[0020] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, which includes a computer program. When the computer program runs on an electronic device, the electronic device executes the first aspect and any possible technical solution of the first aspect.

[0021] Beneficial Effects: In a first aspect, the present invention is applied to the field of text element extraction. In each iteration, a base model outputs k candidate elements in parallel. Through an integrated approach using evidence reasoning rules, the optimal candidate element (k×m) output by m different base models is selected as the leading extracted element. This leading extracted element is then added to the input sample of the next iteration. This extraction reflects the dependencies between elements. Furthermore, the extracted elements generated in each iteration of the entire result are all optimal. Therefore, the resulting extraction result is optimal overall, and each element is also optimal. This avoids the situation where the overall result is optimal but contains clearly erroneous sub-elements. Furthermore, since different base models in the present invention each output k candidate elements, and the elements are derived from the text, the different vocabularies of each base model can actually provide candidate element diversity. The optimal selection mechanism of the integrated evidence reasoning rules can further constrain the accuracy under this diversity. Therefore, the present invention can achieve both candidate diversity and result accuracy in integrated extraction.

[0022] On the second aspect, in the method for obtaining the token sequence of candidate elements of the present invention, the element name is iterated to add tokens in multiple rounds, and in each round, the conditional probability of all token sequences that can be combined with the vocabulary token is calculated, and the best token sequences of this round are obtained from them, until a termination mark appears in a certain optimal token sequence of a certain round, indicating that one of the optimal token sequences (the optimal candidate element of the element name) appears, and after calculating the token sequence of the element name, the confidence of the token sequence of different element categories is generated, and the best one is selected to form an outputtable optimal candidate element, and k optimal candidate elements are output in multiple rounds of iteration according to the specified k. Therefore, the candidate elements used for integration of each base model in the present invention have themselves been selected through multiple rounds of iteration, and further combined with the above-mentioned method of integrating the best evidence reasoning rules, the accuracy of the extraction results can be further improved.

[0023] In a further embodiment of the second aspect, since elements represented by simplified Chinese characters and elements represented by traditional Chinese characters generally have similar conditional probabilities, the results may include multiple candidate elements that are indistinguishable from traditional and simplified Chinese characters. The present invention skips all sequences containing traditional Chinese characters during the stage of selecting retained sequences to avoid the occurrence of multiple candidate elements indistinguishable from traditional and simplified Chinese characters in the results.

[0024] In a further solution on the second aspect, the output format of an entity element is "(element content, element category)", and the present invention only generates the element name of the entity candidate element when extracting the entity element. Since the eight entity element categories will frequently appear as part of each entity element during the model training process. Therefore, when the model outputs the token sequence corresponding to the correct entity element category, the conditional probability of each token is very high. Since the length of each candidate sequence is exactly the same, if the element content of some sequences is shorter but the element category is longer, its conditional probability may be higher than that of other sequences with longer element content. In order to reduce the impact of the element category length on the sequence score, the present invention stops generating the sequence after a sequence completes the generation of the element content part, that is, when the last token of the sequence is the token corresponding to the comma. Then, the confidence of each category generated after the sequence is calculated, and the category with the highest confidence is selected as the category of the candidate element.

[0025] In a further solution on the second aspect, when a large language model is used to generate text, it will usually stop after the model outputs a termination token. However, the present invention does not generate a termination token in the candidate element search method. Instead, a termination token is added to each round of integration and its confidence is calculated to determine the timing of terminating the generation of elements. Because the present invention uses three different large language models for integration, but the vocabulary of these three models is not the same, the same text sequence will be divided into different token sequences in different models. This means that when generating candidate elements after some elements have been generated, it is necessary to start generating after the type of the last element of the generated elements so that other models can generate termination tokens in a normal order. However, starting to generate after the type of the last element of the generated elements means that other content may be generated in the element type part of the last element of the generated elements, and the need to generate additional tokens increases the calculation time when generating candidate elements. Therefore, the present invention does not generate a termination token in the candidate element search, and adding a termination token in the recognition framework can avoid these problems and reduce the complexity of the algorithm.

[0026] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 Technology roadmap.

[0028] Figure 2 A framework for building a feature extraction base model based on fine-tuning of a large language model.

[0029] Figure 3 Entity feature extraction task test results.

[0030] Figure 4 Test results of the relational element extraction task.

[0031] Figure 5 A framework for feature extraction methods based on evidence theory and ensemble learning.

[0032] Figure 6 The extraction results of different categories of entity features using the EG-ERRule method.

[0033] Figure 7 Model weight search iteration results based on the NSGA-II algorithm.

[0034] Figure 8 The F1-0.8 index of the entity feature extraction task and the relationship feature extraction task of all individuals on the validation set.

[0035] Figure 9 F1-0.8 indicators of entity feature extraction tasks and relationship feature extraction tasks under different model weights.

[0036] Figure 10 The overall architecture of the prototype system is recommended based on the treatment measures of the political elements.

[0037] Figure 11 Feature extraction module interface. DETAILED DESCRIPTION

[0038] The following describes embodiments of the present application in detail with reference to the accompanying drawings, examples of which are shown in the accompanying drawings. The present application provides a method and an electronic device. The method and device are based on the same technical concept. Since the method and device solve similar problems, the implementation of the device and method can refer to each other, and any repetitions will not be repeated.

[0039] 1.1 Terminology

[0040] 1.1.1 Online Government Inquiry Platforms: As new channels for communication between the government and the public in the information technology era, online government inquiry platforms fully utilize the message data generated by these platforms, and numerous scholars have conducted relevant research. Currently, the mining of inquiry data from online government inquiry platforms primarily relies on empirical research. Current research on message information mining primarily focuses on single aspects, such as the complaint area or sentiment, but lacks research on extracting key elements such as the demands and response measures.

[0041] 1.1.2 Feature Extraction: Feature extraction is the process of automatically identifying and extracting key information from unstructured or semi-structured data. This information typically includes structured elements such as entities, attributes, and relationships, to facilitate further data analysis, information retrieval, or knowledge base construction. Current research on feature extraction typically transforms feature extraction tasks in specific domains into information extraction tasks such as named entity recognition and relationship extraction, leveraging the rich methods and models in the field of information extraction to extract feature information from specific domains.

[0042] 1.1.3 Instruction Learning: Instruction Tuning, also known as Instruction Learning, is a method that uses a combination of natural language instructions and text to input into a pre-trained language model to perform specific natural language processing tasks. In this type of method, the instructions are usually a detailed description of the task, which may include the task objectives, explanations of the proper nouns involved, output format requirements, precautions, etc. In traditional fine-tuning methods, the model usually requires a large number of input and output samples for training in order to learn the requirements of the task and output format. The instruction fine-tuning method, on the other hand, inputs the instructions together with the text to be processed into the pre-trained language model, and requires the model to output according to the instructions.

[0043] 1.1.4 Ensemble Learning: Ensemble learning is a method that combines multiple prediction results from different models to produce a final prediction. Ensemble learning can combine multiple complementary models to improve the generalization capabilities of the ensemble model and has been widely used in various natural language processing tasks, such as intent recognition, relationship extraction, and sentiment classification.

[0044] (1) Using ensemble learning for information extraction: Current research on using ensemble learning in information extraction tasks usually assumes that the basic unit, the entity, appears in the form of original text fragments. This makes it difficult to handle the problem that the fragments of the political messages studied in this invention, which have problems such as missing components, redundancy, and non-standard wording, cannot be directly used as political elements. Therefore, this invention uses a large language model to perform element extraction tasks in the form of sequence generation, and designs a corresponding ensemble method to integrate multiple large language models.

[0045] (2) Using evidence theory to integrate model results: In integrated learning research, it is usually necessary to combine the results from different models. Commonly used integration strategies such as voting, averaging, and weighted averaging are simply combinations of results and cannot effectively utilize the internal information of the model results. The integration strategy based on evidence theory in the present invention can fully utilize the distribution information of model results and can process model output results with uncertain information. The integration method based on evidence theory has more effective information fusion capabilities than traditional integration methods. Therefore, the text uses the evidence reasoning rule method to integrate the information of the large language model to select the optimal elements of the question and message.

[0046] (3) Large language model integration: Existing research on large language model integration usually chooses to integrate the generation results of different models, but this method has some problems in integrating the generation result granularity. First, if all the integrated models do not generate correct results, then the integration result cannot be correct. Second, for feature extraction tasks, the model generation results contain multiple different features and there are dependencies between these features. If the generation error of the previous feature will affect the correct generation of the subsequent feature. Therefore, directly integrating the generation results of different models cannot identify and correct the generated erroneous features, thereby affecting the accuracy of the generation of the subsequent features.

[0047] 1.2 Research content and technical route: The technical roadmap of this invention is as follows Figure 1As shown. The main research content of the present invention is to design a large language model for extracting political question elements, aiming to solve the problem of poor performance in extracting political question message elements under the condition of lack of labeled data. In order to improve the factor extraction effect, the present invention uses an ensemble learning method to combine the advantages of different large language models to improve the factor extraction effect. The premise of integrating sequence generation models to achieve efficient factor extraction is that at least one model can accurately generate political question elements. Therefore, the base model for integration needs to have a higher factor extraction capability. The first research content of the present invention is to use the instruction fine-tuning method to use other fields of information extraction data sets to improve the base model's ability to extract political questions, and provide a model basis for subsequent integration. The second research content of the present invention is to design a factor extraction method framework based on ensemble learning, which integrates each factor to timely discover and correct generation errors, improve factor extraction accuracy, and reduce the possibility of transmission errors.

[0048] Due to the lack of labeled data in the field of extracting elements from online political messages, relevant studies have shown that increasing the number of instruction training tasks can improve the model's ability to learn with a small number of samples. Therefore, the present invention first constructs a Chinese information extraction instruction dataset. Since Chinese information extraction instruction datasets are currently scarce, existing Chinese information extraction instruction datasets such as KnowLM-IE are mainly labeled using remote supervision methods, and there is a certain amount of noise in the training samples. Therefore, the present invention collects multiple existing Chinese information extraction-related datasets, designs information extraction instructions to modify the datasets, and constructs a Chinese information extraction instruction dataset for pre-training of information extraction tasks. This dataset is then used to fine-tune the model.

[0049] Due to the large parameter size of large language models, fine-tuning the model requires a huge amount of video memory and computing power resources. Therefore, the present invention uses the LoRA method to fine-tune the basic large language model. Next, the present invention uses a web crawler method to crawl the government message data from the Hunan government inquiry platform, and uses a manual annotation method to construct a government message element extraction instruction dataset. This dataset is used to further fine-tune the model to transfer the general extraction capabilities learned by the model from other domain datasets to the government message element extraction task, achieving accurate extraction of message elements.

[0050] In response to the error propagation problem that exists when large language models generate sequences, the present invention proposes a factor extraction method based on evidence theory and ensemble learning. The method first uses a search-based candidate factor search method to search for multiple candidate factors through multiple large language models, and uses the set of searched candidate factors as the identification framework for integration. Each large language model is used to calculate the conditional probability geometric mean of each candidate factor as the confidence of each candidate factor. In order to better fuse the information from multiple models, the present invention uses the NSGA-II algorithm to search for the weight of each model and uses the evidence reasoning rule method to fuse the candidate factor confidence information of multiple models to calculate the most likely next factor. This factor generation process is repeated continuously, and the generation results of multiple large language models are integrated at the factor granularity, which reduces the generation of erroneous factors and improves the accuracy of factor extraction.

[0051] Based on the results of the two parts of research work, the present invention designed and implemented a prototype system for recommending treatment measures based on political inquiry messages, further verified the effectiveness of the method proposed in the present invention, and took the recommendation of treatment measures as an example to demonstrate the application scenarios and value of the extracted political inquiry elements.

[0052] 2. Method for Constructing a Feature Extraction Base Model Based on Instruction Fine-tuning of a Large Language Model: Data in the field of online political inquiries lacks labeled data and is mostly informal and colloquial. Traditional information extraction methods are not well-suited to extracting key elements from online political inquiries. To address these issues, the present invention designs a method for constructing a feature extraction model based on instruction fine-tuning of a large language model. This method first defines the key element categories of complaint-related online political inquiries. It then designs information extraction instructions and constructs a corresponding dataset of complaint-related political inquiries. Next, a Chinese information extraction instruction dataset is constructed based on several existing Chinese datasets, and the model is fine-tuned to train its general information extraction capabilities. The model is then further fine-tuned using the complaint-related political inquiries instruction dataset, transferring the learned general information extraction capabilities to the field of feature extraction from political inquiries. Finally, the proposed method is trained on multiple open-source large language models and tested on a dataset of complaint-related political inquiries to verify its effectiveness.

[0053] 2.1 Definition of the task of extracting elements from political messages and the framework of the base model construction method

[0054] 2.1.1 Definition of the task of extracting elements from government messages: Online government inquiry data includes two parts: citizen messages and responses from relevant departments. The citizen message part is the citizen’s description of the problem, and the relevant department’s response part is the response of the department responsible for handling the problem to the citizen, mainly including the department handling the problem and its handling measures. Therefore, the present invention divides the key elements of government messages into two categories: entity elements and relationship elements. The entity elements are defined as the following eight categories: complaint problem, time of occurrence of the complaint problem, location of occurrence of the complaint problem, object of complaint, harm caused by the complaint problem, appeal, handling department, and handling method. The meaning and examples of each type of entity element are shown in Table 2.1. Relationship elements are the corresponding relationship between the handling department and the handling measures. Identifying such relationships helps to clarify the specific measures implemented by each specific handling department in the relevant department replies with multiple departments and multiple handling measures, thereby providing a data basis for applications such as the sharp reduction of handling measures for similar problems.

[0055] Table 2.1 Entity element categories of complaint-related messages

[0056]

[0057] Currently, feature extraction mainly involves unified modeling of entity recognition, relationship extraction, and event extraction tasks. Using a unified information extraction task modeling approach not only helps the model learn the general capabilities of different information extraction tasks, but also enables fine-tuning using more datasets from other fields to improve the model's extraction performance. The three common information extraction tasks of entity recognition, relationship extraction, and event extraction are usually divided into four subtasks: entity recognition, relationship recognition, event category recognition, and argument recognition. This reduces the complexity of each subtask and improves the model's extraction performance. The goal of the entity recognition task is to generate a sequence:

[0058]

[0059] Among them, entity i Indicates entity value, entity_type i Indicates the entity type corresponding to the i-th entity.

[0060] The relation extraction task is divided into two subtasks: entity recognition and relation recognition. The entity recognition subtask identifies the subject and object and their types in the input text; the relation recognition subtask generates a sequence based on this:

[0061] (relation1, object1, subject1), (realtion2, object2, subject2),..., (relation i , object i , subject i )

[0062] where relation i Indicates the relationship type, object i Indicates a specific subject, subject i Indicates a specific object.

[0063] The event extraction task is divided into two subtasks: event category recognition and argument recognition. The event category recognition subtask identifies the category of events present in the input. Its goal is to generate the sequence event1, event2, ..., event i , where event i Represents the event type; the argument recognition subtask identifies the arguments and types of each event on this basis. The goal of the argument recognition subtask is to generate the sequence

[0064] (event1, (argument 11 , argument_type 11 ),...), (event2, (argument 21 , argument_type 21 ),…),…,(event i ,(argument i1 , argument_type i1 ), …)

[0065] Among them event i Indicates the type of event, argument i1 Indicates the first argument content of the event, argument_type i1 Indicates the argument type corresponding to the first argument of the event.

[0066] In the present invention, extracting elements from government messages can be considered the aforementioned sequence generation task. The large language model of the present invention performs the task of extracting elements from government messages. The elements described only involve entity elements and relationship elements, and the extraction task only involves entity recognition and relationship recognition tasks. Entity element extraction is performed as an entity recognition task, while relationship element extraction is performed as entity recognition and relationship recognition subtasks. The relationship recognition subtask has only one relationship, "execution," whose subject is the processing department and whose object is the processing measures executed by the processing department.

[0067] However, as mentioned above, the present invention has constructed a Chinese information extraction instruction dataset based on several existing Chinese datasets, and fine-tuned the model to train the general information extraction capability of the model. Subsequently, a complaint-type political inquiry message instruction dataset is used to further fine-tune the model, and the general information extraction capability learned by the model is transferred to the field of political inquiry message element extraction. Therefore, in the model training stage, the present invention involves several existing Chinese information extraction instruction datasets as training sets. Therefore, in the model training stage, the present invention involves event extraction tasks as well as event category recognition and argument recognition subtasks.

[0068] 2.1.2 Building a framework for feature extraction base models based on fine-tuning of large language model instructions

[0069] Traditional entity extraction and relationship extraction methods usually require a large amount of labeled data, and sufficient training of the model can achieve good results. With the development of large language model technology and the improvement of large language model performance, instruction fine-tuning, as a technology that can effectively utilize large language models, acquire knowledge from training corpus during pre-training and enable the model to follow instructions to handle unknown tasks, is used to perform entity extraction and relationship extraction tasks in a small sample environment. However, Chinese information extraction instruction datasets are currently scarce, and existing Chinese information extraction instruction datasets such as KnowLM-IE are mainly labeled using remote supervision methods, and there is a certain amount of noise in the training samples. In response to the above problems, the present invention proposes a feature extraction base model construction based on instruction fine-tuning.

[0070] The feature extraction model construction framework based on instruction fine-tuning is as follows Figure 2As shown. First, in order to better utilize the knowledge learned by the large language model during the pre-training process, the present invention represents the entity extraction, relationship extraction and event extraction tasks as sequence generation tasks. Referring to the instruction design in the previous research on instruction fine-tuning, the present invention processes each information extraction task text into three parts: instructions, text and answers. The instruction part describes in detail the information that needs to be extracted from the text to be extracted, the relevant requirements and the output format, etc., which is used to guide the model to correctly extract information from the text to be extracted and generate output in the correct format; the text refers to the sentence or paragraph that needs to be extracted. The text will be attached to the instruction and input into the large language model so that the model outputs the corresponding extraction result according to the specific task requirements; the answer refers to the sentence generated after the information extracted from the text is organized according to the format requirements in the instruction, that is, the expected output sequence of the large language model after inputting the corresponding instruction and text. For details on the design of information extraction instructions, please refer to Section 2.2.1. Next, since there is currently no dataset related to the extraction of elements from political messages, the research according to the present invention needs to construct an instruction dataset for extracting elements from political messages, manually annotate complaint-type political messages, and process them according to the instruction template to construct an instruction dataset for extracting elements from complaint-type political messages. In order to improve the element extraction performance of the model, it is necessary to construct an instruction dataset for information extraction from other fields to fine-tune the model and train the general information extraction capability of the model. Therefore, the present invention processes the existing Chinese information extraction dataset to construct a Chinese information extraction instruction dataset. The details of the dataset construction are detailed in Section 2.2.2. Finally, the large language model is fine-tuned with instructions using the Chinese information extraction instruction dataset and the complaint-type political element extraction instruction dataset. First, fine-tune the instructions on the Chinese information extraction instruction dataset to improve the model's general information extraction capability and the ability to understand the extracted instructions, and then use the political element extraction instruction dataset for further fine-tuning. This achieves an element extraction model with better training effect under limited data scale. Due to the large number of model parameters, traditional full-parameter fine-tuning methods require excessive storage and computing resources. We selected the LoRA method for fine-tuning. This method reduces the storage and computing requirements during fine-tuning by reducing the number of parameters updated during fine-tuning. Details of model training are provided in Section 2.3.

[0071] 2.2 Two-stage information extraction instruction design and instruction dataset construction: The instruction fine-tuning method has been widely proven to enable the model to have good zero-sample and few-sample performance, but existing instruction fine-tuning research mainly focuses on English corpus and lacks Chinese information extraction instruction dataset. In order to improve the model's ability to extract elements from political messages, it is necessary to use the Chinese information extraction instruction dataset to pre-fine-tune the model before using the political message data for training. Therefore, the present invention first designs two-stage information extraction instructions and corresponding instruction templates based on the instruction design method previously studied, and then constructs a complaint-type political message element extraction instruction dataset and a Chinese information extraction instruction dataset based on the instruction template.

[0072] 2.2.1 Two-stage information extraction instruction design: In order to better utilize the knowledge learned by the large language model during the pre-training process, the present invention represents the entity extraction, relationship extraction and event extraction tasks as sequence generation tasks. Each label data of each specific extraction task will be processed into three parts: instructions, text and answers. The instruction part describes in detail the type of information to be extracted from the text to be extracted and the output format and other information, which is used to guide the model to correctly extract information from the text to be extracted and generate output in the correct format. The text part is the text from which information needs to be extracted, and the answer part is the result of processing the information in the text according to the output format requirements in the instruction. The present invention tests multiple instruction templates under zero-sample and few-sample conditions on the ChatGPT3.5 model, and selects the instruction template with the best effect. The instruction templates used in the text are shown in Table 2.2. The parts in brackets such as "[Entity Type List]" need to be replaced with the actual categories that need to be extracted in the specific information extraction data. Taking the task of extracting entity elements from political messages in invention research as an example, "[Entity Type List]" needs to be replaced with "[Complaint issue, time of occurrence of complaint issue, location of occurrence of complaint issue, object of complaint, harm caused by complaint issue, appeal, handling department, handling measures]".

[0073] Table 2.2 Instruction template examples

[0074]

[0075]

[0076] Taking relation extraction as an example, the data sample S of the relation extraction task using two-stage instructions can be expressed as:

[0077] S={Instruction er , Text, Answer er ,Instruction re , Answer re}(2.1)

[0078] Instruction er is the instruction of the entity recognition subtask, Text is the text to be extracted, Answer er is the expected output of the entity recognition subtask, Instruction re Instructions for identifying subtasks for a relation, Answer re is the expected output of the relation recognition subtask. It should be noted that during training, the answer to the relation recognition subtask er Labels from data samples, Answer in actual extraction er is the output of the model in the entity recognition subtask.

[0079] As mentioned above, compared to the model training for the "Question and Message Instructions" dataset, this instruction template only applies to the entity recognition and relationship recognition tasks. It's understandable that this example instruction template can be used as a general instruction template to cover a wider range of tasks, such as the model training for the "Chinese Information Extraction Instructions" dataset.

[0080] 2.2.2 Instruction Dataset Construction

[0081] (1) Construction of a dataset for extracting elements from government messages: Although the government inquiry platform has accumulated a vast amount of government message data, there is currently no labeled dataset suitable for the task of this invention. Therefore, through operations such as data acquisition, processing, and labeling, this invention first constructs a dataset of elements from complaint-related government messages that meets the task requirements. Specifically, the following describes the process for constructing a dataset for extracting elements from government messages, including data acquisition, preprocessing, labeling, and adding instructions.

[0082] 1) Data Acquisition: Currently, the message functions of various online government inquiry platforms are largely similar. The message content page on an online government inquiry platform typically includes the message title, content, message type, and the response after relevant processing. The data acquisition stage primarily involves obtaining the message content and corresponding government response data from the online government inquiry platform. The message type is also required to filter out the complaint-related government inquiry messages studied in this paper.

[0083] 2) Data preprocessing: The message data obtained in the previous step is preprocessed in two aspects: text filtering and data cleaning: First, the text is filtered. Since the present invention extracts the elements of complaint messages, it is necessary to first filter out the text data of the complaint type. The present invention first filters out complaint-type political messages based on the message tag information, but there are still some messages that are essentially consultation-type messages. Therefore, the present invention removes non-complaint-type messages from the remaining messages by manual inspection, and also removes messages that have been replied but the reply content is being processed. Due to the differences in the complexity of the complaints of the masses, there are also differences in the degree of carefulness and meticulousness of the masses and the processing department when writing messages and replies. It can be observed that there is a huge difference in the length of messages and replies. Some messages or replies are less than 100 words, while some messages or replies are more than 1,000 words long. Considering that the large language model has a significant performance degradation when extrapolating the length and the model needs to use more computing power and video memory space when processing long texts, the text only retains messages with a message part length of no more than 500 words and a reply part length of no more than 600 words. Then the data is cleaned. According to the requirements of the model output format in the instructions used in the present invention, the model will use half-width symbols to segment the output content during output to distinguish different elements, element contents and element types. Therefore, the present invention unifies the punctuation used in messages and replies, replaces half-width punctuation with full-width punctuation, and uses spaces with an ASCII code of 32 to replace invisible characters other than line breaks. At the same time, unnecessary spaces and line breaks are deleted. Unifying punctuation marks can not only avoid the confusion caused by using the same symbols in the text and the output format, but also unifying symbols with the same meaning can avoid difficulties when the model processes different symbols with the same meaning.

[0084] 3) Data Annotation: Manually annotate the pre-processed messages and responses according to the entity element category requirements described in Table 2.1 and the corresponding relationship between the processing department and the treatment measures in the text. Since the message text is informal and written by the public, there may be non-standardized and colloquial language. Therefore, during the annotation process, if the original text contains non-standard language, interrogative sentences, missing structure, etc., it is necessary to modify the original text appropriately, add or delete redundant content as element content, and ensure that the annotated element content is complete and the expression is clear and concise. For example, in the message “…the outdoor billboard of the Maiji Paradise in the shopping mall next to the north gate of Century Landscape Community (near the municipal government) turns on its lights every night until the next day. Since the light from the opposite side is too bright and shines directly into the room and living room, even with two layers of curtains drawn, it cannot be blocked, which seriously affects the children’s sleep and rest schedule…”, the user who left the message complained that “the outdoor billboard lights are too bright”, but the user who left the message also detailed the location of the billboard, lighting time and other information. Therefore, when extracting the complaint problem elements of the message, this part of the content needs to be appropriately deleted to ensure the simplicity and clarity of the extracted elements. Since the labeling task of the present invention is not a traditional entity recognition and relationship recognition task, in order to improve labeling efficiency, the present invention uses the open source data labeling platform Label Studio to perform data labeling. The platform allows users to customize the labeling interface and labeling targets to meet personalized labeling needs. The labeling results are exported in json format.

[0085] 4) Inject command text: Process the exported annotated data according to the command data template in Table 2.2. For each message and reply pair, add entity recognition and relationship recognition commands. Replace the "entity type list" with a list of eight message entity elements extracted from the text. Replace the "relationship type list" with "execute."

[0086] 5) Adjust the order of elements: Finally, in order to guide the model to generate in the order in which the elements appear in the original text, the elements or relationship triples in the answer part of the dataset are sorted. The elements in the answer are sorted according to the order in which the element content appears in the original text. The relationship triples in the answer are sorted based on the order in which the treatment measures appear in the original text as the main sorting basis, and the order in which the treatment departments appear in the original text as the secondary sorting basis. In order to represent the entity elements concisely and clearly, some of the annotated elements do not have exactly the same text in the original text. Therefore, the similarity between the element and any substring of the original text based on the Levenshtein distance is calculated, and the position of the substring with the highest similarity is taken as the position of the element. The sorted dataset is used as the instruction dataset for extracting elements from political messages.

[0087] (2) Construction of Chinese information extraction instruction dataset: Studies have shown that fine-tuning a large language model using instruction data from multiple different tasks can improve the model's few-sample capabilities in other tasks. This paper chooses to modify an existing public information extraction dataset to construct a Chinese information extraction instruction dataset, which is used to pre-train the model on information extraction instructions to improve the model's general information extraction capabilities and its ability to understand extraction instructions. The following will introduce the process of constructing the Chinese information extraction instruction dataset, including data acquisition, preprocessing, annotation, and output format.

[0088] 1) Data Acquisition: This paper collected nine different datasets covering different fields and extraction tasks. The basic information of these datasets is shown in Table 2.3. The CMeIE dataset was used to verify the effectiveness of information extraction instruction pre-training at different training set sizes and was therefore not used to construct the Chinese information extraction instruction dataset. However, it was processed according to the instruction template like the other datasets.

[0089] Table 2.3 Basic information of the collected Chinese information extraction dataset

[0090]

[0091] 2) Data preprocessing: The present invention first cleans the data collected in the Chinese information extraction dataset, mainly deleting data containing undefined event categories, relationship categories, and entity categories, for example, "other" type events in the CCKS2021 dataset, and "other" type entities in the CMeIE dataset. Because different datasets use different data formats to save data, the present invention converts the formats of other datasets with reference to the format of the CCKS2022 dataset to facilitate subsequent unified processing. Taking into account the large differences in the number of samples in different datasets, the present invention limits the samples of each dataset to less than 10,000 with reference to the processing of Wang et al. If the number of samples is more than 10,000, 10,000 samples will be randomly sampled, of which the CCKS2022 dataset contains multiple different extraction tasks, and each extraction task sample of the dataset retains 10,000 samples. The CMeIE dataset was not used to construct the Chinese information extraction instruction dataset, so the training samples were not deleted.

[0092] 3) Injecting Instruction Text: Process the preprocessed dataset using the two-stage information extraction instruction template described in Section 2.1.1, adding the instructions corresponding to the dataset task and replacing the "type list" in the instruction template with the list of specific types in the dataset task. Due to the input text length limitations of the model, this method splits data samples where the total length of the three components, instruction, text, and answer, exceeds 2000 words.

[0093] After the above processing, the present invention constructs a Chinese information extraction instruction dataset for information extraction pre-training from the public Chinese information extraction dataset. This dataset contains 91,552 samples, including 50,903 samples for entity recognition tasks, 23,214 samples for relationship extraction tasks, and 17,435 samples for event extraction tasks. An example of the format of the processed relationship extraction task samples is as follows:

[0094]

[0095] 2.3 LoRA-based method for fine-tuning instructions of the base model for feature extraction: In order to improve the extraction capability of the base model for feature extraction when the number of training samples is small, this aspect will use the Chinese information extraction instruction dataset and the political message feature extraction instruction dataset to fine-tune the model in turn. Both fine-tunings use the form of supervised fine-tuning commonly used in instruction fine-tuning research to train the model. Taking into account that full parameter fine-tuning requires a large amount of storage and computing power resources, the present invention uses the LoRA method to fine-tune the model. When using the LoRA method to perform feature extraction training on a large language model, it is first necessary to convert the instruction data into a token sequence that the model can process. Secondly, it is necessary to add an adapter layer to the model and freeze other parameters. Finally, the model is fine-tuned in a supervised manner.

[0096] (1) Training data preparation: In a large language model, a token represents the smallest unit that the model can process, usually a word, character, punctuation mark or phrase, and each token has its own unique numerical number. Each large language model has a corresponding vocabulary that records all tokens that the model can process and their numbers. The input that the model can process is a sequence composed of token numbers, hereinafter referred to as a token sequence. Therefore, before training, the training text needs to be converted into a token sequence that the corresponding model can process. At the same time, because the present invention uses a two-stage information extraction instruction design, it is necessary to use the multi-round dialogue capability of the large language model. Therefore, it is necessary to add tokens that identify the dialogue role and the start and end positions before and after the token sequence of questions and answers so that the model can correctly understand the historical dialogue when generating. Taking relation extraction as an example, the training data S of a relation extraction task can be represented as the five parts shown in formula (2.1) in the instruction data set. First, the text of each part is segmented according to the model's vocabulary and replaced with the corresponding token number. Then, conversation-related tokens are added. This method combines the instructions in the instruction dataset with the corresponding text as conversation questions, and uses the answers in the instruction dataset as conversation responses. This allows fine-tuning instructions using the same format as used during model training. Furthermore, "Text to be processed:" is inserted between the instructions and text in the instruction dataset to help the model distinguish between instructions and text. The format of conversation-related tokens varies between different models. For the Qwen model, for example, the structure of the processed training data S' is shown in Table 2.4.

[0097] Table 2.4 Example of token sequence format of relation extraction training data in the Qwen model

[0098]

[0099]

[0100] (2) Model preparation: Existing research shows that when training a model on a specific task, it only needs to be trained in a solution space with a number of dimensions far lower than the number of model parameters to converge. Therefore, many tasks have a low intrinsic dimension (Intrinsic Dimension). The LoRA method limits the dimension of the solution space by adding a low-dimensional adapter layer to the weight matrix of the linear layer and freezing the original weights, reducing the number of trainable parameters and reducing the storage and computing power requirements during training without affecting the fine-tuning effect. The existing large language model can generally be divided into three parts in terms of structure: an embedding layer, multiple Transformer decoding layers, and a language model output layer. The embedding layer is used to convert the input token sequence into the corresponding embedding vector, and multiple Transformer layers are used to capture the semantic features of the token in the input sentence and generate an embedding vector containing contextual semantic information for the input token. The language model output layer calculates the probability that the embedding vector containing contextual semantic information belongs to each token in the vocabulary.

[0101] Since the feature extraction task does not require adding new tokens to the model, all parameters of the embedding layer and the language model output layer are frozen, and no adapter layer is added. While reducing the number of trainable parameters, it can avoid the adjustment of the embedding parameters causing semantic deviation and affecting the training effect. For the Transformer decoding layer, the research of Hu et al. showed that under the same trainable parameters, reducing the adapter dimension and adding adapters to more linear layers can improve the training effect of the model. The experimental results show that the weight W of the multi-head attention part in the Transformer decoder layer is better than that of the multi-head attention part in the Transformer decoder layer. q ,W k ,W v ,W o Adding adapters can achieve optimal results. Therefore, in addition to the multi-head attention part, this paper also adds adapters to the two linear layers in the feed-forward network part of the Transformer decoder layer.

[0102] Research has shown that merging LoRA adapter layers and adding new adapter layers allows the model to search in different solution spaces. Because the model needs to be fine-tuned using two different datasets, and considering differences in domains and text sources, different information extraction tasks also require different model capabilities. Therefore, this approach adds adapter layers before each fine-tuning step and merges adapter layers after each fine-tuning step. This allows the model to search for optimal weights in different solution spaces when fine-tuning different tasks, thereby improving the model's performance in extracting elements from political messages.

[0103] (3) Supervised fine-tuning: After converting the instruction dataset into the corresponding token sequence and adding the adapter layer to the model, the supervised fine-tuning method can be used to train the model. Specifically, assuming that the token sequence of a training data is T = {t1, t2, ..., t n}, where n is the number of tokens in the token sequence, t i Indicates the number corresponding to the i-th token.

[0104] First, the token sequence T is input into the model after adding the adapter layer. After the calculation of the embedding layer, multiple Transformer decoding layers, and the language model output layer, the model will output Where vocab_size is the total number of tokens in the model vocabulary. L represents the cosine value of the embedding vector of each token in T in the input sentence and the standard output embedding of all tokens in the language model output layer. Matrix L is processed row by row to obtain matrix L'. L' represents the conditional probability distribution of the token generated by the next position of each token in T, that is, the i-th row and j-th column of L' represents the conditional probability of generating the token numbered j from the i+1-th token after the first i tokens of T. Assume that each t i Each corresponds to a probability distribution t' i , t' i The random variable value is all tokens in the model vocabulary, of which only the token numbered t i The probability of the token is 1, and the probability of other tokens is 0.

[0105] Then, calculate the loss function. The cross entropy loss function is usually used when fine-tuning a large language model. The text is partially adjusted based on this. The specific calculation formula is:

[0106]

[0107] where t i+1 Represents the i+1th token in the input sequence T, L' i Represents the conditional probability distribution of the i+1th token. CrossEntropyLoss represents the cross entropy loss function. Because the input contains the instructions, texts and answers of the instruction dataset, and in the feature extraction task, only the ability of the model to generate correct answers needs to be trained. If the loss function of all positions is calculated, not only will the model be trained to generate corresponding answers based on the instructions and texts, but the model will also be trained to generate instructions or texts. In order to reduce the interference of these trainings on the information extraction ability of the model, it is stipulated that q will be generated if and only if the text corresponding to the i+1th token belongs to the answer part or the dialogue termination mark of the answer part. i+1 =1, otherwise qi+1 = 0. Finally, the gradient of the parameters in the model is calculated according to the loss function and the weights of the trainable parameters are updated.

[0108] 2.4 Experiment and result analysis

[0109] 2.4.1 Experimental Design

[0110] (1) Experimental data: This experiment uses the following three datasets.

[0111] 1) Instruction data set for extracting elements of political messages: The present invention chooses to collect the data required for research from the "Ask the Government Hunan" online political inquiry platform. As a provincial political inquiry platform, the platform was founded earlier and has a large number of users. A large amount of political message data has been accumulated in the platform. At the same time, the platform provides message type and subject information to facilitate subsequent screening of the required message data. According to the production steps of the political element extraction instruction set in Section 2.2.2, the present invention first uses Python language to write a web crawler code to crawl the HTML code of the message page from the "Ask the Government Hunan" platform, and then uses XPath to locate the HTML element position of the message title, message content, reply content, message category, theme and other contents in the message page, then reads the text content of the HTML element, and finally saves it to the SQLite database. The present invention crawls a total of 319,774 messages and reply data that can be displayed on the website with message IDs between 1 and 600,000 on the "Ask the Government Hunan" platform. The question time of these messages is between 2010 and 2022, and 85,585 messages contain information such as replies and message types. Among these messages, 35,591 messages were marked as "complaint" on the platform, and their message times were between August 6, 2018 and August 9, 2022. After randomly sorting these messages and processing and labeling them according to the steps in Section 2.2.2, a total of 982 labeled complaint-type government messages and corresponding replies were obtained, including 7,354 entity elements and 1,703 corresponding relationships between processing departments and processing measures. Example of the processed message and reply data format:

[0112]

[0113] The number of entity elements in different categories is shown in Table 2.5. Before the experiment, the dataset was divided into training, validation, and test sets in a ratio of 7:1:2. The dataset for extracting elements from government messages will be referred to as the D-Elecment dataset.

[0114] 2) Chinese Information Extraction Instruction Dataset, which contains data from multiple information extraction tasks in multiple fields. For details, please see Section 2.2.2. It is referred to as the D-pretrain dataset below.

[0115] 3) The CMeIE dataset, a Chinese medical text entity relationship extraction dataset, contains pediatric and 100 common disease corpora. The CMeIE dataset used in this experiment was processed according to the instruction model, as detailed in Section 2.2.2. It should be noted that since the validation set of the CMeIE dataset does not have public labels, in this experiment, the validation set was randomly split into two parts, used as the validation set and the test set, respectively.

[0116] Table 2.5 Number of entity elements of different categories

[0117]

[0118]

[0119] (2) Experimental model: This experiment uses three different large language models to verify the effectiveness of the method for constructing a base model for feature extraction based on fine-tuning of large language model instructions proposed in this invention. The models used in this experiment are: 1) ChatGLM3 model. ChatGLM3 is a conversation pre-training model jointly released by Zhipu AI and Tsinghua University KEG Laboratory. This model is trained based on the General Language Model (GLM) architecture and has the characteristics of smooth conversation and low deployment threshold. 2) Qwen model. Qwen is an open source pre-training language model released by Alibaba. The model has stably trained large-scale, high-quality and diverse data, covering multiple languages, and has the capabilities of chatting, text creation, summarization, information extraction, translation, etc. 3) Yi model. The Yi model is a bilingual language model trained on the 3T language corpus and performs well in language cognition, common sense reasoning, reading comprehension, etc. The basic parameters of the model used in this experiment are shown in Table 2.6.

[0120] Table 2.6 Basic parameters of the model

[0121]

[0122] (3) Experimental parameters: The linear layers of the three large language models in this experiment with the adapter layer added are shown in Table 2.7.

[0123] Table 2.7 Linear layer with added adapter layer

[0124]

[0125] Through preliminary exploratory experiments, the parameter settings for pre-training the model for information extraction tasks using the D-pretrain dataset are shown in Table 2.8. Because this dataset contains a large amount of data, a setting of 4 epochs is sufficient for adequate model training. When training the model using the D-Elecment dataset, a setting of 12 epochs is used, and the remaining parameter settings remain the same as in Table 2.8.

[0126] Table 2.8 Fine-tuning parameter settings for information extraction instruction pre-training using the D-pretrain dataset

[0127]

[0128] The model's decoding strategy uses a search strategy to generate deterministic results, and the optimal sequence retained at each step is set to 2 to avoid consuming too much computing power and storage space during the decoding process.

[0129] 2.4.2 Evaluation Indicators: In information extraction tasks, precision, recall, and Micro-F1 indicators are generally used to evaluate the effectiveness of classification models. Assume that the labels of the dataset are where l i Represents the basic unit set of the i-th sample label, It represents the basic unit of information that needs to be extracted from the jth sample of the i-th sample. The extraction result of the model is where l' i Represents the basic unit set extracted by the i-th sample model, Represents the jth basic unit extracted by the i-th sample model. The granularity of basic units varies for different information extraction tasks. In named entity recognition tasks, a basic unit represents a binary tuple consisting of an entity and its relationship. In relationship extraction tasks, a basic unit represents a triple consisting of a relationship type, subject, and object. In event extraction tasks, a basic unit represents a set consisting of the type of an event and all its arguments and their corresponding categories. The same basic unit is then used to represent the extraction result of the model. Depending on whether the basic unit of the label is consistent with the basic unit extracted by the model, the extraction result and label of the model can be divided into two parts. The total number of basic units in the extraction result that are exactly the same as those in the label is recorded as TP, the total number of basic units that appear only in the extraction result is recorded as FP, and the total number of basic units that appear only in the label is recorded as FN.

[0130] The precision rate indicates the proportion of correct basic units extracted from the model extraction results. The calculation formula is as follows:

[0131]

[0132] The recall rate indicates the proportion of basic units correctly extracted from the label, and is calculated as follows:

[0133]

[0134] Micro-F1 is a comprehensive indicator that combines precision and recall to reflect the overall performance of the model. Its calculation formula is as follows:

[0135]

[0136] Because the Instructions dataset for extracting elements from government messages modifies elements that are unclear, missing, or redundant in the original text, the model cannot simply copy portions of the original text to generate elements. Instead, it must appropriately modify the text to make it more complete and clear. However, even for elements whose original text is relatively complete and clear, models often make certain modifications during generation, though these modifications typically do not affect the semantics. Therefore, using the Micro-F1 metric to evaluate model performance on the Instructions dataset is overly stringent. It requires that the basic units extracted by the model are completely consistent with those in the label for TP to be counted, and it cannot effectively distinguish between models. Gui et al. also addressed this issue when designing evaluation metrics for the InstructIE dataset, incorporating the Rouge-2 metric, commonly used in sequence generation tasks. When training a model for the on-demand information extraction task using instruction fine-tuning, Jiao et al. used the SentenceBERT model to calculate the similarity of the table headers for the F1 score, and used the Rouge-L F1 metric to assess the model's accuracy on table content.

[0137] This experiment also uses a similar soft matching method to calculate precision, recall, and Micro-F1. Since the SentenceBERT model does not have the ability to process Chinese text, this experiment uses the text2vec-large-chinese model in the text2vec toolkit to calculate sentence similarity. Specifically, for a basic unit extracted by the model Divide it into parts representing types Such as entity categories, relationship categories, etc., as well as parts that represent specific content Such as the value of the entity, the value of the subject, etc. Similarly, the basic unit in the tag Divided into type parts and content section when A basic unit in the label of the same sample When the type part is exactly the same and the sentence similarity of the content part is greater than or equal to the threshold p, it is considered and is a match and should be counted in TN. Note that for the relation extraction task, the content of the basic unit includes the subject and the object, and it is considered a soft match if and only if the sentence similarity of the subject and the object is greater than the threshold. Any basic unit in the label of the same sample When none of the is the basic unit of extraction error and is included in FP. Any basic unit in the extraction results of the same sample When neither constitutes a soft match, it is considered is a basic unit that was not correctly extracted and is included in FN. Obviously, when the similarity threshold p = 1, only basic units with identical types and content are matched, which is called a strict match. Then, the formula is used to calculate precision, recall, and Micro-F1. Below, Pp, Rp, and F1-p will be used to represent precision, recall, and Micro-F1 when the similarity threshold is p.

[0138] 2.4.3 Experimental results and analysis: In order to explore the effectiveness of the proposed method for constructing a feature extraction base model based on fine-tuning of large language model instructions, the text classification was fine-tuned using the training set of the D-Elecment dataset with and without the D-pretrain dataset for information extraction tasks, and then tested on the test set of the D-Elecment dataset. The results of entity feature extraction are shown in Tables 2.9 and Figure 3 As shown in Table 2.10 and Figure 4 shown.

[0139] After pre-training the information extraction task using the D-pretrain dataset, the entity feature extraction performance of all three models improved. When the similarity threshold was 0.8, the precision rate increased by an average of 1.75%, the recall rate increased by an average of 1.4%, and the F1 value increased by an average of 1.6%. In the relationship feature extraction task, the performance of all three models improved after pre-training the information extraction task using the D-pretrain dataset. When the similarity threshold was 0.8, the precision rate increased by an average of 1.26%, the recall rate increased by an average of 1.09%, and the F1 value increased by an average of 1.24%. This verifies the effectiveness of the proposed method. When the scale of training data is small, pre-training the task using labeled data from other fields of information extraction can help improve the model's general ability to perform information extraction tasks, thereby improving the model's ability to extract political message features.

[0140] Compared with the entity feature extraction task, the relationship feature extraction task is less effective. Analysis of the extraction result data reveals two main reasons for this disparity. First, in the replies to messages, there are complex situations such as multiple processing departments and treatment measures appearing in a staggered manner, and multiple processing departments taking certain treatment measures after being delegated step by step. This makes it difficult to identify the corresponding relationship between processing departments and treatment measures. Second, the relationship recognition subtask of relationship feature extraction uses relationship recognition instructions to control the model to generate corresponding triples based on the feature extraction results. Although this alleviates the problem of the model generating incorrect processing departments or treatment measures when directly generating triples, the relationship recognition results are limited by the recall rate of the processing department and treatment measure element extraction, and there is a certain error propagation problem.

[0141] Table 2.9 Entity feature extraction task test results (unit: %)

[0142]

[0143] Table 2.10 Relationship factor extraction task test results (unit: %)

[0144]

[0145] Due to the relatively small size of the D-Elecment dataset, this experiment used the larger CMeIE dataset to test the impact of information extraction pretraining on the model's performance in specific domains under different training set sizes. First, the Qwen model, both pretrained and non-pretrained for information extraction, was fine-tuned using the full CMeIE dataset training set. Then, 10% of the data randomly sampled from the CMeIE dataset training set was used for fine-tuning. Furthermore, following the instructions for the CMeIE dataset, the chinese-roberta-wwm-ext-large model was fine-tuned on both training data sizes as a reference baseline. Because all entities in this dataset are words or phrases from the original text, a strict matching method with a similarity threshold of 1 was used to calculate precision, recall, and F1 score as evaluation metrics. The experimental results are shown in Table 2.11.

[0146] Compared with the chinese-roberta-wwm-ext-large model, the Qwen model without information extraction task pre-training performed slightly better when using the full dataset, mainly due to an improvement in precision. Both accuracy and recall were significantly improved when using a small-scale training set. The Qwen model with information extraction task pre-training showed improvements on both training sets of different sizes compared to the model without information extraction task pre-training, and the improvement was more significant when using a small-scale training set. Among the three models, the Qwen model with information extraction task pre-training showed the least performance degradation when using a small-scale training set, indicating that information extraction task pre-training helps the model learn more general information extraction capabilities and improves the model's information extraction capabilities in the target domain. In particular, the performance improvement is more significant when the target domain dataset is small.

[0147] Table 2.11 Relationship extraction task test results of CMeIE dataset (unit: %)

[0148]

[0149] 3. Feature extraction method based on evidence theory and integrated learning: A feature extraction base model construction method based on fine-tuning of large language model instructions is proposed above, and experiments have verified that this method can train a model with good extraction effect on a small-scale data set. However, in the process of using a large language model to generate features, errors in the generation of preceding features will affect the generation of subsequent features, causing error transmission. Using a single model for feature extraction lacks a method to identify errors in preceding features, making it difficult to solve this problem. To address this problem, the present invention proposes a feature extraction method based on evidence theory and integrated learning. This method uses multiple models trained in the previous chapter to extract multiple candidate features and uses these models to evaluate all candidate features. Then, the evidence reasoning rule method is used to fuse the evaluation results to determine the extracted features. This method can effectively identify and select features that have a high probability on multiple models, avoid erroneous results due to the bias of a single model, and thus alleviate the problem of error transmission.

[0150] 3.1 Framework of the factor extraction method based on evidence theory and integrated learning: The present invention uses a sequence generation form to extract the elements of the political message. If the model generates an erroneous pre-order element, in the process of generating the subsequent elements, the model will refer to the input instructions, text and pre-order elements to generate the subsequent elements. In particular, there is a dependency relationship between the entity elements such as the complaint problem, the location of the complaint problem, and the appeal extracted by the present invention. Therefore, it is necessary to check the elements generated by the model and correct the erroneous elements. The present invention uses multiple different large language models to evaluate the generated elements to identify the erroneous elements, and uses a search-based candidate element search method to generate multiple candidate elements to provide a larger selection range to provide better quality candidate elements. Unlike traditional large language model integration research that integrates after the model has completely generated the result, the present invention chooses to integrate immediately after the model generates an element, and continues to the next element after the integration result, so that the model that originally generated the erroneous element can continue to generate on the correct result after integration, reducing the problem of error transmission. The framework of the factor extraction method based on evidence theory and integrated learning is as follows. Figure 5 This integration method is a cyclic process. In each round of the cycle, multiple candidate elements are searched and one of them is selected as the result and added to the input text. The calculation process of each round in the cycle is as follows:

[0151] First, a search strategy is used to use different models to search for several candidate elements after the instructions, text and extracted elements of the same sample. The set of all candidate elements is used as the selection range for this round of integration. The candidate element search method is detailed in Section 3.2. Then calculate the confidence of each model for each candidate element. The confidence of each model for all candidate elements participates in the evidence fusion of this round as a piece of evidence. The candidate element confidence calculation method is detailed in Section 3.3. Then calculate the weight of each model. The present invention uses the NSGA-II algorithm to determine the weight of each model and use it as the weight of the evidence generated by the model. For details, please see Section 3.4. Finally, use the evidence reasoning rule method to fuse the confidence of different candidate elements from different models, select the candidate element with the highest probability after fusion as the element generated in this round, add it to the extracted elements, and then perform the next round of element generation. The evidence fusion calculation method based on evidence reasoning rules is detailed in Section 3.5.

[0152] To terminate feature generation at the appropriate time, each model's confidence level is calculated during each round of model evaluation, and this confidence level is used as a special factor in the result fusion. Feature generation ceases when the factor with the highest confidence level in the fusion result becomes the termination token. The pseudocode for this feature extraction method based on evidence theory and ensemble learning is shown in Algorithm 3.1.

[0153]

[0154] 3.2 Search-Based Candidate Element Search Method: In evidence theory, an identification framework represents a set of mutually exclusive propositions that can form a complete set. For entity element extraction and relationship element extraction tasks, a proposition represents the next element to be generated after the instruction, text, and generated elements. The present invention uses a sequence generation method to achieve element extraction. The number of all possible elements is exponentially based on the size of the model vocabulary. Obtaining all possible elements is computationally infeasible. However, most possible elements are simply random combinations of words with no practical meaning and are generally not considered as possible answers to questions. From the perspective of a large language model, the generation probability of most possible elements is extremely low. Therefore, the present invention only selects a set of elements with high conditional probabilities as the identification framework. Specifically, the present invention uses a search strategy to generate multiple elements through multiple models, and uses these elements and a set of tokens representing termination as the identification framework. As described in Section 2.2, the generation format of entity elements and relationship elements is basically the same. Unless otherwise specified, candidate elements below refer to both entity elements and relationship elements. The present invention uses a search decoding strategy to generate multiple candidate elements. This strategy can search for multiple candidate elements with high conditional probabilities at a relatively low computational cost. Although sampling-based decoding strategies such as Top-K and Top-p can also generate multiple different candidate elements through multiple sampling, they may also generate multiple identical candidate elements, resulting in a waste of computing resources. At the same time, the characteristics of the question and message element extraction task are taken into consideration.

[0155] (1) Since in the search algorithm, the criterion for evaluating the generated text sequence is the conditional probability of the text sequence, when using traditional Chinese characters or synonyms to replace words in the text, the conditional probabilities of the two text sequences may not differ much. Therefore, it is easy to generate multiple slightly different versions of the same selected element using the classical search algorithm. To better generate multiple different candidate elements, the present invention prohibits the model from generating any traditional Chinese characters. Although the question-and-answer message data used does not contain any traditional Chinese characters, when using classical search decoding, the model may generate candidate elements containing traditional Chinese characters. Because the vocabulary of the model used in the present invention covers common Chinese characters, Chinese words, and English words, among which the Chinese characters and Chinese words include simplified Chinese characters and traditional Chinese characters. In the pre-training of massive data, the model has learned the relationship between traditional Chinese characters and their corresponding simplified Chinese characters, which is specifically manifested in the output embedding matrix of the output layer of the model. The embedding vectors of simplified Chinese characters and their corresponding traditional Chinese characters have a relatively high cosine similarity. Therefore, in the search process, elements represented by simplified Chinese characters and elements represented by traditional Chinese characters usually have similar conditional probabilities. As a result, the search results may contain multiple candidate elements that have no difference except for traditional and simplified Chinese characters. For example, when using the Qwen model for search, it will search for two candidate elements: "Daokou Village, Changpu Township, Suining County, the location where the complaint problem occurred" and "Daokou Village, Changpu Township, Suining County, the location where the complaint problem occurred". In the output embedding of the output layer of the Qwen model language model, the cosine similarity between the output embeddings corresponding to the tokens "鋪" and "铺" is 0.6172. Therefore, the present invention skips all sequences containing traditional Chinese characters at the stage of selecting and retaining sequences during the search process to avoid this problem.

[0156] (2) Only generate the element content part of the entity candidate element. This modification is only used when extracting entity elements because there is only one type of relationship type in the relationship element extraction task and it is located at the front of the relationship triple. As described in Section 2.2.2, the output format of an entity element is "(element content, element category)". During the model training process, the 8 entity element categories frequently appear as part of each entity element. Therefore, when the model outputs the token sequence corresponding to the correct entity element category, the conditional probability of each token is very high. In the search algorithm, the length of each candidate sequence is exactly the same. Therefore, if the element content of some sequences is shorter but the element category is longer, its conditional probability may be higher than that of other sequences with longer element content. To reduce the influence of the element category length on the sequence score, the present invention adopts the following strategy during the search: After the generation of the element content part of a sequence is completed, that is, when the last token of the sequence is the token corresponding to the comma, stop the generation of the sequence. Then, calculate the confidence of generating each category after this sequence and select the category with the highest confidence as the category of this candidate element. The calculation method of the element category confidence is described in detail in Section 3.3.

[0157] The process of searching for candidate entity elements using the modified search algorithm is shown in Algorithm 3.2. The algorithm requires as input the sample's instructions, text, and generated elements, and specifies the number of candidate elements to search, num_beams, through model hyperparameter settings. The initial value of the number of unfinished candidate sequences, k, is set to num_beams; the initial value of the k unfinished sequences is set to an empty sequence. First, the model is used to predict the probability distribution of the next token of the current unfinished candidate sequence within the model vocabulary. Sequences that do not contain traditional Chinese characters are filtered out from the token sequence consisting of the unfinished candidate sequence and the next token. Next, the conditional probability of the last token in the filtered token sequence is multiplied by the conditional probability of the corresponding original sequence (the unfinished candidate sequence) to obtain the conditional probability of the new token sequence (the conditional probability of a token sequence of length k = the conditional probability of the sequence consisting of the first k-1 tokens of the sequence × the conditional probability of the last token). Then, the k sequences with the highest conditional probabilities are selected from the new token sequence as the unfinished candidate sequences for the next step. Finally, check whether there are any candidate sequences in the next step whose last token is a comma. If so, calculate the confidence of each feature category generated after these token sequences (the token sequences of feature names), select the feature category with the highest confidence as the feature category, mark these token sequences as completed, and then reduce the value of k accordingly. If the number of unfinished sequences k is still greater than 0 at this time, continue the loop until all sequences are completed.

[0158] The process for searching for candidate relationship elements is similar to that for searching for candidate entities. The difference is that the sequence generation is completed only if the last token in the sequence contains a right bracket. Finally, the next step is to check whether any candidate sequence contains a token whose last token is a token from the vocabulary that begins with a right bracket.

[0159] It's important to note that text generation using a large language model typically stops after the model outputs a termination token. However, this method doesn't generate a termination token in its candidate feature search method. Instead, it adds a termination token to each round of integration and calculates its confidence to determine when to stop generating features. Because this method uses three different large language models for integration, but their vocabularies are different, the same text sequence will be segmented into different token sequences in different models. Take the three punctuation marks “),(” between two elements as an example. In the Qwen model, it is one token “),(”, in the ChatGLM3 model, it is two tokens “),” and “(”, and in the Yi model, it is three tokens “)”, “,” and “(”. This means that when generating candidate elements after some elements have been generated, it is necessary to start generating after the type of the last element of the generated elements, so that the Qwen model and the ChatGLM3 model can generate the termination token in the normal order. However, starting to generate after the type of the last element of the generated elements means that other content may be generated in the feature type part of the last element of the generated elements, and the need to generate additional tokens increases the calculation time when generating candidate elements. Adding a termination token to the recognition framework can avoid these problems and reduce the complexity of the algorithm.

[0160]

[0161] 3.3 Confidence calculation method of candidate elements based on the geometric mean of conditional probability: In evidence theory, basic probability distribution represents the degree of support of an evidence for each proposition or proposition combination in the power set of the identification framework. For the task of extracting elements from political messages, a piece of evidence is the degree of support for each candidate element by a large language model participating in the integration. In the search decoding strategy, the conditional probability of the generated text sequence is used as the basis for evaluating the quality of the generated sequence. During the search process, the sequences to be evaluated have the same length, but when evaluating the quality of candidate elements with different lengths, using conditional probability as the evaluation basis will obviously benefit candidate elements with shorter texts. The large language model is in the sequence t1, t2,…, t q The sequence t generated later q+1 ,t q+2 ,…,t q+u The conditional probability is:

[0162]

[0163] The conditional probability of each token in the generated sequence is a number in the interval (0,1), so even if the conditional probability of each token is the same, the conditional probability of the long text will be lower than that of the short text. Therefore, the present invention selects the geometric mean of the conditional probability of each token in the candidate element as the confidence of the candidate element. The use of geometric mean can eliminate the influence of text length and can compare candidate elements of different lengths more fairly. Similarly, categories of different lengths will also affect the confidence of the candidate elements, because element categories appear frequently during the fine-tuning process, and the conditional probability of each token in the correct element category is close to 1. When the length of the element content part of the candidate element is the same as the conditional probability, the confidence of the candidate element with a longer element type text is higher. Therefore, the element type part of the candidate element will be regarded as a single token to participate in the confidence calculation, and its conditional probability is the geometric mean of the conditional probability of each token, reducing the influence of type length on confidence.

[0164] Specifically, for the entity feature extraction task, assume that the token sequence corresponding to the sample's instructions, text, and generated features is T, where T includes the comma and left bracket after the last generated feature to ensure that the same token as used in training is used to represent the three punctuation marks "),(". Candidate entity feature θ e The token sequence of the element content part is Where lv is the sequence length. The token sequence of the feature type part of the candidate feature is Where lc is the sequence length. The set TE represents the set of tokens starting with a right bracket in the vocabulary of model m. Taking the Qwen model as an example, TE = {"), (",")"}. Then the candidate entity factor θ e The confidence calculation formula on model m is as follows:

[0165]

[0166] where t comma represents the token corresponding to the comma. PEC represents the conditional probability of the token corresponding to the comma. PET represents the geometric mean of the conditional probabilities of the candidate feature types. PEE represents the probability of the token that marks the end of a feature. As mentioned above, two different tokens may be used to mark the end of a feature in the Qwen and ChatGLM3 models, so the sum of the conditional probabilities of the two is taken.

[0167] For the relational element extraction task, assuming that the token sequence corresponding to the sample's instructions, text, and generated elements is T, the candidate relational element θ r The token sequence consisting of the relationship type, subject, and object is Where lr is the sequence length. Then the candidate relationship element θ r The confidence calculation formula on model m is as follows:

[0168]

[0169] Where TRE represents the set of tokens starting with a right bracket in the vocabulary of model m.

[0170] In the basic probability allocation stage, in addition to calculating the confidence of the candidate elements, the confidence of the termination token also needs to be calculated. The present invention uses the conditional probability of the termination token to represent the confidence of the termination token, and its calculation formula is:

[0171] Confidence(m,θ end )=P(t end |T') (3.4)

[0172] where θ end is a proposition in the identification framework that indicates the termination of continued generation, t end represents the termination token, and T' represents the token sequence corresponding to the sample's instructions, text, and generated elements.

[0173] Finally, the confidence of all propositions in a piece of evidence on the corresponding model is scaled to ensure that the sum of the basic probability distribution is 1. Specifically, for model m and identification framework Θ = {θ1,θ2,…,θ n}, the evidence e corresponding to model m m for:

[0174]

[0175] where p m,θ Indicates evidence m The degree of belief in the proposition θ.

[0176] 3.4 Model weight determination method based on NSGA-II algorithm

[0177] When using multiple models for integration, it is necessary to assign appropriate weights to each model to adjust the influence of different models on the integration results, thereby improving the integration effect. Since the present invention includes two tasks: factor extraction and identification of the correspondence between processing departments and processing measures, an algorithm with multi-objective optimization capabilities is required to search for model weights. Secondly, because the relationship between model weights and the effect of the final task is complex and there is an obvious mutual influence between the weights of several models, it is inconsistent with the premise assumptions of the hyperparameter search algorithm based on Bayesian optimization. Taking into account the low convergence efficiency of grid search and random search algorithms and the high computing power consumption of using multiple large language model integrations for factor extraction. Therefore, the NSGA-II algorithm with multi-objective optimization capabilities is used to search for the optimal combination of model weights in the verification set.

[0178] The NSGA-II algorithm is a non-dominated genetic algorithm used for multi-objective optimization tasks. It uses an elite retention strategy to ensure that individuals with good performance can continue to participate in the inheritance. At the same time, it uses the crowding distance indicator to determine the degree of crowding of individuals in the solution space, giving priority to individuals in the relatively "open" areas of the solution space. This allows the searched individuals to be more evenly distributed on the Pareto optimal frontier, thereby improving the diversity of the population. The following will introduce the key steps of the NSGA-II algorithm.

[0179] (1) Chromosome encoding method: In genetic algorithms, feasible solutions are regarded as chromosomes. Since the goal of using NGSA-II in the present invention is to search for the optimal weight combination, a floating-point encoding scheme is used. Specifically, each gene position represents the weight of a model, which is represented by a floating-point number. At the same time, considering that the sum of the weights of evidence should be 1, and the weight of evidence is the weight of the model that generates the evidence, at the end of the operator involving the generation of new chromosomes, such as population initialization and the generation of new individuals, each gene position in the chromosome is divided by the sum of all gene positions to ensure that the sum is 1. An example of chromosome encoding:

[0180]

[0181] (2) Designing a fitness function: In genetic algorithms, the fitness function is used to evaluate the performance of an individual in solving the target problem. Since the feature extraction task consists of two parts: entity feature extraction and relationship feature extraction, two fitness functions are required to determine the effects of different weight combinations on the two tasks.

[0182] 1) For the entity feature extraction task, this paper uses the F1-0.8 index of the integrated model on the validation set of the D-Elecment dataset as the fitness function for the entity feature extraction task. For detailed information about the F1-0.8 index, see Section 2.4.2.

[0183] 2) For the relational element extraction task, the present invention uses the F1-0.8 index of the integrated model on the validation set of the D-Elecment dataset as the fitness function of the relational element extraction task.

[0184] (3) Genetic operators: The genetic operators in the genetic algorithm mainly include selection operators, crossover operators and mutation operators, which are used to generate offspring populations from parent populations. The present invention chooses to use the binary tournament algorithm, randomly extracting two individuals from the parent individuals each time, and selecting the individual with the lower Pareto rank. When the Pareto ranks of the two individuals are the same, the individual with the larger crowding distance is selected, and the process is repeated until half of the number of individuals in the parent population is selected for reproduction. For the calculation method of Pareto rank and crowding distance, please refer to the literature. Since the present invention chooses to use floating point encoding, the simulated binary crossover operator and the polynomial mutation operator are used to better search the surrounding area of ​​the weight with excellent effect.

[0185] (4) Iterative search using the NSGA-II algorithm: After determining the genetic encoding method, fitness function, and genetic operator, the steps of the NSGA-II algorithm are followed to perform population initialization, generate offspring populations, calculate non-dominated ranks and crowding distances, sort, and select new parent populations to search for a better model weight combination. For details of the search process, please refer to the literature. Given that the generation of large language models requires a large amount of computing power and time, and considering that decoding methods without random processes such as greedy search and search produce the same generation results when the same sequence is input, the present invention adds a cache mechanism to the NSGA-II algorithm search process for input text and corresponding record generation results to speed up the search process. Specifically, the present invention saves the relevant parameters and results of the two steps of candidate element search and candidate element confidence calculation into the database. Taking candidate element search as an example, the parameters that affect the search results include the specific model used for the search, the text before the model starts searching, and the search strategy and its parameters. The present invention uses the set of these parameters as a key and saves the search results as a value into the database. Whenever a candidate feature needs to be searched, the database is first searched to see if the same key exists. If so, the result is returned directly. If not, the model is called to perform calculations and the key-value pair is saved in the database before returning the result.

[0186] (5) Optimal solution selection: After iterative search, a set of Pareto optimal solutions and corresponding Pareto optimal frontiers can be obtained. The present invention selects the one with the largest sum of the F1-0.8 index of the entity factor extraction task and the relationship factor extraction task as the final searched weight.

[0187] 3.5 Candidate factor information integration method based on evidence reasoning rules: In evidence reasoning rules, the identification framework is composed of a set of mutually exclusive propositions that can form a complete set. In the task of extracting elements from political messages, the identification framework is the set consisting of all candidate elements and the termination token. An evidence e is defined as:

[0188]

[0189] where p θ Represents the confidence of evidence e in a proposition or proposition combination θ. This invention considers the confidence of a model for all candidate elements in the identification framework as one piece of evidence. The weight of evidence represents the decision maker's judgment of the importance of different pieces of evidence relative to the evidence in the evidence fusion process. This invention uses the weight of the model that generates the evidence as the evidence weight. The reliability of evidence, on the other hand, represents the ability of the evidence's information source to provide a correct evaluation of the problem. In ensemble learning, the performance indicators of the base model can usually be used as the reliability of the evidence generated by the base model. Considering that in this invention, the evidence is generated by a large language model, the reliability of the evidence should be determined by the large language model's ability to generate correct results in the task. As can be seen from Section 2.4.3, the three large language models are similar in terms of indicators such as precision and recall. At the same time, when performing evidence fusion, the confidence of the evidence for candidate elements or relationship triples is calculated using the confidence. Therefore, this invention calculates the average confidence of each element in the validation set labels of the D-Elecment dataset in model m as the reliability of the evidence generated by model m.

[0190] Specifically, the evidence e generated by model m m Reliability m The calculation formula is as follows:

[0191]

[0192] Where Y represents the set of all elements in the labels of the validation set of the D-Elecment dataset, |Y| represents the number of elements in the set Y, and the confidence calculation method of the elements is detailed in Section 3.3.

[0193] Assuming that all base models search out n-1 different candidate elements in one round of integration, the identification framework Θ={θ1,θ2,…,θ n}, (i≠j; i,j=1,2,...,n). Assume that there are lm different base models that calculate the confidence of the candidate elements in the identification framework and generate lm pieces of evidence e1,e2,...,e lm , the weight of the i-th evidence is w i , reliability is r i Then the evidence ei The weighted confidence distribution g i for:

[0194]

[0195] Where P(Θ) is a special element added to preserve the remaining confidence after weight discount, and specifies any subset of the identification frame θ∩P(Θ)=θ. Let e(i) represent the first i pieces of evidence e1, e2, ..., e i After fusion, the evidence generated by all lm basis models can be calculated using the following iterative formula:

[0196]

[0197] where g θ,e (i) represents the confidence of the weighted confidence distribution of the evidence e(i) after the fusion of the first i pieces of evidence on the subset θ of the identification framework. P(Θ),e(i) It represents the confidence of the weighted confidence distribution of the evidence e(i) after the fusion of the first i pieces of evidence on the element P(Θ). For the first piece of evidence, there is g θ,e(1) =g θ,1 .

[0198] The element with the highest probability in the evidence e(lm) generated by all lm basis models after fusion is selected as the integration result. If the integration result is a candidate element, it is added to the answer and the next element is integrated. If the integration result is a termination token, the loop is stopped and the existing elements in the answer are taken as the final extraction result.

[0199] 3.6 Experiment and Results Analysis

[0200] 3.6.1 Experimental Design

[0201] (1) Experimental Data: The dataset used in this experiment is the D-Elecment dataset, which is a dataset for extracting elements from complaint-related political messages. For more information about this dataset, see Sections 2.2.2 and 2.4.1. This dataset is constructed by manually annotating complaint-related political messages from the "Wen Zheng Hunan" online political inquiry platform. There are 982 complaint-related political messages and their corresponding replies, which are randomly divided into training, validation, and test sets in a ratio of 7:1:2.

[0202] (2) Evaluation indicators: In order to reflect the effectiveness of the factor extraction method based on evidence theory and ensemble learning proposed in this invention, this experiment uses the following evaluation indicators.

[0203] 1) Precision Pp (soft matching) reflects the proportion of correctly extracted basic units in the extraction results, where p is the soft matching threshold. 2) Recall Rp (soft matching) reflects the proportion of correctly extracted basic units in the label, where p is the soft matching threshold. 3) Micro-F1 Fp (soft matching) combines precision and recall to form a comprehensive indicator of overall model performance, where p is the soft matching threshold. The calculation methods for these indicators are detailed in Section 2.4.2.

[0204] (3) Comparative Methods: The present invention selects the following three methods for comparative analysis. For ease of explanation, EG-ERRule is used to refer to the factor extraction method based on evidence theory and ensemble learning proposed in the present invention.

[0205] 1) ChatGLM3, Qwen, and Yi: A single large language model pre-trained on the D-pretrain dataset for information extraction instructions and fine-tuned on the D-Elecment dataset. This model also serves as the base model for the ensemble. 2) EG-Avg: An ensemble method that uses averaging at the feature level. 3) FG-ERRule: An ensemble method that generates all features at once and uses evidential reasoning rules.

[0206] (4) Parameter setting: Unless otherwise specified, all base models use the search-based candidate feature generation method described in Section 3.2, and the number of sequences retained in each step of the search process is 2. All methods that require model weights use the NSGA-II-based evidence weight determination method described in Section 3.4 to perform weight search on the validation set of the D-Elecment dataset. After preliminary exploratory experiments, the parameters shown in Table 3.1 were used for model weight search. At the same time, the search was stopped after the F1-0.8 index of the two tasks of entity feature extraction and relationship feature extraction did not improve for more than 10 generations. The reliability of the model was calculated according to the method described in Section 3.5, and the results are shown in Table 3.2.

[0207] Table 3.1 NSGA-II algorithm search parameters

[0208]

[0209] 3.6.2 Experimental Results and Analysis: To verify the effectiveness of the feature extraction method based on evidence theory and ensemble learning, we used different methods to perform entity feature extraction and relationship feature extraction tasks on the D-Elecment dataset test set. The results of all the comparison methods and the base model for the entity feature extraction task on the D-Elecment dataset are shown in Table 3.3. As can be seen from Table 3.3:

[0210] (1) All ensemble methods have significantly improved the precision, recall, and Micro-F1 values ​​compared to the base model, demonstrating the effectiveness of using confidence to evaluate the quality of candidate features and implementing an ensemble strategy based on this. Although the features generated by the base model may be incorrect due to factors such as the small number of training set samples and the limited model size, the correct features usually have a higher confidence on the base model. Candidate features with high confidence on all three base models are more likely to be correct features. The average confidence of the generated results of different methods or models on the base model is calculated on the validation set of the D-Elecment dataset. The results are shown in Table 3.4. The average confidence of the features generated by several ensemble methods using confidence as an indicator for evaluating the quality of candidate features is higher, while the average confidence of the generated results of a single base model on other base models is slightly lower than the average confidence of the validation set labels on other base models, indicating that each base model has a certain ability to identify incorrect features. Therefore, integrating the confidence information of multiple base models can identify the generation errors of the base models and select appropriate candidate features as the ensemble results.

[0211] (2) Compared with the EG-Avg method, the EG-ERRule method proposed in this paper has a similar precision at a similarity threshold of 0.8, a 2.57% increase in recall, and a 1.34% increase in Micro-F1. This shows that compared with the average method, the candidate factor integration method using evidence reasoning rules can more effectively fuse the uncertain evidence generated by different base models.

[0212] (3) Compared with the FG-ERRule method, the EG-ERRule method, which integrates at the element granularity, has a slightly lower precision, but a significantly improved recall rate, with the Micro-F1 value at a similarity threshold of 0.8 increasing by 1.6%. One reason for the significant improvement in recall is that the generation of elements is more flexible. Each element can be evaluated and integrated individually to determine whether it needs to appear in the final generated answer, rather than being selected as a whole with other elements. The EG-ERRule method generated a total of 1,460 different elements on the D-Elecment dataset test set. The EG-Avg method, which also integrates at the element granularity, generated 1,410 different elements, while the FG-ERRule method only generated 1,358 elements. Overall, the EG-ERRule method has a better extraction effect, proving that integration at the element granularity is more effective.

[0213] Table 3.3 Entity feature extraction task test results (unit: %)

[0214]

[0215] Table 3.4 Mean confidence of the generated results of different methods or models on the base model

[0216]

[0217]

[0218] The results of the relational feature extraction task of all comparison methods and base models on the D-Elecment dataset are shown in Table 3.5. From Table 3.5, we can see that: (1) In general, the ranking of each model on this task is basically consistent with that in the entity feature extraction task. On the one hand, the relation recognition subtask is performed after the entity recognition subtask, and the subject and object of the extracted triples come from the entity feature extraction task. Its results are affected by the quality of the entity feature extraction task. On the other hand, the two tasks require the model to have some similar capabilities to complete, such as the ability to understand the role of part of the text in the entire message or message reply. Therefore, the model that performs well in the entity feature extraction task also performs well in the relational feature extraction task. (2) Compared with other methods, the FG-ERRule method integrated at the entire generated content granularity has higher precision and lower recall. On the one hand, this is due to the influence of the entity feature extraction results. On the other hand, when using confidence to evaluate the entire answer composed of multiple triples, if all correct triples have the same conditional probability and all incorrect triples have the same but lower conditional probability, then the confidence of the entire answer is positively correlated with the proportion of correct triples in the answer. Therefore, using this integration method is more likely to select answers with only a small number of high-confidence triples, resulting in a higher precision but lower recall in the final test results.

[0219] Table 3.5 Relationship factor extraction task test results (unit: %)

[0220]

[0221] The entity element generation results of the EG-ERRule method proposed in this invention are statistically analyzed according to element categories. The results are as follows: Figure 6 As shown. Figure 6It can be seen that: (1) The entity element extraction effect of the processing department category is the best. There are two main reasons for this result. First, the number of processing department elements is second only to the processing measures, and the model has more samples for training this category; second, the processing departments in the message replies are mainly government departments such as public security, street offices, urban management, and public enterprises and institutions such as water companies, state grids, and natural gas companies responsible for water supply, power supply, gas supply and other infrastructure. The model only needs to extract the names of such government departments and public enterprises and institutions that appear in the message to usually correctly extract the processing department. (2) The recall rate of the complaint object and the time of occurrence of the complaint problem is low. The possible reason is that the number of these two elements is small and the model lacks sufficient training samples. The reason for the small number of these two types of elements is mainly that for complaints such as road damage and road section lighting, the complaint object and the specific time of occurrence are difficult to verify and are not helpful for the handling of the problem. The complainant usually does not mention it. (3) The extraction effect of the harmful factors caused by the complaint problem is poor, with low precision and recall rates. The reason for this phenomenon may be that the message contains many descriptions of the harm of the complaint problem, especially the harm to the message writer himself. The same harm may be mentioned repeatedly, and the model may extract it multiple times. For example, in the message "... causes gas to return directly from the smoke pipe to every household. The smell is disgusting... When I return home, there is a pungent smell...", the harm of irritating oil smoke entering the home is described many times. In addition, the description of the harm caused by the complaint problem in the message often uses rhetoric techniques such as metaphors and exaggerations. It is usually impossible to use the original text directly when annotating, and certain modifications need to be made. Therefore, when extracting such factors, the model also needs to generate modified entity factors based on the original text, which makes extraction more difficult.

[0222] 3.6.3 Analysis of the impact of model weights: To explore the impact of model weights on the integration effect, this paper analyzes the search process of the model weight determination method based on the NSGA-II algorithm introduced in Section 3.4 when determining the optimal weight of the EG-ERRule method. Figure 7 The F1-0.8 index of the EG-ERRule method for entity feature extraction and relationship feature extraction on the validation set during the iterative process is shown. Figure 7 The dot in the middle represents the index value of the individual with the highest F1-0.8 index among the newly added individuals in one iteration, and the green line represents the index value of the individual with the highest F1-0.8 index found during the iteration. The optimal weight combination for the entity feature extraction task is searched when the iteration reaches the 4th generation population, and the optimal weight combination for the relationship feature extraction task is searched when the iteration reaches the 5th generation. The iteration stops after both indicators do not increase in 10 consecutive iterations. Figure 7It can also be seen that the weight combination randomly initialized in the first iteration has already worked well in the entity feature extraction task, while the relationship feature index has large fluctuations during the search process. The possible reason is that the evaluation results of all base models on the quality of entity features are relatively similar in most of the validation set data, and are therefore less affected by the weights.

[0223] The evidence weight determination method based on the NSGA-II algorithm is as follows: In the iterative process, all weight combinations are combined on the validation set to obtain the F1-0.8 index of the entity and relationship feature extraction task. Figure 8 As shown, Figure 8 The red dots in represent the Pareto optimal weight combinations. Figure 8 As can be seen from the figure, there is a clear positive correlation between the F1-0.8 index values ​​of the two tasks. The weight combination that performs well in the entity feature extraction task also performs well in the relationship feature extraction task. This shows that the two tasks have certain similarities, and using data from both tasks for simultaneous training can help improve the model's performance on both tasks.

[0224] The present invention selects the weight combination with the largest F1-0.8 index on the two tasks as the final weight combination, that is, the weight combination represented by the red dot in the upper right corner. The model weight of this point is shown in Table 3.6. The F1-0.8 index values ​​of the EG-ERRule method on the two tasks under different model weights are shown in Table 3.6. Figure 9 As shown. Figure 9 It can be found that: (1) When the weight of the ChatGLM3 model is high, the effect of the ensemble method is generally poor. As shown in Table 3.4, the confidence averages of the other two base models on the ChatGLM3 model generation results are low. It is speculated that there is a big difference between the text generation style of the ChatGLM3 model and the label. The other two models cannot accurately evaluate the quality of the ChatGLM3 model generation results. Therefore, when the ChatGLM3 model weight is high, the ensemble result is poor. Similarly, among the model weights finally searched, the ChatGLM3 model weight is low. (2) When the weight of a model is large, the effect of the ensemble method is worse than when the model weights are more balanced. The possible reason is that when the weight of a model is too large, the other models cannot correct the model when it makes an error, and the ensemble result is closer to the result of a single model. Secondly, when the model with a large weight mistakenly gives too high a confidence to the termination token, the ensemble method will terminate the generation early, resulting in the inability to generate subsequent elements. For the same reason, the ensemble result of some weight combinations is worse than the result of a single model.

[0225] Table 3.6 Model weights of the EG-ERRule method

[0226]

[0227] As mentioned above, since online government messages are informal texts with problems such as missing characters and missing components, traditional information extraction methods based on sequence classification or pointer networks are unable to identify valid information fragments and extract clear and accurate element information. This paper addresses the problems existing in the task of extracting message information from online government platforms and proposes corresponding solutions. The main work and conclusions of this paper are as follows:

[0228] (1) Research on the method of constructing a feature extraction base model based on fine-tuning of large language model instructions. The text of online political inquiries and messages is highly colloquial, and there is a lack of labeled data in the field of political message element extraction. It is difficult for traditional models to extract concise and clear feature information from them. To address this problem, the present invention proposes a method of constructing a feature extraction model based on fine-tuning of large language model instructions. This method uses a large language model to perform feature extraction tasks in a sequence generation manner, and utilizes the good text generation ability of the large language model to extract concise and clear feature content from the colloquial feature description. In the instruction fine-tuning, the method first uses information extraction data from other fields for fine-tuning to improve the general extraction ability of the model and alleviate the problem of insufficient message element extraction data; then, a complaint-type political message instruction dataset is constructed to further fine-tune the model, and the general extraction ability learned by the model is transferred to the task of extracting political message elements. Experimental results show that fine-tuning using information extraction data from other fields can effectively improve the model's political element extraction effect.

[0229] (2) Research on the factor extraction method based on evidence theory and ensemble learning. In response to the problem of error propagation in the sequence generation process of large models, the present invention proposes a factor extraction method based on evidence theory and ensemble learning. This method uses a search strategy to search for candidate factors, calculates the conditional probability geometric mean of the candidate factors as an evaluation index, uses the NSGA-II algorithm to search for appropriate model weights, and uses the evidence reasoning rule method to fuse the evaluation results of different models, selects appropriate factors as the integration results, and generates subsequent factors based on the integration results. Experimental results show that this method can effectively improve the accuracy of generated factors, avoid the generated erroneous factors affecting the generation of subsequent factors, and improve the accuracy of factor extraction.

Claims

1. A method for extracting elements from online message text based on large language model integration, characterized in that: Used to perform the task of extracting elements from government messages, where the elements include entity elements and / or relationship elements, and the extraction task includes entity recognition task and / or relationship recognition task; The extraction method is applied to a large language model, the large language model includes at least two base models with different vocabularies, wherein the text describes the text of the element to be extracted, the instruction describes the type and output format of the element in the text of the element to be extracted, and the answer describes the extracted element output by the base model according to the instruction; The network message text element extraction method based on large language model integration includes: S100. Input a sample token sequence into the base model, wherein the sample token sequence includes an instruction, a text, and a token sequence of extracted elements; The input sample token sequences of different base models are the same, but the vocabulary of different base models are different; Wherein, if the sample token sequence does not have the extracted element, the token sequence of the extracted element is empty; S200. Any base model outputs a token sequence of k candidate elements according to the input sample token sequence; S300. Calculate the confidence of any candidate element in all candidate elements output by all base models on any base model, and calculate the confidence of the termination token; S400. Assign weights to any base model; S500. Taking the confidence of any candidate element on any base model and the confidence of the termination token as the confidence of the proposition of the identification framework of the evidence reasoning rule, and generating evidence of any base model according to the confidence of the proposition of any base model in the identification framework; S600. Calculate the weighted confidence distribution of the evidence of any base model according to the evidence of any base model and the weight of any base model; S700. According to the weighted confidence distribution of the evidence of any base model, the evidence of all base models is integrated to obtain integrated evidence, and the element with the highest probability in the integrated evidence is taken as the integration result. If the integration result is a candidate element, the candidate element is taken as an extracted element and recorded in the answer, and steps S100-S700 are iteratively performed; If the integration result is a termination token, the loop is stopped and the extracted elements recorded in the answer are output as the extracted elements output by the large language model.

2. The method for extracting elements from online message text based on large language model integration according to claim 1 is characterized in that: in, The token sequence of the candidate element in step S200 is obtained based on the following method. If the candidate element is an entity element, it includes: S1-210. The base model generates a corresponding token sequence according to the input sample text sequence and any token in the base model vocabulary; S1-220. Generate a conditional probability distribution of a corresponding token sequence according to any token in the base model vocabulary, and set the conditional probability of any token as the conditional probability of the corresponding token sequence; S1-230. The k token sequences with the highest conditional probabilities are candidate token sequences. Any of the k candidate token sequences is combined with any token in the base model vocabulary to generate a corresponding token sequence, wherein the any token is the next token of the any candidate token sequence. S1-240. According to the probability distribution that any token in the base model vocabulary is the next token of any candidate token sequence, the conditional probability of the next token is multiplied by the conditional probability of any candidate token sequence to obtain the conditional probability of the corresponding token sequence; S1-250. Iterate steps S230 to S240 until the current token of any candidate token sequence is a token represented by ",", wherein any candidate token sequence is a token sequence of entity element content and its indicator, wherein the indicator includes "(" represented by the first token of any candidate token sequence and "," represented by the current token of any candidate token sequence; S1-260. After calculating the token sequence of the entity element content, generate the confidence of the token sequence of different entity element categories, and use the token sequence of the entity element category with the highest confidence as the token sequence of the entity element category after the token sequence of the entity element content, to obtain a token sequence of a candidate element and output it as a candidate entity element; S1-270. Set k-1, iterate steps S230 to S260, until k=0, the base model outputs the token sequence of the kth candidate entity element, and iterate and exit; If the candidate element is a relational element, it includes: S2-210. The base model generates a corresponding token sequence according to any token in the base model vocabulary according to the input sample text sequence; S2-220. Generate a conditional probability distribution of a corresponding token sequence according to any token in the base model vocabulary, and set the conditional probability of any token as the conditional probability of the corresponding token sequence; S2-230. The k token sequences with the highest conditional probabilities are candidate token sequences. Any of the k candidate token sequences is combined with any token in the base model vocabulary to generate a corresponding token sequence, wherein the any token is the next token of the any candidate token sequence. S2-240. According to the probability distribution that any token in the base model vocabulary is the next token of any candidate token sequence, the conditional probability of the next token is multiplied by the conditional probability of any candidate token sequence to obtain the conditional probability of the corresponding token sequence; S2-250. Iterate steps S230 to S240 until the current token of any candidate token sequence is any token in the set of tokens starting with a right bracket in the vocabulary, and any candidate token sequence is a token sequence of a relationship element and its indicator, wherein the indicator includes "(" represented by the first token of any candidate token sequence, "," between the relationship type, subject and object, and any symbol or symbol set in the set of tokens starting with a right bracket in the vocabulary represented by the current token of any candidate token sequence, to obtain a token sequence of a candidate relationship element and output it as a candidate relationship element; S2-260. Set k-1 and iterate steps S230 to S250 until k=0, the base model outputs the token sequence of the kth relationship candidate element, and the iterative execution exits.

3. The method for extracting elements from online message text based on large language model integration according to claim 2 is characterized in that: in, k represents the hyperparameter of the base model specifying the number of extracted candidate elements; In step S1-220 and / or S2-220, the conditional probability of any token does not include a traditional Chinese character token; In step S1-230 and / or S2-230, any candidate token sequence among the k and any token in the base model vocabulary are used to generate a corresponding token sequence, wherein the generated corresponding token sequence does not include a traditional Chinese character token sequence; In step 1-260, the confidence of the token sequence of the entity element category is expressed by the following formula: in: PET represents the conditional probability geometric mean of the element category of the candidate element, and represents the confidence of the token sequence of the entity element category. The token sequence of the element content of the entity candidate element is Where lv is the sequence length; The token sequence of the feature category of the entity candidate feature is Where lc is the sequence length; t comma Indicates the token corresponding to ","; i represents count.

4. The method for extracting elements from online message text based on large language model integration according to claim 1 is characterized in that: If the element extracted is an entity element, then the entity candidate element θ in step S300 e The confidence in the base model m is e ), as shown by the following formula: in: Entity candidate factor θ e The token sequence of the feature name is Where lv is the sequence length; T represents the token sequence of candidate elements; Entity candidate factor θ e The token sequence of the feature category is Where lc is the sequence length; PEC represents the conditional probability of the token ","; t comma Indicates the token corresponding to the comma; TE m Represents the set of tokens starting with a right bracket in the vocabulary of base model m; PET represents the geometric mean of the conditional probabilities of the feature categories of the candidate features; PEE stands for TE m The sum of the conditional probabilities of the tokens in ; The set TE represents the set of tokens starting with a right bracket in the vocabulary of the base model m; te represents the token starting with a right bracket in the vocabulary of the base model m; If the element extracted is a relation element, then the relation candidate element θ in step S300 r The confidence in the base model m is r ), as shown by the following formula: in: Candidate relation factor θ r The token sequence is Where lr is the sequence length; TE m Represents the set of tokens in the vocabulary of model m that start with a right bracket; PRE represents the conditional probability of the terminal token of the candidate element token sequence; Calculate the confidence of the termination token Cofidence(m,θ end ) is shown by the following formula: Confidence(m,θ end )=P(t end |T') in: θ end It is a proposition in the identification framework that indicates the termination of continued generation; t emd Indicates the end token of the candidate element token sequence; T' represents the sample token sequence.

5. The method for extracting elements from online message text based on large language model integration according to claim 4 is characterized in that: In step S500, evidence e of base model m is generated according to the confidence of the proposition of base model m in the identification framework. m , as shown by the following formula: in: p m,θ Indicates evidence m The confidence in the proposition θ; θ means θ e or θ r , θ represents θ e It means that entity element extraction is performed, and θ represents θ r It means that the relational element extraction is executed; ∑ρ ∈Θ Confidence(m,ρ) represents the sum of the confidence of any proposition ρ among all propositions in the framework Θ on the base model m.

6. The method for extracting elements from online message text based on large language model integration according to claim 5 is characterized in that: In step S600, in one iteration, any base model outputs a token sequence of k candidate elements according to the input sample token sequence, merges the same candidate elements, and all base models output n-1 different candidate elements. The recognition framework Θ = {θ1, θ2, ..., θ n },in, i≠j; i,j=1,2,...,n; lm different basis models, according to the identification framework Θ={θ1,θ2,…,θ n }, and generates lm pieces of evidence e1, e2, ..., e lm , the i-th evidence e i The weight w i By the i-th evidence e i The weight assigned to the corresponding base model i is represented; Then the evidence i The weighted confidence distribution g i It is expressed by the following formula: in: g θ,i It represents the credibility of evidence e for a proposition or a combination of propositions θ; g θ,i Indicates evidence i The confidence in a proposition or combination of propositions θ; P(Θ) is an element added to preserve the remaining confidence after weight discounting, and specifies any subset of the recognition frame θ∩P(θ)=θ; e(i) represents the first i pieces of evidence e1, e2, ..., e i After merging the evidence, Then the LM evidence generated by all LM basis models and the fused evidence e(lm) are calculated using the following iterative formula: in: g θ,e(i) represents the confidence of the weighted confidence distribution of the evidence e(i) after the fusion of the first i pieces of evidence on the subset θ of the identification framework; g P(Θ),e(i) It represents the confidence of the weighted confidence distribution of the evidence e(i) after the fusion of the first i pieces of evidence on the element P(Θ); The first piece of evidence θ,e(1) =g θ,1 ; in: The evidence e generated by the i-th base model i Reliability i It is expressed by the following formula: in: Y represents the set of all elements in the labels of the validation set of the D-Elecment dataset, and |Y| represents the number of elements in the set Y; ∑ ρ∈Y Confidence(i,ρ) represents the sum of the confidence of any element ρ in the i-th base model among all the elements in the set Y; The evidence generated by all lm base models is fused, and the element with the largest conditional probability in the fused evidence e(lm) is taken as the integration result. If the integration result is a candidate element, the candidate element is taken as an extracted element and recorded in the answer, and steps S100-S700 are iteratively executed; If the integration result is a termination token, the loop is stopped, and the extracted elements recorded in the answer are output as the extracted elements output by the large language model.

7. The method for extracting elements from online message text based on large language model integration according to claim 1 is characterized in that: in, The large language model is trained based on the following method: S110. Constructing a data set of instructions for extracting elements from political messages, wherein the sample of the instruction data set includes instructions, text, and answers; S120. Input the sample into the base model, and adjust the weight of the base model parameters according to the loss function; The categories of entity elements include complaint issues, the time when the complaint issues occurred, the location where the complaint issues occurred, the object of the complaint, the harm caused by the complaint issues, the appeal, the handling department and the handling measures; the relationship elements include the corresponding relationship between the handling department and the handling measures; In step S110, a data set of instructions for extracting elements from political messages is constructed, including S111. Filter and clean the data of government message; S112. Annotate the data after text filtering and data cleaning; S113. Processing the annotation data of the text according to the instruction data template base model, wherein the entity type list includes a list of entities of the category of the entity elements, and the relationship type list is execution; S114. Sort the triplets of entity extraction elements or relationship extraction elements of the answers of the base model. The entity extraction elements in the answers are sorted according to the order in which the entity elements appear in the text. The relationship triplets of relationship extraction elements in the answers are sorted based on the order in which the treatment measures appear in the text as the primary sorting criterion and the order in which the treatment departments appear in the text as the secondary sorting criterion.

8. The method for extracting elements from online message text based on large language model integration according to claim 7 is characterized in that: The base model in step S120 includes Embedding layer, used to convert the input token sequence into the corresponding embedding vector; Multiple Transformer decoding layers are used to capture the semantic features of the token in the input sentence and generate an embedding vector of the input token containing contextual semantic information, including feedforward networks and multi-head attention; The language model output layer is used to calculate the probability that the embedding vector containing contextual semantic information belongs to each token in the vocabulary; Among them, a linear layer with a bias term is expressed as: y=Wx+b Where: x is the input of the linear layer, is the weight of the linear layer, b is the bias term, and y is the output value; The two linear layers in the feed-forward network are adapted with adapter layers, and the linear layers adapted with adapter layers are expressed as: y=(W+BA)x+b=Wx+BAx+b x is the input of the linear layer, is the weight of the linear layer, b is the bias term, y is the output value, is the weight of one of the adapter layers, is the weight of one of the adapter layers, r represents the hyperparameter, m represents, n represents, r<<min(m,n); The elements of weight B of the adapter layer are initialized to 0, and the elements of weight A are randomly initialized according to Gaussian distribution; in: Freeze the weights W of the linear layer during base model training, and adjust the weights B and A of the adapter layer; After the base model training is completed, the weights B and A of the adapter layer are merged into the weight W of the linear layer, and the weight W' of the linear layer is W+BA. Step S120 inputs the sample into the base model and adjusts the weights of the base model parameters according to the loss function, including The token sequence of the sample of the political message element extraction instruction dataset is T = {t1, t2, ..., t n }, where n is the number of tokens in the token sequence, t i Indicates the i-th token, ti +1 represents the i+1th token, assuming that each t i Each corresponds to a probability distribution t' i , t' i The random variable of is the value of all tokens in the model vocabulary, of which only the token numbered t i The probability of the token is 1, and the probability of other tokens is 0; The token sequence T is input into the linear layer and the base model with the adapter layer. After the embedding layer, multiple Transformer decoding layers, and the language model output layer, the base model output matrix Where vocab_size is the total number of tokens in the model vocabulary, and the matrix L represents the matrix of the cosine values ​​of the embedding vector of each token in the input sentence and the standard output embedding of all tokens in the output layer of the language model; Perform softmax processing on the matrix L row by row to obtain the matrix L'. L' represents the conditional probability distribution of the token generated at the next position of each token in the token sequence T. The i-th row and j-th column of L' represents the conditional probability of generating the token numbered j from the i+1-th token after the first i tokens in the token sequence T. The loss function is calculated as follows: in: The token sequence of the sample of the political message element extraction instruction dataset is T = {t1, t2, ..., t n }, where n is the length of the token sequence in the token sequence; CrossEntropyLoss represents the cross entropy loss function; L' i Represents the conditional probability distribution of the i+1th token; q i+1 Indicates the end of the conversation; If and only if the text corresponding to the i+1th token belongs to the answer or the dialogue termination mark of the answer, q i+1 =1, otherwise q i+1 =0; The gradients of the parameters in the base model are calculated according to the loss function, and the weights of the trainable parameters in it are updated.

9. The method for extracting elements from online message text based on large language model integration according to any one of claims 1 to 8, characterized in that: The online message text is an online political inquiry message text.

10. An electronic device, comprising: One or more processors, a memory, and one or more programs; wherein the one or more programs are stored in the memory, and the one or more programs include instructions, which, when executed by the electronic device, enable the electronic device to execute the method described in any one of claims 1-9.

Citation Information

Patent Citations

  • Method and system for extracting key elements of long text and terminal equipment

    CN115600602A

Cited By

  • Heating and ventilation drawing equipment identification method based on multivariate information fusion and large model reasoning

    CN119339406A

  • HVAC equipment identification method based on multi-information fusion and large model reasoning

    CN119339406B