Enhancing Medical Dialogue Generation through Knowledge Refinement and Dynamic Prompt Adjustment (2025)

Abstract: Medical dialogue systems (MDS) have emerged as crucial online platforms for enabling multi-turn, context-aware conversations with patients. However, existing MDS often struggle to (1) identify relevant medical knowledge and (2) generate personalized, medically accurate responses. To address these challenges, we propose MedRef, a novel MDS that incorporates knowledge refining and dynamic prompt adjustment. First, we employ a knowledge refining mechanism to filter out irrelevant medical data, improving predictions of critical medical entities in responses. Additionally, we design a comprehensive prompt structure that incorporates historical details and evident details. To enable real-time adaptability to diverse patient conditions, we implement two key modules, Triplet Filter and Demo Selector, providing appropriate knowledge and demonstrations equipped in the system prompt.Extensive experiments on MedDG and KaMed benchmarks show that MedRef outperforms state-of-the-art baselines in both generation quality and medical entity accuracy, underscoring its effectiveness and reliability for real-world healthcare applications.

## introduction medical dialogue systems (mds) have emerged as a pivotal research spotlight, aiming to support healthcare professionals through multi-turn and context-aware conversations with patients @xcite . unlike general dialogue systems, mds must understand and respond using medical domain knowledge @xcite @xcite , offering valuable support for preliminary assessments and nursing care, particularly in resource-constrained environments @xcite . despite the promise of mds, several challenges remain in delivering accurate and contextually appropriate responses. one key challenge is effectively tracking a patient's evolving health state throughout multi-turn interactions. as displayed in figure 1 , doctors gradually refine their understanding of a patient's condition over successive turns. similarly, mds must maintain coherence as the conversation progresses. a common approach involves retrieving relevant medical entities (e.g., symptoms, diagnoses, treatments) from a medical knowledge graph (medkg) @xcite . however, such retrieval-augmented generation (rag) methods often introduce irrelevant knowledge, which degrades response quality. meanwhile, large language models (llms) have greatly improved mds fluency, but remain sensitive to the prompt structure and content. effective prompts for mds must (1) direct the model's attention to critical medical entities and dialogue acts, and (2) include relevant conversation demonstrations for guidance. crucially, these prompts should dynamically adapt to reflect real-time patient information, which is underexplored by existing mds. to address these challenges, we aim to (1) refine the retrieved knowledge for more accurate response guidance and (2) dynamically adjust system prompts to align with specific patient conditions. therefore, we propose medref, a novel mds with knowledge refining and dynamic prompt adjustment. first, we explicitly represent the patient's condition by incorporating contextual medical entities. inspired by @xcite , we adopt an entity-action joint prediction module to obtain the expected entities and acts. to mitigate noise from retrieved entities, we introduce a knowledge refining mechanism to enable more accurate entity prediction and knowledge-driven response generation. building upon this, we construct a comprehensive prompt structure tailored to each dialogue turn. this system prompt mainly includes the following key components: (1) task instruction: a high-level directive guiding the system's response generation process. (2) historical details: a summary of the dialogue context and identified medical entities. (3) evident details: predicted entities and acts, and relevant knowledge triplets to provide medical evidence for response generation. (4) relevant demonstration: an example conversation for response formatting. to enhance responsiveness, we integrate a dynamic prompt adjustment strategy that updates prompt contents in real time. specifically, we leverage the triplet filter and demo selector to retain only the most relevant knowledge and demonstrations. this enables our system to generate accurate, contextually grounded, and patient-specific responses throughout the dialogue. we conduct extensive experiments on two widely used benchmarks: meddg @xcite and kamed @xcite . experimental results demonstrate the superiority of our medref compared with state-of-the-art baselines in both generation quality and medical entity accuracy. ablation studies further validate the effectiveness of each module in our framework. to sum up, our contributions can be summarized as follows: ## conclusion in this paper, we propose medical dialogue system with knowledge refining and dynamic prompt adjustment (medref). we introduce a variational knowledge refining mechanism for more accurate medical entity predictions and knowledge-driven responses. we also develop a dynamic prompt adjustment method that adapts system prompts in realtime to the patient's evolving condition, ensuring more personalized and contextually relevant multiturn medical dialogue generation. extensive experiments on two benchmarks verify that medref can achieve the best performance in terms of both text generation and medical entity-based metrics. these findings underscore medref's potential to improve the quality and reliability of mds, paving the way for more context-aware and medically sound interactions in healthcare settings.