Social governance event decision model training method, analysis method, system and equipment

By constructing a structured decision-making training corpus and a set of similar events, and using an LLAMA model for pre-training and fine-tuning, the problems of scalability and accuracy in social governance event decision-making were solved, and automated data updates and efficient management were achieved.

CN118940866APending Publication Date: 2024-11-12HANGZHOU CITY BRAIN CO LTD

Patent Information

Application Number
CN202411435792.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

Existing social governance decision-making methods suffer from insufficient scalability, low decision-making accuracy, the need for multiple database management, and reliance on human updates.

Method used

By periodically acquiring historical social governance event data through API interfaces, a structured decision-making training corpus is constructed. The LLAMA model is used for pre-training, and similar event sets are constructed through text similarity calculation and dependency analysis. A similar training corpus is dynamically generated, and the model is fine-tuned by combining the policy gradient algorithm to achieve model expansion and accurate decision-making.

Benefits of technology

It has improved the scalability and accuracy of decision-making in social governance events, unified the data structure, reduced dependence on multiple databases, achieved automated data updates, and improved data management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940866A_ABST
    Figure CN118940866A_ABST
Patent Text Reader

Abstract

The invention provides a social governance event decision model training method. The method comprises the following steps: periodically acquiring historical social governance event data through an API (Application Program Interface) and classifying the historical social governance event data; forming a data result sequence table based on the event information and the decision information of each event data, and analyzing the data result sequence table to construct a structured decision training corpus set; pre-training an LLAMA model by using the decision training corpus set to obtain a pre-trained decision model; obtaining similar events under each classification theme from the event data set or the decision training corpus set based on text similarity calculation so as to construct a similar event set; combining the similar event sets into a data structure mode of a question and answer set, inputting the data structure mode into a pre-training decision model, and combining similar event descriptions and similar decision information to dynamically generate similar training corpus sets in batches; and inputting the generated similar training corpus set into a pre-training decision model, and performing training again to generate an event decision model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of urban operation data processing, and in particular to a social governance event decision-making model training method, analysis method, system and equipment. Background Art

[0002] Social governance event decision-making is to make decisions by systematically collecting, organizing, and analyzing social data and using scientific means when facing various social problems and emergencies. This process includes real-time monitoring of events, risk assessment, resource allocation, and comprehensive coordination of emergency response. The basis for decision-making is an in-depth analysis of multi-dimensional data to understand the development trend of events, affected groups, and possible risks. Through scientific and technological means, decision makers can quickly obtain accurate information, formulate flexible and effective response strategies, improve the intelligence and response speed of social governance, and ultimately achieve the rapid resolution of crises, the maintenance of social order, and the improvement of social security.

[0003] In order to improve the efficiency of handling social governance events, some auxiliary decision-making methods have been proposed, but these methods generally have the following defects: ① According to the matching of historical social governance event information based on keywords, decisions can only be made based on the association with existing historical events, and there is no scalability; ② There are multiple keywords in the event, and the error of matching events by keywords is large, and the decision output accuracy is low and difficult to apply; ③ Multiple databases need to be established to store the classified data of social governance; ④ A large amount of manpower is required to manually keep the social governance event database updated in real time. Summary of the invention

[0004] In order to overcome at least one shortcoming of the prior art, the present invention provides a social governance event decision analysis method, system and device.

[0005] In order to achieve the above-mentioned purpose, the present invention provides a social governance event decision analysis method, which comprises: regularly obtaining historical social governance event data through an API interface and classifying them, each event data including event information and decision information;

[0006] Forming a data result sequence table based on the event information and decision information of each event data, and parsing the data result sequence table to construct a structured decision training corpus;

[0007] Pre-train the LLAMA model with the decision training corpus to obtain a pre-trained decision model;

[0008] Based on text similarity calculation, similar events under each classification topic are obtained from the event data set or the decision training corpus to construct a similar event set, and each similar event is converted into a structured expression including {similar event description: similar decision information};

[0009] Combining similar event sets into a data structure pattern of a question-answer set and then inputting it into a pre-trained decision model, combining similar event descriptions and similar decision information to dynamically batch generate similar training corpora, each of which is a structured expression including {corpus event description: corpus decision information};

[0010] The generated similar training corpus is input into the pre-trained decision model, and the event decision model is generated after re-training.

[0011] According to an embodiment of the present invention, similar events under each classification topic are obtained from the event data set based on text similarity calculation to construct a similar event set, including:

[0012] Extract or obtain keywords of each event data or decision training corpus and convert them into vector representation, the keywords include key entities;

[0013] Based on the extracted keyword vectors, construct the original sentence word vector matrix of the event data;

[0014] Performing dependency analysis on the event data to obtain a dependency syntax tree, and obtaining a plurality of dependent words in the dependency syntax tree through one-hop dependency and / or two-hop dependency;

[0015] Arrange the obtained multiple dependent words according to the sentence order in the event data to form a multi-tuple word vector matrix;

