Home

Awesome

Open in Spaces

MedQSum

Welcome to the MedQSum repository! This GitHub repository presents the code source of our paper "Enhancing Large Language Models' Utility for Medical Question-Answering: A Patient Health Question Summarization Approach", which introduces a solution to get the most out of LLMs, when answering health-related questions. We address the challenge of crafting accurate prompts by summarizing consumer health questions (CHQs) to generate clear and concise medical questions. Our approach involves fine-tuning Transformer-based models, including Flan-T5 in resource-constrained environments and three medical question summarization datasets.

Datasets

To fine-tune and evaluate our models, we utilize three question summarization datasets:

DatasetReferenceExamplesDownloadComments
MeQ-SumAsma Ben Abacha et al1000download
HCMKhalil Mrini et al1643download
CHQ-SummShweta Yadav et al1507download693 examples were used as outlined here

MedQSum Architecture

Our implemented models undergo fine-tuning using the following architecture:

<p align="center"> <img src="./assets/models.png" style="box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5);" /> </p>

Results

We present the validation results of our fine-tuned models for question summarization across three diverse datasets:

DatasetModelR-1R-2R-LR-L-SUM
MeQ-SumT5 Base41.7825.8839.9039.97
BART Large XSum50.76*33.94*48.87*48.83*
Pegasus XSum46.5930.4644.6044.78
Flan-T5 XXL45.7424.8743.1643.09
HCMT5 Base38.4919.8237.6437.71
BART Large XSum38.5021.86*37.6437.67
Pegasus XSum38.68*21.4838.24*38.20*
Flan-T5 XXL38.3419.3536.9436.89
CHQ-SummT5 Base38.3120.3636.0536.10
BART Large XSum39.95*20.43*37.46*37.36*
Pegasus XSum37.1618.7634.9634.86
Flan-T5 XXL36.7817.0235.0835.05
MeQ+HCMT5 Base37.9020.1136.7536.75
BART Large XSum41.39*24.12*40.24*40.23*
Pegasus XSum41.1422.1340.0339.96
Flan-T5 XXL41.3122.4139.7439.73
MeQ+HCM+CHQT5 Base37.2218.5835.9335.88
BART Large XSum41.1023.0639.1739.20
Pegasus XSum41.6623.51*40.2740.32
Flan-T5 XXL42.69*23.2840.88*40.87*

We also present ablation results demonstrating the effects of generative configuration choices and instruction fine-tuning on the MeQ-Sum dataset:

ModelR-1R-2R-LR-L-SUM
Flan-T5 Standard Fine-tuning45.7424.8743.1643.09
Flan-T5 Instruction Fine-Tuning46.94*27.09*43.40*43.72*
BART Large XSum50.7633.9448.8748.83
BART Large XSum (top_p=.95, top_k=50, and temp.=.6)54.32*38.08*51.98*51.99*

Getting Started

Repository Cloning

To get started, clone the repository to your environment using the following command:

git clone https://github.com/zekaouinoureddine/MedQSum.git

Requirements

Ensure that you have Python 3 installed, along with the necessary dependencies. You can install the dependencies using the provided requirements.txt file:

pip install -r requirements.txt

Models Fine-Tuning

To fine-tune our implemented models and reproduce the results. Navigate to the source code directory with cd src, and execute the following command. Make sure to customize file paths and adjust parameters according to your specific requirements.

python train.py \
      --train_data_path ../data/meq_sum/train.json \
      --valid_data_path ../data/meq_sum/valid.json \
      --train_batch_size 4 \
      --valid_batch_size 4 \
      --lr 3e-5 \
      --epochs 4 \
      --device cuda \
      --chq_max_len 382 \
      --sum_max_len 32 \
      --model_checkpoint facebook/bart-large-xsum \
      --use_instruction False \
      --model_path ./output/medqsm.bin

Inference

To do inference and create an understandable CHQ, use this command with your own configuration.

python inference.py \
      --model_checkpoint facebook/bart-large-xsum \
      --chq_max_len 384 \
      --input_chq_text Type your CHQ input text \
      --device cuda

Cite Us

If you are using this repository's code for your reseach work, please cite our paper:

@INPROCEEDINGS{10373720,
  author={Zekaoui, Nour Eddine and Yousfi, Siham and Mikram, Mounia and Rhanoui, Maryem},
  booktitle={2023 14th International Conference on Intelligent Systems: Theories and Applications (SITA)}, 
  title={Enhancing Large Language Models’ Utility for Medical Question-Answering: A Patient Health Question Summarization Approach}, 
  year={2023},
  volume={},
  number={},
  pages={1-8},
  doi={10.1109/SITA60746.2023.10373720}}

Contact

For help or issues using the paper's code, please submit a GitHub issue. For personal communication related to the paper, please contact: {nour-eddine.zekaoui, syousfi, mmikram, mrhanoui}@esi.ac.ma.


If you like it, give it a ⭐, then follow me on: