TriMediQ is an approach designed for interactive medical QA.
It addresses the limitation of LLMs in interactive settings where clinical facts are scattered across dialogue turns without explicit connections.
The approach introduces a triplet-structured knowledge graph (KG) that incrementally converts patient responses into UMLS-style triplets and integrates them into the expert LLM via a projection module.
- Projection Training: Fine-tuning a projection module that encodes UMLS-style triplets via a graph encoder + projector and injects them into a frozen expert LLM through prefix tuning.
- Interactive QA: Using the trained projection to support inference in multi-turn patient–expert interactions.
Create a new conda environment with all dependencies (requires GPU for PyTorch + CUDA):
conda env create -f environment.yml
conda activate TriMediQExample run:
python TriMediQ_benchmark.py \
--expert_module expert --expert_class ScaleExpert \
--patient_module patient --patient_class FactSelectPatient \
--data_dir ../data --dev_filename all_dev_good.jsonl \
--output_filename out.jsonl --max_questions 10This repository is released under the MIT License.