[0016] The original sentence word vector matrix and the multi-tuple word vector matrix constitute similar feature information, and the similarity between event data is calculated based on the similar feature information.

[0017] According to an embodiment of the present invention, when a word vector model is used to convert keywords into vector representations, a synonym dictionary and context word representations are embedded to expand the semantic scope of the keywords.

[0018] According to an embodiment of the present invention, the step of classifying the acquired event data set includes:

[0019] Preprocess each event data in the acquired event data set;

[0020] Extract keywords from event data and convert them into vector representations using a word vector model, and store the converted keyword vectors as input for constructing a similar event set;

[0021] The event is classified based on the vector average of the keywords contained in each event data.

[0022] According to an embodiment of the present invention, iterative instruction fine-tuning of the LLAMA model using a decision training corpus to obtain a pre-trained decision model includes:

[0023] The fine-tuning is divided into N rounds. After each round of fine-tuning, a corresponding version of the model will be obtained. The next round of fine-tuning will be trained based on the model obtained after the previous round of fine-tuning.

[0024] Rejection sampling is used for fine-tuning in rounds 1 to N-1; in round N, rejection sampling is first used for fine-tuning, and then the policy gradient-based PPO algorithm is used for fine-tuning. The training objective formula of the policy gradient-based PPO algorithm is as follows:

[0025]

[0026] This formula is to find the goal of strategy π, p is the given prompt, g is the generated product, R is the reward function, D is the input decision training corpus, and E is the expected value.

[0027] According to one embodiment of the present invention, when fine-tuning is performed using a policy gradient-based PPO algorithm, relative entropy is introduced to constrain the output result of the fine-tuning model. After the relative entropy is introduced, the training objective formula of the policy gradient-based algorithm is as follows:

[0028] ;

[0029] in, is the adjusted comprehensive reward function, is the adjusted strategy π θ The penalty term of the relative entropy between the original strategy π and β is the coefficient that determines the intensity of the penalty to control the deviation between the reward strategy and the original strategy.

[0030] According to one embodiment of the present invention, the adjusted comprehensive reward function is composed of the usefulness reward function and the safety reward function The common output is obtained, which is expressed as follows:

[0031] .

[0032] On the other hand, the present invention provides a social governance event decision model training system, which includes a data acquisition module, a decision corpus construction module, a pre-training module, a similar event set construction module and a retraining module. The data acquisition module regularly acquires and classifies historical social governance event data through an API interface, and each event data includes event information and decision information. The decision corpus construction module forms a data result sequence table based on the event information and decision information of each event data, and parses the data result sequence table to construct a structured decision training corpus. The pre-training module pre-trains the LLAMA model with the decision training corpus to obtain a pre-trained decision model. The similar event set construction module obtains similar events under each classification topic from the event data set or the decision training corpus based on text similarity calculation to construct a similar event set, and each similar event is converted into a structured expression including {similar event description: similar decision information}. The similar corpus generation module combines similar event sets into the data structure mode of the question-answer set and then inputs it into the pre-trained decision model, combines similar event descriptions and similar decision information to dynamically batch generate similar training corpora, and each similar training corpus is a structured expression including {corpus event description: corpus decision information}. The retraining module inputs the generated similar training corpus into the pre-trained decision model, and generates an event decision model after retraining.

[0033] According to an embodiment of the present invention, the similar event set construction module obtains similar events under each classification topic from the event data set based on text similarity calculation to construct a similar event set, including:

[0034] Extract or obtain keywords of each event data or decision training corpus and convert them into vector representation, the keywords include key entities;

[0035] Based on the extracted keyword vectors, construct the original sentence word vector matrix of the event data;

[0036] Performing dependency analysis on the event data to obtain a dependency syntax tree, and obtaining a plurality of dependent words in the dependency syntax tree through one-hop dependency and / or two-hop dependency;

[0037] Arrange the obtained multiple dependent words according to the sentence order in the event data to form a multi-tuple word vector matrix;

[0038] The original sentence word vector matrix and the multi-tuple word vector matrix constitute similar feature information, and the similarity between event data is calculated based on the similar feature information.

[0039] On the other hand, the present invention further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0040] In summary, the social governance event decision model training method provided by the present invention uses the decision training corpus formed by the historical social governance event data set to pre-train the LLAMA model to obtain a pre-trained decision model. On this basis, a similar event set is constructed and a batch of similar training corpus sets are dynamically generated using the pre-trained decision model to expand the model training corpus, thereby realizing the intelligent expansion of governance events. It not only relies on historical event experience, but also dynamically generates related events according to real-time data and trends, and uses the generated corpus for model training to solve the problem of low decision-making accuracy that the existing model can only rely on a small number of historical social governance events. The event decision model obtained based on LLAMA model training improves the semantic understanding of social events through deep learning, solves problems such as only keyword matching, and increases scalability. After obtaining the event data set, the social governance event subject classification is introduced, the social governance events are labeled and managed, the data structure is unified, the consistency and efficiency of data management are improved, and the problem of multi-database management is solved.

