Public opinion information retrieval method based on big language model and knowledge graph bidirectional enhancement

By leveraging a bidirectional enhancement mechanism combining large language models and knowledge graphs, a knowledge graph is dynamically constructed and combined with a multi-factor ranking algorithm. This addresses the issues of information fragmentation and timeliness in public opinion information retrieval, enabling personalized public opinion information retrieval and decision support.

CN121350336APending Publication Date: 2026-01-16NANJING LES CYBERSECURITY & INFORMATION TECH RES INST CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511334589.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-18
Publication Date
2026-01-16

AI Technical Summary

Technical Problem

Existing technologies for retrieving public opinion information suffer from fragmented information, semantic comprehension bias, and insufficient dynamic evolution tracking capabilities. Traditional methods cannot effectively associate semantics, and large language models are costly and infrequently updated, leading to the omission of the latest content. Retrieval enhancement generation technologies have weak reasoning capabilities and cannot achieve personalized recommendations.

Method used

By constructing a two-way enhancement mechanism, leveraging the mutual enhancement of large language models and knowledge graphs, dynamically building knowledge graphs, updating public opinion data in real time, and combining multi-factor ranking algorithms for personalized retrieval, a comprehensive score based on semantic matching, path weight, and user interest is achieved.

Benefits of technology

It improves the accuracy and timeliness of public opinion information retrieval, and realizes the leap from information matching to decision support, which is applicable to scenarios such as public opinion emergency response and risk control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121350336A_ABST
    Figure CN121350336A_ABST
Patent Text Reader

Abstract

The invention provides a public opinion information retrieval method based on bidirectional enhancement of a big language model and a knowledge graph. The method comprises the following steps: constructing a bidirectional enhancement mechanism, enhancing the big language model through the knowledge graph, and enhancing the knowledge graph through the big language model to obtain an enhanced big language model and the enhanced knowledge graph; acquiring real-time public opinion data in real time, and dynamically constructing a knowledge graph by adopting the bidirectional enhancement mechanism according to the real-time public opinion data; personalized retrieval and sorting are carried out, retrieval calculation is carried out on the knowledge graph and the content in the public opinion data retrieval pool according to user retrieval content, a retrieval result is obtained through sorting, and public opinion information retrieval based on bidirectional enhancement of the large language model and the knowledge graph is completed. According to the method, the crossing from a static knowledge base to a dynamic cognitive system can be realized, and second-level response knowledge reserve and deduction capability are provided for decision making; the qualitative change from a retrieval result to decision insight is realized, the user is effectively enabled, and the user stickiness is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a public opinion information retrieval method, and more particularly to a public opinion information retrieval method based on bidirectional enhancement of a large language model and a knowledge graph. Background Technology

[0002] This section provides only background information relevant to this disclosure and is not necessarily prior art.

[0003] With the continuous development of network technology and the increasing growth of the online media industry, public opinion data is characterized by large volume, complex content, and significant time sensitivity, posing challenges to public opinion content management and retrieval. The core challenges currently facing public opinion information retrieval lie in information fragmentation, semantic comprehension bias, and insufficient ability to track dynamic evolution.

[0004] While existing technologies partially address the problems, significant bottlenecks remain: Traditional keyword retrieval techniques can achieve basic text matching and support simple public opinion monitoring (such as hot word statistics), but cannot correlate semantics (e.g., "apple" cannot distinguish between a company and a fruit); retrieval methods based on static knowledge graphs improve semantic relevance through entity relationship networks (e.g., the "company-negative event-user" link), but graph updates rely on manual intervention, resulting in excessively long update times for new public opinion events, and fixed node weights make it impossible to quantify the decay of event influence; Large Language Models (LLM) are single-path applications that directly generate query results using semantic understanding, but due to the inherent illusions of large models, there are instances where answers conflict with facts. Furthermore, the high training cost of large models means that real-time data updates are not frequent enough, leading to the omission of the latest public opinion content; Retrieval Augmentation (RAG) technology can supplement external knowledge through vector retrieval, but its reasoning ability is weak, and it cannot perform decision-making reasoning and personalized recommendations for user questions.

[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] Purpose of the invention: The technical problem to be solved by the present invention is to provide a public opinion information retrieval method based on bidirectional enhancement of large language model and knowledge graph, which addresses the shortcomings of the existing technology.

[0007] To address the aforementioned technical problems, this invention discloses a public opinion information retrieval method based on bidirectional enhancement of a large language model and knowledge graph, comprising the following steps:

[0008] Step 1: Construct a bidirectional enhancement mechanism, which enhances the large language model through the knowledge graph and enhances the knowledge graph through the large language model, resulting in an enhanced large language model and an enhanced knowledge graph, respectively.

[0009] Step 2: Obtain real-time public opinion data through the real-time data acquisition pipeline, and dynamically construct a knowledge graph based on the real-time public opinion data using the bidirectional enhancement mechanism;

