A Social Media Speech Stance Detection Method Based on Conjugate Chain Reasoning and Intelligent Gating Function
By using conjugated chain inference and intelligent gating function methods in position detection, complementary parallel inference chains and reference nodes are constructed, which solves the problems of instability and inefficiency in the existing technology, and achieves a more efficient, accurate and stable position detection effect.
Patent Information
- Application Number
- CN202510433379.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2045-04-08
AI Technical Summary
The existing position detection method based on large language models has problems such as inference instability, inefficiency and insufficient information utilization.
A method based on conjugated chain inference and intelligent gating function is adopted to achieve dynamic interaction and conditional fusion by constructing two complementary parallel inference chains (support chain and opposition chain) and an independent reference node, and the inference process is optimized through the scoring function and gating mechanism.
It improves the efficiency and stability of position detection, enhances the accuracy and robustness of reasoning, avoids excessive reasoning, and achieves more efficient, more stable and smarter position detection.
Smart Images

Figure CN119940556B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing (NLP), and specifically to a method for detecting the stance of social media speech based on conjugate chain reasoning and intelligent gating functions. Background Art
[0002] Stance detection is an important task in natural language processing, aiming to determine the attitude of a text towards a certain target (such as a person, an event, an opinion, etc.). With the progress of technologies related to large language models, natural language processing sub-fields such as stance detection and sentiment analysis increasingly use methods based on large language models. Most of the existing stance detection methods rely on a single reasoning chain or independent multiple chains for reasoning. Although they can complete basic tasks, there are the following problems:
[0003] (1) The reasoning process is long and unstable, often relying on artificially specified thinking steps.
[0004] (2) In the multi-chain scenario, there is little interaction between reasoning chains, and the reasoning results of each chain are not fully utilized.
[0005] (3) There is often a lack of an efficient termination mechanism, which easily leads to over-inference, reducing the reasoning efficiency and robustness. Summary of the Invention
[0006] The purpose of the present invention is: aiming at the problems of unstable reasoning, low efficiency, and insufficient information utilization in the current stance detection technology based on large language models, a method of comprehensive reasoning using an independent reference node plus two complementary parallel reasoning chains (conjugate stance chains) is proposed to detect the stance expressed by social media speech. Previous methods often relied on single-link reasoning, with a long and unstable reasoning process and over-computation phenomenon; while multi-link methods can perform parallel reasoning, but lack a flexible link interaction mechanism and are difficult to fully utilize the information in each link. The present invention constructs two complementary parallel links: a support link and an opposition link, initializes two opposing views of support and opposition as the initial nodes of the two links respectively, guides the large model to continuously and synchronously deepen and correct the views on the two different views, in order to reach a consistent conclusion. When performing the next step of reasoning (link extension) each time, external knowledge is injected, and according to the confidence levels of the complementary links, it is dynamically selected whether to introduce the views of adjacent links to achieve dynamic interaction and conditional fusion within the links. At the same time, combined with the backup assistance of the reference node, the situation of long-link instability is prevented. This "conjugate chain" mechanism enables the two links to influence each other and deepen the views during the reasoning process, achieving the "depth" of reasoning. The introduction of external knowledge and the reference node expands the "breadth" of information, and their combined effects can improve the accuracy and stability of reasoning.
[0007] However, an overly long reasoning chain will reduce the detection efficiency and introduce instability. To solve this problem, the present invention designs another scoring function and its gating mechanism. The function comprehensively evaluates the consistency of positions and the overall position among the independent reference node and the latest nodes of the two links, and gives a score. The higher the absolute value of the score, the higher the degree of consensus reached by the system on a certain view, and the positive or negative sign of the score represents the position polarity (support or opposition). Therefore, when a high degree of consistency is achieved among the three nodes during the reasoning process, the link extension can be terminated in advance, and instead, the final node (representing the final conclusion) is generated to improve the reasoning efficiency. Finally, during the final node generation stage, the information of the two links and the reference node is integrated to ensure the robustness and credibility of the reasoning result.
[0008] The present invention aims to provide a more efficient, stable, and intelligent solution for stance detection in natural language processing.
[0009] The technical solution of the present invention is as follows:
[0010] A method for detecting the stance of social media remarks based on conjugate chain reasoning and intelligent gating function, comprising the following steps:
[0011] Step S1: For a given text to be detected and target, respectively generate the initial nodes of two opposing stance links and an independent reference node, and set the upper limit L of the link length and the upper threshold of the gating mechanism and the lower threshold ;
[0012] Step S2: Before performing the next step of reasoning, perform dynamic external knowledge injection, and supplement the question-knowledge pairs for the two links respectively according to the conclusion of the previous step;
[0013] Step S3: Combine the external knowledge injection, and conditionally cross-adjacent link arguments, perform reasoning and extend the link;
[0014] Step S4: Evaluate the latest nodes of the two links and the reference node through the node stance scoring function, and select the next operation according to the result of the scoring function;
[0015] Step S5: When the link extension reaches the length limit or the scoring function reaches a clear conclusion, enter the final node generation stage; otherwise, repeat steps S2 - S4;
[0016] Step S6: Integrate the results of the two links and the information of the reference node to construct a final node to represent the final reasoning result.
[0017] Further, the specific content of step S1 includes:
[0018] By specifying a stance, the large language model is called sequentially to generate supporting nodes and opposing nodes, each containing two opposing views, as the initial nodes of the support chain and the opposing chain. Additionally, an independent reference node without a specified stance is generated separately.
[0019] Furthermore, the method of external knowledge injection is specifically as follows: Using a large model or an external retrieval tool, external knowledge composed of question-answer combinations is constructed by summarizing the latest nodes.
[0020] Furthermore, the argument for adjacent links in step S3 is as follows:
[0021] When the confidence of the node generated in the previous round on the adjacent link is greater than the set confidence threshold, it is added to the reasoning of the current link together with the external knowledge to generate a new node and extend the link.
[0022] Furthermore, the node stance scoring function is specifically a gated scoring function, and the formula is as follows:
[0023] ;
[0024] Among them, represents the stance score of the node, represents the polarity of the node, with three values, representing opposition, neutrality, and support respectively; represents the confidence of the node; , and represent the stance scores of the opposing chain node , the stance score of the support chain node and the stance score of the reference node K respectively; is a variance calculation function; when the score exceeds the upper threshold, it is determined that the text supports the target stance; when it is lower than the lower threshold, it is determined that the text opposes the target stance; otherwise, go to the next step.
[0025] Furthermore, the node is defined as follows:
[0026] ;
[0027] Among them, represents the argument, which summarizes the explanatory text argument for the judgment in the form of a paragraph of text; represents the polarity, with three values representing opposition, neutrality, and support respectively; represents the confidence; these three variables are simultaneously extracted from the single-round output of the large model.
[0028] Furthermore, the generation of the node in step 1 is described by the following formula:
[0029] ;
[0030] Among them, , , represent the opposition node, the support node, and the reference node respectively; represents a large language model with parameter ; represents a prompt template used to guide the model to generate nodes with an "opposition" stance during the initialization of the opposition chain; represents a prompt template used to guide the model to generate nodes with a "support" stance during the initialization of the support chain; represents the prompt template used to generate the reference node; represents the text to be detected; represents the stance target corresponding to the text.
[0031] Furthermore, the final node is specifically as follows:
[0032] When the score calculated by the gating scoring function for the generation of the final node exceeds the threshold, given the symbol represents the argument of the final node, represents the polarity of the final node, then the generation of the final node is described by the following formula:
[0033] ;
[0034] Among them, represents the sign function, which returns 1 if the input is a positive number and -1 if the input is a negative number; represents the final actual length of the link, and respectively represent the final nodes of the opposition chain and the support chain;
[0035] If the upper limit of the link triggers the generation of the final node, the large model is called to summarize the polarity and argument at the same time, so as to construct the final node:
[0036] .
[0037] Compared with the existing technology, the beneficial effects of the present invention are:
[0038] 1. Inference efficiency. By constructing two parallel conjugate stance chains, the present invention realizes the parallelization of the inference process, effectively shortening the inference time. Compared with the traditional single thought chain method, it avoids long and unstable inference paths and reduces the dependence on artificially specified thinking steps. On the other hand, the present invention comprehensively reflects the maturity of the inference through a scoring function. When the score exceeds the preset upper threshold or is lower than the lower threshold, the system will immediately terminate the extension of the link and determine the stance of the text as "support" or "opposition". This mechanism effectively avoids over-inference and improves the inference efficiency.
[0039] 2. Accuracy and robustness. By introducing a dynamic interaction and conditional fusion mechanism, the two chains can influence and correct each other during the inference process, which not only improves the inference efficiency but also enhances the stability. In the arbitration stage, the system will synthesize the information of the two chains and the reference nodes to generate the final node, ensuring the robustness and credibility of the inference result. Compared with the prior art, the present invention can not only make accurate judgments in clear situations but also maintain stable detection performance in complex or ambiguous situations, achieving more efficient, stable, and intelligent stance detection.
[0040] 3. Innovative knowledge and link interaction mechanism. The present invention introduces an external knowledge injection collaborative link interaction mechanism, significantly enhancing the depth and breadth of the inference. During the inference process, the system will use a large model or an external retrieval tool to construct external knowledge according to the requirements of the latest node and inject it into the link inference. At the same time, the interaction logic between the links ensures that the information of adjacent links can be effectively fused, further improving the comprehensiveness of the inference. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a flowchart of a method for detecting the stance of social media speech based on conjugate chain inference and intelligent gating function.
[0042] Figure 2 It is a schematic diagram of the data structure of the nodes used in the inference process.
[0043] Figure 3 It is a detailed flowchart of conjugate chain inference.
[0044] Figure 4 It is a schematic diagram of the interaction logic between the links. DETAILED DESCRIPTION OF THE INVENTION
[0045] The following further elaborates on the present invention in conjunction with specific embodiments, but the present invention is not limited to the following embodiments.
[0046] Embodiment 1
[0047] This embodiment provides a method for detecting the stance of social media speech based on conjugate chain inference and intelligent gating function, asFigure 1 As shown, it includes the following steps:
[0048] Step S1: For the given text to be detected and the target, respectively generate the initial nodes of two links and an independent reference node, and set the upper limit L of the link length and the upper and lower thresholds of the gating mechanism and the lower threshold ;
[0049] Specifically, by specifying the stance, the large language model is called in sequence to generate supporting nodes and opposing nodes, each containing two opposing views, as the initial nodes of two links (supporting link and opposing link), and an independent reference node that does not specify the stance is generated separately.
[0050] As Figure 2 shown, the node is defined as follows:
[0051]
[0052] Among them: represents the argument, which summarizes the explanatory text argument for generating the judgment in the form of a paragraph of text; represents the polarity, with three values representing opposition, neutrality, and support respectively; represents the confidence level, indicating the confidence of the large model in the correctness of its own view. The three variables are simultaneously extracted from the single-round output of the large model, and the specific details are set through the prompt words.
[0053] The generation of the node can be described by the following formula:
[0054]
[0055] Among them, , , represent the opposing node, the supporting node, and the reference node respectively; represents the large language model with parameter ; represents the prompt word template used to guide the model to generate nodes with an "opposing" stance when initializing the opposing link; represents the prompt word template used to guide the model to generate nodes with a "supporting" stance when initializing the supporting link; represents the prompt word template used to generate the reference node; represents the text to be detected; represents the stance target corresponding to the text.
[0056] Step S2: Before proceeding to the next round of reasoning, perform dynamic external knowledge injection. Based on the conclusion of the previous step, supplement question-knowledge pairs for the two links respectively. The specific method for obtaining external knowledge is as follows:
[0057] Use a large model or an external retrieval tool to construct external knowledge consisting of several question-answer combinations by summarizing the latest nodes. The generation process can be described by the following formula:
[0058]
[0059]
[0060] Where, represents the latest node of one of the two links; represents the node the question that needs to be answered for reasoning; represents the tool for obtaining knowledge, which can be a large model or an API tool such as online retrieval; represents the question answer.
[0061] Step S3: Combine external knowledge injection, conditionally cross-reference the evidence of adjacent links, perform reasoning, and extend the links. Specifically, if the confidence of the node generated in the previous round on the adjacent link is high enough, add it together with the external knowledge to the reasoning of the current link to generate a new node and extend the link. The specific process is described by the following formula (taking the anti-chain as an example, the other link is the same):
[0062]
[0063] Where, represents the anti-chain node to be generated currently; and represent the external questions and corresponding answers required for generating the node ; represents the node obtained in the previous round of generation on the support chain; represents the confidence of the node .
[0064] Step S4: Evaluate the latest nodes and reference nodes of the two links through the node stance scoring function, and select the next operation according to the result of the scoring function;
[0065] The node stance scoring function is specifically the gated scoring function. The formula is as follows. The numerator is the sum of the stance scores of the three nodes, representing the overall sentiment stance of the system. The denominator is calculated through variance, which can represent the degree of difference between the three nodes, and increases the denominator when there are disagreements to suppress the calculated score:
[0066]
[0067] Among them, represents the position score of a certain node. The magnitude of the value indicates the intensity of sentiment, and the plus or minus sign indicates the sentiment direction (support or opposition). , and respectively represent the position scores of the nodes in the anti-chain , the position scores of the nodes in the support chain , and the position score of the reference node K; is the variance calculation function, which is used to evaluate the degree of consistency among the three;
[0068] When the score exceeds the upper threshold , it is determined that the text supports the target position. When it is lower than the lower threshold , it is determined that the text opposes the target position. Otherwise, further judgment is required.
[0069] Step S5: When the link extension reaches the length limit or the scoring function reaches a clear conclusion, stop the reasoning and extension of the link and enter the final node generation stage; otherwise, repeat steps S2 - S4; if the link length reaches the limit or the value of the gated scoring function exceeds the threshold, generate the final node. Otherwise, repeat steps S2 - S4 to continuously extend the link.
[0070] Step S6: Synthesize the results of the two links and the information of the reference node to construct the final node to represent the final reasoning result.
[0071] Specifically, if the final node generation stage is triggered by the gated score reaching the threshold, it means that the reasoning of the three nodes reaches an agreement. Therefore, the polarity of the final node can be directly determined by the score, and only the arguments need to be summarized in this stage. Otherwise, it is necessary to call the large model to summarize both the polarity and the arguments to construct the final node.
[0072] When the generation of the final node is triggered by the value calculated by the gated scoring function exceeding the threshold, given the symbol representing the arguments of the final node, representing the polarity of the final node, then the generation of the final node can be described by the following formula:
[0073]
[0074] Among them, represents the sign function, which returns 1 if the input is a positive number and -1 if it is a negative number; represents the final actual length of the link, and respectively represent the final nodes of the anti-chain and the support chain.
[0075] If the link upper limit triggers the generation of the final node, call the large model to summarize the polarity and arguments simultaneously, so as to construct the final node:
[0076]
[0077] Embodiment 2
[0078] Implementation of the conjugate stance chain.
[0079] This embodiment demonstrates the basic implementation of the present invention, using the conjugate stance chain to perform inference detection of the text on the target stance. The large language model used has parameters , and can generate response replies according to the input. The external knowledge acquisition tool is the intelligent agent constructed by the large model, which can quickly respond to the external information requirements of the inference node and return relevant answers. Secondly, it is necessary to clarify the maximum length L of this inference, as well as the upper and lower thresholds of the gating mechanism, as Figure 3 shown, including the following steps:
[0080] Step S1: Generation of the initial node;
[0081] Input text and target , through the prompt template and respectively generate the initial node of the support chain and the initial node of the opposition chain. Use the prompt template to generate the independent reference node , ensuring that even if the two links deviate, the system can still refer to the independent view to assist in decision-making. The node form is defined as , where represents the text argument of the node, represents the polarity, represents the confidence; the specific node generation process is as follows:
[0082] Step S2: Inference based on knowledge interaction;
[0083] According to the text argument of the current link node, generate a question through the large language model, and use the online retrieval tool to obtain the answer . Inject the question-answer pair into the corresponding link to supplement the external knowledge required for the inference process.
[0084] When expanding the inference of the two links, check the confidence of the adjacent link nodes. As Figure 4As shown, if the confidence of adjacent link nodes is high ( ), its argument and external knowledge are used as inputs to extend the current link: . If the confidence is low, only the information of the current link is used for extension:
[0085] Step S3: Scoring and termination judgment;
[0086] The newly generated node is comprehensively evaluated through a scoring function : Among them is the node stance score. According to the scoring result, if or , the reasoning is stopped and the final node generation stage is entered; otherwise, step S2 is continued.
[0087] Step S4: Final node generation;
[0088] If the score exceeds the threshold, the polarity of the final node is directly generated: , and then the large model is called to summarize the arguments of the three nodes (two final link nodes and one reference node): . If the upper limit of the link triggers the generation of the final node, it indicates that the link information is inconsistent and arbitration is required. At this time, the large model is called to comprehensively summarize the information of the two links and the reference node to generate the final node, and the polarity and argument are also generated.
[0089] In summary, the present invention provides an innovative, efficient and stable technical solution for the stance detection task.
[0090] It can be understood that the present invention is described through some embodiments. Those skilled in the art know that without departing from the spirit and scope of the present invention, various changes or equivalent replacements can be made to these features and embodiments. Additionally, under the teaching of the present invention, these features and embodiments can be modified to adapt to specific situations and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application belong to the scope protected by the present invention.
Claims
1. A social media speech stance detection method based on conjugate chain reasoning and intelligent gating function, characterized in that: The following steps are involved: Step S1: For the given text to be detected and the target, generate the initial nodes of two opposing position links and an independent reference node respectively, and set the upper limit of the link length L and the upper threshold θ of the gating mechanism up and the lower threshold θ down ; Step S2: Before the next step of reasoning, dynamic external knowledge injection is performed to supplement the two links with question-knowledge pairs according to the conclusion of the previous step; Step S3: Combined with external knowledge injection, conditionally interact with adjacent link arguments, perform reasoning and extend the link; specifically, when the node confidence of the adjacent link generated in the previous round is greater than the set confidence threshold, add it together with the external knowledge to the reasoning of the current link to generate a new node and extend the link; Step S4: Evaluate the latest nodes and reference nodes of the two links through the node stance scoring function, and select the next operation according to the result of the scoring function; the node stance scoring function is specifically a gated scoring function, and the formula is as follows: Among them, g=pd represents the node's position score, p represents the node's polarity, which has three values, indicating opposition, neutrality, and support; d represents the node's confidence; and g K Represents the opposing chain node X i Position points, support chain node Y i The position score of the target and the position score of the reference node K; Var is the variance calculation function; when the score Score exceeds the upper threshold, the text is determined to be "supportive" of the target; if it is lower than the lower threshold, the text is determined to be "opposed" to the target; otherwise, go to the next step; Step S5: When the link extension reaches the upper limit or the scoring function reaches a clear conclusion, the final node generation phase is entered; otherwise, steps S2-S4 are repeated; Step S6: Integrate the two-link results and reference node information to construct a final node to represent the final reasoning result.
2. According to claim 1, a method for detecting social media speech stance based on conjugate chain reasoning and intelligent gating function is characterized in that: The step S1 specifically includes: By specifying a stance, the large language model is called in sequence to generate support nodes and opposition nodes, which contain two opposing viewpoints as the initial nodes of the support chain and opposition chain respectively. In addition, an independent reference node without specifying a stance is generated separately.
3. According to claim 2, a method for detecting social media speech stance based on conjugate chain reasoning and intelligent gating function is characterized in that: The specific method of injecting external knowledge is: using a large model or an external search tool to construct external knowledge composed of a question-answer combination by summarizing the latest nodes.
4. According to claim 3, a method for detecting social media speech stance based on conjugate chain reasoning and intelligent gating function is characterized in that: The node definition is as follows: (C,p,d),p∈{-1,0,1},d∈{1,2,..,5}; Among them, C represents argument, which summarizes the explanatory textual arguments that produce the judgment in the form of a paragraph; p represents polarity, and the three values -1, 0, and 1 represent opposition, neutrality, and support respectively; d represents confidence; these three variables are extracted simultaneously from the single-round output of the large model.
5. According to claim 4, a method for detecting social media speech stance based on conjugate chain reasoning and intelligent gating function is characterized in that: The generation of the node in step S1 is described by the following formula: Among them, X0, Y0, and K represent opposing nodes, supporting nodes, and reference nodes, respectively; represents a large language model with parameters θ; P against represents the prompt word template used to guide the model to generate nodes with "opposition" stance when the opposition chain is initialized; support Represents the prompt word template used to guide the model to generate nodes with a "support" stance when the support chain is initialized; P CoT represents the prompt word template used to generate the reference node; S represents the text to be detected; t represents the stance target corresponding to the text.
6. According to claim 5, a method for detecting social media speech stance based on conjugate chain reasoning and intelligent gating function is characterized in that: The final nodes are as follows: When the final node generation is triggered by the score calculated by the gated scoring function exceeding the threshold, given the symbol C F represents the final node argument, p F represents the final node polarity, then the final node F=(C F ,p F ) is generated by the following formula: Among them, Sign represents the sign function, which returns 1 if the input is a positive number and -1 if the input is a negative number; N represents the final actual length of the link, and X N and Y N They represent the final nodes of the opposition chain and the support chain respectively; If the link cap triggers the generation of the final node, the large model is called to summarize the polarity and arguments at the same time, thus constructing the final node:
7. According to claim 6, a method for detecting social media speech stance based on conjugate chain reasoning and intelligent gating function is characterized in that: The confidence threshold is 4.
Citation Information
Patent Citations
Dialogue system using knowledge bases and language models for automotive systems and applications
CN117725150A
Long context knowledge reasoning method based on large language model knowledge extraction and self-consistent thinking chain prompt
CN119378685A