[0041] In addition, when constructing a set of similar events to expand the model training corpus, on the basis of extracting keywords, key entity extraction, original sentence word vector matrix and multi-group word vector matrix are introduced. On the basis of the overall similarity calculation of event information, the calculation of local similarity is added, and multi-scale similarity judgment is used to improve the accuracy and coverage of the generation of similar training corpus sets, thereby improving the accuracy of the output of the trained model.

[0042] In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 The figure is a flow chart of a social governance event decision model training method provided in one embodiment of the present invention.

[0044] Figure 2 FIG. 1 is a schematic diagram of step S10.

[0045] Figure 3 FIG. 1 is a schematic diagram of the steps of constructing a similar event set in step S40 in FIG. 1 .

[0046] Figure 4 The figure is a flow chart of a social governance event decision analysis method provided in one embodiment of the present invention.

[0047] Figure 5 Shown is a schematic diagram of the structure of a social governance event decision-making model training system provided by an embodiment of the present invention.

[0048] Figure 6 Shown is a schematic diagram of the principles of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0049] like Figure 1 As shown, this embodiment provides a social governance event decision model training method, which includes: regularly obtaining and classifying event data sets of historical social governance through an API interface, and each event data includes event information and decision information (step S10). Based on the event information and decision information of each event data, a data result sequence table is formed, and the data result sequence table is parsed to construct a structured decision training corpus (step S20). The LLAMA model is pre-trained with the decision training corpus to obtain a pre-trained decision model (step S30). Based on text similarity calculation, similar events under each classification topic are obtained from the event data set or the decision training corpus to construct a similar event set, and each similar event is converted into a structured expression including {similar event description: similar decision information} (step S40). After the similar event set is combined into a data structure pattern of a question-answer set, it is input into the pre-trained decision model, and similar event descriptions and similar decision information are combined to dynamically batch generate similar training corpora, and each similar training corpus is a structured expression including {corpus event description: corpus decision information} (step S50). The generated similar training corpus is input into the pre-trained decision model, and an event decision model is generated after re-training (step S60).

[0050] In step S10, the social governance event decision model training system will automatically and regularly obtain various types of real-time historical social governance events based on the API interface on the hardware device (computer device), such as historical traffic accident processing, historical environmental pollution processing, and historical water, electricity, and coal failure processing. Afterwards, the acquired event data is classified. Figure 2 As shown, the step includes:

[0051] Step S101, pre-process each event data in the acquired event data set. Specifically, this step includes: screening, merging or adjusting the event data to obtain valid event data, and the valid event data includes event information describing the event process and decision information describing the event processing results. Specifically, ① Data quality check: Use automated tools to conduct a comprehensive data quality check on the event data to check the integrity, accuracy, consistency and reliability of the data; for missing data, it may include filling missing values, deleting records where missing data are located, or using interpolation methods for estimation. ② Data format unification: Unify the event data format, including unified date format, unified unit, unified naming specification, etc. ③ Data standardization: Standardize the text content in the event data, including case conversion, stem extraction, sensitive word removal, etc. ⑤ Data screening and merging: Screen and / or merge the event data, filter out irrelevant social governance event data, and merge according to the actual situation of the event. Multiple identical events or multiple data sets can be integrated to form a more comprehensive and comprehensive event data set. Afterwards, the valid event data is cleaned to remove irrelevant information and noise data to obtain preprocessed valid event data.

[0052] Step S102, extract keywords from valid event data, convert keywords into vector representations using a word vector model, and store the converted keyword vectors as input for constructing a similar event set in step S40. Specifically, any word vector model among Paragram word vectors, Paragram-Phrase-ML word vectors, and Glove word vectors can be used for vector conversion. However, the present invention does not make any limitation to this.

[0053] Step S103: Based on the vector average of the keywords contained in each event data, the cosine similarity is used to calculate the similarity between the vector average of each event data and the preset subject classification label, so as to realize the rapid classification of event themes. The labeling management of social governance events based on subject classification enables social governance events of different subject types to be stored in the same database, which well solves the problem that the existing decision-making model requires multiple databases and is difficult to maintain and manage.

[0054] After preprocessing and subject classification of valid event data, step S20 is executed to construct a decision training corpus. Specifically, a data result sequence table is formed based on the event information and decision information of each event data. Taking the historical traffic accident handling event as an example, the integrated data result sequence table is as follows:

[0055] [1] Event: M Road is severely congested. Please solve the congestion on M Road.

[0056] [2] Decision: In view of the severe congestion on M Road, the following suggestions are made to solve or alleviate the congestion problem:

[0057] [2.1] Traffic flow survey and analysis: Conduct a detailed survey of the traffic flow on Road M, including peak hours, average vehicle speed, vehicle types, etc.; analyze the causes of congestion, which may be excessive traffic volume, unreasonable intersection design, frequent traffic accidents, etc.

[0058] [2.2] Optimize the traffic signal system: Based on the traffic flow survey results, optimize the traffic signal configuration of M Road to ensure smooth traffic.