[0010] Step 3: Personalized search and ranking. Based on the user's search content, the knowledge graph constructed in Step 2 is used to search and calculate the content in the public opinion data retrieval pool, and the search results are ranked to obtain the search results, thus completing the public opinion information retrieval based on the bidirectional enhancement of the large language model and knowledge graph.

[0011] Furthermore, the construction of the bidirectional enhancement mechanism described in step 1 includes:

[0012] Step 1-1: Enhance the large language model through knowledge graphs, that is, transform the structured relationships of the knowledge graph into natural language prompts and inject them into the reasoning process of the large language model;

[0013] Steps 1-2 involve enhancing the knowledge graph through a large language model. This involves using a large language model to extract entity relationships from unstructured text, generating labeled data, dynamically updating the knowledge graph, and expanding the graph to include missing relationships.

[0014] Furthermore, the dynamic construction of the knowledge graph described in step S includes:

[0015] Step 2-1: Obtain real-time public opinion data through the real-time data acquisition tube;

[0016] Step 2-2: Using the enhanced large language model, input instructions to extract entities, relationships, attributes, and attribute values ​​from the public opinion data;

[0017] Steps 2-3: Add a timestamp attribute to each extracted entity, which records the occurrence time of the events associated with it;

[0018] Steps 2-4: For each extracted entity, label it based on its associated events;

[0019] Steps 2-5: Pre-set initial weights for each tag and dynamically update the weights.

[0020] Furthermore, the personalized search ranking mentioned in step 2 includes:

[0021] A multi-factor ranking method is adopted, which calculates a ranking score based on the degree of matching between the user's search content and the relevant content of the knowledge graph, and the freshness of the matching event. The result with the highest score is taken as the search result. The method for calculating the ranking score is as follows:

[0022] Score=α·LLMMatchScore+β·KGPathWeight+γ·UserInterestsWeight

[0023] Wherein, Score is the ranking score, LLMMatchScore is the semantic matching score, KGPathWeight is the path weight score, UserInterestsWeight is the interest score, and α, β and γ are the weights of each score.

[0024] Furthermore, the enhancement of the large language model through knowledge graphs described in step 1-1 includes:

[0025] Step 1-1-1: Obtain node information of events in the knowledge graph;

[0026] Step 1-1-2: Input the node information into the large language model to be enhanced and convert it into natural language;

[0027] Step 1-1-3: When a user asks a question, the large language model responds to the user's question using natural language derived from the node information of events in the knowledge graph.

[0028] Furthermore, the enhancement of knowledge graphs through large language models described in steps 1-2 includes:

[0029] Step 1-2-1: Obtain public opinion data from social media;

[0030] Step 1-2-2: Extract entity relationships from the events in the acquired public opinion data using a large language model, record the time attribute of the event, and label the extracted entities based on the event.

[0031] Steps 1-2-3 update nodes in the existing knowledge graph, that is, by comparing existing nodes in the knowledge graph with the large language model, update the new relationships of events in the public opinion data.

[0032] Furthermore, the dynamic updating of the weights described in steps 2-5 includes:

[0033] The weights are dynamically updated using a weight dynamic update function, as shown below:

[0034] w e (t)=w0·e -λt +β·I new_event

[0035] Among them, w e The updated weights are: w0 is the old weight from the previous stage of the current event, λ is the time decay coefficient, t is the time from the previous stage of the event in hours, β is the heat coefficient used to assess the intensity of public opinion dissemination, and I... new_event It is the impact value of a new event, used to measure the severity of the new event itself;

[0036] The calculation method for the heat coefficient is as follows:

[0037]

[0038] Where C is the current propagation volume, T is the baseline threshold, which is set according to the event type, and min indicates taking the minimum value;

[0039] The current propagation quantity C is calculated as follows:

[0040]

[0041] Where p represents different dissemination platforms, r p It is the original propagation volume, c p It is the platform conversion factor, w platform It's platform authority;

[0042] The method for calculating the impact value of a new event is as follows:

[0043]

[0044] Among them, I base It is the base impact value, determined by the event type, I extra,j This is an additional impact value, calculated based on the specific circumstances of the event.

[0045] Furthermore, the semantic matching score mentioned in step 2 is calculated as follows:

[0046] Extract entities from user-input questions;

[0047] The extracted entities are expanded, including: using an enhanced large language model to obtain the first keyword related to the entity, associating with the knowledge graph to obtain the second keyword related to the entity, merging the keywords, and quantizing them to obtain vectorized keywords;

[0048] Calculate the cosine similarity between the vectorized keywords and the text in the search pool. The cosine similarity value is the semantic matching score.

[0049] Furthermore, the path weight score mentioned in step 2 is calculated as follows:

[0050] Calculate the cosine similarity between text in the retrieval pool and entities in the knowledge graph. Based on the cosine similarity, identify the event with the highest matching degree, and assign a real-time weight w to the tag of that event. e (t) represents the path weight score.

[0051] Furthermore, the interest score mentioned in step 2 is calculated as follows:

