Design and Implementation of a Medical Question Answering System Based on Retrieval-Augmented Generation

Authors

  • Jiacong Nie
  • Xianxin Liu
  • Yixiong Tu
  • Geng Zhao
  • Danyang Wu
  • Yuhao Tang

DOI:

https://doi.org/10.54097/4xqm5c93

Keywords:

Retrieval-Augmented Generation, Medical Question Answering, Artificial Intelligence, Natural Language Processing

Abstract

With the rapid growth of medical information demand, providing accurate and reliable medical question-answering services has become a pressing challenge. Traditional generative Q&A models are prone to hallucinations, frequently generating inaccurate medical advice, while simple retrieval systems lack natural fluency. To address this, we propose a Retrieval-Augmented Generation (RAG)-based medical QA system with a five-layer architecture. The data processing layer cleans and formats data from the MedChatZH dataset. The knowledge storage layer encodes documents into 768-dimensional vectors using the BGE-small-zh-v1.5 embedding model and builds an index. The retrieval layer selects relevant documents via cosine similarity. The answer generation layer employs the ChatGLM3-6B language model for context-aware responses. Finally, a user-friendly web interface is implemented using Gradio, offering high-quality medical Q&A services.

Downloads

Download data is not yet available.

References

[1] WU T, HE S, LIU J, et al. A brief overview of ChatGPT: the history, status quo and potential future development[J]. IEEE /CAA Journal of Automatica Sinica,2023,10(5):1122-1136.

[2] Zhang L, Wang Y, Li S, et al. An Evaluation of DeepSeek Models in Biomedical Natural Language Processing [EB/OL]. arXiv:2503.00624, 2025. Available: https://arxiv.org/abs/2503.00624.

[3] Chen Yongwei. Beyond ChatGPT: Opportunities, Risks, and Challenges of Generative AI. Journal of Shandong University (Philosophy and Social Sciences Edition), 2023, (3): 127–143.

[4] Yan Jianzhi, He Yuxin, Luo Ziye, et al. Typical Applications and Challenges of Generative Large Language Models in the Medical Field. Journal of Medical Informatics, 2023, 44(09): 23–31.

[5] Hu Zhensheng, Yang Rui, Zhu Jiahao, et al. Research and Development of Large Language Models in the Medical Domain. Artificial Intelligence, 2023, (04): 10–19. DOI:10.16453/j.2096-5036.2023.04.002.

[6] Luo R, Sun L, Xia Y, et al. BioGPT: generative pre-trained transformer for biomedical text generation and mining[J]. Briefings in bioinformatics, 2022, 23(6): bbac409.

[7] GLM T, Zeng A, Xu B, et al. Chatglm: A family of large language models from glm-130b to glm-4 all tools[J]. arXiv preprint arXiv:2406.12793, 2024.

[8] Wang Yang. Application and Prospects of Traditional Chinese Medicine Diagnosis and Treatment Technologies under the Background of Artificial Intelligence. Information & Computer (Theoretical Edition), 2019, (11): 135–136.

[9] Lewis P, Perez E, Piktus A, et al. Retrieval-augmented generation for knowledge-intensive nlp tasks[J]. Advances in neural information processing systems, 2020, 33: 9459-9474.

[10] Tan Y, Li M, Huang Z, et al. Medchatzh: a better medical adviser learns from better instructions[J]. arXiv preprint arXiv:2309.01114, 2023.

[11] Reimers N, Gurevych I. Sentence-bert: Sentence embeddings using siamese bert-networks[J]. arXiv preprint arXiv:1908.10084, 2019.

[12] Xiao S, Liu Z, Zhang P, et al. C-pack: Packed resources for general chinese embeddings[C]//Proceedings of the 47th international ACM SIGIR conference on research and development in information retrieval. 2024: 641-649.

[13] Dou Fengqi, Hu Shan, Li Jialong, et al. Design and Implementation of a RAG-based QA System Using LangChain: A Case Study of C Programming Course. Information & Computer (Theoretical Edition), 2024, 36(06): 101–103.

Downloads

Published

28-08-2025

Issue

Section

Articles

How to Cite

Nie , J., Liu, X., Tu, Y., Zhao, G., Wu, D., & Tang, Y. (2025). Design and Implementation of a Medical Question Answering System Based on Retrieval-Augmented Generation. International Journal of Biology and Life Sciences, 11(3), 1-6. https://doi.org/10.54097/4xqm5c93