Dialogue generation method and system based on hybrid drive of knowledge graph and large model
By using a dialogue generation method driven by a hybrid knowledge graph and large model, the illusion problem of large language models and the high cost of knowledge updates in the power grid field are solved, achieving low-cost, high-efficiency, and reliable information generation, which is suitable for power grid business scenarios.
Patent Information
- Application Number
- CN202511495036.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-20
- Publication Date
- 2026-03-13
AI Technical Summary
Existing technologies for applying large language models in the power grid field suffer from problems such as illusion, high knowledge update costs, and unreliable answers, failing to meet the power grid's high requirements for information accuracy, timeliness, and consistency.
A dialogue generation method driven by a hybrid approach of knowledge graph and large model is adopted. Structured factual data is obtained through navigational retrieval, and the accuracy and reliability of information are ensured by combining constraint prompt templates and post-generation fact verification.
It enables low-cost and high-efficiency knowledge updates and answer generation, ensures the reliability and traceability of information, adapts to rapid changes in power grid business policies, and provides strong constraints and security.
Smart Images

Figure CN121659916A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology, and in particular relates to a dialogue generation method and system based on a hybrid approach of knowledge graph and large model. Background Technology
[0002] In recent years, generative artificial intelligence, represented by large language models (such as the GPT series), has made groundbreaking progress in the field of natural language processing and has been widely used to build intelligent question-answering robots. However, in specialized fields such as power grids, where the accuracy, timeliness, and consistency of information are extremely important, existing technical solutions have significant shortcomings:
[0003] The solution based on a general-purpose large language model directly uses this model for question answering. Its main drawback lies in the "hallucination" problem. When the model lacks internal knowledge or has fuzzy memory, it may fabricate seemingly reasonable but completely erroneous information. In the power grid scenario, this can lead to misinterpretations of critical information such as electricity prices, business processing procedures, and safety regulations, causing billing disputes, business processing failures, and even security risks with serious consequences. Furthermore, updating the knowledge of the general-purpose large model relies on large-scale retraining or fine-tuning, which is costly and time-consuming, making it unable to adapt to the frequently changing business needs of power grid policies, prices, and service areas.
[0004] Retrieval Augmentation (RAG) based schemes: RAG alleviates the illusion problem to some extent by providing relevant document fragments as context to the large model before generation. However, its drawbacks are: 1. Inaccurate retrieval: Traditional retrieval methods based on keywords or vector similarity are prone to retrieving irrelevant or incomplete context when faced with massive amounts of highly similar power grid policy documents or business rules. For example, a user querying "residential peak-valley electricity prices" may retrieve outdated policies, policies from other regions, or similar descriptions of commercial electricity use, resulting in low-quality "raw materials" supplied to the large model and potentially generating incorrect answers. 2. Lack of fact-checking loop: Traditional RAG schemes end after answer generation, lacking an independent and decisive fact-checking step. It cannot guarantee that the large model is "faithful" to the provided context during generation, nor can it guarantee that it has not engaged in improper reasoning or information tampering. Once generated, the correctness of the answer is difficult to monitor effectively.
[0005] Therefore, there is an urgent need for a new technical solution that can achieve low-cost and high-efficiency knowledge maintenance while ensuring high accuracy of dialogue services in the power grid sector, and fundamentally establish a verifiable, traceable, and controllable answer generation mechanism to completely eradicate the problem of hallucinations. Summary of the Invention
[0006] This invention provides a dialogue generation method and system based on a hybrid approach of knowledge graph and large model, which addresses problems such as illusion, delayed knowledge updates, and unreliable answers that exist when large language models are applied to professional fields such as power grids in the prior art.
[0007] In a first aspect, the present invention provides a dialogue generation method based on a hybrid approach driven by knowledge graphs and large models, comprising:
[0008] Receive and parse user input, extract query intent and at least one key entity, and generate a structured semantic representation;
[0009] Based on the query intent and key entities, a navigational retrieval is performed in the pre-built domain knowledge graph to obtain structured fact data that strictly corresponds to the query. The entities and relationships in the knowledge graph are accompanied by version, effective time and regional attributes.
[0010] The structured factual data is injected into a preset constraint prompt template to generate prompt text that includes factual constraints, generation rules, and output format requirements;
[0011] The large language model is invoked to generate an initial response based on the prompt text, and the initial response is subjected to post-generation fact verification, including information extraction, field-level comparison and logical consistency check.
[0012] If the verification passes, output the response result; if the verification fails, execute the downgraded response strategy.
[0013] Secondly, this invention provides a dialogue generation system based on a hybrid knowledge graph and large model approach, comprising:
[0014] The first generation module is configured to receive and parse user input, extract query intent and at least one key entity, and generate a structured semantic representation.
[0015] The acquisition module is configured to perform a navigational retrieval in a pre-built domain knowledge graph based on the query intent and key entities to obtain structured fact data that strictly corresponds to the query. The entities and relationships in the knowledge graph are accompanied by version, effective time and regional attributes.
[0016] The second generation module is configured to inject the structured fact data into a preset constraint prompt template to generate prompt text containing fact constraints, generation rules and output format requirements;
[0017] The verification module is configured to call the large language model, generate an initial response based on the prompt text, and perform post-generation fact verification on the initial response, including information extraction, field-level comparison, and logical consistency check.
[0018] The output module is configured to output a response result if the verification passes, and to execute a downgraded response strategy if the verification fails.
[0019] Thirdly, an electronic device is provided, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the steps of the dialogue generation method based on a knowledge graph and large model hybrid drive according to any embodiment of the present invention.
[0020] Fourthly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor performs the steps of the dialogue generation method based on a hybrid knowledge graph and large model driven by any embodiment of the present invention.
[0021] This application presents a dialogue generation method and system based on a hybrid knowledge graph and large model. Firstly, this method fundamentally suppresses the "illusion" problem of large language models by using structured factual data retrieved from the knowledge graph as the sole basis for generation. Furthermore, it performs rigorous field-level comparisons and logical consistency checks before output, doubly guaranteeing the absolute accuracy and reliability of information in professional domain question-and-answer sessions. This is particularly suitable for power grid business scenarios with extremely low fault tolerance, such as those involving electricity prices, policies, and safety regulations. Secondly, it innovatively decouples knowledge updates from large model training, requiring only the maintenance of nodes, relationships, and attributes (such as version and validity period) in the knowledge graph. This system achieves low-cost, high-efficiency, near real-time knowledge updates, completely overcoming the bottlenecks of traditional large-scale models that rely on heavy training, long cycles, and high costs, perfectly adapting to the business needs of frequent changes in power grid policies. In addition, the system has high interpretability and traceability, with each generated answer accurately traceable back to specific fact nodes in the knowledge graph and original policy documents, greatly facilitating auditing, accountability, and system optimization. At the same time, through the combined use of constraint prompts and multi-level degradation strategies (such as safe rejection, direct fact output, and manual transfer), strong constraints on the generation process and proper handling of abnormal situations are achieved, ensuring the system's security and controllability in any output scenario. Attached Figure Description
[0022] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1A flowchart illustrating a dialogue generation method based on a hybrid knowledge graph and large model driven by an embodiment of the present invention;
[0024] Figure 2 This is a structural block diagram of a dialogue generation system based on a hybrid knowledge graph and large model driven by an embodiment of the present invention.
[0025] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] Please see Figure 1 The diagram shows a flowchart of a dialogue generation method based on a hybrid knowledge graph and large model driven by this application.
[0028] like Figure 1 As shown, the dialogue generation method based on a hybrid approach of knowledge graph and large model specifically includes the following steps:
[0029] Step S101: Receive and parse user input, extract query intent and at least one key entity, and generate a structured semantic representation.
[0030] Step S102: Based on the query intent and key entities, perform a navigational retrieval in the pre-built domain knowledge graph to obtain structured fact data that strictly corresponds to the query. The entities and relationships in the knowledge graph are accompanied by version, effective time and regional attributes.
[0031] In this step, the navigation-style retrieval specifically includes: selecting a predefined relational path template based on the query intent; filling the path template with key entities to generate a structured graph query statement; executing the query and dynamically filtering and resolving conflicts based on the timeliness and geographic attributes attached to the entities or relations.
[0032] Step S103: Inject the structured fact data into a preset constraint prompt template to generate prompt text that includes fact constraints, generation rules and output format requirements.
[0033] In this step, the constraint prompt template includes at least one of the following: role setting instructions; explicit constraints prohibiting the introduction of external information; output format specifications; and strategies for refusing to answer or clarifying when facts are insufficient.
[0034] Step S104: Invoke the large language model, generate an initial response based on the prompt text, and perform post-generation fact verification on the initial response, including information extraction, field-level comparison, and logical consistency check.
[0035] In this step, post-fact verification includes: extracting key information fragments from the initial response; matching the extracted results with the original fact data at the field level, supporting unit conversion and error tolerance; and checking the logical consistency between information, including time intervals, numerical ranges, or business rule conflicts.
[0036] Step S105: If the verification passes, output the response result; if the verification fails, execute the downgrade response strategy.
[0037] In this step, the downgrade response strategy includes at least one of the following: returning a preset security rejection response; generating clarification follow-up questions to guide the user to provide additional information; directly outputting structured factual data; or transferring the user to human assistance or generating a service ticket.
[0038] In one specific embodiment, a dialogue generation method based on a hybrid approach of knowledge graph and large model in the power grid domain is presented. The core idea of this method is a three-stage closed-loop control process: "knowledge graph navigation retrieval + constraint-based prompt guidance + post-generation fact verification." Specifically, the method of this invention includes the following steps:
[0039] First, the Natural Language Understanding (NLU) module accurately parses user queries to clarify their intent (such as querying electricity prices) and key entities (such as "residential electricity" and "Nanchang").
[0040] Next, one of the key steps of this invention is knowledge graph navigation-based retrieval. Unlike fuzzy text matching, this step utilizes intent-driven NLU parsing to perform structured path traversal and constraint filtering within a pre-constructed knowledge graph rich in power grid domain knowledge (entities, relationships, attributes, versions, effective dates). For example, starting from the entity "residential electricity consumption," it follows relationship paths such as "has tiered electricity pricing" and "applies to," and filters using entities and attributes such as "Nanchang" and "current time," ultimately accurately extracting one or more structured facts, such as electricity price details in JSON format.
[0041] Next, we move on to the constrained Prompt construction phase. The structured factual data set obtained in the previous step is embedded into a carefully designed Prompt template. This Prompt explicitly instructs the Large Language Model (LLM) to play the role of a "power grid expert" and strictly stipulates that it must and can only use the provided facts to answer the question, prohibiting any form of improvisation or additional information.
[0042] Subsequently, LLM is invoked for guided generation. Thanks to the strong guidance of the constraining Prompt, the generation process of LLM is strictly confined within the "safe zone" of facts, and its task changes from "creation" to "fact-based language organization and polishing".
[0043] Another key step in this invention is post-generation fact verification. After the LLM generates the initial response text, the system does not output it directly. Instead, a separate verification module extracts information from the text, extracting all key information (such as price, date, time period, place name, etc.), and performs a rigorous field-by-field comparison and logical consistency check with the original fact data set retrieved from the knowledge graph in the second step.
[0044] Finally, decisions and outputs are made based on the validation results. Only when validation passes completely, proving that the LLM's output is 100% consistent with the facts, is the answer presented to the user. If validation fails (e.g., the LLM adds an incorrect number during polishing), a fallback strategy is triggered, such as safely refusing to answer, guiding the user to clarify the question, directly outputting the unpolished original facts, or transferring the user to human assistance, thereby ensuring that no unverified information is leaked to the user under any circumstances.
[0045] The present invention also discloses a system for implementing the above method. The system includes an NLU module, a domain knowledge graph database, a graph retrieval engine, a Prompt construction module, a large model interface module, a fact verification module, and a central control module. The modules work together to form a complete technical closed loop.
[0046] In summary, the method of this application has the following beneficial effects:
[0047] Extremely high accuracy: Through the dual mechanisms of "precise graph retrieval" and "post-generation fact verification", facts are locked and verified from both the data source and the generated result, forming a complete closed loop. This can fundamentally suppress and eliminate the illusion problem of large models and ensure the high reliability of the answer in the professional field.
[0048] Low-cost, highly agile knowledge maintenance: knowledge updates only require modifying relevant nodes, relationships, or attributes in the knowledge graph and setting the version and effective period, without any retraining or fine-tuning of the large language model. This decoupling makes knowledge updates extremely low-cost and can be implemented in near real-time, perfectly adapting to the rapid changes in power grid business policies.
[0049] Explainability and traceability: Each answer can be traced back to specific fact nodes and relationships in the knowledge graph, and these facts themselves can be linked to the original policy documents or data sources. When an answer has a problem, it can be quickly located whether the data source is incorrect, the retrieval logic is incorrect, or the validation rules are incorrect, thus possessing full explainability.
[0050] Strong controllability and security: The behavior of large models is effectively "constrained" through binding prompts and fact verification. The existence of degradation strategies ensures that the system can respond safely under any uncertain conditions, avoiding the transmission of erroneous or unverified information to users, making it particularly suitable for high-risk fields such as finance, law, and power.
[0051] Excellent engineering and scalability: The system architecture proposed in this invention is modular, and each component can be implemented and optimized independently. The system is easy to deploy on various power grid service terminals, such as service hall robots, official apps / mini-programs, and intelligent customer service hotlines, and can be easily extended to other professional fields with similar needs.
[0052] For example, processing user queries about "**residential peak-valley electricity pricing":
[0053] This embodiment will describe in detail the workflow of the system of the present invention when a user queries "**What is the current peak and off-peak electricity price for residential electricity?" via voice or text.
[0054] System environment:
[0055] Knowledge Graph Database: Utilizing the Neo4j graph database, a pre-built knowledge graph of power grid policies covering all regions of the country has been constructed. Nodes and relationships in the graph all possess attributes such as version, effective_from, effective_to, and priority.
[0056] Large Language Model: A privately deployed, instruction-fine-tuned 7B parameter-scale LLM.
[0057] Central control module: A microservice implemented in Python that coordinates other modules via a REST API.
[0058] Detailed Process Explanation:
[0059] Step S1: Receive and parse user queries
[0060] 1. The user's voice query "What is the current peak and off-peak electricity price for residential electricity in Nanchang?" is received by the voice interaction module and converted into text through ASR (Automatic Speech Recognition) technology.
[0061] 2. The NLU module receives this text.
[0062] Intent recognition: The query intent is identified as query_peak_valley_price using a pre-trained text classification model.
[0063] Entity extraction: Using a domain dictionary and a BiLSTM-CRF sequence labeling model, key entities / slots are extracted: {Region: "Nanchang", User type: "Resident", Time: "Current"}.
[0064] 3. The NLU module outputs a standardized semantic frame: {intent:"query_peak_valley_price",slots:{region:"Nanchang",user_type:"Resident",time:"2025-09-12"}}.
[0065] Step S2: Knowledge Graph Navigation Search
[0066] 1. The central control module transmits semantic frames to the graph retrieval engine.
[0067] 2. The graph retrieval engine selects the preset relational path template based on the intent query_peak_valley_price: (u:UserType)-[:APPLIES_TO]->(r:Region)-[:HAS_POLICY]->(p:Policy)-[:CONTAINS_RULE]->(rule:PeakValleyRule).
[0068] 3. The engine uses the entities in the slots as constraints to generate specific Cypher query statements:
[0069] MATCH(u:UserType{name:'Resident'})-[:APPLIES_TO]->(r:Region{name:'Nanchang'})
[0070] MATCH(r)-[:HAS_POLICY]->(p:Policy)
[0071] WHERE p.effective_from<=date('2025-09-12')AND(p.effective_to IS NULLOR p.effective_to>=date('2025-09-12'))
[0072] MATCH(p)-[:CONTAINS_RULE]->(rule:PeakValleyRule)
[0073] WITH rule ORDER BY p.priority DESC LIMIT 1
[0074] MATCH(rule)-[:HAS_PRICE_TIER]->(tier)
[0075] RETURN tier.type AS period,tier.price AS price,tier.startTime ASstartTime,tier.endTime AS endTime,p.documentId as source_doc
[0076] 4. After executing the query, the database returns the following results, which the search engine formats into a structured collection of facts in JSON format:
[0077]
[0078]
[0079] Step S3: Construct constraint hints
[0080] 1. The Prompt build module receives the above Facts.
[0081] 2. Generate the following constraint prompts based on the template:
[0082] You are a professional power grid business expert. Your task is to answer users' questions using only the structured information provided in the "---Fact List---" below.
[0083] prohibit:
[0084] - Absolutely no information, figures, dates, or conclusions not listed in the fact sheet are permitted.
[0085] - Do not make any kind of speculation or improvisation.
[0086] - If the information in the fact list is insufficient to answer the question, please reply directly: "I'm sorry, based on the accurate information I have, I cannot answer your question."
[0087] ---Fact List---
[0088]
[0089]
[0090] ---End of Fact List---
[0091] User question: What are the current peak and off-peak electricity prices for residential electricity in Nanchang?
[0092] Based on the above facts, please provide a concise, clear, and user-friendly answer.
[0093] Step S4: Guided Generation
[0094] 1. The large model interface module sends the above Prompt to the LLM service.
[0095] 2. Under strict instruction and factual constraints, LLM generates the initial response text: "Hello, the current peak and off-peak electricity prices for residential use in Nanchang City are as follows: the price during peak hours (8:00 AM to 10:00 PM) is 0.75 yuan per kilowatt-hour; the price during off-peak hours (10:00 PM to 8:00 AM the next day) is 0.45 yuan per kilowatt-hour."
[0096] Step S5: Post-Generation Fact Verification
[0097] 1. The fact verification module receives the initial response text generated by the LLM.
[0098] 2. Information Extraction: The extraction unit within the module identifies key information in the text:
[0099] Region: Nanchang City
[0100] User type: Residential electricity
[0101] Time Segment 1: Peak Hour, 8:00 AM to 10:00 AM (10:00 PM)
[0102] Price 1: 0.75 yuan
[0103] Time Slot 2: Off-peak hours, from 10:00 AM (10:00 PM) to 8:00 AM
[0104] Price 2: 0.45 yuan
[0105] 3. Item-by-item comparison: The comparison unit compares the extracted information with the Facts in step S2.
[0106] '0.75 yuan' (extraction) vs 0.75 yuan / degree (fact) -> Match successful.
[0107] '0.45 yuan' (extraction) vs 0.45 yuan / degree (fact) -> Match successful.
[0108] '8:00 to 10:00' (extracted) vs '08:00' - '22:00' (fact) -> After time format normalization, the match is successful.
[0109] '10:00 to 8:00' (extracted) vs '22:00' - '08:00' (fact) -> After time format normalization, the match is successful.
[0110] 4. Logical Consistency Check: Check whether the peak and valley periods cover 24 hours without overlap. [8:00, 22:00) and [22:00, 8:00) logically cover a complete day, so the check passes.
[0111] 5. If all verification items pass, the verification module returns a "verification passed" status to the central control module.
[0112] Step S6: Decision and Output
[0113] 1. The central control module received a "verification passed" signal.
[0114] 2. It was decided to use the initial response text as the final answer.
[0115] 3. The TTS (Text-to-Speech) module is invoked to convert the text into speech, which is then played back to the user through the voice interaction module. Simultaneously, the answer is displayed on the text interface, along with a clickable "Source" link pointing to a summary of the original policy document corresponding to source_doc_id:"ZJDT-2025-034".
[0116] 4. The system records a complete log of this interaction, including Facts, Prompt, LLM output, verification report, etc., for auditing and continuous improvement.
[0117] Example of a downgrade strategy
[0118] Suppose that in step S4, LLM generates the following for some reason: "...the peak electricity price is 0.75 yuan per kilowatt-hour, the off-peak electricity price is 0.45 yuan per kilowatt-hour, and the flat electricity price is 0.60 yuan...".
[0119] During the verification in step S5, the verification module will find that the information "flat electricity price 0.60 yuan" does not exist in the original Facts, so it returns "verification failed" and inconsistency item.
[0120] Upon receiving a failure signal, the central control module, based on a preset strategy, may choose a **read-only fact-only** approach, bypassing the LLM and directly formatting the facts into a standard text: "According to the latest policy, Nanchang City implements peak-valley electricity pricing. Peak hours (08:00-22:00) price is 0.75 yuan / kWh; valley hours (22:00-08:00) price is 0.45 yuan / kWh." This is then output to the user. While the language may not be as polished as the LLM, this ensures absolute accuracy of the information.
[0121] Those skilled in the art will understand that the above embodiments are merely preferred examples of the present invention, and various equivalent substitutions or improvements can be made without departing from the principles of the present invention. For example, the storage method of the knowledge graph can be replaced with other graph databases or RDF storage; the NLU model can adopt a more advanced Transformer architecture; fact verification can introduce more complex logical reasoning rules, etc., and these modifications should all fall within the protection scope of the present invention.
[0122] In summary, this invention effectively addresses the core pain points of professional domain dialogue systems through an innovative hybrid-driven architecture that combines knowledge graphs, large language models, and rigorous verification mechanisms, providing a solid technical foundation for building highly reliable, maintainable, and trustworthy next-generation intelligent service robots.
[0123] Please see Figure 2 The diagram illustrates the structural block diagram of a dialogue generation system based on a hybrid knowledge graph and large model driven by this application.
[0124] like Figure 2 As shown, the dialogue generation system 200 includes a first generation module 210, an acquisition module 220, a second generation module 230, a verification module 240, and an output module 250.
[0125] The system comprises the following modules: a first generation module 210, configured to receive and parse user input, extract query intent and at least one key entity, and generate a structured semantic representation; an acquisition module 220, configured to perform a navigational retrieval in a pre-built domain knowledge graph based on the query intent and key entity, and acquire structured factual data that strictly corresponds to the query, wherein the entities and relationships in the knowledge graph are accompanied by version, effective time, and regional attributes; a second generation module 230, configured to inject the structured factual data into a preset constraint prompt template, generating prompt text containing factual constraints, generation rules, and output format requirements; a verification module 240, configured to call a large language model, generate an initial response based on the prompt text, and perform post-generation fact verification on the initial response, including information extraction, field-level comparison, and logical consistency checks; and an output module 250, configured to output the response result if the verification passes, and execute a downgraded response strategy if the verification fails.
[0126] It should be understood that Figure 2 The modules and references described in the document Figure 1 The steps described in the text correspond to those in the method described above. Therefore, the operations, features, and corresponding technical effects described above also apply to the method described in the text. Figure 2 The various modules in the document will not be described in detail here.
[0127] In other embodiments, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor performs the dialogue generation method based on a hybrid knowledge graph and large model driven in any of the above method embodiments.
[0128] In one embodiment, the computer-readable storage medium of the present invention stores computer-executable instructions, which are configured as follows:
[0129] Receive and parse user input, extract query intent and at least one key entity, and generate a structured semantic representation;
[0130] Based on the query intent and key entities, a navigational retrieval is performed in the pre-built domain knowledge graph to obtain structured fact data that strictly corresponds to the query. The entities and relationships in the knowledge graph are accompanied by version, effective time and regional attributes.
[0131] The structured factual data is injected into a preset constraint prompt template to generate prompt text that includes factual constraints, generation rules, and output format requirements;
[0132] The large language model is invoked to generate an initial response based on the prompt text, and the initial response is subjected to post-generation fact verification, including information extraction, field-level comparison and logical consistency check.
[0133] If the verification passes, output the response result; if the verification fails, execute the downgraded response strategy.
[0134] Computer-readable storage media may include a stored program area and a stored data area, wherein the stored program area may store an operating system and an application program required for at least one function; the stored data area may store data created based on the use of a knowledge graph- and large model-driven dialogue generation system, etc. Furthermore, the computer-readable storage medium may include high-speed random access memory, and may also include memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the computer-readable storage medium may optionally include memory remotely located relative to the processor, which can be connected to the knowledge graph- and large model-driven dialogue generation system via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0135] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiment of the present invention, such as... Figure 3 As shown, the device includes a processor 310 and a memory 320. The electronic device may also include an input device 330 and an output device 340. The processor 310, memory 320, input device 330, and output device 340 can be connected via a bus or other means. Figure 3 Taking a bus connection as an example, memory 320 is the computer-readable storage medium described above. Processor 310 executes various server functions and data processing by running non-volatile software programs, instructions, and modules stored in memory 320, thereby implementing the dialogue generation method based on a hybrid knowledge graph and large model driving mechanism described in the above embodiment. Input device 330 can receive input numeric or character information and generate key signal inputs related to user settings and function control of the dialogue generation system based on a hybrid knowledge graph and large model driving mechanism. Output device 340 may include a display screen or other display device.
[0136] The aforementioned electronic device can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in the embodiments of the present invention.
[0137] In one implementation, the above-described electronic device is applied to a dialogue generation system driven by a hybrid knowledge graph and large model, for a client, and includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0138] Receive and parse user input, extract query intent and at least one key entity, and generate a structured semantic representation;
[0139] Based on the query intent and key entities, a navigational retrieval is performed in the pre-built domain knowledge graph to obtain structured fact data that strictly corresponds to the query. The entities and relationships in the knowledge graph are accompanied by version, effective time and regional attributes.
[0140] The structured factual data is injected into a preset constraint prompt template to generate prompt text that includes factual constraints, generation rules, and output format requirements;
[0141] The large language model is invoked to generate an initial response based on the prompt text, and the initial response is subjected to post-generation fact verification, including information extraction, field-level comparison and logical consistency check.
[0142] If the verification passes, output the response result; if the verification fails, execute the downgraded response strategy.
[0143] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A dialogue generation method based on a hybrid approach of knowledge graph and large model, characterized in that, include: Receive and parse user input, extract query intent and at least one key entity, and generate a structured semantic representation; Based on the query intent and key entities, a navigational retrieval is performed in a pre-built domain knowledge graph to obtain structured fact data that strictly corresponds to the query. The entities and relationships in the knowledge graph are accompanied by version, effective time and regional attributes. The structured factual data is injected into a preset constraint prompt template to generate prompt text that includes factual constraints, generation rules, and output format requirements; The large language model is invoked to generate an initial response based on the prompt text, and the initial response is subjected to post-generation fact verification, including information extraction, field-level comparison and logical consistency check. If the verification passes, output the response result; if the verification fails, execute the downgraded response strategy.
2. The dialogue generation method based on a hybrid knowledge graph and large model as described in claim 1, characterized in that, The navigation-based retrieval specifically includes: Select a predefined relational path template based on the query intent; Use key entities to populate path templates to generate structured graph query statements; Execute queries and dynamically filter and resolve conflicts based on timeliness and geographic attributes attached to entities or relationships.
3. The dialogue generation method based on a hybrid approach of knowledge graph and large model as described in claim 1, characterized in that, The constraint prompt template includes at least one of the following: Character setting instructions; Explicit constraints prohibiting the introduction of external information; Output format specifications; Strategies for refusing to answer or clarifying when facts are insufficient.
4. The dialogue generation method based on a hybrid knowledge graph and large model as described in claim 1, characterized in that, The post-generation fact verification includes: Extract key information fragments from the initial response; The extracted results are matched with the original factual data at the field level, and unit conversion and error tolerance are supported. Check for logical consistency between information, including time intervals, numerical ranges, or business rule conflicts.
5. The dialogue generation method based on a hybrid knowledge graph and large model as described in claim 1, characterized in that, The degradation response strategy includes at least one of the following: Returns the preset security rejection response; Generate clarifying follow-up questions to guide users to provide additional information; Directly output structured fact data; Transfer to human assistance or generate a service order.
6. A dialogue generation system based on a hybrid approach of knowledge graph and large model, characterized in that, include: The first generation module is configured to receive and parse user input, extract query intent and at least one key entity, and generate a structured semantic representation. The acquisition module is configured to perform a navigational retrieval in a pre-built domain knowledge graph based on the query intent and key entities to obtain structured fact data that strictly corresponds to the query. The entities and relationships in the knowledge graph are accompanied by version, effective time and regional attributes. The second generation module is configured to inject the structured fact data into a preset constraint prompt template to generate prompt text containing fact constraints, generation rules and output format requirements; The verification module is configured to call the large language model, generate an initial response based on the prompt text, and perform post-generation fact verification on the initial response, including information extraction, field-level comparison, and logical consistency check. The output module is configured to output a response result if the verification passes, and to execute a downgraded response strategy if the verification fails.
7. An electronic device, characterized in that, include: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method described in any one of claims 1 to 5.