[0052] For each question raised by the user, the cosine similarity between each question and the event in the knowledge graph is obtained using the same method as calculating the semantic matching score. The event tag with the highest cosine similarity is obtained by associating the event tag with the event tag text vectorization and summing the results to obtain the user's historical interest vector.

[0053] The cosine similarity between the user's historical interest vector and the text in the search pool is then calculated, which is the interest matching score.

[0054] Beneficial effects:

[0055] 1. The method proposed in this invention achieves a leapfrog improvement through three core technologies. A bidirectional enhancement mechanism transforms knowledge graph relationship chains into natural language prompts, injecting them into the LLM reasoning process to improve the accuracy of complex logical question answering. Simultaneously, it utilizes LLM to extract unstructured text of public opinion in real time, dynamically updating the graph and significantly increasing the event injection duration. Dynamic knowledge graph construction introduces dynamic node embedding and dynamic relationship weights, automatically reducing weights and quantifying the tightness of event associations based on time decay mechanisms and timestamp attributes, upgrading the graph from a static database to a dynamic cognitive system. Personalized retrieval employs a multi-factor ranking algorithm, shifting matching queries to decision insights, making the detection results more aligned with user expectations.

[0056] 2. This invention achieves knowledge cyclical iteration through a two-way enhancement mechanism, breaks through the timeliness bottleneck through dynamic graph construction, and completes the leap from information matching to decision support through a multi-factor ranking algorithm, providing a technical foundation for scenarios such as public opinion emergency response and public opinion risk control. Attached Figure Description

[0057] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention in the above and / or other aspects will become clearer.

[0058] Figure 1 This is a schematic diagram of the overall structure.

[0059] Figure 2 This is a schematic diagram of a two-way enhancement mechanism.

[0060] Figure 3 This is a schematic diagram of the dynamic construction of a knowledge graph.

[0061] Figure 4 This is a diagram illustrating personalized search and sorting. Detailed Implementation

[0062] like Figure 1 As shown, this invention discloses a public opinion information retrieval method based on bidirectional enhancement of Large Language Model (LLM) and Knowledge Graph (KG), comprising the following steps:

[0063] Step S1: Establish a bidirectional enhancement mechanism, which includes large model enhancing knowledge graph and knowledge graph enhancing large model;

[0064] The aforementioned bidirectional enhancement refers to enhancing the large language model through knowledge graphs and enhancing the knowledge graph through the large language model. Enhancing the large language model through knowledge graphs involves transforming the structured relationships of the knowledge graph into natural language prompts, injecting them into the large language model's reasoning process, and improving the accuracy of the large language model's logical understanding of public opinion information. Enhancing the knowledge graph through the large language model involves using the large language model to extract entity relationships from unstructured text (social media, news), generating labeled data to dynamically update the knowledge graph, and expanding the graph's missing relationships. The bidirectional enhancement manifests in that the knowledge graph provides logical constraints to the large language model, reducing illusions; the large language model injects real-time knowledge into the knowledge graph, such as extracting event relationships from real-time public opinion data to update the knowledge graph.

[0065] Step S2: Dynamic construction of the knowledge graph;

[0066] The dynamic construction of the knowledge graph refers to acquiring real-time public opinion data through the Kafka real-time data acquisition pipeline (https: / / blog.csdn.net / 2301_81259717 / article / details / 148807494). Entities, relationships, attributes, and attribute values ​​are extracted from the public opinion data through input instructions to a large model. A timestamp attribute needs to be added to each entity to record the time of the event, which is later used to calculate the timeliness of the event. In addition, each entity is tagged based on associated events. Specifically, for example, in the event: Factory-Investigated-Environmental Protection Bureau, "Factory" and "Environmental Protection Bureau" are entities, "Investigated" is the relationship between the two entities, and the time attribute of the event is "Year Month Day". The tag for entity "Factory" based on this event is "Environmental Violation". The tag is obtained by the large model according to the classification in the tag database; if no matching tag is found, it will be automatically generated. Each tag has a pre-set initial weight ("Environmental Violation" 0.95). As time goes by or new events occur, the weights will change: the weight of event tags will decay over time, and newly occurring related public opinion events will also affect the original tag and relationship weights. The large model will call the corresponding decay formula according to the original event type and the newly occurring event, so as to achieve real-time dynamic updates of weights.

[0067] Step S3, personalized search ranking;

[0068] The personalized search ranking refers to incorporating users' real-time interests into the search results. A multi-factor ranking algorithm is used to calculate the search results based on the degree of matching between the user's search content and relevant content in the knowledge graph, the freshness of the matching events, and a weighted sum based on LLM semantic matching, knowledge graph relevance weights, and user interests. The result with the highest score is then displayed first.

[0069] The bidirectional enhancement mechanism in step S1 includes knowledge graph enhancement of the large model and model enhancement of the knowledge graph, such as... Figure 2 As shown, the details are as follows:

