Standard detection method, system and terminal based on remote supervision
By building a local generation model and a stance prediction model based on a remote supervision method, the problem of stance detection requiring a large amount of manual annotation data and data leakage in the existing technology is solved, and more efficient and secure stance detection is achieved.
Patent Information
- Application Number
- CN202410498176.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-24
- Publication Date
- 2024-09-10
AI Technical Summary
Existing stance detection methods require a large amount of manually annotated data, and using large language models to directly process data can easily lead to privacy data leakage, making detection difficult and low security.
Using a method based on remote supervision, by obtaining the calling instructions and training data sets, inputting the preset large language model and generation model, building the final generation model, performing data inference and training, reducing the dependence on data processing, and conducting the position locally Detect and protect data privacy.
It reduces the difficulty of stance detection, improves detection accuracy, effectively avoids data leakage, and enhances detection security.
Smart Images

Figure CN118626841A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a stance detection method, system, terminal and computer-readable storage medium based on remote supervision. Background Art
[0002] Stance detection is a fundamental task in the field of Natural Language Processing, which aims to classify the attitude expressed by a specific target based on an input text with opinions. This task has attracted a lot of attention in recent years due to its relevance in various fields, including political analysis, social media monitoring, and customer feedback analysis. In its early stages, the research on stance detection mainly focused on online debates that conform to standardized sentence structures, and users' attitudes are usually expressed in a direct manner.
[0003] Stance detection methods usually take the form of goal-based sentence-level classification tasks. These methods can be broadly divided into non-pretrained and pre-trained language models. Non-pretrained models usually use deep neural networks, such as long short-term memory, graph convolutional networks, and attention-based models to build stance classification models. In general, these methods usually regard stance detection as a goal-oriented sentence-level text classification task. However, existing methods usually rely heavily on a large amount of manually annotated data, and all need to deploy large language models (such as GPT-3.5) locally, and directly use large language models to process the data to be processed, which may lead to the leakage of private data.
[0004] Therefore, the prior art still needs to be improved and developed. Summary of the invention
[0005] The main purpose of the present invention is to provide a stance detection method, system, terminal and computer-readable storage medium based on remote supervision, aiming to solve the problem that stance detection in the prior art requires a large amount of manually labeled data, and directly processing data with a large language model is prone to data leakage, thereby making stance detection difficult and low in security.
[0006] To achieve the above object, the present invention provides a remote supervision-based stance detection method, which comprises the following steps:
[0007] Obtaining a call instruction and a training data set, and inputting the call instruction and the training data set into a preset large language model to obtain a first reasoning process set;
[0008] Inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model;
[0009] The data to be predicted is input into the final generation model to obtain a target reasoning process, and the data to be predicted and the target reasoning process are input into a pre-trained local stance prediction model to obtain a stance detection result, which is used to represent the viewpoint of the data to be predicted.
[0010] Optionally, the stance detection method based on remote supervision, wherein the step of obtaining a call instruction and a training data set, and inputting the call instruction and the training data set into a preset large language model to obtain a first reasoning process set, specifically includes:
[0011] Receive a call instruction input by a user, obtain a training data set from a preset database, and input the call instruction and the training data set into a preset large language model;
[0012] The preset large language model performs reasoning process extraction processing on each sample in the training data set according to the calling instruction to obtain a first reasoning process corresponding to each sample;
[0013] All of the first reasoning processes are integrated to obtain a first reasoning process set.
[0014] Optionally, the stance detection method based on remote supervision, wherein the step of inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model, specifically comprises:
[0015] Inputting the training data set into a preset generation model, wherein the preset generation model generates a second reasoning process set according to the training data set;
[0016] Calculate a cross entropy loss value according to the first reasoning process set and the second reasoning process set;
[0017] The preset generation model is optimized and trained according to the cross entropy loss value until a convergence condition is reached to obtain a final generation model.
[0018] Optionally, the stance detection method based on remote supervision, wherein the step of inputting the training data set into a preset generation model, wherein the preset generation model generates a second reasoning process set according to the training data set, specifically comprises:
[0019] Obtain all input texts in the training data set and the target corresponding to each input text;
[0020] Concatenate all the input texts with the corresponding targets respectively to obtain concatenated features;
[0021] The splicing features are input into the preset generation model, and the preset generation model generates a second reasoning process set according to the splicing features.
[0022] Optionally, the stance detection method based on remote supervision, wherein the step of inputting the data to be predicted into the final generation model to obtain a target reasoning process, and inputting the data to be predicted and the target reasoning process into a pre-trained local stance prediction model to obtain a stance detection result, specifically includes:
[0023] Obtaining the data to be predicted input by the user, inputting the data to be predicted into the final generation model, and obtaining the target reasoning process;
[0024] Performing a splicing operation on the data to be predicted and the target reasoning process to obtain data to be processed;
[0025] Inputting the data to be processed into the pre-trained local stance prediction model to obtain sentence representation of the data to be predicted;
[0026] A stance detection is performed according to the sentence representation to obtain a stance detection result.
[0027] Optionally, the stance detection method based on remote supervision, wherein the step of inputting the data to be processed into the pre-trained local stance prediction model to obtain a sentence representation of the data to be predicted, specifically comprises:
[0028] Determine a hidden state corresponding to the data to be processed;
[0029] Based on the multi-head self-attention mechanism, a first attention feature is calculated according to the hidden state;
[0030] fusing and normalizing the first attention feature and the hidden state to obtain a second attention feature;
[0031] Calculate an attention vector according to the second attention feature;
[0032] A weighted fusion process is performed on the attention vector and the second attention feature to obtain a sentence representation corresponding to the data to be processed.
[0033] Optionally, the stance detection method based on remote supervision, wherein the step of performing stance detection according to the sentence representation to obtain a stance detection result, specifically includes:
[0034] Processing the sentence representation by a preset stance detection function to obtain probabilities of multiple detection results corresponding to the sentence representation;
[0035] The final position detection result of the data to be predicted is obtained according to all the probabilities.
[0036] In addition, to achieve the above-mentioned purpose, the present invention further provides a remote supervision-based stance detection system, wherein the remote supervision-based stance detection system comprises:
[0037] An inference process acquisition module, used to acquire a call instruction and a training data set, and input the call instruction and the training data set into a preset large language model to obtain a first inference process set;
[0038] A generation model training module, used for inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model;
[0039] The detection result generation module is used to input the data to be predicted into the final generation model to obtain the target reasoning process, and input the data to be predicted and the target reasoning process into a pre-trained local stance prediction model to obtain a stance detection result, and the stance detection result is used to represent the viewpoint of the data to be predicted.
[0040] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a remote supervision-based stance detection program stored in the memory and executable on the processor, wherein the remote supervision-based stance detection program, when executed by the processor, implements the steps of the remote supervision-based stance detection method as described above.
[0041] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a remote supervision-based stance detection program, and when the remote supervision-based stance detection program is executed by a processor, the steps of the remote supervision-based stance detection method as described above are implemented.
[0042] In the present invention, a call instruction and a training data set are obtained, and the call instruction and the training data set are input into a preset large language model to obtain a first reasoning process set; the training data set is input into a preset generation model to obtain a second reasoning process set, and the preset generation model is trained according to the first reasoning process set and the second reasoning process set to obtain a final generation model; the data to be predicted is input into the final generation model to obtain a target reasoning process, and the data to be predicted and the target reasoning process are input into a pre-trained local stance prediction model to obtain a stance detection result, which is used to represent the viewpoint of the data to be predicted. The present invention reduces the difficulty of stance detection, improves the accuracy of stance detection, and protects data privacy by constructing a local generation model and a stance prediction model, thereby avoiding data leakage. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 is a flow chart of a preferred embodiment of the remote-supervised stance detection method of the present invention;
[0044] Figure 2 It is an overall framework diagram of a preferred embodiment of the stance detection method based on remote supervision of the present invention;
[0045] Figure 3 It is an example diagram of the use of the calling instruction of the preferred embodiment of the remote supervision-based stance detection method of the present invention;
[0046] Figure 4 This is an example diagram of obtaining the first reasoning process of a preferred embodiment of the remote-supervised stance detection method of the present invention;
[0047] Figure 5 It is a schematic diagram of the principle of a preferred embodiment of the stance detection system based on remote supervision of the present invention;
[0048] Figure 6 Schematic diagram of the operating environment of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0050] The stance detection method based on remote supervision described in the preferred embodiment of the present invention is as follows: Figure 1 As shown, the stance detection method based on remote supervision includes the following steps:
[0051] Step S10: Obtain a calling instruction and a training data set, and input the calling instruction and the training data set into a preset large language model to obtain a first reasoning process set.
[0052] Specifically, Figure 2 As shown, the stance detection system in the preferred embodiment of the present invention is mainly composed of three parts, namely: a command-based thinking chain (COT), a generation model, and a stance classifier based on pre-trained BERT (Bidirectional Encoder Representations from Transformers, a language representation model).
[0053] Most traditional remote supervision methods construct weak supervision signals based on knowledge graphs. In recent years, due to the emergence of large language models (LLMs), their significant knowledge and understanding capabilities have been widely used in various tasks. The present invention proposes a method for constructing weak supervision signals based on the COT (thinking chain) method. The COT method reveals the multi-hop reasoning potential of LLMs, that is, LLMs can perform effective chain reasoning to meet user needs when given certain input prompts or instructions. Therefore, the present invention designs a method that uses a large language model to extract pseudo-labels by calling instructions, and uses the COT method to extract the reasoning process of the model using the analytical ability of LLMs.
[0054] Further, the acquiring of the calling instruction and the training data set, and inputting the calling instruction and the training data set into a preset large language model to obtain a first reasoning process set specifically includes:
[0055] Receive a call instruction input by a user, obtain a training data set from a preset database, and input the call instruction and the training data set into a preset large language model; the preset large language model performs reasoning process extraction processing on each sample in the training data set according to the call instruction to obtain a first reasoning process corresponding to each sample; integrate all the first reasoning processes to obtain a first reasoning process set.
[0056] Specifically, Figure 3 As shown, the stance detection system first receives the call instruction input by the user (equivalent to Figure 3 The stance detection system then sends the call instruction to the preset large language model. This process is to set the rules for the preset large language model to extract and process the reasoning process, such as Figure 3 In the API call, the relevant rules RULE are given first, and then the relevant Input and Output examples are given, so that the preset large language model can perform the corresponding reasoning process extraction processing according to the user's needs; Figure 4 A specific example is provided. The stance detection system first inputs the rule RULE corresponding to the call instruction (API call) into the preset large language model, and then inputs the sentence "She's smarter and works harder.". The preset large language model will give the corresponding output "IF (Hillary smarter and works harder.) THEN (the attitude towards Hillary is favor).", and then "Hillary smarter and works harder." is used as the reasoning process r, and "favor" is used as the pseudo label. The above process is the instruction-based COT method; therefore, in a preferred embodiment of the present invention, the training data set (equivalent to Figure 2 The original labeled training set D shown train ) is input into the preset large language model, and the preset large language model performs reasoning process extraction processing on all samples respectively to obtain the first reasoning process corresponding to each sample, and then integrates all the first reasoning processes to obtain the first reasoning process set And the pseudo label set corresponding to the training data set can also be extracted
[0057] Step S20: input the training data set into a preset generation model to obtain a second reasoning process set, and train the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model.
[0058] Specifically, although the instruction-based COT method can be used to directly extract the reasoning process according to the preset large language model, in actual application scenarios, it is usually necessary to use a smaller, locally deployable method to prevent data leakage when predicting stance. Therefore, the present invention proposes to use a generative model to learn the mapping relationship between the training data set and the first reasoning process set obtained by the instruction COT method, so that the corresponding target reasoning process can be directly generated for the unseen data to be predicted according to the final generative model, so that the preset large language model does not need to be used in the actual detection stage.
[0059] Further, the step of inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model specifically includes:
[0060] The training data set is input into a preset generation model, and the preset generation model generates a second reasoning process set according to the training data set; a cross entropy loss value is calculated according to the first reasoning process set and the second reasoning process set; and the preset generation model is optimized and trained according to the cross entropy loss value until a convergence condition is reached to obtain a final generation model.
[0061] Specifically, the preset generative model can be modeled using any encoder-decoder architecture. In a preferred embodiment of the present invention, a pre-trained sequence-to-sequence Transformer, i.e., a BART-large (a version of the BART model, Bidirectional and Auto-Regressive Transformers) model containing 4 million parameters is selected as the basic framework of the preset generative model.
[0062] like Figure 2 As shown, the training data set is first input into the preset generation model, and the preset generation model is based on the training data set D train Generate the second reasoning process set Then, the second reasoning process set is remotely supervised according to the first reasoning process set, the cross entropy loss value is calculated through the first reasoning process set and the second reasoning process set, and the stochastic gradient descent algorithm with Adam optimizer is used to minimize the cross entropy loss value, so as to optimize the training of the preset generation model until the convergence condition (set by the technicians) is reached, and the final generation model is obtained, which can effectively optimize the network parameters of the preset generation model and improve the reasoning process extraction capability of the preset generation model.
[0063] Furthermore, the inputting of the training data set into a preset generation model, wherein the preset generation model generates a second reasoning process set according to the training data set, specifically includes:
[0064] Acquire all input texts in the training data set and the targets corresponding to each of the input texts; splice all the input texts with the corresponding targets respectively to obtain splicing features; input the splicing features into the preset generation model, and the preset generation model generates a second reasoning process set according to the splicing features.
[0065] Specifically, obtain all input texts in the training data set and the target corresponding to each input text. The input text is represented as<x,p> , where x represents the input text, and p represents the target corresponding to the input text. For example, if the input text is "XX watch is really useful", the corresponding target is "XX company".
[0066] First, all the input texts and corresponding targets in the training data set are concatenated to obtain concatenated features, and then the concatenated features are input into the decoder as memory. Finally, the second reasoning process corresponding to each concatenated feature in the training data set is output, and all the second reasoning processes are integrated to obtain the second reasoning process set corresponding to the training data set.
[0067] Step S30: input the data to be predicted into the final generation model to obtain the target reasoning process, input the data to be predicted and the target reasoning process into the pre-trained local stance prediction model to obtain a stance detection result, and the stance detection result is used to represent the viewpoint of the data to be predicted.
[0068] Specifically, in a preferred embodiment of the present invention, the data to be predicted that requires stance detection is obtained from the user input, and then the data to be predicted is input into the final generation model. The final generation model outputs the target reasoning process according to the data to be predicted. Finally, the data to be predicted and the target reasoning process are input into a pre-trained local stance prediction model to obtain the final stance detection result. The stance detection result indicates the viewpoint that the data to be predicted wants to express, which is divided into three categories in the preferred embodiment of the present invention, namely: support, opposition and neutrality.
[0069] Furthermore, the step of inputting the data to be predicted into the final generation model to obtain a target reasoning process, and inputting the data to be predicted and the target reasoning process into a pre-trained local stance prediction model to obtain a stance detection result specifically includes:
[0070] Obtain the data to be predicted input by the user, input the data to be predicted into the final generation model, and obtain the target reasoning process; perform a splicing operation on the data to be predicted and the target reasoning process to obtain the data to be processed; input the data to be processed into the pre-trained local stance prediction model to obtain the sentence representation of the data to be predicted; perform stance detection according to the sentence representation to obtain the stance detection result.
[0071] Specifically, the data to be predicted input by the user is obtained, and then the data to be predicted is input into the final generation model that has been trained. The final generation model performs reasoning process extraction processing on the data to be predicted to obtain the target reasoning process corresponding to the data to be predicted.
[0072] The data to be predicted and the target reasoning process are concatenated to obtain the data to be processed, which is then used as the input of the local stance prediction model. The local stance prediction model processes the data to be processed to obtain the sentence representation corresponding to the data to be processed. Finally, stance detection is performed based on the sentence representation to obtain the final stance detection result.
[0073] Furthermore, the step of inputting the data to be processed into the pre-trained local stance prediction model to obtain sentence representation of the data to be predicted specifically includes:
[0074] Determine the hidden state corresponding to the data to be processed; based on the multi-head self-attention mechanism, calculate a first attention feature according to the hidden state; fuse and normalize the first attention feature and the hidden state to obtain a second attention feature; calculate an attention vector according to the second attention feature; perform weighted fusion processing on the attention vector and the second attention feature to obtain a sentence representation corresponding to the data to be processed.
[0075] Specifically, first determine the corresponding hidden state H according to the data to be processed, then input the hidden state H into the multi-head self-attention mechanism (MHsA), and calculate the output of the Transformer layer according to the hidden state H. The output of the Transformer layer is the first attention feature Attn(H). The specific calculation formula is:
[0076] Q=HW q , K = HW k , V = HW v ;
[0077]
[0078]
[0079] Among them, Q, K and V represent the query vector, key vector and value vector respectively, and W q , W k and W v are all learnable parameters, is the attention matrix, T is the transposed symbol, d K is the scale scaling factor.
[0080] Subsequently, by constructing a residual structure, the hidden state H and the calculated first attention matrix Attn(H) are fused, and layer normalization (LN) is applied to normalize the fused representation, that is, the fused representation is standardized to obtain the second attention feature Attn(H′). The specific calculation formula of the second attention feature is: Attn(H′)=LN(Attn(H)+H); the use of this residual structure can effectively alleviate the gradient vanishing problem and improve the training efficiency of the network.
[0081] The second attention feature Attn(H′) can be further processed by the feedforward layer based on the attention mechanism. The second attention feature Attn(H′) after the multi-head self-attention mechanism and the residual structure is taken as input and processed by the feedforward layer based on the attention mechanism. The feedforward layer includes a fully connected layer and a nonlinear activation function. By performing nonlinear mapping on the input, the features are further extracted to obtain the attention vector α t , the attention vector α t The specific calculation formula is: t =softmax(Attn(H′) t ), where t represents the classification category, usually three categories, namely support, opposition and neutral.
[0082] Then, by using the attention vector α t , the hidden state of the second attention vector Attn(H′) can be aggregated to learn the sentence representation e corresponding to the data to be processed. First, use the attention vector α t Each position in the second attention vector Attn(H′) is weighted to obtain a weighted representation, and then the weighted representation is fused to obtain the aggregated sentence representation e. The specific calculation formula is: Among them, n represents the number of categories; it should be noted that the attention vector α t It means that the complete attention vector α adds the information of the tth category, so that the attention is focused on the most important part of the data to be predicted, so as to better obtain the sentence representation corresponding to the data to be predicted.
[0083] Furthermore, performing stance detection according to the sentence representation to obtain a stance detection result specifically includes:
[0084] The sentence representation is processed by a preset stance detection function to obtain the probabilities of multiple detection results corresponding to the sentence representation; and the final stance detection result of the data to be predicted is obtained according to all the probabilities.
[0085] Specifically, the sentence representation is finally processed by a preset stance detection function to obtain the probabilities of multiple detection results corresponding to the sentence representation. In a preferred embodiment of the present invention, the Softmax function is used; the sentence representation is processed by the Softmax function to obtain the distribution of three types of predictions (support, opposition, and neutrality) converted into a probability distribution, and the prediction category with the largest probability is selected as the final stance detection result of the data to be predicted.
[0086] Furthermore, if Figure 5As shown, based on the above-mentioned stand detection method based on remote supervision, the present invention also provides a stand detection system based on remote supervision, wherein the stand detection system based on remote supervision includes:
[0087] An inference process acquisition module 51 is used to acquire a call instruction and a training data set, and input the call instruction and the training data set into a preset large language model to obtain a first inference process set;
[0088] A generation model training module 52, used for inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model;
[0089] The detection result generation module 53 is used to input the data to be predicted into the final generation model to obtain the target reasoning process, and input the data to be predicted and the target reasoning process into the pre-trained local stance prediction model to obtain the stance detection result, and the stance detection result is used to represent the viewpoint of the data to be predicted.
[0090] Furthermore, if Figure 6 As shown, based on the above-mentioned remote supervision-based stance detection method and system, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Figure 6 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0091] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code of the installation terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a remote-supervised position detection program 40 is stored on the memory 20, and the remote-supervised position detection program 40 can be executed by the processor 10, thereby realizing the remote-supervised position detection method in the present application.
[0092] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, configured to run the program code or process data stored in the memory 20, such as executing the remote supervision-based stance detection method.
[0093] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a system bus.
[0094] In one embodiment, when the processor 10 executes the remote supervision-based stance detection program 40 in the memory 20, the following steps are implemented:
[0095] Obtaining a call instruction and a training data set, and inputting the call instruction and the training data set into a preset large language model to obtain a first reasoning process set;
[0096] Inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model;
[0097] The data to be predicted is input into the final generation model to obtain a target reasoning process, and the data to be predicted and the target reasoning process are input into a pre-trained local stance prediction model to obtain a stance detection result, which is used to represent the viewpoint of the data to be predicted.
[0098] The acquiring of the calling instruction and the training data set, and inputting the calling instruction and the training data set into a preset large language model to obtain a first reasoning process set specifically includes:
[0099] Receive a call instruction input by a user, obtain a training data set from a preset database, and input the call instruction and the training data set into a preset large language model;
[0100] The preset large language model performs reasoning process extraction processing on each sample in the training data set according to the calling instruction to obtain a first reasoning process corresponding to each sample;
[0101] All of the first reasoning processes are integrated to obtain a first reasoning process set.
[0102] The step of inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model specifically includes:
[0103] Inputting the training data set into a preset generation model, wherein the preset generation model generates a second reasoning process set according to the training data set;
[0104] Calculate a cross entropy loss value according to the first reasoning process set and the second reasoning process set;
[0105] The preset generation model is optimized and trained according to the cross entropy loss value until a convergence condition is reached to obtain a final generation model.
[0106] The step of inputting the training data set into a preset generation model, wherein the preset generation model generates a second reasoning process set according to the training data set, specifically includes:
[0107] Obtain all input texts in the training data set and the target corresponding to each input text;
[0108] Concatenate all the input texts with the corresponding targets respectively to obtain concatenated features;
[0109] The splicing features are input into the preset generation model, and the preset generation model generates a second reasoning process set according to the splicing features.
[0110] The step of inputting the data to be predicted into the final generation model to obtain a target reasoning process, and inputting the data to be predicted and the target reasoning process into a pre-trained local stance prediction model to obtain a stance detection result specifically includes:
[0111] Obtaining the data to be predicted input by the user, inputting the data to be predicted into the final generation model, and obtaining the target reasoning process;
[0112] Performing a splicing operation on the data to be predicted and the target reasoning process to obtain data to be processed;
[0113] Inputting the data to be processed into the pre-trained local stance prediction model to obtain sentence representation of the data to be predicted;
[0114] A stance detection is performed according to the sentence representation to obtain a stance detection result.
[0115] The step of inputting the data to be processed into the pre-trained local stance prediction model to obtain sentence representation of the data to be predicted specifically includes:
[0116] Determine a hidden state corresponding to the data to be processed;
[0117] Based on the multi-head self-attention mechanism, a first attention feature is calculated according to the hidden state;
[0118] fusing and normalizing the first attention feature and the hidden state to obtain a second attention feature;
[0119] Calculate an attention vector according to the second attention feature;
[0120] A weighted fusion process is performed on the attention vector and the second attention feature to obtain a sentence representation corresponding to the data to be processed.
[0121] The performing stance detection according to the sentence representation to obtain a stance detection result specifically includes:
[0122] Processing the sentence representation by a preset stance detection function to obtain probabilities of multiple detection results corresponding to the sentence representation;
[0123] The final position detection result of the data to be predicted is obtained according to all the probabilities.
[0124] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a remote supervision-based stance detection program, and when the remote supervision-based stance detection program is executed by a processor, the steps of the remote supervision-based stance detection method as described above are implemented.
[0125] In summary, the present invention provides a remote-supervised stance detection method, system, and terminal, the method comprising: obtaining a call instruction and a training data set, and inputting the call instruction and the training data set into a preset large language model to obtain a first reasoning process set; inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model; inputting the data to be predicted into the final generation model to obtain a target reasoning process, and inputting the data to be predicted and the target reasoning process into a pre-trained local stance prediction model to obtain a stance detection result, the stance detection result is used to represent the viewpoint of the data to be predicted. The present invention reduces the difficulty of stance detection, improves the accuracy of stance detection, and protects data privacy to avoid data leakage by constructing a local generation model and a stance prediction model.
[0126] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or terminal including the element.
[0127] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the program can be stored in a computer-readable storage medium that can be read by a computer, and the program can include the processes of the above-mentioned method embodiments when executed. The computer-readable storage medium can be a memory, a disk, an optical disk, etc.
[0128] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A stance detection method based on remote supervision, characterized in that: The remote supervision-based stance detection method comprises: Obtaining a call instruction and a training data set, and inputting the call instruction and the training data set into a preset large language model to obtain a first reasoning process set; Inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model; The data to be predicted is input into the final generation model to obtain a target reasoning process, and the data to be predicted and the target reasoning process are input into a pre-trained local stance prediction model to obtain a stance detection result, which is used to represent the viewpoint of the data to be predicted.
2. The remote supervision-based stance detection method according to claim 1, characterized in that: The acquiring of the calling instruction and the training data set, and inputting the calling instruction and the training data set into a preset large language model to obtain a first reasoning process set specifically includes: Receive a call instruction input by a user, obtain a training data set from a preset database, and input the call instruction and the training data set into a preset large language model; The preset large language model performs reasoning process extraction processing on each sample in the training data set according to the calling instruction to obtain a first reasoning process corresponding to each sample; All of the first reasoning processes are integrated to obtain a first reasoning process set.
3. The remote supervision-based stance detection method according to claim 1, characterized in that: The step of inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model specifically includes: Inputting the training data set into a preset generation model, wherein the preset generation model generates a second reasoning process set according to the training data set; Calculate a cross entropy loss value according to the first reasoning process set and the second reasoning process set; The preset generation model is optimized and trained according to the cross entropy loss value until a convergence condition is reached to obtain a final generation model.
4. The remote supervision-based stance detection method according to claim 3, characterized in that: The step of inputting the training data set into a preset generation model, wherein the preset generation model generates a second reasoning process set according to the training data set, specifically includes: Obtain all input texts in the training data set and the target corresponding to each input text; Concatenate all the input texts with the corresponding targets respectively to obtain concatenated features; The splicing features are input into the preset generation model, and the preset generation model generates a second reasoning process set according to the splicing features.
5. The remote supervision-based stance detection method according to claim 1, characterized in that: The step of inputting the data to be predicted into the final generation model to obtain a target reasoning process, and inputting the data to be predicted and the target reasoning process into a pre-trained local stance prediction model to obtain a stance detection result specifically includes: Obtaining the data to be predicted input by the user, inputting the data to be predicted into the final generation model, and obtaining the target reasoning process; Performing a splicing operation on the data to be predicted and the target reasoning process to obtain data to be processed; Inputting the data to be processed into the pre-trained local stance prediction model to obtain sentence representation of the data to be predicted; A stance detection is performed according to the sentence representation to obtain a stance detection result.
6. The remote supervision-based stance detection method according to claim 5, characterized in that: The step of inputting the data to be processed into the pre-trained local stance prediction model to obtain sentence representation of the data to be predicted specifically includes: Determine a hidden state corresponding to the data to be processed; Based on the multi-head self-attention mechanism, a first attention feature is calculated according to the hidden state; fusing and normalizing the first attention feature and the hidden state to obtain a second attention feature; Calculate an attention vector according to the second attention feature; A weighted fusion process is performed on the attention vector and the second attention feature to obtain a sentence representation corresponding to the data to be processed.
7. The remote supervision-based stance detection method according to claim 5, characterized in that: The performing stance detection according to the sentence representation to obtain a stance detection result specifically includes: Processing the sentence representation by a preset stance detection function to obtain probabilities of multiple detection results corresponding to the sentence representation; The final position detection result of the data to be predicted is obtained according to all the probabilities.
8. A remotely supervised stance detection system, characterized in that: The remote supervision-based stance detection system comprises: An inference process acquisition module, used to acquire a call instruction and a training data set, and input the call instruction and the training data set into a preset large language model to obtain a first inference process set; A generation model training module, used for inputting the training data set into a preset generation model to obtain a second reasoning process set, and training the preset generation model according to the first reasoning process set and the second reasoning process set to obtain a final generation model; The detection result generation module is used to input the data to be predicted into the final generation model to obtain the target reasoning process, input the data to be predicted and the target reasoning process into the pre-trained local stance prediction model to obtain the stance detection result, and the stance detection result is used to represent the viewpoint of the data to be predicted.
9. A terminal, characterized in that: The terminal includes: a memory, a processor, and a remote supervision-based stance detection program stored in the memory and executable on the processor. When the remote supervision-based stance detection program is executed by the processor, the steps of the remote supervision-based stance detection method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a remote-supervision-based stance detection program, and when the remote-supervision-based stance detection program is executed by a processor, the steps of the remote-supervision-based stance detection method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Standard-based abstract generation method and system, terminal and storage medium
CN119203993A
LLM-based dialectic decision-making method between multiple agents and method for synthesizing, by using same, datasets for evaluating artificial intelligence system
WO2026095205A1
