Knowledge-Graph Prompting for Reliable Medical LLM Inference

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Fine-tuned Large Language Models (LLMs) face challenges in multi-turn dialogue tasks due to lack of specialized knowledge, forgetfulness of fine-grained information, and hallucination, leading to inaccurate and potentially harmful responses, especially in medical consultations.

Innovation Solution

Construct a dialogue graph using a knowledge graph to capture fine-grained information and specialized knowledge by identifying entities and attributes from user dialogue, linking them to a knowledge base, and constructing prompts for logical inference.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If a fine-tuned LLM model is used for multi-turn dialogue tasks, then the model can perform language understanding and generation, but it lacks specialized knowledge and produces hallucination leading to inaccurate responses

Engineering Contradiction:
Improveaccuracy of responsesVSAvoidlack of specialized knowledge
Core Design Contradiction:
ReliabilityVSLoss of information

Solution Approach 1:

A knowledge graph is introduced as an intermediary component between the user query and the LLM model. The knowledge graph stores structured medical knowledge including entities, attributes, and relationships. When a user query is received, the system queries the knowledge graph to retrieve relevant knowledge and constructs a dialogue graph that guides the LLM's reasoning process, thereby preventing hallucination and improving response accuracy without requiring the LLM to memorize all specialized knowledge

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system segments the knowledge representation into distinct components: entities (nodes), attributes (properties of nodes), and relationships (edges). This segmentation allows the knowledge graph to efficiently store and retrieve specific medical knowledge elements. The dialogue graph further segments the reasoning process into discrete steps based on the knowledge graph structure, enabling the LLM to systematically process medical information rather than generating responses based solely on probabilistic language patterns

Inventive Principle:
Principle #1Segmentation

2Reliability

If the LLM model tries to remember all detailed information in multi-turn dialogue history, then it can maintain context, but it becomes difficult to retain fine-grained information and produces forgetfulness

Engineering Contradiction:
Improvememory of dialogue informationVSAvoidcomplexity of information retention
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The knowledge graph acts as an external memory intermediary that stores fine-grained medical information in a structured manner. Instead of relying on the LLM's limited context window to remember all dialogue details, the system continuously queries the knowledge graph for relevant information based on the current dialogue state. This externalizes the memory function and provides reliable access to specialized knowledge throughout the multi-turn dialogue

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system transitions from storing dialogue information in a linear sequence (traditional context window) to a multi-dimensional knowledge graph structure where information is organized by entities, attributes, and relationships. This dimensional transformation enables efficient retrieval of specific information elements regardless of their position in the dialogue history, allowing the system to maintain context without being constrained by sequential memory limitations

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

3Reliability

If the LLM model generates dialogue content without knowledge graph guidance, then the generation process is simple and fast, but hallucination occurs making content unreliable

Engineering Contradiction:
Improvereliability of generated contentVSAvoidcomplexity of inference process
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The system performs preliminary actions by pre-building the knowledge graph with verified medical knowledge before the dialogue begins. During the dialogue, the knowledge graph structure and pre-computed relationships are used to guide the LLM's reasoning process. This preliminary preparation ensures that the LLM has access to accurate medical knowledge and follows valid reasoning paths, reducing hallucination while maintaining a relatively simple generation process

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The dialogue graph serves as an intermediary structure that bridges the knowledge graph and the LLM generation process. It translates the structured knowledge into a format that guides the LLM's reasoning step-by-step, ensuring that generated content is grounded in verified medical knowledge rather than relying solely on the LLM's probabilistic predictions

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentEP4708154A1Medical LLM model inference method based on knowledge graph and related devices
Publication Date: 2026.03.11 ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
  • EP4708154A1 patent drawingFigure 1
  • EP4708154A1 patent drawingFigure 2~3
  • EP4708154A1 patent drawingFigure 4

AI summary

This specification provides a medical LLM model inference method based on a knowledge graph and related devices. The knowledge graph includes a plurality of nodes and edges connecting the nodes, the nodes represent entities, and the edges represent relationships between the entities. The method includes: obtaining target dialogue text entered by a user, and identifying, from the knowledge graph, a subgraph related to an entity mention included in the target dialogue text, where the subgraph includes a target node that represents a target entity and a plurality of neighboring nodes connected to the target node; obtaining attribute values of a plurality of attributes of the target entity from multi-turn dialogue text that is entered by the user and that includes the target dialogue text; constructing, based on the subgraph and the attribute values of the plurality of attributes of the target entity, a dialogue graph corresponding to the target dialogue text; and constructing a prompt based on the dialogue graph and the target dialogue text, and inputting the prompt into an LLM model, so that the LLM model performs logical inference based on the prompt.