[0070] Knowledge graph augmented big data models transform the structured relationships of a knowledge graph into natural language prompts, injecting them into the big data model's reasoning process to improve the accuracy of its logical understanding of public opinion information. Specifically, it first obtains node information for an event from the knowledge graph, such as (Typhoon Mangkhut)—impact area—>(Guangdong Province), (Typhoon Mangkhut)—wind speed—>(42m / s). This information is then fed into the big data model, transforming it into the natural language "Typhoon Mangkhut affects Guangdong Province, with a maximum wind speed of 42m / s." When a user asks a question, the big data model will respond based on the actual data in the knowledge graph. For example, if a user searches for "risk of shortage of supplies in Guangzhou," the big data model will expand the user's search by combining the information "Typhoon Mangkhut affects Guangdong Province, with a maximum wind speed of 42m / s." Without real-time data, the big data model's associations are prone to producing illusions or deviating from reality.

[0071] Large language models enhance knowledge graphs by extracting entity relationships from unstructured text (social media, news) using large language models, generating labeled data to dynamically update the graph and expand missing relationships. Specifically, it first obtains public opinion data from streaming social media data, for example, the tweet "A new energy vehicle spontaneously combusted while charging, with thick smoke billowing from the scene #SafetyHazard". Next, the large language model extracts entity relationships from this sentence, for example, (new energy vehicle) — occurred —> (spontaneous combustion), where "new energy vehicle" and "spontaneous combustion" are entities, and "an accident occurred" is the relationship between the two entities. The event's time attribute is "Year X Month X Day," and the entity "new energy vehicle" is labeled "high-risk accident" based on this event. The label is obtained by the large model from the label database; if no matching label is found, it is automatically generated. Next, new nodes are added to the knowledge graph, which involves adding, deleting, and modifying existing knowledge graph information. This step uses a large language model to first compare existing nodes in the graph to achieve semantic standardization. For example, for the terms "new energy vehicle" and "new energy automobile," since the graph already has a "new energy automobile" node, the original relationship is replaced with: (new energy automobile) — Occurrence —> (spontaneous combustion). Furthermore, the large model will discover new relationships related to public opinion events in the knowledge graph, such as (car company) — negative event —> (spontaneous combustion), and finally update the entity relationships in the knowledge graph.

[0072] The dynamic construction of the knowledge graph in step S2, such as Figure 3 As shown, it includes:

[0073] In the bidirectional reinforcement mechanism, expanding the missing relationships in the knowledge graph through a large model is the foundation for the dynamic construction of the knowledge graph. Besides entity relationship construction, event tag weights also need to be defined to measure the freshness of events. These dynamic relationship weights refer to the fact that freshness changes with time and the emergence of new events. By combining the timestamp tags of each change, the knowledge graph can better record the evolutionary stages of events.

[0074] The weight dynamic update function is as follows:

[0075] w e (t)=w0·e -λt +β·I new_event

[0076] Where w is the weight value, w e For the calculated new weights, w0 represents the old weights from the previous stage of the event. λ is the time decay coefficient, set to 0.05 here. t is the time interval from the previous stage of the event, in hours. β is the heat coefficient, used to assess the intensity of public opinion dissemination. new_event It is the impact value of a new event, used to measure the severity of the new event itself.

[0077] The heat coefficient is calculated using the following formula:

[0078]

[0079] β is the heat coefficient.

[0080] C represents the current spread (Converted Spread), the total spread after platform conversion, calculated as follows:

[0081]

[0082] p represents different platforms. r p This refers to the original reach, including the number of reposts, calculated by the number of times. p This is the platform conversion factor, for example, Weibo (1.0), Douyin (0.001), YouTube (0.0005). platform It is the platform weight, the influence coefficient of different platforms, such as Weibo (1.0), Douyin (1.2), YouTube (0.8).

[0083] T is the baseline threshold, which is set according to the type of event, such as traffic accidents (5000), food safety (10000), and celebrity scandals (20000).

[0084] min means to take the minimum value, and here 1.0 is set as the top value.

[0085] The impact value of a new event is calculated using the following formula:

[0086]

[0087] I new_event This is the impact value of the new event.

[0088] I base It is the basic impact value, which is determined by the type of event, such as liability accidents (0.3), negative remarks by senior executives (-0.2), and penalties from regulatory authorities (0.4).

[0089] I extra,j This is the Extra Impact value, calculated based on the specific circumstances of the event. Taking spontaneous combustion as an example, the extra impacts include casualties, the extent of the spread, and the scale of the recall. 'j' refers to the specific circumstances.

[0090] The platform conversion coefficient, platform weight, basic influence value, and basic influence value are all preset and stored in a MySQL database (https: / / www.mysql.com / ) for easy real-time access and manual adjustment via the front-end page.

[0091] Specifically, assuming there is an existing relationship in the knowledge graph (car company) — production —> (new energy vehicle) with an original weight of 0.85, a new event (new energy vehicle) — occurrence —> (spontaneous combustion) occurs 24 hours after the event. The two events are closely related, and the label weight of the new event can be calculated based on the weight dynamic update function.

