$$\rightleftharpoonup{xx}$$
$$\longleftharp{xx}$$,
$$\longrightharp{xx}$$,
In this study, we examined the utility of a guideline-based RAG chatbot that used a web-based clinical practice guideline—the JLCS Guidebook for Lung Cancer Patients and Families—as its reference information source. The chatbot generated responses grounded in the guideline content by exploiting the web structure of the guideline and retrieving pages based on their similarity to user queries. This approach demonstrated that similarity-based retrieval combined with guideline-referenced response generation can support reliable and efficient medical information delivery. Recent studies have highlighted both the potential and limitations of LLM-based medical chatbots, particularly regarding hallucinations and response reliability12,13,14. Unlike previous studies that focused on general chatbot frameworks10,12,13, the present protocol demonstrates a reproducible guideline-based RAG approach that retrieves patient-guideline content at the URL level and generates responses grounded in identifiable reference information. This study therefore provides a transparent protocol for cancer information delivery rather than a fully validated clinical chatbot system.
Rather than training the AI on the entire guideline corpus, our system selected only the CQs most relevant to each user query as the reference information (Figure 1). The relevance between the question text and each CQ was quantitatively evaluated using the programming language–based cosine similarity calculations with TF–IDF vector representations. Based on these similarity scores, CQs were ranked and selected in descending order of relevance, enabling systematic extraction of appropriate information sources from within the guideline without reliance on subjective judgment (Table 1). Furthermore, concatenating the retrieved CQ texts and presenting them collectively to the AI helped preserve a consistent evidentiary basis for response generation, thereby improving the accuracy and contextual coherence of the generated responses. In RAG systems, the generation of correct information critically depends on accurate and appropriate reference sources14. This design allowed the system to compensate for information that could not be sufficiently covered by a single CQ, contributing to more comprehensive and clinically plausible answers. In addition, RAG enables flexible retrieval of up-to-date CQ content and is well suited for evidence-based medical applications10,11. Although guideline-based RAG approaches have been described previously11,18, the present protocol differs in its use of the existing CQ-based web structure of a patient-oriented guideline as the primary retrieval framework. This design provides a transparent and reproducible workflow that can be implemented without manual knowledge-base construction or model retraining.
Importantly, the chatbot restricted its responses to the scope of the referenced guideline. When questions fell outside the guideline content, the system explicitly refrained from generating answers, thereby reducing the risk of unsupported responses. The use of cosine similarity to control reference selection further enhanced the safety and reliability of the generated responses (Table 2). Reference pages were also retrieved for questions outside the scope of the guideline (Table 3). The cosine similarity values were higher for in-scope questions (0.20–0.65) than for out-of-scope questions (0.20–0.31; data not shown), but low similarity scores were still assigned to some guideline pages even when the content was not clinically relevant. This occurred because cosine similarity was calculated solely on the basis of keyword matching between the query and the guideline text. Importantly, these low-relevance references did not result in inappropriate responses, as the chatbot refrained from generating answers when sufficient reference information was unavailable. No hallucinations were identified during manual review under the defined test conditions. The cosine similarity threshold of 0.2 was selected empirically during preliminary testing to balance retrieval sensitivity and specificity. Although this threshold was effective under the present test conditions, systematic evaluation of threshold sensitivity was beyond the scope of this protocol study. Future studies should investigate the effects of alternative threshold settings using larger benchmark datasets and quantitative retrieval metrics. The observed behavior suggests that RAG-based output control may be useful in medical AI applications. However, the current evaluation was based on a limited number of in-scope and out-of-scope questions and was intended primarily as a proof-of-concept assessment of the proposed workflow. Therefore, the findings should not be interpreted as a comprehensive validation of clinical accuracy, safety, or generalizability.
This study has several technical limitations. We employed the Japanese morphological analyzer and GPT-3.5-turbo-16k (LLM for response generation). The LLM was selected because it was a widely available and stable model at the time of system development and enabled reproducible implementation of the proposed workflow. Morphological analyzers and LLMs have distinct characteristics; thus, the choice of models or libraries influences both the accuracy of information extraction and the content of the generated responses22,23. Although newer models (e.g., GPT-4- or GPT-5-class LLMs) may improve performance and external validity22, evaluation of alternative models was beyond the scope of the present protocol study. Newer LLMs may offer improved reasoning ability, instruction following, and response quality; however, the primary objective of this study was to evaluate the feasibility of a guideline-based RAG framework rather than to compare the performance of different LLMs. Further optimization of these components may enable more efficient and accurate response generation, and validation using different model configurations is necessary to assess the generalizability of these findings. In addition, the present protocol was developed using a Japanese-language guideline and Japanese morphological analysis. Although the retrieval framework based on TF–IDF vectorization, cosine similarity, and RAG is language-independent in principle, implementation in other languages would require language-specific text-processing tools and validation. Although this study was limited to a single guideline and therefore does not allow direct comparison of different guideline structures, the CQ-level organization facilitated systematic extraction of guideline content and supported the construction of reference information for the guideline-based RAG chatbot. In particular, the web structure of the guideline—wherein each CQ is associated with a unique URL—played an important practical role in enabling efficient scraping and organization of reference content at the URL level. Guidelines with different formats, including PDF-based documents or websites without CQ-level URLs, may require alternative segmentation and retrieval strategies. Therefore, the generalizability of the present workflow to other guideline structures and medical specialties remains to be established. Future work should evaluate the applicability of this approach across multiple diseases, guideline formats, and information sources.
The findings of this study provide practical guidance for designing guideline-referencing AI systems and demonstrate that a guideline-based RAG chatbot referencing web-based clinical guidelines has potential as a tool for delivering cancer-related medical information. However, this study represents a proof-of-concept evaluation intended to demonstrate the technical feasibility of guideline retrieval, response generation, and response-restriction mechanisms and should not be interpreted as formal clinical validation of a medical information system. Clinical effectiveness, safety, and user outcomes were not evaluated and remain to be established through future studies. From an ethical and user-safety perspective, restricting responses to guideline-supported information may reduce the risk of unsupported or hallucinated responses. However, excessive refusal behavior may also reduce user satisfaction and perceived usefulness. Future work should therefore evaluate the balance between safety and usability while maintaining appropriate safeguards against misinformation. By leveraging the information structure of web-based guidelines and providing focused responses to user questions, this system may serve as a useful model for future applications of AI in medical information delivery.