A user risk behavior perception method based on large language model and related equipment
By constructing a social information knowledge base based on a large language model and conducting risk behavior assessment, it solves the problem of the inability of existing technology to deeply analyze user risk behavior, and achieves highly accurate and interpretable risk behavior assessment and early warning.
Patent Information
- Application Number
- CN202410964780.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-18
AI Technical Summary
Existing user risk behavior perception methods are unable to further evaluate and analyze the relevant details of risk behavior, have low accuracy, and are difficult to provide practical guidance and suggestions.
Using a method based on a large language model, we build a social information knowledge base by obtaining the user's historical social information, use vectorization models and vector retrieval tools to conduct similarity analysis, and generate a risk behavior perception assessment report, including behavior category, time, location and In-depth analysis of character information.
It improves the accuracy and explainability of risk behaviors, reduces labor costs, supports large-scale applications, and provides comprehensive risk behavior assessment and early warning capabilities.
Smart Images

Figure CN118504586B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to a user risk behavior perception method based on a large language model and related equipment. Background Art
[0002] The big language model is a deep neural network model trained based on massive text data and with more than tens of billions of model parameters. It is suitable for multiple application scenarios such as summary generation, reasoning analysis, and machine translation, and has a strong ability to understand natural language knowledge.
[0003] In recent years, with the continuous development of Internet applications, social media has become an important way for people to communicate their emotions and express their opinions. There are extreme online expressions and risky behaviors of extreme individuals in real life. These risky behaviors undermine social trust and affect public safety and social order. Therefore, in order to maintain social harmony and stability, it is necessary to correctly understand and analyze social media information, perceive users' risky behaviors in advance, monitor and control them, and related technical research has become increasingly important.
[0004] There are two main methods for perceiving user risk behaviors. The first is based on field visits, structured interviews, and community observations, using preset questions and standard procedures to perceive user risk behaviors. However, this solution usually requires well-trained professionals to use their own experience to implement it, and has disadvantages such as high time and labor costs and difficulty in large-scale application. The second is a natural language processing method based on sentiment analysis of user social media speeches to perceive user risk behaviors. However, this method can only perceive user risk behaviors through a single dimension of emotions, and the analysis results lack interpretability. It is impossible to further evaluate and analyze the relevant details of risk behaviors, and the accuracy rate is low, making it difficult to provide practical guidance and suggestions to business personnel. Summary of the invention
[0005] The present invention provides a user risk behavior perception method based on a large language model and related equipment, aiming to solve the problem that the existing user behavior perception method based on natural language processing cannot further evaluate and analyze the relevant details of the risk behavior.
[0006] In a first aspect, the present invention provides a method for perceiving user risk behavior based on a large language model, comprising:
[0007] Step 1: Obtain the user's historical social information within a specified time period on each social media platform; the historical social information includes the user's attribute information and the text content information posted by the user;
[0008] Step 2: Determine the risk behavior category of the text content information posted by all potential abnormal users based on the first preset large language model and the preset prompt template;
[0009] Step 3: Use the attribute information of the user and the risk behavior category of the text content information published by the user as the prompt information of the user social information knowledge base, use the corresponding text content information published by the user as the target information of the user social information knowledge base, and construct and obtain the user social information knowledge base;
[0010] Step 4: Search the given query information in the user social information knowledge base to determine the N prompt information with the highest similarity to the query information, and recall the corresponding N target information according to the N prompt information;
[0011] Step 5: The N target information are used as texts to be perceived and evaluated, and are input into the first preset large language model according to a preset prompt template for analysis to generate a risk behavior perception evaluation report.
[0012] Furthermore, the method further comprises:
[0013] Step 6: Based on the risk behavior category label of the user’s social information and the risk behavior perception assessment report, issue risk behavior warnings to the user.
[0014] Furthermore, the user's attribute information includes at least one of a user name and a personal ID, a publishing platform and a publishing time.
[0015] Furthermore, the construction process of the first preset large language model includes:
[0016] A base large model is selected, and the user risk behavior category instruction fine-tuning sample set is used to efficiently fine-tune the parameters of the base large model to obtain a first preset large language model; wherein the user risk behavior category instruction fine-tuning sample set is composed of text content information of several known risk behavior categories.
[0017] Furthermore, the base large model is Qwen2 or LlamA3;
[0018] Furthermore, step 4 specifically includes:
[0019] Step 4.1: Use the vectorization model to perform text vectorization operations on the query information and the prompt information in the user social information knowledge base to obtain the embedding vector of the query information and the embedding vector of the prompt information in the user social information knowledge base;
[0020] Step 4.2: storing the embedding vector of the query information and the embedding vector of the prompt information in the user social information knowledge base into a vector database;
[0021] Step 4.3: Use the vector search tool FAISS to perform similarity analysis on the vector database to obtain N prompt information with the highest similarity to the query information;
[0022] Step 4.4: Recall the corresponding N target information according to the N prompt information.
[0023] Furthermore, the process of constructing the vectorized model includes:
[0024] Inputting the prompt information in the user social information knowledge base into the second preset large language model, and setting a first prompt word and a second prompt word for the second preset large language model respectively, so as to obtain rewritten information and random information; wherein the first prompt word is to return rewritten information with similar semantics to the input prompt information; and the second prompt word is to return random information with different semantics from the input prompt information;
[0025] Constructing a triple data set, wherein the data sample format in the triple data set is (sentence1, sentence2, label); wherein sentence1 is the prompt information in the user social information knowledge base, sentence2 is the rewritten information or random information corresponding to the prompt information, and label is a data type label used to indicate that sentence2 is the rewritten information or random information;
[0026] Construct a vector network, input sentence1 and sentence2 into the vector network respectively to obtain their embedding vectors, calculate the cosine distance between their embedding vectors, input the cosine distance into the softmax classifier to obtain the predicted label probability, calculate the loss between the predicted label and the true label to optimize the parameters of the vector network until the preset conditions are met, stop the optimization, and obtain the vectorized model.
[0027] In a second aspect, the present invention provides a user risk behavior perception system based on a large language model, comprising:
[0028] A social information acquisition module is used to acquire the user's historical social information within a specified time period on each social media platform; the historical social information includes the user's attribute information and the text content information posted by the user;
[0029] A risk behavior identification module, used to determine the risk behavior category of the text content information posted by all potential abnormal users based on a first preset large language model and a preset prompt template;
[0030] A knowledge base construction module is used to use the attribute information of the user and the risk behavior category of the text content information published by the user as prompt information of the user social information knowledge base, and use the corresponding text content information published by the user as the target information of the user social information knowledge base, so as to construct and obtain the user social information knowledge base;
[0031] A target information acquisition module is used to search the given query information in the user social information knowledge base to determine the N prompt information with the highest similarity to the query information, and recall the corresponding N target information according to the N prompt information;
[0032] The risk behavior assessment module is used to take the N target information as the text to be perceived and evaluated, and input it into the first preset large language model according to the preset prompt template for analysis and generate a risk behavior perception assessment report.
[0033] Furthermore, the system also includes: an early warning module, which is used to issue risk behavior early warnings to users based on risk behavior category labels and risk behavior perception assessment reports of user social information.
[0034] In a third aspect, the present invention provides an electronic device comprising a memory and a processor, wherein the memory stores program codes executable by the processor, and when the processor executes the program codes, the method for perceiving user risk behavior based on a large language model as described in the first aspect above is implemented.
[0035] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for perceiving user risk behavior based on a large language model as described in the first aspect is implemented.
[0036] Beneficial effects of the present invention:
[0037] 1. The present invention makes full use of the excellent reasoning and analysis capabilities of the large language model by fine-tuning the large language model and designing high-quality prompt word templates. It can not only identify the user's risk behavior label, but also generate an easy-to-understand risk behavior perception assessment report. The generated risk behavior perception assessment report carefully evaluates the user's potential risk behavior through comprehensive, all-round and multi-angle analysis. Compared with the existing natural language processing method that only perceives the user's risk behavior by analyzing a single dimension of emotion, the method of the present invention has the ability to deeply analyze the behavior category, time information, location information, event information and character information involved in the user's risk behavior, and has the ability to accurately predict the corresponding warning level of the risk behavior, which not only improves the accuracy, but also increases the interpretability of the analysis results.
[0038] 2. The method of querying information in the form of input text in the present invention accurately retrieves the social information corresponding to the user's risky behavior. This method does not need to use structured query language (SQL) to query the data related to the user's social information in the database, which greatly reduces the threshold for non-technical personnel to access and operate the database, allowing more business personnel to participate in data management and analysis, thereby reducing labor costs, meeting the conditions for large-scale application, and improving the convenience and flexibility of user risk behavior perception technology.
[0039] 3. The present invention generates accurate embedding vectors for the input text query information and the social information in the user social information knowledge base through an optimized vectorization model (for example, the Chinese semantic vector model bge-large-zh-v1.5), and performs similarity analysis on the embedded vectors to find the user social information that needs to be evaluated for risk behavior perception, thereby ensuring the accuracy of the retrieved target information. The vector retrieval tool FAISS is used to enable the similarity analysis to achieve millisecond-level retrieval performance, thereby ensuring speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A flowchart of a method for perceiving user risk behavior based on a large language model provided by an embodiment of the present invention;
[0041] Figure 2 A schematic diagram of a flow chart of a method for obtaining target information of a user who needs to undergo risk behavior perception assessment provided by an embodiment of the present invention;
[0042] Figure 3 A schematic diagram of the structure of a user risk behavior perception system based on a large language model provided by an embodiment of the present invention;
[0043] Figure 4 A schematic diagram of the structure of an electronic device for perceiving user risk behavior based on a large language model provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] Example 1
[0046] like Figure 1 As shown, an embodiment of the present invention provides a user risk behavior perception method based on a large language model, comprising the following steps:
[0047] S101: Acquire historical social information of a user within a specified time period on each social media platform; the historical social information includes attribute information of the user and text content information posted by the user;
[0048] Specifically, in this embodiment, the historical social information of the user on three social media platforms is obtained. In practical applications, a request body carrying cookies can be used to simulate logging into a social media platform, an IP proxy pool can be set to periodically change the IP value on the social media platform, and the web crawler framework Scrapy can be used to obtain all social information of the user within a specified time period on all social media platforms.
[0049] The user's selection range can be the participating users under a hot event topic, or the users in a location area. The specified time period can be the past 3 days, the past 7 days, or a specific date in the past. The user's social information includes the user's original posting information on the social media platform and the forwarding information and comment information of the interaction with other users on the social media platform. The user's selection range and specified time period can be customized.
[0050] In this embodiment, the user's attribute information includes at least one of a user name and a personal ID, a publishing platform, and a publishing time.
[0051] S102: Determine risk behavior categories of text content information posted by all potential abnormal users based on a first preset large language model and a preset prompt template;
[0052] Specifically, each acquired text content information is independently integrated into a preset prompt template, and input into the first preset large language model to obtain the risk behavior category of each text content information of the user.
[0053] The preset prompt template includes the role function played by the large language model, the type of risky behavior to be identified, and the output format of the identification results.
[0054] As an implementable method, the preset prompt template format is:
[0055] ## Role: You are an expert in identifying risky behavior types
[0056] ## Rules:
[0057] 1. Define the following classification labels: {spreading rumors, reporting, attacking and insulting, cyberbullying, and exaggerating negative emotions}
[0058] 2. Return only the above category labels
[0059] 3. The classification results are returned only in JSON format, without any other extra text
[0060] ## Output Format :
[0061] {
[0062] "category":""
[0063] }
[0064] ## Workflow
[0065] 1. The user gives input text in the form of [MESSAGE];
[0066] 2. For the text given by the user, according to <rules>Output the result.
[0067] ## MESSAGE
[0068] Social information for risk behavior type identification
[0069] It is understandable that the risk behavior type to be identified and the output format of the identification result can be pre-defined. For example, the output format of the identification result can be a string format or a JSON data format.
[0070] As an implementable method, the preset large language model is obtained by fine-tuning the parameters of the base large model through supervised learning. Preferably, in order to solve the problem that the base large model has insufficient understanding of the vertical field of risk behavior perception, this embodiment uses the user risk behavior category instruction fine-tuning sample set to perform PEFT (Parameter-Efficient Fine-Tuning) on the base large model. The base large model can be Qwen2 or LlamA3.
[0071] Specifically, the user risk behavior category instruction fine-tuning sample set consists of several samples in the format of (text content information, risk behavior category). For example, a sample is as follows:
[0072] ("Today's weather is gloomy, and I am under a lot of pressure at work. Work tasks come one after another, making me feel very depressed", "Exaggerating negative emotional behaviors").
[0073] The efficient parameter fine-tuning strategy can be LoRA fine-tuning, P-Tuning v2 fine-tuning, or AdaLoRA fine-tuning. Efficient parameter fine-tuning achieves an effect close to that of fine-tuning all parameters by training only a small number of parameters. This not only improves the accuracy of model recognition, but also greatly reduces the GPU resources required for fine-tuning large language models.
[0074] S103: Using the attribute information of the user and the risk behavior category of the text content information published by the user as prompt information of the user social information knowledge base, using the corresponding text content information published by the user as target information of the user social information knowledge base, and constructing and obtaining the user social information knowledge base;
[0075] Specifically, the user social information knowledge base consists of multiple social information of multiple users in a preset time period and a preset social media platform. Each piece of social information includes user behavior details such as the user's name, personal ID, publishing platform, publishing time, risk behavior category label, and text content information of the social information, and the user social information knowledge base is stored as JSON format data.
[0076] S104: searching the given query information in the user social information knowledge base to determine N prompt information with the highest similarity to the query information, and recalling corresponding N target information according to the N prompt information;
[0077] Specifically, the query information includes the user name to be queried, the personal ID, the risk behavior type to be evaluated, and one or more of the social information source platforms; the query information is analyzed for similarity with the prompt information in the user social information knowledge base, the N prompt information with the highest similarity to the query information is retrieved, and the corresponding target information is recalled according to the prompt information. Figure 2 As shown, the specific steps are as follows:
[0078] S1041: Performing a text vectorization operation on the query information and the prompt information in the user social information knowledge base using a vectorization model to obtain an embedding vector of the query information and an embedding vector of the prompt information in the user social information knowledge base;
[0079] Specifically, the vectorization model in this embodiment is obtained by training the constructed vector network. In this embodiment, the vector network is mainly obtained by improving the deep semantic matching model DSSM model, specifically replacing the encoding layer in the DSSM model with the Chinese semantic vector model bge-large-zh-v1.5, and the rest of the structure remains unchanged. Among them, the preset Chinese semantic vector model bge-large-zh-v1.5 is pre-trained, on this basis, the training process of the vectorization model specifically includes:
[0080] ① Input the prompt information in the user social information knowledge base into the second preset large language model, set the prompt word to "return rewritten information with similar semantics to the prompt information", and obtain similar expression information with similar semantics to the prompt information. Set the prompt word to "return random information with different semantics from the prompt information" to obtain random information with different semantics from the prompt information. It can be understood that the construction process of the second preset large language model can refer to the first preset large language model, for example, including: selecting a base large model, using a text generation training set to efficiently fine-tune the parameters of the base large model, and obtaining a second preset large language model; wherein the text generation training set is composed of several text content information pairs with similar or different semantics. The base large model is Qwen2 or LlamA3.
[0081] ②Construct a triple data set. The data in the triple data set consists of the prompt information in the user social information knowledge base and the rewritten information obtained in ① above. The data format is (sentence1, sentence2, label), where sentence1 is the prompt information in the user social information knowledge base, sentence2 is similar expression information with similar semantics to the prompt information or random information with different semantics from the prompt information, and label is the data label. When sentence2 is similar expression information with similar semantics to the prompt information, label is 1, and when sentence2 is random information with different semantics from the prompt information, label is 0.
[0082] ③ Input sentence1 and sentence2 into the vector model bge-large-zh-v1.5 respectively to obtain their embedding vectors.
[0083] ④ Use the remaining structures other than the encoding layer of the DSSM model to calculate the cosine distance between the two embedded vectors, input the cosine distance into the softmax classifier to obtain the predicted label probability, calculate the loss between the predicted label and the true label, and when the absolute value of the difference between the loss value of this round of training and the loss value of the previous round of training is greater than the preset threshold, use the Adam optimization algorithm to update the parameters of the vector model bge-large-zh-v1.5. When the absolute value of the difference between the loss value of this round of training and the loss value of the previous round of training is less than the preset threshold, stop training and complete the optimization of the parameters of the Chinese semantic vector model bge-large-zh-v1.5. The preset threshold can be customized. The optimized Chinese semantic vector model bge-large-zh-v1.5 is the final vectorization model.
[0084] Optionally, in this embodiment, a cross entropy loss function is used to calculate the loss, and the cross entropy loss function formula is as follows:
[0085] in, , represents the true label, is the predicted label probability.
[0086] S1042: storing the embedding vector of the query information and the embedding vector of the prompt information in the user social information knowledge base into a vector database;
[0087] S1043: Use the vector search tool FAISS to perform similarity analysis on the vector database to obtain N prompt information with the highest similarity to the query information.
[0088] Specifically, the similarity analysis is performed by calculating the cosine similarity of the cosine angle of the vectors. The calculation formula of the cosine similarity is:
[0089] in, is the embedding vector of the query information, It is the embedding vector of the prompt information in the user's social information knowledge base.
[0090] Considering that the number of users and social information of users participating in a hot event topic or users in a location area is large, the rate of looping through all vectors for similarity analysis is very slow. Therefore, this embodiment uses the vector search tool FAISS to achieve millisecond-level search performance for similarity analysis. The specific similarity analysis steps are as follows:
[0091] ① Data format conversion: convert the embedded vectors in the vector database into vectors with data type "float32".
[0092] ② Use FAISS to construct an index that can uniquely match the query information and prompt information.
[0093] ③ Perform similarity analysis on the vectors in the vector database. The similarity analysis uses a method of calculating cosine similarity to obtain N indexes with the highest similarity scores with the query information. Preferably, N is pre-set to 5, and N can be customized.
[0094] ④ Obtain N prompt information corresponding to the N indexes with the highest similarity to the query information.
[0095] Optionally, the input query information involving risk behavior type, information source platform, and release time period can be customized. The risk behavior type to be queried can be a specific risk behavior or multiple risk behaviors. The social information to be queried can come from a specific social media platform or multiple social media platforms. The release time of the social information to be queried can be a specific date or multiple dates.
[0096] S1044: Recall the corresponding N target information according to the N prompt information.
[0097] S105: The N target information are used as texts to be perceived and evaluated, and are input into a first preset large language model according to a preset prompt template for analysis to generate a risk behavior perception evaluation report.
[0098] Specifically, the target information is placed in a preset prompt template, the Temperature parameter (temperature coefficient) of the first preset large language model is adjusted, and the user's risky behavior is perceived based on the first preset large language model and an evaluation report is generated. The evaluation report performs entity recognition on the time information, location information, event information, and person information involved in the user's risky behavior, makes a judgment on the riskiness of the user's behavior, and gives suggestions on how to prevent and manage the user's risky behavior.
[0099] Preferably, the Temperature parameter (temperature coefficient) of the first preset large language model is pre-set to 0.6. The temperature coefficient is a parameter used to control the creativity level of text generated by artificial intelligence, which can affect the probability distribution of the output of the large language model, making the output content more centralized or more diversified. When the temperature coefficient is low (such as 0.2, 0.3), the large language model will mainly select from words with higher probabilities, thereby generating a smoother and more coherent risk behavior perception assessment report. When the temperature coefficient is high (such as 0.8, 0.9), the large language model will be more inclined to select from richer and more diverse words to generate a risk behavior perception assessment report with stronger creativity and richer diversity. This embodiment does not specifically limit the size setting of the temperature coefficient, which can be set by itself.
[0100] Furthermore, the user behavior perception method of this embodiment also includes the following steps:
[0101] S106: Providing risk behavior warnings to users based on risk behavior category labels and risk behavior perception assessment reports of user social information.
[0102] Specifically, based on the risk behavior category label of the user's social information and the risk behavior perception assessment report, the risk index and warning level corresponding to the risk behavior are obtained. The risk index can be determined based on the risk behavior category involved in the user and the number of related personnel involved in the behavior, the location concentration, and the sensitivity of the associated events. The larger the risk index, the higher the corresponding warning level. Finally, a risk behavior warning signal for the user is generated based on the risk behavior perception assessment report, risk index, and warning level.
[0103] The method provided by the embodiment of the present invention constructs a user social information knowledge base, retrieves the user social information for risk behavior perception in the knowledge base by inputting query information, and then designs high-quality prompt word templates, fully utilizing the excellent reasoning and analysis capabilities of the large language model to generate an evaluation report containing relevant detailed information on risk behavior categories, time information, location information, event information, and character information. This not only reduces labor costs, but also improves accuracy and increases the interpretability of analysis results, making it convenient to provide practical guidance and suggestions to business personnel.
[0104] Example 2
[0105] like Figure 3 As shown, an embodiment of the present invention provides a user risk behavior perception system based on a large language model, including a social information acquisition module, a risk behavior identification module, a knowledge base construction module, a target information acquisition module, a risk behavior assessment module and an early warning module.
[0106] Among them, the information acquisition module is used to obtain the historical social information of the user within the specified time period of each social media platform; the historical social information includes the attribute information of the user and the text content information published by the user. The risk behavior identification module is used to determine the risk behavior category of the text content information published by all potential abnormal users based on the first preset large language model and the preset prompt template. The knowledge base construction module is used to use the attribute information of the user and the risk behavior category of the text content information published by the user as the prompt information of the user social information knowledge base, and use the corresponding text content information published by the user as the target information of the user social information knowledge base, so as to construct and obtain the user social information knowledge base. The target information acquisition module is used to search the given query information in the user social information knowledge base to determine the N prompt information with the highest similarity to the query information, and recall the corresponding N target information according to the N prompt information. The risk behavior assessment module is used to use the N target information as the text to be perceived and evaluated, and input it into the first preset large language model according to the preset prompt template for analysis and generate a risk behavior perception assessment report. The warning module is used to warn the user of risk behavior based on the risk behavior category label of the user social information and the risk behavior perception assessment report.
[0107] It should be noted that the user risk behavior perception system based on a large language model provided in the embodiment of the present invention is for the purpose of implementing the above method. Its specific functions can be referred to the above method embodiment and will not be repeated here.
[0108] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor 401 , a communication interface 402 , a memory 403 and a communication bus 404 , wherein the processor 401 , the communication interface 402 , and the memory 403 communicate with each other via the communication bus 404 . The processor 401 can call the logic instructions in the memory 403 to execute the user risk behavior perception method based on the large language model, which includes: obtaining the historical social information of the user within a specified time period on each social media platform; the historical social information includes the user's attribute information and the text content information posted by the user; determining the risk behavior category of the text content information posted by all potential abnormal users based on the first preset large language model and the preset prompt template; using the user's attribute information and the risk behavior category of the text content information posted by the user as the prompt information of the user social information knowledge base, and using the corresponding text content information posted by the user as the target information of the user social information knowledge base, to construct and obtain the user social information knowledge base; searching the given query information in the user social information knowledge base to determine the N prompt information with the highest similarity to the query information, and recalling the corresponding N target information according to the N prompt information; using the N target information as the text to be perceived and evaluated, and inputting it into the first preset large language model according to the preset prompt template for analysis and generating a risk behavior perception evaluation report.
[0109] In addition, when the logic instructions in the above-mentioned memory 403 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0110] An embodiment of the present invention also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments, for example, including: obtaining historical social information of users within a specified time period on various social media platforms; the historical social information includes user attribute information and text content information posted by users; determining risk behavior categories of text content information posted by all potential abnormal users based on a first preset large language model and a preset prompt template; using both the user attribute information and the risk behavior category of the text content information posted by the user as prompt information of a user social information knowledge base, using the corresponding text content information posted by the user as target information of the user social information knowledge base, and constructing and obtaining the user social information knowledge base; searching the user social information knowledge base for given query information to determine N prompt information with the highest similarity to the query information, and recalling corresponding N target information according to the N prompt information; using the N target information as text to be perceived and evaluated, and inputting it into the first preset large language model according to the preset prompt template for analysis and generating a risk behavior perception evaluation report.
[0111] The embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method provided by the above-mentioned method embodiments is implemented, for example, including: obtaining historical social information of users within a specified time period on each social media platform; the historical social information includes the attribute information of the user and the text content information posted by the user; determining the risk behavior category of the text content information posted by all potential abnormal users based on the first preset large language model and the preset prompt template; using the attribute information of the user and the risk behavior category of the text content information posted by the user as the prompt information of the user social information knowledge base, and using the corresponding text content information posted by the user as the target information of the user social information knowledge base, to construct and obtain the user social information knowledge base; searching the user social information knowledge base for given query information to determine the N prompt information with the highest similarity to the query information, and recalling the corresponding N target information according to the N prompt information; using the N target information as the text to be perceived and evaluated, and inputting it into the first preset large language model according to the preset prompt template for analysis and generating a risk behavior perception evaluation report.
[0112] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.< / rules>
Claims
1. A user risk behavior perception method based on a large language model, characterized in that: include: Step 1: Obtain the user's historical social information within a specified time period on each social media platform; The historical social information includes user attribute information and text content information posted by the user; Step 2: Determine the risk behavior category of the text content information posted by all potential abnormal users based on the first preset large language model and the preset prompt template; Step 3: Use the attribute information of the user and the risk behavior category of the text content information published by the user as the prompt information of the user social information knowledge base, use the corresponding text content information published by the user as the target information of the user social information knowledge base, and construct and obtain the user social information knowledge base; Step 4: Search the given query information in the user social information knowledge base to determine the N prompt information with the highest similarity to the query information, and recall the corresponding N target information according to the N prompt information; Step 5: The N target information are used as texts to be perceived and evaluated, and are input into the first preset large language model according to a preset prompt template for analysis to generate a risk behavior perception evaluation report.
2. According to claim 1, a user risk behavior perception method based on a large language model is characterized in that: Also includes: Step 6: Based on the risk behavior category label of the user’s social information and the risk behavior perception assessment report, issue risk behavior warnings to the user.
3. According to claim 1, a user risk behavior perception method based on a large language model is characterized in that: The user's attribute information includes at least one of a user name and a personal ID, a publishing platform, and a publishing time.
4. According to claim 1, a user risk behavior perception method based on a large language model is characterized in that: The construction process of the first preset large language model includes: A base large model is selected, and the user risk behavior category instruction fine-tuning sample set is used to efficiently fine-tune the parameters of the base large model to obtain a first preset large language model; wherein the user risk behavior category instruction fine-tuning sample set is composed of text content information of several known risk behavior categories.
5. According to claim 4, a user risk behavior perception method based on a large language model is characterized in that: The large base model is Qwen2 or LlamA3.
6. According to the method of user risk behavior perception based on large language model in claim 1, it is characterized in that: Step 4 specifically includes: Step 4.1: Use the vectorization model to perform text vectorization operations on the query information and the prompt information in the user social information knowledge base to obtain the embedding vector of the query information and the embedding vector of the prompt information in the user social information knowledge base; Step 4.2: storing the embedding vector of the query information and the embedding vector of the prompt information in the user social information knowledge base into a vector database; Step 4.3: Use the vector search tool FAISS to perform similarity analysis on the vector database to obtain N prompt information with the highest similarity to the query information; Step 4.4: Recall the corresponding N target information according to the N prompt information.
7. The user risk behavior perception method based on a large language model according to claim 6 is characterized in that: The construction process of the vectorized model includes: Inputting the prompt information in the user social information knowledge base into the second preset large language model, and setting a first prompt word and a second prompt word for the second preset large language model respectively, so as to obtain rewritten information and random information; wherein the first prompt word is to return rewritten information with similar semantics to the input prompt information; and the second prompt word is to return random information with different semantics from the input prompt information; Construct a triple data set, wherein the data sample format in the triple data set is (sentence1, sentence2, label); wherein sentence1 is the prompt information in the user social information knowledge base, sentence2 is the rewritten information or random information corresponding to the prompt information, and label is a data type label used to indicate that sentence2 is the rewritten information or random information; A vector network is constructed, sentence1 and sentence2 are respectively input into the vector network to obtain their embedding vectors, the cosine distance between their embedding vectors is calculated, the cosine distance is input into the softmax classifier to obtain the predicted label probability, the loss between the predicted label and the true label is calculated to optimize the parameters of the vector network until the preset conditions are met, the optimization is stopped, and the vectorized model is obtained.
8. A user risk behavior perception system based on a large language model, characterized in that: include: A social information acquisition module is used to obtain the user's historical social information within a specified time period on each social media platform; The historical social information includes user attribute information and text content information posted by the user; A risk behavior identification module, used to determine the risk behavior category of the text content information posted by all potential abnormal users based on a first preset large language model and a preset prompt template; A knowledge base construction module is used to use the attribute information of the user and the risk behavior category of the text content information published by the user as prompt information of the user social information knowledge base, and use the corresponding text content information published by the user as the target information of the user social information knowledge base, so as to construct and obtain the user social information knowledge base; A target information acquisition module is used to search the given query information in the user social information knowledge base to determine the N prompt information with the highest similarity to the query information, and recall the corresponding N target information according to the N prompt information; The risk behavior assessment module is used to take the N target information as the text to be perceived and evaluated, and input it into the first preset large language model according to the preset prompt template for analysis and generate a risk behavior perception assessment report.
9. An electronic device, comprising a memory and a processor, characterized in that: The memory stores program codes that can be executed by the processor, and when the processor executes the program codes, it implements the user risk behavior perception method based on a large language model as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for perceiving user risk behavior based on a large language model as described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Public opinion analysis method and device, equipment and storage medium
CN122734059A