[0092] (Automaker) — Negative Event —> (Spontaneous Combustion) Tag Weight = (Automaker) Existing Weight * Decay + Impact Value of Spontaneous Combustion Event * Popularity Coefficient

[0093] Old weight * time decay = w0 * e -λt =0.85·e -0.05*24 =0.255

[0094] It is known that the Weibo post has been forwarded 12,000 times and the Douyin post has been viewed 500,000 times.

[0095]

[0096] Wherein, the total propagation volume C = ∑ p (r p ×c p ×w platform = (Weibo reposts * 1.0 + Douyin views * 0.001 * 1.2) = 12600; the baseline threshold T is 10000 for car accidents.

[0097] The incident is known to be a product liability accident, resulting in minor injuries to three people, affecting three regions, and prompting a recall of 20,000 vehicles.

[0098] The impact value of a spontaneous combustion event = I base +∑ j I extra,j =0.3 + (0.6 + 0.3 + 0.3) = 1.5

[0099] Among them, the basic impact value I nase The product liability incident impact value is 0.3; the additional impact value is I. extra The factors include casualties, diffusion coefficient, and recall coefficient, which respectively conform to the following established formulas:

[0100] Casualty coefficient = 0.2 × number of lightly injured + 0.5 × number of seriously injured + 1.0 × number of dead

[0101] Diffusion coefficient = 0.1 × number of regions involved (upper limit 0.5)

[0102] Recall coefficient = min(0.3, number of recalled items / 10000)

[0103] The casualty coefficient is 0.2×3=0.6; the diffusion coefficient is 0.1×3=0.3; and the recall coefficient is min(0.3,20000 / 10000)=0.3.

[0104] The final calculated weight for the tag (car manufacturer) — negative event —> (spontaneous combustion) is 0.255 + 1.5 * 1.0 = 1.755.

[0105] The knowledge graph records the weight changes of events at different times. In the diagram, stage T0 records the timestamp of the event and its weight value at that time. After a new event occurs, it evolves to stage T1, updating the timestamp and also updating the nodes, relationships, and related weights of the knowledge graph.

[0106] Step S3 as follows Figure 4 As shown, personalized search ranking includes:

[0107] A multi-factor ranking algorithm is adopted to calculate the final score by weighting the user's search results through LLM semantic matching, knowledge graph related weights, and user interests. The result with the highest score is displayed first.

[0108] Multi-factor ranking algorithm score calculation method:

[0109] Score=α·LLMMatchScore+β·KGPathWeight+γ·UserInterestsWeight

[0110] The score is the final ranking score.

[0111] LLM semantic matching refers to calculating a semantic matching score (LLMMatchScore) based on user searches and search events. α is the semantic matching score weight, with a default value of 0.4. Specifically, the semantic matching score is calculated as follows:

[0112] First, entities are extracted from the user's question. These entities are then expanded using the knowledge graph and the large language model's own expansion capabilities. For example, if a user searches for "new energy vehicle spontaneous combustion," the large language model will extract ["new energy vehicle," "spontaneous combustion"] and obtain related keywords ["lithium battery," "explosion"]. By associating with the knowledge graph, it will obtain related keywords ["CATL," "Xiaomi," etc.] and merge these keywords. By selecting the bge-large-zh-v1.5 Chinese text vectorization champion model, the merged keywords were vectorized, and the cosine similarity between the merged keywords and the text in the retrieval pool (the retrieval pool consists of all collected public opinion data used as retrieval targets, stored in the Milus database [https: / / blog.csdn.net / huang9604 / article / details / 151356260]. All text information was vectorized using bge-large-zh-v1.5 and then stored in Milus). The cosine similarity value is the semantic matching score.

[0113] KGPathWeight is the real-time weight of event labels in the knowledge graph of S2, i.e., the updated weight w. e (t). β is the weight of the path weight score, which defaults to 0.3.

[0114] Specifically, the KG path weight is calculated as follows: The cosine similarity between the text in the retrieval pool and the entities in the knowledge graph is calculated to obtain the event tag with the highest matching degree. The real-time weight w of this tag is then assigned. e (t) represents the path weight score. The knowledge graph records events and their real-time states, while the retrieval pool contains all collected public opinion data, serving as the target for user searches. However, it lacks analytical information on individual events. Therefore, it's necessary to combine real-time information from the knowledge graph to assign weights to the data in the retrieval pool.

[0115] User interest matching is a score representing a user's interest in a searched event, known as UserInterestsWeight. γ is the weight of the interest matching score, with a default value of 0.3.

[0116] Specifically, the interest score is calculated as follows: A user's historical interests are determined by their previous searches. Each search result is associated with an event tag in the knowledge graph (using the same method as LLM semantic matching mentioned above, the aim being to find events in the knowledge graph related to the user's search content). The event tag text is vectorized and summed to obtain the user's historical interest vector. Cosine similarity is then used to calculate the similarity value between the user's historical interest vector and the search pool text, which is the interest matching score.