[0059] [2.3] Introduce intelligent traffic signal systems that make dynamic adjustments based on real-time traffic data.

[0060] [2.4] Public transportation priority: Increase the number of public transportation routes and frequencies along M Road to encourage citizens to use public transportation; set up bus lanes to ensure that buses arrive on time and operate efficiently.

[0061] [2.5] Traffic management: Strengthen traffic management and strictly manage illegal parking, running red lights and other behaviors; regularly carry out traffic order rectification actions to improve drivers' traffic safety awareness.

[0062] [2.6] Improvement of road infrastructure: expansion or reconstruction of M Road, increase the number of lanes, and improve road capacity; optimization of intersection design, reduction of vehicle conflict points, and improvement of traffic efficiency;

[0063] [2.7] Non-motorized vehicle and pedestrian facilities: Set up non-motorized vehicle lanes and pedestrian crossing facilities to reduce the intersection of non-motorized vehicles and pedestrians with motor vehicles; improve the safety and convenience of pedestrian crossings, such as setting up safety islands and increasing the crossing signal time.

[0064] [2.8] Application of intelligent transportation technology: Introduce intelligent traffic monitoring system to monitor traffic conditions in real time and respond to congestion in a timely manner; use big data and artificial intelligence technology to conduct traffic forecasting and planning, and provide a scientific basis for traffic management.

[0065] [2.9] Publicity and education: Strengthen traffic safety publicity and education to improve citizens’ traffic safety awareness and civilized driving quality; advocate green travel modes, such as walking, cycling, carpooling, etc., to reduce private car travel;

[0066] Staggered travel and flexible work systems: Encourage enterprises and units to implement staggered travel and flexible work systems to reduce traffic pressure during peak hours; promote new working methods such as remote office and video conferencing to reduce commuting needs.

[0067] [2.10] Establish a feedback mechanism: Establish a citizen feedback mechanism to promptly collect citizens’ opinions and suggestions on traffic conditions; regularly evaluate citizens’ feedback and adjust traffic management measures accordingly.

[0068] After forming the above data result sequence table, natural language processing technology (including text segmentation, entity recognition, and time extraction) is used to automatically identify each data result sequence table, and extract keywords including event description, event time, event location, and event-related people; at the same time, the decision information in the decision result corresponding to the event is extracted, including decision content, decision time, decision impact, etc. The extracted information is then combined into a structured data set to construct a decision training corpus. Specifically, in the decision training corpus, each event data is represented as a data record, which includes fields such as event description, topic classification label, and decision information.

[0069] After constructing the decision training corpus, step S30 is performed: pre-training the LLAMA model with the decision training corpus to obtain a pre-trained decision model. The LLAMA model used in this embodiment is the Chinese language large model LLAMA2-13B. However, the present invention does not limit this. In other embodiments, other versions of the LLAMA model may also be used. Specifically, the decision training corpus performs iterative instruction fine-tuning on the LLAMA model to obtain a pre-trained decision model, and this step includes:

[0070] First: the fine-tuning is divided into five rounds. After each round of fine-tuning, a corresponding version of the model will be obtained. The next round of fine-tuning will be trained based on the model obtained after the previous round of fine-tuning.

[0071] Secondly, rejection sampling is used for fine-tuning in rounds 1 to 4. In the fifth round, rejection sampling is used for fine-tuning, and then a policy gradient algorithm based on the AC (Actor-Critic) architecture is used for fine-tuning, such as the PPO (Proximal Policy Optimization) algorithm. The training objective formula of the PPO algorithm based on the AC architecture is as follows:

[0072]

[0073] The formula is the goal of finding a policy π, where p is a given prompt, g is the generated product, R is the reward function, D is the input decision training corpus, and E is the expected value. The policy can maximize the expected reward R of the generated product g when the prompt p is given. The policy π determines the behavior of the model (i.e., how to generate text). The expected value E is calculated based on the distribution of the given prompt p in the decision training corpus D and the g generated by the policy π. The goal of the policy is to iteratively improve π to generate responses that are considered high quality according to the reward function R.

[0074] The PPO algorithm relies on the reward value output by the reward function to assist in training during training. However, in order to avoid the fine-tuned model from overfitting the performance of the reward function, the KL (Kullback–Leibler) divergence (i.e., relative entropy) is introduced to constrain the changes in the output results of the fine-tuned model. After the relative entropy is introduced, the training objective formula based on the policy gradient algorithm is as follows:

[0075] ;

[0076] in, is the adjusted comprehensive reward function, which combines the safety reward function and usefulness reward function , to ensure that the model's responses are both safe (not generating harmful or inappropriate content) and useful (providing useful information or responses). is the adjusted strategy π θ The penalty term of the relative entropy between the original strategy π and β is the coefficient that determines the intensity of the penalty to control the deviation of the reward strategy from the original strategy, which helps prevent overfitting of the reward function and promotes generalization.

