MedGraph: Maintaining Patient State with Graph Memory for Long-Term Medical Dialogue
Organizations: University of Michigan · Georgetown University · Johns Hopkins University · Harvard University
Abstract
LLM-based medical assistants that follow a patient across visits need a memory that keeps the patient's clinical state correct as it changes. We examine the errors of five memory systems on longitudinal medical dialogue and find three recurring causes: the retrieved evidence gives an outdated state, includes another person's health facts, or lacks a safety fact the answer depends on. We present MedGraph, a graph memory built for these three cases. Construction extracts dated facts from each session, attributes each fact to the person it describes, and links medication, diagnosis, and measurement records into chains that keep earlier states. Retrieval ranks the patient's chains as units, reads each chain at the time the question asks about, and adds the original dialogue text; a patient profile lists every recorded safety fact with every question. On MedMemoryBench, MedGraph has the highest overall accuracy with both a GPT and a Qwen backbone, 10.5 and 10.4 points above the strongest of five baselines, with efficient memory construction and answering in the GPT setting.
Figures & tables
| Fact type | Storage | Current record |
|---|---|---|
| medication, condition | chain, insertion order | chain tail |
| lab, vital | chain, all kept | latest by date |
| symptom, event | individual records | – |
| safety | append-only | all in profile |
| preference | individual records | – |
| Avg. | EEM | MQ | TLA | SUA | IG | MCD | |
| GPT backbone | |||||||
| Emb. RAG | 41.4 | 50.5 | 69.8 | 46.3 | 42.0 | 22.2 | 17.2 |
| Mem0 | 40.3 | 47.5 | 65.3 | 36.2 | 63.0 | 20.2 | 9.7 |
| MemOS | 39.1 | 46.0 | 61.8 | 50.3 | 61.0 | 13.6 | 2.2 |
| LightMem | 37.1 | 40.0 | 68.3 | 44.6 | 53.0 | 13.6 | 3.2 |
| REMem | 23.0 | 27.5 | 53.8 | 23.2 | 28.0 | 3.5 | 2.2 |
| State | Subject | Safety | ||||
| Avg. | Acc. | Polluted entries | Polluted questions | Missing | Acc. | |
| Emb. RAG | 41.4 | 49.0 | 12.2 | 22.8 | 38.2 | 44.0 |
| Mem0 | 40.3 | 55.4 | 22.4 | 55.6 | 51.7 | 44.9 |
| MemOS | 39.1 | 53.4 | 17.1 | 40.4 | 59.6 | 39.7 |
| LightMem | 37.1 | 52.9 | 21.8 | 74.1 | 74.2 | 40.8 |
| REMem | 23.0 | 35.8 | 27.3 | 63.6 | 80.9 | 25.6 |
| Question (patient 4, IG): “Doctor, my knee pain is back. Can I take a painkiller again?” | ||
|---|---|---|
| Gold : Avoid ibuprofen, which the doctor stopped; with perindopril and spironolactone it risks kidney damage and high potassium. | ||
| Evidence | Answer | |
| LightMem ✗ | “Took ibuprofen 200 mg as needed for about a year” (Jan 3) and “the doctor told the patient to stop ibuprofen” (Jan 5), with no mark of which is current; none names perindopril or spironolactone. | “If the pain is very bad, a one-off 200 mg of ibuprofen is acceptable.” |
| MemOS ✗ | Knee-pain and exercise memories. Its memory holds the order to stop ibuprofen and the interaction warning, but neither is retrieved. | No drug record; an old painkiller “can be considered”. |
| REMem ✗ | General advice and another person’s records, e.g., “continue mecobalamin to support nerve recovery” . Its stored interaction warning is not retrieved. | Asks whether the user is “Xiao Zhou, who used celecoxib”. |
| MedGraph ✓ | Current medications: perindopril, spironolactone, and valsartan, all “in use” with dates. Safety: “[interaction] ibuprofen: with perindopril and spironolactone, adds kidney and potassium risk; do not keep taking it” (2024-01-03). | “With perindopril, valsartan, and spironolactone, do not take ibuprofen on your own.” |
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | Builder | Evidence per question |
|---|---|---|
| Embedding RAG | none | top 5 chunks ( 4,096 tok.) |
| Mem0 | gpt-6-luna | top 5 memories |
| MemOS | gpt-6-luna | top 5 memories |
| LightMem | gpt-6-luna | top 20 memories |
| REMem | gpt-6-luna | top 5, gist agent |
| MedGraph | gpt-6-luna | 8 units, 4 causal, dates |
| Question (patient 9, inference): “Doctor, I am always tired in the afternoon. Is it the medicine? Should I stop it for now?” | |
| Gold : do not stop; the afternoon fatigue was there before the diabetes drugs were started, so it is unlikely to be their side effect. | |
| Embedding RAG, MemOS ✗ | MedGraph ✓ |
| Evidence. Embedding RAG retrieves three noise sessions—two general health consultations and one about the father’s blood-pressure drugs —and none of the patient’s own. Three of MemOS’s five memories are about the father’s blood pressure, e.g., “if the father’s systolic pressure falls to about 110 mmHg with dizziness, indapamide can be paused for a day” . | Evidence. Profile: “DPP-4 inhibitor: active, started 2024-01-10” ; “metformin: active, 1,500 mg/day on a new regimen for about two weeks” (both as of 2024-01-10). Matched facts: “(2024-01-04) afternoon fatigue, like being drained, worst at 3–4 pm” ; “(2024-01-08) afternoon fatigue and poor concentration”; “(2024-01-10) afternoon fatigue still present”. No fact about the father appears. |
| Answer (both discuss the father’s drugs). “…not likely caused by your father’s current drugs (valsartan/amlodipine) …” (Embedding RAG). | Answer. The fatigue was reported before the drug change, so it is unlikely to be a side effect; do not stop on your own. |
| Why. The subject filter keeps the father’s sessions out and the profile gives the patient’s own diabetes drugs, so the answer is about the right person’s drugs. The dated fatigue records in the evidence start on 2024-01-04, before the DPP-4 inhibitor is recorded as added (2024-01-10). Mem0, LightMem, and REMem also answer wrongly; we show the two baselines whose evidence is about the father. | |
Long-Term Conversational Memory
Long-term conversational memory helps AI assistants retain, update, and use information from past conversations across sessions.
See all 274 papers