[0117] For example, if a user searches for "spontaneous combustion of new energy vehicles," and the search pool contains the content "CATL battery thermal runaway protection technology," with an LLM semantic matching score of 0.85, a KG path weight of 0.8, and a User interest matching score of 0.96, then the article's ranking score would be: 0.4*0.85 + 0.3*0.8 + 0.3*0.96 = 0.868 (the highest value is 1), indicating a higher ranking and priority display.

[0118] Example:

[0119] This embodiment provides a public opinion information retrieval method based on bidirectional enhancement of large language models and knowledge graphs. Taking the perspective of a public opinion analyst as an example, the practical application of this method is demonstrated, and the steps are as follows:

[0120] Step S1, bidirectional enhancement mechanism;

[0121] Step S2: Dynamic construction of the knowledge graph;

[0122] Step S3, personalized search ranking;

[0123] Step S1 involves the continuous collection and preprocessing of multimodal media asset data, including: large model-enhanced knowledge graph and knowledge graph-enhanced large language model.

[0124] The large-scale model enhances the knowledge graph by first acquiring node information for an event in the knowledge graph, such as (Typhoon Mangkhut) — Affected Area —> (Guangdong Province), (Typhoon Mangkhut) — Wind Speed ​​—> (42 m / s). This information is then fed into the large-scale language model, which converts it into the natural language "Typhoon Mangkhut affected Guangdong Province, with a maximum wind speed of 42 m / s". When a user asks a question, the large-scale language model will respond based on the actual data in the knowledge graph. For example, if a user searches for "risk of shortage of supplies in Guangzhou", the large-scale language model will expand the user's search by combining the information "Typhoon Mangkhut affected Guangdong Province, with a maximum wind speed of 42 m / s".

[0125] The large-scale model-enhanced knowledge graph first acquires public opinion data from streaming social media data, such as the tweet "A new energy vehicle spontaneously combusted while charging, with thick smoke billowing from the scene #SafetyHazard". Next, a large-scale language model extracts entity relationships from this sentence, for example, (new energy vehicle) — Occurrence —> (Spontaneous Combustion), where "new energy vehicle" and "spontaneous combustion" are entities, and "an accident occurred" is the relationship between the two entities. The event's time attribute is "Year X Month X Day". The entity "new energy vehicle" is tagged as "high-risk accident" based on this event, with the tag obtained by the large-scale model from a tag database; if no matching tag is found, it is automatically generated. Next, nodes are added to the graph, i.e., existing knowledge graph information is added, deleted, or modified. This step involves the large-scale language model comparing existing nodes in the graph to achieve semantic standardization. For example, for "new energy vehicle" and "new energy automobile", since the graph already has a "new energy automobile" node, the original relationship is replaced with: (new energy automobile) — Occurrence —> (Spontaneous Combustion). In addition, the large model will discover new relationships of public opinion events in the knowledge graph, such as (car company) — negative event —> (spontaneous combustion), and finally update the entity relationships in the knowledge graph.

[0126] Step S2, dynamic knowledge graph construction, includes:

[0127] Event tag weights are dynamically assigned to measure the freshness of events. These dynamic weights mean that freshness changes over time and with the emergence of new events. By combining these changing timestamps, the knowledge graph can better record the evolutionary stages of events.

[0128] First, the knowledge graph already contains the relationship (car company) — production —> (new energy vehicle) with an original weight of 0.85. 24 hours after the event occurs, a new event is retrieved from the Kafka queue: (new energy vehicle) — occurrence —> (spontaneous combustion). The two events are closely related, and the label weight of the new event can be calculated based on the weight dynamic update function.

[0129] (Automaker) — Negative Event —> (Spontaneous Combustion) Tag Weight = (Automaker) Existing Weight * Decay + Impact Value of Spontaneous Combustion Event * Popularity Coefficient

[0130] Old weight * time decay = w0 * e -λt =0.85·e -0.05*24 =0.255

[0131] It is known that the Weibo post has been forwarded 12,000 times and the Douyin post has been viewed 500,000 times.

[0132]