[0077] Comprehensive reward function The score is determined by the usefulness reward function and the safety reward function The common output is obtained by combining the output results of the two functions through the piecewise function. Specifically, when the prompt is unsafe or the safety reward function If the output score is less than 0.15, the safety reward function is used The output of is used as the score of the comprehensive reward function; otherwise, the usefulness reward function is used The output of is used as the score of the comprehensive reward function, and the result of the comprehensive reward function output is finally normalized to ensure that the score of the comprehensive reward function output and the KL divergence constraint value are within a measurement range. Its expression is as follows:

[0078] ;

[0079] Based on the above instruction fine-tuning method, a large model of the social governance field is obtained. The present invention does not impose any restrictions on the number of fine-tuning rounds.

[0080] After the pre-training decision model is obtained through pre-training in step S30, step S40 is performed to construct a similar event set. Specifically, as shown in the figure, this step includes:

[0081] Step S401, extract each event data keyword and convert it into a vector representation. In this embodiment, the keyword extraction and vector conversion have been completed when the event data is subject-classified in step S10. Therefore, step S401 only needs to obtain the keyword vector stored in step S102. However, the present invention does not make any limitation to this. In other embodiments, the decision training corpus formed in step S20 can also be subjected to keyword extraction and vector conversion.

[0082] In this embodiment, step S201 combines the named entity recognition model (NER) when performing keyword extraction to identify key entities (such as names, place names, organizations, etc.) in the event data to improve the accuracy of similarity judgment. At the same time, synonym dictionaries (such as WordNet) and context word representations (such as BERT) are embedded to expand the semantic scope of keywords and improve the coverage and accuracy of similarity calculation.

[0083] Step S402: construct an original sentence word vector matrix of the event data based on the extracted keyword vectors.

[0084] Step S403, performing dependency analysis on the event data to obtain a dependency syntax tree, and obtaining multiple dependent words in the dependency syntax tree through one-hop dependency and / or two-hop dependency. Specifically, the grammatical relationship between words can be captured by Stanford syntax analysis to obtain a dependency syntax tree. Afterwards, a bigram is formed by combining two dependent words obtained through a one-hop dependency, and a bigram is formed by combining three dependent words obtained through a two-hop dependency. However, the present invention does not make any limitation to this. In other embodiments, other tuples can also be obtained through dependencies of more than three hops.

[0085] Step S404: Arrange the acquired multiple dependent words according to the sentence order in the event data to form a multi-tuple word vector matrix. The extracted bigrams and trigrams are used as a supplement to the original sentence word vector matrix. In order to add long-distance dependency information to the event data, the extracted word combinations need to be converted to the same order as the words in the event data to avoid conflicts with the word combination information extracted from the event data.

[0086] Step S405, the original sentence word vector matrix and the multi-tuple word vector matrix form similar feature information, and the similarity between the event data is calculated based on the similar feature information. Specifically, this embodiment uses a similarity model based on a neural network for calculation, and the original sentence word vector matrix and the multi-tuple word vector are respectively extracted with convolution kernels of width 2 and 3 to form similarity model input features. The similarity calculation formula is expressed as follows:

[0087]

[0088] The similarity calculation formula uses Tanh as the activation function, ⊙ represents the element-wise multiplication, It represents the feature representation of the first event data after passing through the convolutional network; represents the feature representation of the second event data after the convolutional network; W is the weight of the fully connected layer, which is calculated by the convolutional layer; b is the bias of the layer, is the similarity. However, the present invention does not make any limitation to this. In other examples, the cosine similarity and other distance formulas can also be used to calculate the similarity of two event data.

[0089] The text similarity calculation method provided in this embodiment uses multi-scale similarity judgment to improve overall and local similarity. On the basis of the existing overall similarity calculation method, it realizes the similarity at the word segmentation, sentence or paragraph level based on word vectors, discovers local similarity, and makes the processing of complex and long texts more detailed and accurate. Fine-tuning the model on the text data of social governance enables the word vector model to better capture the characteristics of the field and significantly improve the accuracy of similarity calculation. Furthermore, the setting of the multi-tuple word vector matrix extracts long-distance dependency information through the dependency relationship between words in the event data, and then uses this information as a supplement to the original input information, improves the performance of similarity calculation between long text event data, and then constructs a similar event set with high similarity, which provides a basis for batch generation of accurate similar training corpus in step S50.

[0090] After similarity calculation is used to form a similar event set, each similar event is converted into a structured expression including {similar event description: similar decision information}. Similarly, taking the traffic accident handling event as an example, its similar event description can be: ① The traffic conditions on M Road are worrying, especially during peak hours in the morning and evening, when vehicles are queuing and pedestrians have difficulty crossing the road; ② Event 2: According to citizens, M Road is often congested due to the dense residential and commercial areas around it, the traffic pressure is huge; ③ Event 3: M Road is often congested due to its narrow road and heavy traffic, which affects the travel experience of citizens. Similar feature information is the original sentence word vector matrix and multi-tuple word vector matrix after keyword extraction and dependency analysis for each event. The decision information expression can be: Decision A: Optimize the traffic light configuration of M Road based on the traffic flow survey results; Decision B: Increase the number of public transportation routes and flights along M Road; Decision C: Expand or reconstruct M Road to increase the number of lanes; and Decision D: Set up non-motorized vehicle lanes and pedestrian crossing facilities.