[0133] Wherein, the total propagation volume C = ∑ p (r p ×c p×w platform = (Weibo reposts * 1.0 + Douyin views * 0.001 * 1.2) = 12600; the baseline threshold T is 10000 for car accidents.

[0134] The incident is known to be a product liability accident, resulting in minor injuries to three people, affecting three regions, and prompting a recall of 20,000 vehicles.

[0135] The impact value of a spontaneous combustion event = I base +∑ j I extra,j =0.3 + (0.6 + 0.3 + 0.3) = 1.5

[0136] Among them, the basic impact value I base The product liability incident impact value is 0.3; the additional impact value is I. extra The factors include casualties, diffusion coefficient, and recall coefficient, which respectively conform to the following established formulas:

[0137] Casualty coefficient = 0.2 × number of lightly injured + 0.5 × number of seriously injured + 1.0 × number of dead

[0138] Diffusion coefficient = 0.1 × number of regions involved (upper limit 0.5)

[0139] Recall coefficient = min(0.3, number of recalled items / 10000)

[0140] The casualty coefficient is 0.2×3=0.6; the diffusion coefficient is 0.1×3=0.3; and the recall coefficient is min(0.3,20000 / 10000)=0.3.

[0141] The final calculated weight for the tag (car manufacturer) — negative event —> (spontaneous combustion) is 0.255 + 1.5 * 1.0 = 1.755.

[0142] The knowledge graph records the weight changes of events at different times. In the diagram, stage T0 records the timestamp of the event and its weight value at that time. After a new event occurs, it evolves to stage T1, updating the timestamp and also updating the nodes, relationships, and related weights of the knowledge graph.

[0143] Step S3, personalized search ranking, includes:

[0144] A multi-factor ranking algorithm is adopted to calculate the final score by weighting the user's search results through LLM semantic matching, knowledge graph related weights, and user interests. The result with the highest score is displayed first.

[0145] For example, if a user searches for "spontaneous combustion of new energy vehicles", the search score for the content "CATL battery thermal runaway protection technology" in the search pool is calculated through the following steps.

[0146] First, entities are extracted from user queries and expanded using knowledge graphs and the inherent expansion capabilities of the large language model. For example, if a user searches for "new energy vehicle spontaneous combustion," the large language model will extract ["new energy vehicle," "spontaneous combustion"] and obtain related keywords ["lithium battery," "explosion"]. Through the associated knowledge graph, related keywords ["CATL," "Xiaomi," etc.] are obtained and merged. The bge-large-zh-v1.5 Chinese text vectorization champion model is used to vectorize the merged keywords, and the cosine similarity between the merged keywords and the text in the search pool is calculated (https: / / baijiahao.baidu.com / s?id=1821817320449768081&wfr=spider&for=pc). The cosine similarity value is the semantic matching score. The actual calculated semantic matching score is 0.85.

[0147] Next, the cosine similarity between the retrieval pool text and the knowledge graph entities is calculated to obtain the event tag with the highest matching degree. The real-time weight of this tag is the path weight score. The actual calculated path weight score is 0.8.

[0148] User interest matching is a score reflecting a user's interest in a retrieved event. γ is the weight of the interest matching score, defaulting to 0.3. A user's historical interests are determined by their previous searches. Each search result is associated with an event tag in the knowledge graph. The event tag text is vectorized and summed to obtain the user's historical interest vector. Cosine similarity is then used to calculate the similarity between the user's historical interest vector and the text in the search pool, which is the interest matching score. The actual calculated interest matching score is 0.8.

[0149] Ultimately, the article's ranking score was: 0.4*0.85+0.3*0.8+0.3*0.96=0.868 (the highest value is 1), which is a higher ranking and will be displayed first.

[0150] In its specific implementation, this application provides a computer storage medium and a corresponding data processing unit. The computer storage medium is capable of storing a computer program, which, when executed by the data processing unit, can run the invention's content regarding a bidirectional augmentation method for public opinion information retrieval based on a large language model and knowledge graph, as well as some or all of the steps in various embodiments. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0151] Those skilled in the art will clearly understand that the technical solutions in the embodiments of the present invention can be implemented using computer programs and their corresponding general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of computer programs, i.e., software products. These computer program software products can be stored in a storage medium and include several instructions to cause a device containing a data processing unit (which may be a personal computer, server, microcontroller, MCU, or network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments of the present invention.

[0152] This invention provides an approach and method for retrieving public opinion information based on a bidirectional enhancement of a large language model and a knowledge graph. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment of the invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.

Claims

1. A public opinion information retrieval method based on bidirectional enhancement of a large language model and a knowledge graph, characterized in that, The method comprises the following steps: Step 1, constructing a bidirectional enhancement mechanism, enhancing a large language model through a knowledge graph, and enhancing the knowledge graph through the large language model, to obtain an enhanced large language model and an enhanced knowledge graph respectively; Step 2, acquiring real-time public opinion data through a real-time data acquisition pipeline, and dynamically constructing a knowledge graph according to the real-time public opinion data and by using the bidirectional enhancement mechanism; Step 3, personalized retrieval and sorting, retrieving and calculating content in a public opinion data retrieval pool according to user retrieval content, and sorting to obtain a retrieval result, thereby completing the public opinion information retrieval based on bidirectional enhancement of a large language model and a knowledge graph.

2. The public opinion information retrieval method based on bidirectional enhancement of large language models and knowledge graphs according to claim 1, characterized in that, The step 1 comprises: Step 1-1, enhancing the large language model through the knowledge graph, that is, converting the structured relationship of the knowledge graph into natural language prompts and injecting the natural language prompts into a reasoning process of the large language model; Step 1-2, enhancing the knowledge graph through the large language model, that is, extracting entity relationships from unstructured text by using the large language model, generating labeled data, dynamically updating the knowledge graph, and expanding missing relationships of the knowledge graph.

3. The public opinion information retrieval method based on bidirectional enhancement of large language models and knowledge graphs according to claim 2, characterized in that, The step S comprises: Step 2-1, acquiring real-time public opinion data through the real-time data acquisition pipeline; Step 2-2, inputting instructions through the enhanced large language model to extract entities, relationships, attributes, and attribute values in the public opinion data; Step 2-3, adding a timestamp attribute to each extracted entity, that is, recording the occurrence time of an associated event; Step 2-4, labeling each extracted entity based on an associated event; Step 2-5, predefining an initial weight for each label and dynamically updating the weight.

4. The public opinion information retrieval method based on bidirectional enhancement of large language models and knowledge graphs according to claim 3, characterized in that, The step 2 comprises: Using a multi-factor sorting method to calculate a sorting score according to a matching degree of user retrieval content and knowledge graph related content and a freshness of a matching event, and taking a result with the highest score as a retrieval result; wherein the sorting score is calculated as follows: Score=α·LLMMatchScore+β·KGPathWeight+γ·UserInterestsWeight wherein Score is a sorting score, LLMMatchScore is a semantic matching score, KGPathWeight is a path weight score, UserInterestsWeight is an interest degree score, and α, β, and γ are weights of the respective scores.

5. The public opinion information retrieval method based on bidirectional enhancement of large language models and knowledge graphs according to claim 4, characterized in that, The step 1-1 comprises: Step 1-1-1, acquiring node information of an event in the knowledge graph; Step 1-1-2, transmitting the node information into a large language model to be enhanced to convert the node information into natural language; Step 1-1-3, when a user asks a question, the large language model replies to the question based on the natural language converted from the node information of the event in the knowledge graph.

6. The public opinion information retrieval method based on bidirectional enhancement of large language models and knowledge graphs according to claim 5, characterized in that, The step 1-2 comprises: Step 1-2-1, acquiring public opinion data from social media; Step 1-2-2, entity relationship extraction of the events in the obtained public opinion data by a large language model, record the time attribute of the event, and tag the extracted entities based on the event; Step 1-2-3, update the nodes in the existing knowledge graph, that is, compare the existing nodes in the knowledge graph by a large language model, and update the new relationship of the event in the public opinion data.

7. The public opinion information retrieval method based on bidirectional enhancement of large language models and knowledge graphs according to claim 6, characterized in that, The dynamic updating of the weight in step 2-5 includes: The dynamic updating of the weight is represented as follows by using a weight dynamic updating function: w e (t) = w0·e -λt +β·I new_event wherein w e is the updated new weight, w0is the old weight of the previous stage of the current event, λ is the time decay coefficient, t is the time from the previous stage of the event, in hours, β is the heat coefficient, used to evaluate the propagation strength of public opinion, I new_event is the impact value of the new event, used to measure the severity of the new event itself; The calculation method of the heat coefficient is as follows: Wherein, C is the current propagation amount, T is the benchmark threshold, min represents the minimum value, and the benchmark threshold is set according to the type of the event; The calculation method of the current propagation amount C is as follows: C = ∑ p (r p ×c p ×w platform ) where p represents different propagation platforms, r p is the original propagation amount, c p is a platform conversion coefficient, w platform is a platform weight; The calculation method of the influence value of the new event is as follows: where I base is the base impact value, determined by the event type, I extra,j is the additional impact value, computed according to the specific circumstances of the event j.

8. The public opinion information retrieval method based on bidirectional enhancement of large language models and knowledge graphs according to claim 7, characterized in that, The calculation method of the semantic matching score in step 2 is as follows: Extract entities from the user input question; Expand the extracted entities, including: obtain the first keyword related to the entity by using an enhanced large language model, obtain the second keyword related to the entity by associating the knowledge graph, merge the keywords, and vectorize to obtain the vectorized keywords; Calculate the cosine similarity between the vectorized keywords and the text in the retrieval pool, and the cosine similarity value is the semantic matching score.

9. The public opinion information retrieval method based on bidirectional enhancement of large language models and knowledge graphs according to claim 8, characterized in that, The calculation method of the path weight score in step 2 is as follows: The cosine similarity of the text in the retrieval pool and the entity in the knowledge graph is calculated, and the event with the highest matching degree is obtained according to the cosine similarity, and the real-time weight w of the label of the event e (t), that is, the path weight score.

10. The public opinion information retrieval method based on bidirectional enhancement of large language models and knowledge graphs according to claim 9, characterized in that, The calculation method of the interest score in step 2 is as follows: For each question raised by the user, the same method as calculating the semantic matching score is used to obtain the cosine similarity between each question and the events in the knowledge graph, and the event label with the highest cosine similarity is associated to obtain the event label text, which is vectorized and summed to obtain the user historical interest vector; Continue to calculate the cosine similarity between the user historical interest vector and the text in the retrieval pool, which is the interest matching score.