[0091] Afterwards, step S50 is executed: the data structure mode of the question-answer set is combined with the similar event set obtained in step S40 and then input into the pre-trained decision model. Since the API interface will regularly obtain the event data set of historical social governance, step S40 will also regularly update the similar event set. Based on the feature information between similar events updated regularly, step S50 combines similar event descriptions and similar decision information to dynamically batch generate similar training corpus sets, and each similar training corpus is a structured expression including {corpus event description: corpus decision information}. Specifically, when the event data in the input similar event set is {Event 1: Decision A}, the pre-trained decision model will output {Event 2: Decision A}, {Event 3: Decision A}, {Event 1: Decision B}, {Event 1: Decision C}, {Event 1: Decision D}, {Event 2: Decision B}, {Event 3: Decision B}, {Event 3: Decision C} and {Event 3: Decision D} and other batch similar training corpus combinations, thereby forming a similar training corpus set.

[0092] The similar training corpus generated based on the pre-trained decision model and similar event set not only realizes the adaptive expansion of the model training data to improve the accuracy of the trained model, but also forms a dynamic similar event set based on the dynamic historical social governance event data. The dynamic similar event set enables the generated similar training corpus to be well associated with the development trend of the event, so as to realize the intelligent expansion of governance events.

[0093] Finally, step S60 is executed to input the generated similar training corpus into the pre-trained decision model, and generate an event decision model after re-training.

[0094] The social governance event decision model training method provided in this embodiment adopts the LLAMA2 large model technology to construct a large model in the field of social governance, improve the semantic understanding of social events through deep learning, solve problems that can only be solved through keyword matching, and increase scalability. Dynamically generating similar event corpus realizes the intelligent expansion of governance events. It not only relies on historical event experience, but also dynamically generates related events according to real-time data and trends, and uses the generated corpus for model training to avoid the problem of relying only on historical social governance events. At the same time, the subject classification of social governance events is introduced, social governance events are managed in a labeled manner, the data structure is unified, the consistency and efficiency of data management are improved, and the problem of multi-database management is solved. Furthermore, based on the API interface, governance data is automatically acquired, the automatic update of social governance events is realized and used for the training of large models, the real-time and integrity of data is improved, and the waste of human resources is avoided.

[0095] Correspondingly, this embodiment also provides a social governance event decision analysis method, such as Figure 4 As shown, it includes:

[0096] Step S100: Obtaining social governance event data in real time through the API interface;

[0097] Step S200: Use the event decision model trained by the social governance event decision model training method of this embodiment to perform decision analysis on the acquired real-time event data to output the decision analysis results.

[0098] Correspondingly, such as Figure 5 As shown, the present embodiment also provides a social governance event decision model training system, which includes a data acquisition module 10, a decision corpus construction module 20, a pre-training module 30, a similar event set construction module 40, a similar corpus generation module 50 and a retraining module 60. The data acquisition module 10 regularly obtains and classifies event data sets of historical social governance through an API interface, and each event data includes event information and decision information. The decision corpus construction module 20 forms a data result sequence table based on the event information and decision information of each event data, and parses the data result sequence table to construct a structured decision training corpus. The pre-training module 30 pre-trains the LLAMA model with the decision training corpus to obtain a pre-trained decision model. The similar event set construction module 40 obtains similar events under each classification theme from the event data set or the decision training corpus based on text similarity calculation to construct a similar event set, and each similar event is converted into a structured expression including {similar event description: similar decision information}. The similar corpus generation module 50 combines similar event sets into the data structure mode of the question-answer set and then inputs it into the pre-trained decision model, combines similar event descriptions and similar decision information to dynamically batch generate similar training corpora, and each similar training corpus is a structured expression including {corpus event description: corpus decision information}. The retraining module 60 inputs the generated similar training corpus into the pre-trained decision model, and generates an event decision model after retraining.

[0099] In one embodiment of the present invention, the similar event set construction module 40 executes step S40: based on text similarity calculation, similar events under each classification theme are obtained from the event data set to construct a similar event set. Step S40 includes:

[0100] Step S401, extract or obtain keywords of each event data or decision training corpus and convert them into vector representation, the keywords include key entities;

[0101] Step S402: construct an original sentence word vector matrix of the event data based on the extracted keyword vectors;

[0102] Step S403: performing dependency analysis on the event data to obtain a dependency syntax tree, and obtaining a plurality of dependent words in the dependency syntax tree through one-hop dependency relationships and / or two-hop dependency relationships;

[0103] Step S404: Arrange the acquired multiple dependent words according to the sentence sequence in the event data to form a multi-tuple word vector matrix;

[0104] Step S405: The original sentence word vector matrix and the multi-tuple word vector matrix form similar feature information, and the similarity between the event data is calculated based on the similar feature information.

[0105] In one embodiment of the present invention, when the similar event set construction module 40 or the data acquisition module 10 converts keywords into vector representations using a word vector model, a synonym dictionary and context word representations are embedded to expand the semantic scope of the keywords.

[0106] In one embodiment of the present invention, the step of classifying the acquired event data set by the data acquisition module 10 in step S10 includes:

[0107] Step S101, preprocessing each event data in the acquired event data set;

[0108] Step S102: extract keywords from the event data and convert the keywords into vector representations using a word vector model, and store the converted keyword vectors as input for constructing a similar event set;

[0109] Step S103: classify the event based on the vector average value of the keywords contained in each event data.

[0110] In one embodiment of the present invention, the pre-training module 30 performs iterative instruction fine-tuning on the LLAMA model with the decision training corpus in step S30 to obtain a pre-trained decision model. The step includes:

[0111] The fine-tuning is divided into N rounds. After each round of fine-tuning, a corresponding version of the model will be obtained. The next round of fine-tuning will be trained based on the model obtained after the previous round of fine-tuning.

[0112] Rejection sampling is used for fine-tuning in rounds 1 to N-1; in round N, rejection sampling is first used for fine-tuning, and then the policy gradient-based PPO algorithm is used for fine-tuning. The training objective formula of the policy gradient-based PPO algorithm is as follows:

[0113]

[0114] This formula is to find the goal of strategy π, p is the given prompt, g is the generated product, R is the reward function, D is the input decision training corpus, and E is the expected value.

[0115] In one embodiment of the present invention, when fine-tuning is performed using the policy gradient-based PPO algorithm, relative entropy is introduced to constrain the output result of the fine-tuning model. After the relative entropy is introduced, the training objective formula of the policy gradient-based algorithm is as follows:

[0116] ;

[0117] in, is the adjusted comprehensive reward function, is the adjusted strategy π θ The penalty term of the relative entropy between the original strategy π and β is the coefficient that determines the intensity of the penalty to control the deviation between the reward strategy and the original strategy.

[0118] In one embodiment of the present invention, the adjusted comprehensive reward function is composed of the usefulness reward function and the safety reward function The common output is obtained, which is expressed as follows:

[0119] .

[0120] Figure 6 FIG. 1 shows an internal structure diagram of a computer device in an embodiment, and the computer device may specifically be a server. Figure 6 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program, which, when executed by the processor, enables the processor to implement a social governance event decision model training method. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute a social governance event decision model training method or a social governance event decision analysis method.

[0121] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0122] In one embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the processor executes the steps of the social governance event decision model training method. The steps of the social governance event decision model training method here can be the steps of the social governance event decision model training method in each of the above embodiments.

[0123] In one embodiment, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the processor executes the steps of the social governance event decision analysis method described above. The steps of the social governance event decision analysis method here can be the steps of the social governance event decision analysis method described above in each of the embodiments.

[0124] In summary, the social governance event decision model training method provided by the present invention uses the decision training corpus formed by the historical social governance event data set to pre-train the LLAMA model to obtain a pre-trained decision model. On this basis, a similar event set is constructed and a batch of similar training corpus sets are dynamically generated using the pre-trained decision model to expand the model training corpus, thereby realizing the intelligent expansion of governance events. It not only relies on historical event experience, but also dynamically generates related events according to real-time data and trends, and uses the generated corpus for model training to solve the problem of low decision-making accuracy that the existing model can only rely on a small number of historical social governance events. The event decision model obtained based on LLAMA model training improves the semantic understanding of social events through deep learning, solves problems such as only keyword matching, and increases scalability. After obtaining the event data set, the social governance event subject classification is introduced, the social governance events are labeled and managed, the data structure is unified, the consistency and efficiency of data management are improved, and the problem of multi-database management is solved.

[0125] In addition, when constructing a set of similar events to expand the model training corpus, on the basis of extracting keywords, key entity extraction, original sentence word vector matrix and multi-group word vector matrix are introduced. On the basis of the overall similarity calculation of event information, the calculation of local similarity is added, and multi-scale similarity judgment is used to improve the accuracy and coverage of the generation of similar training corpus sets, thereby improving the accuracy of the output of the trained model.

[0126] Although the present invention has been disclosed as above by the preferred embodiment, it is not intended to limit the present invention. Anyone familiar with this technology can make slight changes and modifications without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be based on the scope of protection required by the claims.

Claims

1. A social governance event decision model training method, characterized in that: include: Regularly obtain historical social governance event data and classify them through the API interface. Each event data includes event information and decision information. Based on the event information and decision information of each event data, a data result sequence table is formed, and the data result sequence table is parsed to construct a structured decision training corpus; the LLAMA model is pre-trained with the decision training corpus to obtain a pre-trained decision model; based on text similarity calculation, similar events under each classification topic are obtained from the event data set or the decision training corpus to construct a similar event set, and each similar event is converted into a structured expression including {similar event description: similar decision information}; Combining similar event sets into a data structure pattern of a question-answer set and then inputting it into a pre-trained decision model, combining similar event descriptions and similar decision information to dynamically batch generate similar training corpora, each of which is a structured expression including {corpus event description: corpus decision information}; The generated similar training corpus is input into the pre-trained decision model, and the event decision model is generated after re-training.

2. The social governance event decision model training method according to claim 1 is characterized in that: Based on text similarity calculation, similar events under each classification topic are obtained from the event data set to construct a similar event set, including: extracting or obtaining keywords of each event data or decision training corpus and converting them into vector representations, wherein the keywords include key entities; constructing an original sentence word vector matrix of the event data based on the extracted keyword vectors; performing dependency analysis on the event data to obtain a dependency syntax tree, and obtaining multiple dependent words in the dependency syntax tree through one-hop dependency and / or two-hop dependency; arranging the obtained multiple dependent words according to the sentence order in the event data to form a multi-tuple word vector matrix; the original sentence word vector matrix and the multi-tuple word vector matrix constitute similar feature information, and calculating the similarity between the event data based on the similar feature information.

3. The social governance event decision model training method according to claim 2 is characterized in that: When using the word vector model to convert keywords into vector representations, synonym dictionaries and context word representations are embedded to expand the semantic scope of keywords.

4. The social governance event decision model training method according to claim 2 is characterized in that: The step of classifying the acquired event data set includes: preprocessing each event data in the acquired event data set; extracting keywords in the event data and converting the keywords into vector representations using a word vector model, storing the converted keyword vectors as input for constructing a similar event set; and classifying the event based on the vector average value of the keywords contained in each event data.

5. The social governance event decision model training method according to claim 1 is characterized in that: The LLAMA model is iteratively fine-tuned with the decision training corpus to obtain a pre-trained decision model. The steps include: dividing the fine-tuning into N rounds, and each round of fine-tuning will obtain a corresponding version of the model, and the next round of fine-tuning will be trained based on the model obtained after the previous round of fine-tuning; using rejection sampling for fine-tuning from the 1st round to the N-1th round; in the Nth round, rejection sampling is first used for fine-tuning, and then the PPO algorithm based on policy gradient is used for fine-tuning. The training objective formula of the PPO algorithm based on policy gradient is as follows: This formula is to find the goal of strategy π, p is the given prompt, g is the generated product, R is the reward function, D is the input decision training corpus, and E is the expected value.

6. The social governance event decision model training method according to claim 5 is characterized in that: When fine-tuning the PPO algorithm based on policy gradient, relative entropy is introduced to constrain the output results of the fine-tuning model. After the introduction of relative entropy, the training objective formula of the algorithm based on policy gradient is as follows: ;in, is the adjusted comprehensive reward function, is the adjusted strategy π θ The penalty term of the relative entropy between the original strategy π and β is the coefficient that determines the intensity of the penalty to control the deviation between the reward strategy and the original strategy.

7. The social governance event decision model training method according to claim 6 is characterized in that: The adjusted comprehensive reward function is composed of the usefulness reward function and the safety reward function The common output is obtained, which is expressed as follows: 。 8. A social governance event decision analysis method, characterized in that: include: Obtain social governance event data in real time through API interfaces; The event decision model trained by the social governance event decision model training method described in any one of claims 1 to 7 is used to perform decision analysis on the acquired real-time event data to output the decision analysis results.

9. A social governance event decision model training system, characterized in that: include: The data acquisition module regularly acquires and classifies historical social governance event data sets through the API interface. Each event data includes event information and decision information; A decision corpus construction module forms a data result sequence table based on the event information and decision information of each event data, and parses the data result sequence table to construct a structured decision training corpus; a pre-training module pre-trains the LLAMA model with the decision training corpus to obtain a pre-trained decision model; A similar event set construction module obtains similar events under each classification topic from the event data set or decision training corpus based on text similarity calculation to construct a similar event set, and each similar event is converted into a structured expression including {similar event description: similar decision information}; resemblance The corpus generation module combines similar event sets into a data structure pattern of a question-answer set and then inputs it into a pre-trained decision model, combines similar event descriptions and similar decision information to dynamically batch generate similar training corpora, and each similar training corpus is a structured expression including {corpus event description: corpus decision information}; The retraining module inputs the generated similar training corpus into the pre-trained decision model, and generates an event decision model after re-training.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Online public opinion evolution simulation method and system based on deep learning

    CN112395417A

  • Dialogue language model generation method, dialogue generation method, dialogue generation device and storage medium

    CN116415650A

  • Case matching-based network security operation aid decision-making method, system and device

    CN117350288A

  • Training method and device of medical analysis model, electronic equipment and storage medium

    CN117558442A

Cited By

  • Emergency command and dispatch method based on event driving

    CN119416873A

  • Automatic decision-making method and system based on data governance

    CN119760325A

  • Method and device for generating site pollution treatment scheme

    CN119809116A

  • Event classification method and device and medium

    CN120763675A