Manuscript Offprint
arXiv:2611.03826Rethinking Next-Visit Diagnosis Prediction Beyond Aggregate Metrics: Retrieval--Memory Multi-Agent Adjudication
Abstract
Next-visit diagnosis prediction forecasts the diagnoses documented at a patient's next encounter, turning retrospective electronic health records into prospective clinical prediction. However, conventional aggregate evaluation obscures its multifaceted nature: distributionally, models must handle variable-size diagnosis sets and long-tailed labels; temporally, they must distinguish persistent, newly recorded, and recurrent diagnoses; and both vary with observed history depth. We introduce an evaluation framework along these dimensions and apply it to rule-based heuristics, LLM-based prompting, retrieval, memory, and multi-agent approaches. This reveals that repeating the last visit outperforms most LLM-based approaches overall despite predicting no new or recurrent diagnoses, and that retrieval and memory exhibit distinct profiles whose relative strengths vary across temporal transitions and backbones. Motivated by this, we propose LONGINUS, a retrieval–memory multi-agent adjudication framework combining evidence retrieved from patient records with structured memory of the patient trajectory. Using cross-view agreement as a reliability heuristic, it preserves shared predictions and adjudicates disagreements without revealing their source. Across MIMIC-III and MIMIC-IV with four LLM backbones, LONGINUS achieves the best transition-specific performance among LLM-based methods in nearly all settings while remaining competitive with them on aggregate metrics.
1 Introduction
Electronic health records (EHRs) accumulate a patient's clinical history across encounters, thereby enabling a shift from retrospective documentation towards prospective clinical prediction. Next-visit diagnosis prediction formulates this objective as multi-label prediction over a sequence of prior visits: given a patient's record up to the current encounter, predict the set of diagnoses documented

Figure 1: A synthetic illustrative example of the multifaceted nature of next-visit diagnosis prediction.
at the next visit (Choi et al., 2016a; Li et al., 2020; Koo, 2024). Anticipating these diagnoses could facilitate proactive scheduling, preventive testing, and personalized intervention (Escobar et al., 2020; Goldstein et al., 2020; Adams et al., 2022).
This formulation poses challenges that adjacent tasks do not. Single-label clinical prediction assigns one target per observation (Choi et al., 2016b; Baldenweg et al., 2024); single-visit classification uses one encounter (Rajpurkar et al., 2017; Baltruschat et al., 2019); and retrospective ICD coding labels an already documented encounter (Mullenbach et al., 2018; Huang et al., 2022). In contrast, next-visit diagnosis prediction forecasts a diagnosis set from multi-visit history for a future encounter, combining distributional and temporal challenges over longitudinal histories (Figure 1). Distributionally, encounters contain varying numbers of co-occurring diagnoses drawn from a long-tailed label distribution. Temporally, diagnoses may persist, be newly coded relative to observed history, or reappear after an interval of absence. Both challenges also vary with history depth: label and transition distributions shift as visits accumulate, and recurrence requires at least two observed visits. Aggregate scores alone may therefore conceal performance differences across distributional settings, temporal transitions, and history depths.
| Prior Work | Overall | Distribution | Temporal Transitions | History Depth | |||
|---|---|---|---|---|---|---|---|
| Agg. | Co | LT | Pers. | New | Rec. | ||
| GRAM (Choi et al., 2017) | ✓ | ✗ | ✓ | ✗ | ✗ | ✗ | ✗ |
| TCoN (Sun et al., 2021) | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ |
| NECHO (Koo, 2024) | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
| TAKECare (Wu et al., 2025a) | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ | ✓ |
| RAVEN (Rajamohan et al., 2026) | ✓ | ✗ | ✗ | ✗ | ✓ | ✗ | ✗ |
| Ours (Evaluation) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Table 1: Evaluation coverage in representative next-visit diagnosis prediction studies. Agg.: aggregate metrics; Co: co-occurrence; LT: long-tail; Pers.: persistent; New: newly recorded; Rec.: recurrent. ✓/✗: explicitly evaluated/not explicitly evaluated.
Earlier approaches to next-visit diagnosis prediction modeled visit sequences using recurrent and attention-based networks (Choi et al., 2016a,b; Ma et al., 2017), medical ontologies (Choi et al., 2017), and transformer-based or multimodal architectures (Peng et al., 2021; Li et al., 2020; Koo, 2024). More recently, LLM-based methods have explored ontology-aware hierarchical Chain-of-Thought (CoT) prompting (Koo, 2025b) and fine-tuning (Ben Shoham and Rappoport, 2024).
The evaluation of these diverse approaches, by contrast, remains fragmented (Table 1). Distributional analyses have examined within-visit co-occurrence (Sun et al., 2021) and low-frequency diagnoses (Choi et al., 2017). Temporal analyses have focused primarily on newly appearing diagnoses: RAVEN emphasizes new onsets by down-weighting repeated events (Rajamohan et al., 2026). EviCare also targets novel diagnoses (Zhang et al., 2026). History depth has been examined separately (Wu et al., 2025a), and Kruse et al. (2025) show that LLMs struggle with both rare diagnoses and temporal progression. Nevertheless, to our knowledge, no prior study jointly evaluates distributional factors (multi-label set performance and label frequency), temporal transitions (persistent, new, and recurrent diagnoses), and history depth, leaving unclear how model strengths and limitations vary across these dimensions (see Appendix A).
We therefore introduce a unified, model-agnostic, distribution- and transition-aware evaluation framework that jointly assesses multi-label set performance, label frequency, temporal transitions, and observed history depth. On MIMIC-IV (Johnson et al., 2023), this framework reveals that aggregate scores can reward diagnostic persistence: last-visit carry-forward (LVCF) outperforms most LLM-based results in Micro-F1 (21 of 24; Section 2) despite predicting no New or Recurrent diagnoses, while observed-history union (OHU) can predict Recurrent but not New diagnoses. It also distinguishes the retrieval and memory views: retrieval achieves higher Micro-F1 across all backbones and history depths, whereas memory achieves higher Recurrent F1 with three of four backbones and higher New F1 in most settings, while Persistent F1 shows no consistent direction. These distinct profiles motivate reconciling the two views with patient-specific evidence, rather than relying on either view alone.
We propose LONGINUS (LONGitudinal Integration of retrieval and memory Using Source-neutral adjudication), a retrieval–memory disagreement-guided multi-agent adjudication framework that generates separate predictions from evidence retrieved from the patient’s record and a structured memory of the patient trajectory. Using cross-view agreement as a reliability heuristic, LONGINUS preserves shared predictions and reserves adjudication for candidates proposed by only one view. The adjudicator reviews these candidates using both evidence views and diagnosis-history states, without revealing which view proposed each. This design encourages evidence-based decisions without imposing an explicit preference for either retrieval or memory. In summary, our contributions are threefold:
- We introduce a model-agnostic, distribution- and transition-aware evaluation framework that assesses multi-label set performance and label frequency, decomposes predictions into persistent, new, and recurrent diagnoses, and stratifies results by observed history depth.
- We benchmark training-free LLM-based prompting, retrieval, memory, and multi-agent approaches, showing that LVCF exceeds every LLM-based method in Micro-F1 on MIMIC-III despite predicting no new or recurrent diagnoses, and that retrieval and memory exhibit distinct prediction profiles across transitions, backbones, and history depths.
- We propose LONGINUS, a training-free, LLM-based multi-agent framework that combines local retrieval and global trajectory memory via consensus preservation and source-neutral adjudication. Across two datasets and four backbones, it achieves the best transition-specific F1 among training-free LLM-based methods in 22 of 24 settings while remaining competitive with them on aggregate metrics. Ablation, comparative, and stage-wise analyses further support our design choices.
2.1 Problem Formulation
For a patient , let denote the observed longitudinal record, where each visit consists of demographic information , a clinical note , and the set of documented diagnoses over the fixed label space . The objective is to predict the diagnosis set at the subsequent visit,
where denotes a prediction model, including rule-based heuristics and LLM-based approaches. We stratify patients by observed history depth: one observed visit (Visit 1) or two or more (Visit 2+). This split separates histories in which recurrence is identifiable from those in which it is not.
2.2 Temporal Decomposition by Visit History
For an observed visit , let denote the diagnostic history up to and including visit . We decompose the next-visit diagnoses by their relationship to this history:
where , , and denote Persistent, New, and Recurrent diagnoses, respectively. These sets partition ; New is defined relative to the observed coding history and may include newly developed conditions, previously uncoded comorbidities, or newly documented complications. With one observed visit, is empty by construction, so Recurrent F1 is reported only for Visit 2+. In Visit 2+, Recurrent diagnoses emerge and the share of New diagnoses drops, while Persistent diagnoses remain the largest component (Table 2).
2.3 What Aggregate Metrics Hide
In Table 3, LVCF exceeds 21 of 24 LLM-based results in Micro-F1 despite predicting no New or Recurrent diagnoses and OHU also predicts no New diagnoses¹. Even when NECHOv3 with Llama-3.3-70B exceeds LVCF in Visit 2+, its New F1 is only .082. Since Persistent diagnoses dominate next-visit labels (Table 2), aggregate scores can favor persistence over predicting previously unobserved diagnoses.
| Dataset | History | Patients (%) | New | Persistent | Recurrent |
|---|---|---|---|---|---|
| MIMIC-III | Visit 1 | 78.6 | 45.64 | 54.36 | — |
| Visit 2+ | 21.4 | 27.52 | 59.31 | 13.17 | |
| MIMIC-IV | Visit 1 | 74.4 | 41.37 | 58.63 | — |
| Visit 2+ | 25.6 | 25.05 | 59.14 | 15.81 |
Table 2: Temporal composition (%) of next-visit diagnosis labels by observed history depth. Patients: share of patients per dataset; diagnosis percentages are over all target labels in each history group. Recurrent is undefined for Visit 1 (–).
| Backbone | Method | Visit 1 | Visit 2+ | |||||
|---|---|---|---|---|---|---|---|---|
| Agg. | Temp. | Agg. | Temp. | |||||
| Mic. | Pers. | New | Mic. | Pers. | New | Rec. | ||
| Rule | LVCF | .582 | .732 | .000 | .586 | .734 | .000 | .000 |
| OHU | .582 | .732 | .000 | .582 | .734 | .000 | .444 | |
| Gemini-2.5-Flash-Lite | NECHOv3 | .493 | .722 | .203 | .521 | .741 | .148 | .484 |
| EHR-RAG | .564 | .731 | .247 | .574 | .737 | .157 | .437 | |
| Traj-CoA | .531 | .741 | .283 | .507 | .743 | .186 | .495 | |
| Gemini-3.1-Flash-Lite | NECHOv3 | .552 | .752 | .254 | .552 | .768 | .153 | .453 |
| EHR-RAG | .584 | .748 | .315 | .575 | .753 | .213 | .488 | |
| Traj-CoA | .526 | .719 | .250 | .525 | .735 | .182 | .455 | |
| GPT-OSS-120B | NECHOv3 | .564 | .722 | .290 | .561 | .713 | .223 | .472 |
| EHR-RAG | .579 | .732 | .265 | .589 | .743 | .177 | .450 | |
| Traj-CoA | .571 | .748 | .303 | .545 | .740 | .206 | .483 | |
| Llama-3.3-70B | NECHOv3 | .533 | .710 | .064 | .600 | .747 | .082 | .406 |
| EHR-RAG | .548 | .713 | .138 | .584 | .731 | .107 | .350 | |
| Traj-CoA | .494 | .656 | .227 | .527 | .686 | .184 | .453 | |
Table 3: Performance on MIMIC-IV by observed history depth. NECHOv3 is a single-prompt, full-context baseline (Koo, 2025b); EHR-RAG (Cao et al., 2026) and Traj-CoA (Zeng et al., 2025) are representative patient-internal retrieval and trajectory-memory baselines, respectively (Section 4.1.4). Agg.: Micro-F1; Temp.: transition-specific F1 (Rec. in Visit 2+ only). Bold/underline: best/second-best LLM-based result per backbone and column using unrounded values; Gray: below the best rule-based score per column.
2.4 Retrieval–Memory Prediction Profiles
Existing retrieval- and memory-based methods show distinct profiles (Table 3): across all four backbones, EHR-RAG achieves higher Micro-F1 than Traj-CoA in both history strata, whereas Traj-CoA achieves higher Recurrent F1 with three of four backbones and higher New F1 in six of eight backbone–depth settings. These strengths are backbone-dependent: Persistent F1 shows no consistent direction, and with Gemini-3.1-Flash-Lite, EHR-RAG leads on every transition. Since neither view dominates, these profiles motivate combining the two without a fixed preference: LONGINUS builds history-state-aware retrieval and structured memory views, retains shared predictions, and applies source-neutral review to disagreements (Section 3).
¹Patterns were first observed on the development cohort and are reported here on the evaluation cohort.

Figure 2: Overview of Our LONGINUS Framework. Candidate labels follow the example patient in Figure 1.
3 Methodology
LONGINUS instantiated with three components: a retrieval view that selects local evidence from the patient's record, a memory view that summarizes the global patient trajectory, and a source-neutral adjudicator that reviews disagreements between their predictions while retaining shared labels.
3.1 Retrieval View
The retrieval view selects local evidence from the patient's observed EHR trajectory. We partition the fixed label space according to diagnostic history:
Current,
(5)
Past-only,
(6)
Unseen.
(7)
These history states are observable at prediction time, whereas the Persistent, Recurrent, and New transitions in Section 2 depend on the next-visit outcome. They guide retrieval and later annotate adjudication candidates.
We perform patient-internal dense retrieval over visit-aware EHR chunks using one query per history state. The Current query seeks evidence of continued activity or resolution; the Past-only query targets prior episodes and possible reactivation; and the Unseen query seeks symptoms, abnormal findings, diagnostic workup, treatments, or complications that may support diagnoses not previously documented in the observed history.
Let denote the rank of chunk under retrieval path , with if that path does not retrieve . We merge the retrieved chunks, remove duplicates, and assign each unique chunk its best rank:
We select the unique chunks with the best ranks (ties broken by similarity score), then present these selected chunks to the LLM in chronological order to preserve the temporal sequence of the retrieved evidence,
(9)
where U is the set of unique chunks retrieved across all paths, TopK selects the k = 12 highest-scoring chunks, and Chrono orders them by visit time. Best-rank deduplication (BRD) prioritizes evidence ranked highly by any path without rewarding repeated retrieval across paths.
3.2 Memory View
The memory view summarizes the observed patient trajectory through two LLM calls. The first summarizes the complete record into a structured memory card covering chronic conditions, recurrent and acute events, abnormal trends, prior treatments or procedures, unresolved problems, and risk factors. The second predicts diagnoses using this card and the fixed label space:
(10)
where constructs the structured clinical memory and produces the memory-view prediction.
3.3 Source-Neutral Disagreement Adjudication
Given the separately generated predictions and , we partition their union into consensus and disagreement:
(11) where denotes symmetric difference. Treating cross-view agreement as a signal of reliability, we retain labels in and forward only to the adjudicator . Each candidate includes its history state (Current, Past-only, or Unseen) and prior diagnosis visits, if any; these annotations are denoted collectively by .
To discourage source-based preferences, is not told which view proposed each label. A single batched LLM call decides each candidate with history-state-specific criteria: continued activity for Current, no exclusion solely for absence from the latest visit for Past-only, and patient-specific support for Unseen. Given , and , the adjudicator returns an accepted subset, combining with the consensus to form the final prediction:
4 Experiments
4.1 Experimental Setup
4.1.1 Data and Preprocessing
We construct MIMIC-III (Johnson et al., 2016) and MIMIC-IV (Johnson et al., 2023) cohorts from discharge summaries, diagnosis codes, and demographics following prior protocols (Choi et al., 2016a; Koo, 2024). We retain adults with valid urgent, emergency, or elective admissions and, after predefined exclusions, map diagnoses to 112 CCS single-level labels, which form the label space and are grouped into 14 multi-level parent categories. Each prediction uses up to five chronologically ordered visits immediately preceding the target, with consecutive gaps of at most 180 days, including the observed-to-target gap (Weiskopf et al., 2013). We sample 1,000 unique patients per dataset, stratified by age group, sex, race, and visit depth. Details appear in Appendix B.
4.1.2 Evaluation Metrics
We report Micro-F1 for aggregate performance, patient-averaged Jaccard for set overlap, and label-averaged Macro-F1 for infrequent diagnoses (Wang et al., 2026), after removing out-of-space predictions. Transition-specific F1 maps the history states of Section 3 (Current, Unseen, Past-only) to Persistent, New, and Recurrent and applies them to both predicted and reference labels, so that false positives are also attributed to a transition. All metrics are further stratified by observed history depth;
formal definitions are given in Appendix C.
4.1.3 LLM Backbones
We evaluate four LLM backbones: Gemini-2.5-Flash-Lite (Comanici et al., 2025), Gemini-3.1-Flash-Lite (Team et al., 2023; Google DeepMind, 2026), GPT-OSS-120B (Agarwal et al., 2025), and Llama-3.3-70B (Grattafori et al., 2024). Section 2 reports all four; Section 4 presents detailed results for Gemini-3.1-Flash-Lite and Llama-3.3-70B, with the remaining two in Appendix F. Given inconsistent gains from medical adaptation (Jeong et al., 2024) and backbone sensitivity (Zhuo et al., 2024; Zhou et al., 2024), we evaluate general-purpose LLMs across model families, holding the backbone fixed within each setting.
4.1.4 Baselines
We compare LONGINUS with rule-based heuristics (LVCF and OHU) and four families of LLM-based methods: single-prompting (NECHOv3 (Koo, 2025b)), multi-agent (MedAgents (Tang et al., 2024), MDAgents (Kim et al., 2024), and KAMAC (Wu et al., 2025b)), retrieval (Summary-RAG (Xiong et al., 2024), RGAR (Liang et al., 2025), MASS-RAG (Xiao et al., 2026), and EHR-RAG (Cao et al., 2026)), and memory (Traj-CoA (Zeng et al., 2025)), with task-specific adaptations described in Appendix D.
We focus on training-free LLM methods that require no task-specific training or retraining for new cohorts. Where feasible, we standardize system and task prompts, label space, output format, and recall-oriented guidance (Koo, 2025b), while preserving method-specific procedures.
4.1.5 Implementation Details
We use temperature 0 for all LLM calls. Dense retrieval uses bge-small-en-v1.5 (Xiao et al., 2024). LONGINUS and patient-internal RAG baselines use 160-token chunks with 40-token overlap and retrieve the top 12 chunks. Full prompts of LONGINUS are provided in Appendix E. Design choices, including the adjudication variant (Section 4.3.2), were selected on a separate patient-disjoint development cohort of 500 patients from MIMIC-III and applied unchanged to MIMIC-IV, prioritizing transition-specific F1; the 1,000-patient cohorts were reserved exclusively for final evaluation. We assess statistical significance with two-sided paired patient-level bootstrap tests (2000 replicates; ), applying Holm correction within each comparison family.
| Backbone | Type | Method | MIMIC-III | MIMIC-IV | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Agg. | Dist. | Temp. | Agg. | Dist. | Temp. | |||||||||
| Mic. | Mac. | Jac. | Pers. | New | Rec. | Mic. | Mac. | Jac. | Pers. | New | Rec. | |||
| - | Rule | LVCF | .558 | .510 | .397 | .719 | .000 | .000 | .582 | .479 | .439 | .732 | .000 | .000 |
| OHU | .553 | .510 | .391 | .719 | .000 | .383 | .582 | .492 | .436 | .732 | .000 | .444 | ||
| Gemini-3.1-Flash-Lite | Single-Prompting | NECHOv3 | .514 | .450 | .353 | .715 | .194 | .393 | .552 | .459 | .392 | .756 | .236 | .453 |
| Multi-agent | MedAgents | .506 | .407 | .347 | .695 | .217 | .383 | .547 | .444 | .390 | .736 | .264 | .416 | |
| MDAgents | .505 | .443 | .341 | .700 | .210 | .368 | .546 | .474 | .387 | .736 | .263 | .478 | ||
| KAMAC | .485 | .379 | .324 | .670 | .200 | .372 | .525 | .422 | .365 | .703 | .270 | .435 | ||
| Retrieval | Summary-RAG | .487 | .405 | .330 | .693 | .222 | .409 | .518 | .437 | .356 | .728 | .267 | .491 | |
| RGAR | .472 | .391 | .318 | .674 | .196 | .374 | .512 | .426 | .359 | .705 | .254 | .473 | ||
| MASS-RAG | .526 | .454 | .368 | .713 | .193 | .383 | .578 | .482 | .418 | .746 | .265 | .487 | ||
| EHR-RAG | .530 | .460 | .367 | .716 | .224 | .383 | .582 | .484 | .420 | .749 | .298 | .488 | ||
| Memory | Traj-CoA | .484 | .402 | .332 | .691 | .184 | .372 | .525 | .428 | .380 | .722 | .237 | .455 | |
| Ours | LONGINUS | .535 | .462 | .370 | .728† | .255† | .439 | .583 | .490 | .418 | .773† | .314 | .529 | |
| Llama-3.3-70B | Single-Prompting | NECHOv3 | .510 | .405 | .354 | .686 | .021 | .297 | .548 | .405 | .401 | .719 | .067 | .406 |
| Multi-agent | MedAgents | .428 | .302 | .284 | .606 | .109 | .241 | .468 | .325 | .330 | .630 | .167 | .378 | |
| MDAgents | .449 | .328 | .303 | .632 | .105 | .248 | .487 | .352 | .348 | .656 | .170 | .344 | ||
| KAMAC | .465 | .357 | .315 | .643 | .112 | .250 | .502 | .389 | .362 | .668 | .184 | .358 | ||
| Retrieval | Summary-RAG | .390 | .293 | .261 | .557 | .127 | .268 | .484 | .378 | .342 | .676 | .226 | .436 | |
| RGAR | .463 | .358 | .321 | .642 | .056 | .196 | .491 | .372 | .370 | .657 | .127 | .269 | ||
| MASS-RAG | .518 | .434 | .360 | .694 | .102 | .360 | .562 | .455 | .415 | .723 | .195 | .450 | ||
| EHR-RAG | .508 | .437 | .357 | .683 | .082 | .160 | .556 | .446 | .425 | .717 | .134 | .350 | ||
| Memory | Traj-CoA | .457 | .362 | .313 | .632 | .139 | .345 | .502 | .396 | .364 | .663 | .220 | .453 | |
| Ours | LONGINUS | .547† | .470† | .388† | .725† | .174† | .366 | .597† | .488† | .447† | .759† | .253† | .481 | |
Table 4: Next-visit diagnosis prediction performance for two representative LLM backbones. Bold/underline: best/second-best LLM-based result per backbone and column using unrounded values. Gray: below the best rule-based score in that column (rule-based baselines are backbone-independent). †: LONGINUS significantly exceeds the highest-scoring competing LLM-based method in that column (Section 4.1.5).
4.2 Overall and Temporal Performance
4.2.1 Main Results
Table 4 reports results for Gemini-3.1-Flash-Lite and Llama-3.3-70B. Among LLM-based methods, LONGINUS achieves the best score in 23 of 24 dataset–backbone–metric combinations, including all 12 transition-specific ones; the only exception is MIMIC-IV Jaccard with Gemini-3.1-Flash-Lite, where EHR-RAG leads. Improvements are significant in 10 of 12 columns with Llama-3.3-70B, where LONGINUS exceeds the strongest LLM-based baseline on MIMIC-IV by .035, .027, and .028 in Micro-F1, New F1, and Recurrent F1, respectively, whereas with Gemini-3.1-Flash-Lite margins are smaller in aggregate metrics (e.g., .583 vs. .582 Micro-F1 on MIMIC-IV) than in Recurrent F1 (.529 vs. .491). Across all four backbones (Appendix F), LONGINUS attains the best transition-specific F1 in 22 of 24 settings; gains are consistent in direction but largest and most often significant with Llama-3.3-70B, and are achieved with at most four LLM calls per patient (Appendix D).
Rule-based methods nevertheless remain competitive in aggregate scores: on MIMIC-III, LVCF exceeds LONGINUS with both backbones despite predicting no New or Recurrent diagnoses. Since LONGINUS still exceeds the rule-based Persistent F1 in all four settings, this gap likely reflects imprecise non-persistent predictions. Appendix F reports full results across four backbones and label-frequency strata.
4.2.2 Performance by Visit-History Depth
Table 5 stratifies MIMIC-IV performance by observed history depth. With Llama-3.3-70B, LONGINUS achieves the best LLM-based score on every metric in both strata. With Gemini-3.1-Flash-Lite, it leads on all transition-specific metrics in both strata, whereas EHR-RAG leads on Macro-F1 and Jaccard in Visit 1, and MASS-RAG leads on Micro-F1, Macro-F1, and Jaccard in Visit 2+, where LVCF also exceeds LONGINUS in Micro-F1 (.586 vs. .580). New F1 declines from Visit 1 to Visit 2+ for all LLM-based methods except NECHOv3 with Llama-3.3-70B, consistent with the smaller share of New targets (Table 2). The relative strength of methods thus depends on history depth, motivating depth-stratified evaluation.
| Backbone | Type | Method | Visit 1 | Visit 2+ | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Agg.Mic. | Dist. | Temp. | Agg.Mic. | Dist. | Temp. | ||||||||
| Mac. | Jac. | Pers. | New | Mac. | Jac. | Pers. | New | Rec. | |||||
| - | Rule | LVCFOHU | .582.582 | .470.470 | .440.440 | .732.732 | .000.000 | .586.582 | .402.455 | .437.426 | .734.734 | .000.000 | .000.444 |
| Gemini-3.1-Flash-Lite | Single-Prompting | NECHOv3 | .552 | .435 | .391 | .752 | .254 | .552 | .411 | .396 | .768 | .153 | .453 |
| Multi-agent | MedAgents | .552 | .426 | .397 | .736 | .279 | .532 | .388 | .372 | .734 | .195 | .416 | |
| MDAgents | .549 | .457 | .392 | .733 | .283 | .537 | .404 | .375 | .746 | .174 | .478 | ||
| KAMAC | .528 | .406 | .371 | .700 | .286 | .514 | .385 | .349 | .710 | .197 | .435 | ||
| Retrieval | Summary-RAG | .522 | .425 | .362 | .723 | .285 | .508 | .393 | .338 | .744 | .199 | .491 | |
| RGAR | .511 | .413 | .360 | .698 | .271 | .515 | .371 | .356 | .729 | .181 | .473 | ||
| MASS-RAG | .576 | .458 | .418 | .746 | .274 | .583 | .449 | .418 | .746 | .223 | .487 | ||
| EHR-RAG | .584 | .483 | .424 | .748 | .315 | .575 | .426 | .405 | .753 | .213 | .488 | ||
| Memory | Traj-CoA | .526 | .411 | .384 | .719 | .250 | .525 | .386 | .369 | .735 | .182 | .455 | |
| Ours | LONGINUS | .584 | .477 | .421 | .773† | .330 | .580 | .437 | .408 | .774 | .234 | .529 | |
| Llama-3.3-70B | Single-Prompting | NECHOv3 | .533 | .380 | .383 | .710 | .064 | .600 | .379 | .453 | .747 | .082 | .406 |
| Multi-agent | MedAgents | .466 | .303 | .329 | .630 | .175 | .476 | .306 | .332 | .631 | .118 | .378 | |
| MDAgents | .483 | .334 | .343 | .654 | .178 | .501 | .320 | .361 | .663 | .123 | .344 | ||
| KAMAC | .500 | .367 | .358 | .666 | .195 | .510 | .348 | .372 | .678 | .122 | .358 | ||
| Retrieval | Summary-RAG | .490 | .370 | .345 | .674 | .247 | .465 | .322 | .331 | .685 | .144 | .436 | |
| RGAR | .501 | .367 | .381 | .669 | .140 | .451 | .289 | .336 | .608 | .034 | .269 | ||
| MASS-RAG | .558 | .433 | .416 | .724 | .202 | .572 | .422 | .411 | .718 | .151 | .450 | ||
| EHR-RAG | .548 | .424 | .419 | .713 | .138 | .584 | .397 | .443 | .731 | .107 | .350 | ||
| Memory | Traj-CoA | .494 | .374 | .359 | .656 | .227 | .527 | .356 | .379 | .686 | .184 | .453 | |
| Ours | LONGINUS | .592† | .463† | .444† | .757† | .262 | .613 | .437 | .456 | .764 | .197 | .481 | |
Table 5: Performance on MIMIC-IV by observed history depth. Formatting and † follow Table 4.
| Component | Variant | Agg.Mic. | Dist. | Temp. | |||
|---|---|---|---|---|---|---|---|
| Mac. | Jac. | Pers. | New | Rec. | |||
| Gemini-3.1-Flash-Lite | |||||||
| Full | LONGINUS | .583 | .490 | .418 | .773 | .314 | .529 |
| Retrieval | w/ SQ | .585 | .495 | .421 | .774 | .313 | .520 |
| w/o Current | .582 | .488 | .419 | .772 | .313 | .524 | |
| w/o Past-only | .584 | .489 | .420 | .773 | .315 | .527 | |
| w/o Unseen | .586 | .493 | .425‡ | .773 | .306 | .523 | |
| Memory | w/ US | .590‡ | .488 | .428‡ | .774 | .313 | .531 |
| w/ 4F | .581 | .481 | .416 | .772 | .308 | .507 | |
| Adjudication | w/o , | .597‡ | .491 | .432‡ | .761† | .305 | .522 |
| Llama-3.3-70B | |||||||
| Full | LONGINUS | .597 | .488 | .447 | .759 | .253 | .481 |
| Retrieval | w/ SQ | .593 | .477 | .446 | .757 | .248 | .477 |
| w/o Current | .594 | .486 | .444 | .759 | .250 | .474 | |
| w/o Past-only | .598 | .492 | .447 | .760 | .258 | .470 | |
| w/o Unseen | .597 | .482 | .449 | .760 | .250 | .471 | |
| Memory | w/ US | .594 | .486 | .451 | .758 | .217† | .446 |
| w/ 4F | .591 | .477 | .439 | .759 | .247 | .477 | |
| Adjudication | w/o , | .585† | .460 | .439 | .751 | .189† | .436 |
Table 6: Ablations on MIMIC-IV. w/ SQ: single query (no BRD); w/o Current/Past-only/Unseen: one history-state query removed (top-12 budget fixed); w/ US: unstructured summary; w/ 4F: card without chronic, recurrent, and acute fields; w/o , : adjudication without evidence and memory card. Formatting follows Table 4; †/‡: full LONGINUS/the ablation is significantly better.
4.3 Analysis
4.3.1 Ablation Studies
In Table 6, single-query retrieval (SQ, without BRD) lowers New and Recurrent F1 with both backbones despite slightly higher aggregate metrics with Gemini-3.1-Flash-Lite, and removing any history-state query likewise lowers Recurrent F1, though not significantly. Memory structure is backbone-dependent: an unstructured summary (US) significantly improves Micro-F1 and Jaccard with Gemini-3.1-Flash-Lite but lowers five of six metrics with Llama-3.3-70B, significantly for New F1 (.217 vs. .253), whereas removing history fields (4F) lowers 11 of 12 metrics, though not significantly. Removing evidence and memory from adjudication (w/o , ) lowers all temporal F1 scores with both backbones, significantly for Persistent F1 with Gemini-3.1-Flash-Lite and New F1 with Llama-3.3-70B (.189 vs. .253), despite significantly raising Micro-F1 and Jaccard with Gemini-3.1-Flash-Lite. Evidence-grounded adjudication is thus the most consistent contributor, while the Recurrent F1 drop across all removals suggests partially redundant evidence paths, so robustness stems from the full configuration rather than any single component.
| Type | Variant | Agg. | Dist. | Temp. | |||
|---|---|---|---|---|---|---|---|
| Mic. | Mac. | Jac. | Pers. | New | Rec. | ||
| Gemini-3.1-Flash-Lite | |||||||
| Single view | Retrieval Memory | .578.556† | .489.457† | .411.389† | .753†.767 | .308.296† | .483†.529 |
| No adjud. | Union Intersection | .552†.587 | .472†.474 | .382†.426 | .755†.765 | .300†.303 | .490.523 |
| Adjud. | Source-aware | .582 | .491 | .416 | .770 | .315 | .515 |
| Union-wide | .587 | .483 | .427‡ | .771 | .304 | .536 | |
| Memory-anch. | .562† | .472† | .393† | .773 | .302† | .523 | |
| Retrieval-anch. | .569† | .486 | .400† | .755† | .309 | .491† | |
| LONGINUS | .583 | .490 | .418 | .773 | .314 | .529 | |
| Llama-3.3-70B | |||||||
| Single view | Retrieval Memory | .587†.502† | .482.389† | .446.353† | .748†.666† | .178†.260 | .438.456 |
| No adjud. | Union Intersection | .577†.499† | .490.368† | .419†.370† | .755.654† | .268.161† | .463.420 |
| Adjud. | Source-aware | .593 | .469 | .448 | .753 | .223† | .468 |
| Union-wide | .599 | .487 | .456‡ | .762 | .232† | .480 | |
| Memory-anch. | .579† | .485 | .421† | .759 | .268 | .480 | |
| Retrieval-anch. | .593 | .491 | .439† | .755 | .266‡ | .464 | |
| LONGINUS | .597 | .488 | .447 | .759 | .253 | .481 | |
Table 7: Comparison of retrieval–memory combination and adjudication strategies on MIMIC-IV. Single view: predictions of one view alone; Union/Intersection: set operations without adjudication; Source-aware: LONGINUS with candidate provenance revealed; Union-wide: adjudicates the entire union without fixing consensus; Memory-/Retrieval-anch.: fixes one view's predictions and adjudicates only the other's additions. Bold/underline follow Table 4; †/‡: LONGINUS/the variant is significantly better.
| Stage | Measure (%) | Gemini-3.1-Flash-Lite | Llama-3.3-70B |
|---|---|---|---|
| Candidate precision | Consensus | 54.9 | 66.7 |
| Disagreement (before) | 21.6 | 38.8 | |
| Disagreement (after) | 27.8 | 49.2 | |
| Within disagreement | TP retained | 64.1 | 82.2 |
| FP rejected | 54.3 | 46.3 | |
| Final FN share | Missed by both | 83.1 | 89.3 |
| Rejected by adjudication | 16.9 | 10.7 | |
| Final FP share | Retained consensus | 70.0 | 49.3 |
| Accepted disagreement | 30.0 | 50.7 |
Table 8: Stage-wise analysis of LONGINUS on MIMIC-IV using in-space labels. Disagreement (after): precision of accepted disagreements; TP retained/FP rejected: shares of correct/incorrect disagreement candidates that are accepted/rejected; final FN and FP shares are normalized by the respective final totals.
4.3.2 Comparative Studies
Table 7 compares combination strategies that share view predictions and, for adjudication variants, the adjudicator prompt and evidence. Neither view suffices alone: memory is significantly worse than LONGINUS on all aggregate and distributional metrics, and retrieval on Persistent F1. Set operations are backbone-sensitive: the intersection ties for the best Micro-F1 with Gemini-3.1-Flash-Lite but collapses with Llama-3.3-70B.
Among adjudication variants, revealing provenance lowers Recurrent F1 with both backbones and New F1 with Llama-3.3-70B (.223 vs. .253); Union-wide adjudication improves Jaccard but lowers New F1 with both, likely by discarding correct shared predictions; and anchoring is backbone-dependent, improving New F1 with Llama-3.3-70B but significantly lowering four metrics with Gemini-3.1-Flash-Lite. Although no variant leads every column, LONGINUS attains the best mean rank across the 12 backbone–metric columns (2.4 vs. 2.6 for Union-wide; ≥4.1 otherwise) and stays within .015 of each column's best, whereas every other variant trails by at least .035 somewhere, so it requires no prior choice of which view to trust.
4.3.3 Stage-wise Error Analysis
Table 8 traces predictions stage by stage on MIMIC-IV. Consensus candidates are far more precise than disagreements (54.9% vs. 21.6% with Gemini-3.1-Flash-Lite; 66.7% vs. 38.8% with Llama-3.3-70B), supporting agreement as a reliability heuristic. Adjudication raises disagreement precision to 27.8% and 49.2%, rejecting about half of false positives while retaining most true positives. Most final false negatives (83.1% and 89.3%) are missed by both views, limiting recall at candidate generation, whereas retained consensus contributes 70.0% and 49.3% of final false positives, bounding precision. Appendix G further quantifies the precision–recall trade-offs between the raw candidate union and final predictions, both overall and by temporal transition. We also provide case studies in Appendix H.
5 Conclusion
Aggregate scores can obscure the multifaceted nature of next-visit diagnosis prediction and favor diagnostic persistence: last-visit carry-forward outperforms most LLM-based results in Micro-F1 without predicting new or recurrent diagnoses. Evaluating across label frequency, temporal transitions, and history depth reveals complementary retrieval and memory strengths, which LONGINUS exploits by preserving cross-view consensus and adjudicating only disagreements, achieving the best transition-specific performance among LLM-based methods in nearly all settings.
Limitations
Dataset-side Limitations. Mapping diagnoses to 112 CCS child labels enables consistent cross-dataset evaluation but may collapse clinically meaningful distinctions. Labels also reflect both clinical evolution and encounter-specific coding practices, which our transition categories do not fully disentangle. Due to inference costs, we evaluate on 1,000 patients per dataset, stratified by age group, sex, race, and visit depth; both datasets originate from a single medical center, which may limit generalizability. Moreover, only 214 and 256 patients have two or more observed visits, limiting statistical power for Visit 2+ and Recurrent comparisons.
Model-side Limitations. LONGINUS preserves consensus without adjudication, so erroneous shared predictions propagate to the output. Most remaining false negatives are missed by both views, revealing a candidate-generation bottleneck that adjudication alone cannot resolve. On aggregate and set-overlap metrics, LONGINUS remains below LVCF on MIMIC-III across all four backbones and only comparable to the strongest patient-internal RAG baselines elsewhere; its gains concentrate on transition-specific performance, at up to four LLM calls per patient. MIMIC-derived text may have appeared in LLM pretraining data, which could affect scores and, potentially, method comparisons.
Evaluation Scope. Our framework is model-agnostic, requiring only predicted and reference label sets, but we apply it only to rule-based and training-free LLM-based methods; supervised sequential models and fine-tuned LLMs remain future work.
Ethics Statement
We use de-identified MIMIC-III and MIMIC-IV data under the PhysioNet Credentialed Health Data Use Agreement. Following PhysioNet's guidance on online services, no data were sent to consumer LLM interfaces: Gemini models (Gemini-2.5-Flash-Lite and Gemini-3.1-Flash-Lite) were accessed through Google Cloud Vertex AI without data retention, whereas open-weight models (Llama-3.3-70B and GPT-OSS-120B) and bge-small-en-v1.5 embeddings were run on local GPUs. All models were used under their respective licenses and terms of use. Appendix examples are paraphrased. LONGINUS is a research prototype not validated for clinical use.
References
Roy Adams, Katharine E Henry, Anirudh Sridharan, Hossein Soleimani, Andong Zhan, Nishi Rawat, Lauren Johnson, David N Hager, Sara E Cosgrove, Andrew Markowski, et al. 2022. Prospective, multi-site study of patient outcomes after implementation of the trews machine learning-based early warning system for sepsis. Nature medicine, 28(7):1455–1460.
Sandhini Agarwal, Lama Ahmad, Jason Ai, Sam Altman, Andy Applebaum, Edwin Arbus, Rahul K Arora, Yu Bai, Bowen Baker, Haiming Bao, et al. 2025. gpt-oss-120b & gpt-oss-20b model card. arXiv preprint arXiv:2508.10925.
Tariq Ahmad, Nihar R Desai, Yu Yamamoto, Aditya Biswas, Lama Ghazi, Melissa Martin, Michael Simonov, Ravi Dhar, Allen Hsiao, Nitu Kashyap, et al. 2022. Alerting clinicians to 1-year mortality risk in patients hospitalized with heart failure: the reveal-hf randomized clinical trial. JAMA cardiology, 7(9):905–912.
Fabian Baldenweg, Manuel Burger, Gunnar Rätsch, and Rita Kuznetsova. 2024. Multi-modal contrastive learning for online clinical time-series applications. arXiv preprint arXiv:2403.18316.
Ivo M Baltruschat, Hannes Nickisch, Michael Grass, Tobias Knopp, and Axel Saalbach. 2019. Comparison of deep learning approaches for multi-label chest x-ray classification. Scientific reports, 9(1):6381.
Ofir Ben Shoham and Nadav Rappoport. 2024. Cpllm: Clinical prediction with large language models. PLOS Digital Health, 3(12):e0000680.
Lang Cao, Qingyu Chen, and Yue Guo. 2026. Ehr-rag: Bridging long-horizon structured electronic health records and large language models via enhanced retrieval-augmented generation. arXiv preprint arXiv:2601.21340.
Chen Chen, Mohsen Nayebi Kerdabadi, Dongjie Wang, Mei Liu, and Zijun Yao. 2026. Import what you need: Learning when and how to augment ehr graphs with external knowledge. arXiv preprint arXiv:2609.01839.
Jiayuan Chen, Changchang Yin, Yuanlong Wang, and Ping Zhang. 2024. Predictive modeling with temporal graphical representation on electronic health records. In IJCAI: proceedings of the conference, volume 2024, page 5763.
Edward Choi, Mohammad Taha Bahadori, Andy Schuetz, Walter F Stewart, and Jimeng Sun. 2016a. Doctor ai: Predicting clinical events via recurrent neural networks. In Machine learning for healthcare conference, pages 301–318. PMLR.
Edward Choi, Mohammad Taha Bahadori, Le Song, Walter F Stewart, and Jimeng Sun. 2017. Gram: graph-based attention model for healthcare representation learning. In Proceedings of the 23rd ACM
SIGKDD international conference on knowledge discovery and data mining, pages 787–795.
Edward Choi, Mohammad Taha Bahadori, Jimeng Sun, Joshua Kulas, Andy Schuetz, and Walter Stewart. 2016b. Retain: An interpretable predictive model for healthcare using reverse time attention mechanism. Advances in neural information processing systems, 29.
Hyeong Kyu Choi, Jerry Zhu, and Sharon Li. 2026. When identity skews debate: Anonymization for bias-reduced multi-agent reasoning. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 14284–14311.
Gheorghe Comanici, Eric Bieber, Mike Schaekermann, Ice Pasupat, Noveen Sachdeva, Inderjit Dhillon, Marcel Blistein, Ori Ram, Dan Zhang, Evan Rosen, et al. 2025. Gemini 2.5: Pushing the frontier with advanced reasoning, multimodality, long context, and next generation agentic capabilities. arXiv preprint arXiv:2507.06261.
Jun-En Ding, Phan Nguyen Minh Thao, Wen-Chih Peng, Jian-Zhe Wang, Chun-Cheng Chug, Min-Chen Hsieh, Yun-Chien Tseng, Ling Chen, Dongsheng Luo, Chenwei Wu, et al. 2024. Large language multimodal models for new-onset type 2 diabetes prediction using five-year cohort electronic health records. Scientific reports, 14(1):20774.
Yilun Du, Shuang Li, Antonio Torralba, Joshua B Tenenbaum, and Igor Mordatch. 2023. Improving factuality and reasoning in language models through multiagent debate. arXiv preprint arXiv:2305.14325.
Gabriel J Escobar, Vincent X Liu, Alejandro Schuler, Brian Lawson, John D Greene, and Patricia Kipnis. 2020. Automated identification of adults at risk for in-hospital clinical deterioration. New England Journal of Medicine, 383(20):1951–1960.
Andrew Estornell and Yang Liu. 2024. Multi-llm debate: Framework, principals, and interventions. Advances in Neural Information Processing Systems, 37:28938–28964.
Wenqi Fan, Yujuan Ding, Liangbo Ning, Shijie Wang, Hengyun Li, Dawei Yin, Tat-Seng Chua, and Qing Li. 2024. A survey on rag meeting llms: Towards retrieval-augmented large language models. In Proceedings of the 30th ACM SIGKDD conference on knowledge discovery and data mining, pages 6491–6501.
Benjamin A Goldstein, Marcelo Cerullo, Vijay Krishnamoorthy, Jeanna Blitz, Leila Mureebe, Wendy Webster, Felicia Dunston, Andrew Stirling, Jennifer Gagnon, and Charles D Scales Jr. 2020. Development and performance of a clinical decision support tool to inform resource utilization for elective operations. JAMA network open, 3(11):e2023547.
Google DeepMind. 2026. Gemini 3.1 flash-lite model card. Technical report, Google DeepMind.
Aaron Grattafori, Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Alex Vaughan, et al. 2024. The llama 3 herd of models. arXiv preprint arXiv:2407.21783.
Tuankasfee Hama, Mohanad M Alsaleh, Freya Allery, Jung Won Choi, Christopher Tomlinson, Honghan Wu, Alvina Lai, Nikolas Pontikos, and Johan H Thygesen. 2025. Enhancing patient outcome prediction through deep learning with sequential diagnosis codes from structured electronic health record data: systematic review. Journal of Medical Internet Research, 27:e57358.
Chao-Wei Huang, Shang-Chi Tsai, and Yun-Nung Chen. 2022. Plm-icd: Automatic icd coding with pretrained language models. In Proceedings of the 4th clinical natural language processing workshop, pages 10–20.
Yongfeng Huang, Ruiying Chen, and James Cheng. 2026. Sema-rag: A self-evolving multi-agent retrieval-augmented generation framework for medical reasoning. In Findings of the Association for Computational Linguistics: ACL 2026, pages 18423–18442.
Daniel P Jeong, Saurabh Garg, Zachary Chase Lipton, and Michael Oberst. 2024. Medical adaptation of large language and vision-language models: Are we making progress? In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 12143–12170.
Pengcheng Jiang, Cao Danica Xiao, Adam Cross, and Jimeng Sun. 2024. Graphcare: Enhancing healthcare predictions with personalized knowledge graphs. In International Conference on Learning Representations, volume 2024, pages 16839–16866.
Pengcheng Jiang, Cao Danica Xiao, Minhao Jiang, Parminder Bhatia, Taha Kass-Hout, Jimeng Sun, and Jiawei Han. 2025. Reasoning-enhanced healthcare predictions with knowledge graph community retrieval. In International Conference on Learning Representations, volume 2025, pages 81785–81830.
Di Jin, Eileen Pan, Nassim Oufattole, Wei-Hung Weng, Hanyi Fang, and Peter Szolovits. 2021. What disease does this patient have? a large-scale open domain question answering dataset from medical exams. Applied Sciences, 11(14):6421.
Alistair EW Johnson, Lucas Bulgarelli, Lu Shen, Alvin Gayles, Ayad Shammout, Steven Horng, Tom J Pollard, Sicheng Hao, Benjamin Moody, Brian Gow, et al. 2023. Mimic-iv, a freely accessible electronic health record dataset. Scientific data, 10(1):1.
Alistair EW Johnson, Tom J Pollard, Lu Shen, Liwei H Lehman, Mengling Feng, Mohammad Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G Mark. 2016. Mimic-iii, a freely accessible critical care database. Scientific data, 3(1):160035.
Jiyoun Kim, Muhan Yeo, Eunhye Jang, Jeewon Yang, Hangyul Yoon, Su Ji Lee, Hee Jo Han, Hee-Jae Jung, Doyun Kwon, Jaehun Lee, et al. 2026. Ehrnotechatqa: A benchmark for evidence-grounded multi-turn clinical question answering over longitudinal discharge summaries. arXiv preprint arXiv:2606.15735.
To Eun Kim and Fernando Diaz. 2025. Towards fair RAG: On the impact of fair ranking in retrieval-augmented generation. In Proceedings of the 2025 International ACM SIGIR Conference on Innovative Concepts and Theories in Information Retrieval (IC-TIR), pages 33–43, New York, NY, USA. Association for Computing Machinery.
Yubin Kim, Chanwoo Park, Hyewon Jeong, Yik S Chan, Xuhai Xu, Daniel McDuff, Hyeonhoon Lee, Marzyeh Ghassemi, Cynthia Breazeal, and Hae W Park. 2024. Mdagents: An adaptive collaboration of llms for medical decision-making. Advances in Neural Information Processing Systems, 37:79410–79452.
Heejoon Koo. 2024. Next visit diagnosis prediction via medical code-centric multimodal contrastive ehr modelling with hierarchical regularisation. In Findings of the Association for Computational Linguistics: EACL 2024, pages 41–55.
Heejoon Koo. 2025a. Overcoming uncertain incompleteness for robust multimodal sequential diagnosis prediction via curriculum data erasing guided knowledge distillation. In ICASSP 2025-2025 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 1–5. IEEE.
Heejoon Koo. 2025b. Towards robust and fair next visit diagnosis prediction under noisy clinical notes with large language models. arXiv preprint arXiv:2511.18393.
Maya Kruse, Shiyue Hu, Nicholas Derby, Yifu Wu, Samantha Stonbraker, Bingsheng Yao, Dakuo Wang, Elizabeth M Goldberg, and Yanjun Gao. 2025. Large language models with temporal reasoning for longitudinal clinical summarization and prediction. In EMNLP (Findings), pages 20715–20735.
Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, et al. 2020. Retrieval-augmented generation for knowledge-intensive nlp tasks. Advances in neural information processing systems, 33:9459–9474.
Rui Li, Fenglong Ma, and Jing Gao. 2022. Integrating multimodal electronic health records for diagnosis prediction. In AMIA Annual Symposium Proceedings, volume 2021, page 726.
Rumeng Li, Xun Wang, Dan Berlowitz, Jesse Mez, Honghuang Lin, and Hong Yu. 2025. Care-ad: a multi-agent large language model framework for alzheimer's disease prediction using longitudinal clinical notes. npj Digital Medicine, 8(1):541.
Yikuan Li, Shishir Rao, José Roberto Ayala Solares, Abdelaali Hassaine, Rema Ramakrishnan, Dexter Canoy, Yajie Zhu, Kazem Rahimi, and Gholamreza Salimi-Khorshidi. 2020. Behrt: transformer for electronic health records. Scientific reports, 10(1):7155.
Sichu Liang, Linhai Zhang, Hongyu Zhu, Wenwen Wang, Yulan He, and Deyu Zhou. 2025. Rgar: Recurrence generation-augmented retrieval for factual-aware medical question answering. In EMNLP (Findings), pages 4006–4033.
Nelson F Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. 2024a. Lost in the middle: How language models use long contexts. Transactions of the association for computational linguistics, 12:157–173.
Sizhe Liu, Yizhou Lu, Siyu Chen, Xiyang Hu, Jieyu Zhao, Yingzhou Lu, and Yue Zhao. 2024b. Drugagent: Automating ai-aided drug discovery programming through llm multi-agent collaboration. arXiv preprint arXiv:2411.15692.
Cheng-Yaw Low, Heejoon Koo, Jaewoo Park, and Meeyoung Cha. 2026. Dual-margin embedding for fine-grained long-tailed plant taxonomy. In European Conference on Computer Vision, pages 535–552. Springer.
Fenglong Ma, Radha Chitta, Jing Zhou, Quanzeng You, Tong Sun, and Jing Gao. 2017. Dipole: Diagnosis prediction in healthcare via attention-based bidirectional recurrent neural networks. In Proceedings of the 23rd ACM SIGKDD international conference on knowledge discovery and data mining, pages 1903–1911.
Mingyu Derek Ma, Xiaoxuan Wang, Yijia Xiao, Anthony Cuturrufo, Vijay S Nori, Eran Halperin, and Wei Wang. 2025. Memorize and rank: Elevating large language models for clinical diagnosis prediction. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, pages 24786–24794.
Pritam Mukherjee, Marie Humbert-Droz, Jonathan H Chen, and Olivier Gevaert. 2023. Scope: predicting future diagnoses in office visits using electronic health records. Scientific Reports, 13(1):11005.
James Mullenbach, Sarah Wiegreffe, Jon Duke, Jimeng Sun, and Jacob Eisenstein. 2018. Explainable prediction of medical codes from clinical text. In Proceedings of the 2018 conference of the north American chapter of the association for computational linguistics: human language technologies, volume 1 (long papers), pages 1101–1111.
Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G Patil, Ion Stoica, and Joseph E Gonzalez. 2023. Memgpt: Towards llms as operating systems. arXiv preprint arXiv:2310.08560.
Xueping Peng, Guodong Long, Tao Shen, Sen Wang, and Jing Jiang. 2021. Sequential diagnosis prediction with transformer and ontological representation. In
2021 IEEE International Conference on Data Mining (ICDM), pages 489–498. IEEE.
Hallie C Prescott, Kenneth M Langa, and Theodore J Iwashyna. 2015. Readmission diagnoses after hospitalization for severe sepsis and other acute medical conditions. Jama, 313(10):1055–1057.
Hongjin Qian, Zheng Liu, Peitian Zhang, Kelong Mao, Defu Lian, Zhicheng Dou, and Tiejun Huang. 2025. Memorag: Boosting long context processing with global memory-enhanced retrieval augmentation. In Proceedings of the ACM on Web Conference 2025, pages 2366–2377.
Yao Qu, Hui En Loo, and Jue Wang. 2025. Generative artificial intelligence in higher education: Emotional tensions and ethical declaration. British Journal of Educational Technology.
Zhan Qu and Michael Färber. 2026. Risk horizons: Structured hypothesis spaces for longitudinal clinical prediction. arXiv preprint arXiv:2602.12828.
Haresh Rengaraj Rajamohan, Xiang Gao, Weicheng Zhu, Shih-Lun Huang, Long Chen, Gabe Schulman, Huizhen Jin, Shengduo Li, Yixuan Wang, Huidi Yang, et al. 2026. Scaling recurrence-aware foundation models for clinical records via next-visit prediction. arXiv preprint arXiv:2603.24562.
Pranav Rajpurkar, Jeremy Irvin, Kaylie Zhu, Brandon Yang, Hershel Mehta, Tony Duan, Daisy Ding, Aarti Bagul, Curtis Langlotz, Katie Shpanskaya, et al. 2017. Chexnet: Radiologist-level pneumonia detection on chest x-rays with deep learning. arXiv preprint arXiv:1711.05225.
Chandan K Reddy and Parshin Shojaee. 2025. Towards scientific discovery with generative ai: Progress, opportunities, and challenges. In Proceedings of the AAAI conference on artificial intelligence, volume 39, pages 28601–28609.
Wade L Schulz, H Patrick Young, Andreas Coppi, Bobak J Mortazavi, Zhenqiu Lin, Raymond A Jean, and Harlan M Krumholz. 2021. Temporal relationship of computed and structured diagnoses in electronic health record data. BMC Medical Informatics and Decision Making, 21(1):61.
Andries Smit, Paul Duckworth, Nathan Grinsztajn, Thomas D Barrett, and Arnu Pretorius. 2023. Should we be going mad? a look at multi-agent debate strategies for llms. arXiv preprint arXiv:2311.17371.
Jiwoong Sohn, Yein Park, Chanwoong Yoon, Sihyeon Park, Hyeon Hwang, Mujeen Sung, Hyunjae Kim, and Jaewoo Kang. 2025. Rationale-guided retrieval augmented generation for medical question answering. In Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 12739–12753.
Chenxi Sun, Hongna Dui, and Hongyan Li. 2021. Interpretable time-aware and co-occurrence-aware network for medical prediction. BMC medical informatics and decision making, 21(1):305.
Yanchao Tan, Hang Lv, Yunfei Zhan, Guofang Ma, Bo Xiong, and Carl Yang. 2025. Boxlm: Unifying structures and semantics of medical concepts for diagnosis prediction in healthcare. In Forty-second International Conference on Machine Learning.
Xiangru Tang, Anni Zou, Zhuosheng Zhang, Ziming Li, Yilun Zhao, Xingyao Zhang, Arman Cohan, and Mark Gerstein. 2024. Medagents: Large language models as collaborators for zero-shot medical reasoning. In Findings of the Association for Computational Linguistics: ACL 2024, pages 599–621.
Gemini Team, Rohan Anil, Sebastian Borgeaud, Jean-Baptiste Alayrac, Jiahui Yu, Radu Soricut, Johan Schalkwyk, Andrew M Dai, Anja Hauth, Katie Millican, et al. 2023. Gemini: a family of highly capable multimodal models. arXiv preprint arXiv:2312.11805.
Yuxuan Tian and Hang Qiu. 2026. Pmvgd: Progressive multi-view graph distillation for health event prediction. Information Sciences, page 124266.
Airat Valiev. 2026. Hse nlp team at mediqa-synur 2026: Consensus adjudication ensemble (ace): Balancing precision and recall for schema-bystander clinical extraction. In The 8th Workshop on Clinical Natural Language Processing (Clinical NLP)@ LREC 2026, pages 200–211.
Chutong Wang, Mingda Li, Xuebing Yang, Mengxuan Sun, and Wensheng Zhang. 2026. Integrating electronic health records and large language models for coarse-to-fine hybrid disease prediction. Health Data Science, 6:0466.
Haiyan Wang and Ye Yuan. 2025. Structure-aware hypergraph transformer for diagnosis prediction in electronic health records. In 2025 IEEE International Conference on Systems, Man, and Cybernetics (SMC), pages 1703–1708. IEEE.
Nicole G Weiskopf, George Hripcsak, Sushmita Swaminathan, and Chunhua Weng. 2013. Defining and measuring completeness of electronic health records for secondary use. Journal of biomedical informatics, 46(5):830–836.
Jialun Wu, Xin Mei, Rui Mao, Kai He, and Erik Cambria. 2025a. Takecare: A temporal-hierarchical framework with knowledge fusion for personalized clinical predictive modeling. Information Fusion, page 103620.
Xiao Wu, Ting-Zhu Huang, Liang-Jian Deng, Yanyuan Qiao, Imran Razzak, and Yutong Xie. 2025b. A knowledge-driven adaptive collaboration of llms for enhancing medical decision-making. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pages 33483–33500.
Shitao Xiao, Zheng Liu, Peitian Zhang, Niklas Muennighoff, Defu Lian, and Jian-Yun Nie. 2024. C-pack: Packed resources for general chinese embeddings. In Proceedings of the 47th international ACM SIGIR conference on research and development in information retrieval, pages 641–649.
Xingchen Xiao, He-Yan Huang, Runheng Liu, and Jincheng Xie. 2026. Mass-rag: Multi-agent synthesis retrieval-augmented generation. In Findings of the Association for Computational Linguistics: ACL 2026, pages 9865–9883.
Guangzhi Xiong, Qiao Jin, Zhiyong Lu, and Aidong Zhang. 2024. Benchmarking retrieval-augmented generation for medicine. In Findings of the Association for Computational Linguistics: ACL 2024, pages 6233–6251.
Ran Xu, Wenqi Shi, Yue Yu, Yuchen Zhuang, Bowen Jin, May Dongmei Wang, Joyce Ho, and Carl Yang. 2024. Ram-ehr: Retrieval augmentation meets clinical predictions on electronic health records. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 754–765.
Wei Yang, Shixuan Li, Heng Ping, Peiyu Zhang, Paul Bogdan, and Jesse Thomason. 2026. Auditing multi-agent llm reasoning trees outperforms majority vote and llm-as-judge. arXiv preprint arXiv:2602.09341.
Yumeng Yang, Hongfei Lin, Zhihao Yang, Yijia Zhang, Di Zhao, and Ling Luo. 2025. Lcdl: Classification of icd codes based on disease label co-occurrence dependency and longformer with medical knowledge. Artificial Intelligence in Medicine, 160:103041.
Sihang Zeng, Yujuan Fu, Sitong Zhou, Zixuan Yu, Lucas Jing Liu, Jun Wen, Matthew Thompson, Ruth Etzioni, and Meliha Yetisgen. 2025. Traj-coa: Patient trajectory modeling via chain-of-agents for lung cancer risk prediction. In The Second Workshop on GenAI for Health: Potential, Trust, and Policy Compliance.
Hengyu Zhang, Xuyun Zhang, Pengxiang Zhan, Linhao Luo, Hang Lv, Yanchao Tan, Shirui Pan, and Carl Yang. 2026. Evicare: Enhancing diagnosis prediction with deep model-guided evidence for in-context reasoning. In Proceedings of the 32nd ACM SIGKDD Conference on Knowledge Discovery and Data Mining V. 1, pages 1916–1927.
Jing Zhang, Yazhe Niu, Xueyan Li, Peiyan Zhou, and Di Sun. 2025. besel: A human-aligned llm teaching assistant for enhancing social-emotional learning. In International Conference on Artificial Intelligence in Education, pages 93–101. Springer.
Wanjun Zhong, Lianghong Guo, Qiqi Gao, He Ye, and Yanlin Wang. 2024. Memorybank: Enhancing large language models with long-term memory. In Proceedings of the AAAI conference on artificial intelligence, volume 38, pages 19724–19731.
Lexin Zhou, Wout Schellaert, Fernando Martínez-Plumed, Yael Moros-Daval, César Ferri, and José Hernández-Orallo. 2024. Larger and more instructable language models become less reliable. Nature, 634(8032):61–68.
Jingming Zhuo, Songyang Zhang, Xinyu Fang, Haodong Duan, Dahua Lin, and Kai Chen. 2024. Prosa: Assessing and understanding the prompt sensitivity of llms. In Findings of the Association for Computational Linguistics: EMNLP 2024, pages 1950–1976.
Appendix
A Extended Related Work
A.1 Next-Visit Longitudinal Diagnosis Prediction and Its Evaluation
Longitudinal EHR models forecast future clinical events from prior patient history, including deterioration, mortality, sepsis, and future diagnoses (Escobar et al., 2020; Goldstein et al., 2020; Ahmad et al., 2022; Adams et al., 2022; Hama et al., 2025; Kim et al., 2026). Early next-visit diagnosis prediction relied on recurrent and attention-based sequence models (Choi et al., 2016a,b; Ma et al., 2017), while later work incorporated medical hierarchies, transformers, and multimodal EHR representations (Choi et al., 2017; Li et al., 2020; Peng et al., 2021; Li et al., 2022; Koo, 2024, 2025a; Wu et al., 2025a), as well as temporal graphs, hypergraphs, multi-view distillation, and structure-aware concept embeddings (Chen et al., 2024; Wang and Yuan, 2025; Tan et al., 2025; Tian and Qiu, 2026).
LLMs have shown growing utility in scientific discovery and beyond (Liu et al., 2024b; Qu et al., 2025; Zhang et al., 2025; Reddy and Shojaee, 2025; Low et al., 2026). In clinical prediction, recent work explores LLM-based diagnosis ranking and LLM reranking over retrieved candidate outcomes (Ben Shoham and Rappoport, 2024; Kruse et al., 2025; Ma et al., 2025; Qu and Färber, 2026; Chen et al., 2026).
Across this literature, evaluation relies predominantly on aggregate metrics such as F1, precision/recall, ranking measures, or Jaccard (Hama et al., 2025; Wu et al., 2025a; Wang et al., 2026), and analyses beyond them typically examine one dimension at a time. Distributionally, prior work has examined multi-label co-occurrence (Sun et al., 2021; Yang et al., 2025; Wu et al., 2025a) and low-frequency diagnoses (Choi et al., 2017). Temporally, studies have targeted newly appearing diagnoses (Mukherjee et al., 2023; Ding et al., 2024; Zhang et al., 2026), including previously uncoded comorbidities (Rajamohan et al., 2026), but rarely distinguish Persistent diagnoses, which remain active from the current visit, from Recurrent diagnoses, which reappear after an interval of absence. History depth has likewise been analyzed separately (Wu et al., 2025a). To our knowledge, these dimensions have not been evaluated jointly despite their clinical importance (Prescott et al., 2015; Schulz et al., 2021).
A.2 Retrieval- and Memory-Based Approaches for Clinical Reasoning
Retrieval-augmented generation (RAG) grounds LLMs in evidence selected at inference time (Lewis et al., 2020; Fan et al., 2024; Kim and Diaz, 2025). Medical RAG spans external knowledge retrieval and adaptive evidence selection (Xiong et al., 2024; Sohn et al., 2025). RGAR further combines factual extraction with iterative conceptual retrieval for medical question answering (Liang et al., 2025). Beyond medical QA, RAM-EHR, GraphCare, and KARE augment EHR-based clinical prediction with retrieved or graph-structured medical knowledge (Xu et al., 2024; Jiang et al., 2024, 2025), while EHR-RAG retrieves from long-horizon patient records through factual and counterfactual paths (Cao et al., 2026).
Memory-based methods address LLM long-context limitations (Liu et al., 2024a). MemGPT and MemoryBank maintain long-term memory (Packer et al., 2023; Zhong et al., 2024), while Qian et al. (2025) uses memory-guided retrieval. Traj-CoA models patient trajectories through memory (Zeng et al., 2025). LONGINUS instead combines retrieval and memory as separate views with source-neutral disagreement adjudication.
A.3 Multi-Agent Clinical Reasoning and Disagreement Adjudication
Multi-agent debate seeks to improve LLM reasoning through iterative discussion (Du et al., 2023). In medicine, MedAgents, MDAgents, and KAMAC coordinate specialist roles (Tang et al., 2024; Kim et al., 2024; Wu et al., 2025b), while Traj-CoA and CARE-AD support longitudinal reasoning through shared memory or domain specialization (Zeng et al., 2025; Li et al., 2025). Agentic RAG further distributes evidence processing across specialized agents, as in MASS-RAG and SEMA-RAG (Xiao et al., 2026; Huang et al., 2026).
However, multi-agent debate does not consistently outperform simpler prompting or ensembling strategies (Smit et al., 2023), and agreement can reinforce shared errors (Estornell and Liu, 2024; Yang et al., 2026). Recent work therefore explores evidence-based auditing and verification (Yang et al., 2026; Valiev, 2026) and source anonymization to mitigate identity bias (Choi et al., 2026). LONGINUS instead preserves consensus across heterogeneous evidence views and adjudicates only disagreements without revealing provenance.
B Detailed Data Preprocessing
B.1 Raw Data Sources
We derive the study cohorts from MIMIC-III and MIMIC-IV using only patient demographics, admission information, diagnosis codes, and discharge summaries. The corresponding source tables differ across MIMIC versions, but the same clinical information is extracted from both datasets.
B.2 Patient Eligibility and Cohort Filtering
Following prior preprocessing for next-visit diagnosis prediction (Koo, 2024), we retain adults (≥ 18 years) with urgent, emergency, or elective-related admissions and at least two valid diagnosis admissions. Patients are excluded for invalid admission timing, missing admission, discharge-note, or diagnosis information, or the presence of pregnancy/delivery or congenital/perinatal diagnoses. The same criteria are applied to both datasets; in MIMIC-III, de-identified ages ≥ 300 are recoded to 90 to represent the masked > 89 age group.
B.3 Discharge Summaries
When multiple selected discharge summaries correspond to the same admission, we order them chronologically and concatenate them into a single admission-level document. Text preprocessing is limited to regex-based cleaning; we otherwise retain the original note content, including de-identified placeholders, to avoid potential loss of clinically relevant information.
B.4 Trajectory and Label-Space Construction
Admissions are ordered chronologically, and consecutive visits separated by more than 180 days are treated as discontinuous following prior work (Weiskopf et al., 2013). We retain the earliest contiguous segment, use its final admission as the next-visit target, and take up to five admissions immediately preceding the target as the observed history; earlier admissions in the segment are discarded. Table 9 reports the resulting cohort statistics and the coverage of the retained visit history.
To establish a common diagnosis space across MIMIC-III and MIMIC-IV, we use ICD-9-CM codes directly for MIMIC-III and cross-walk MIMIC-IV ICD-10-CM codes to ICD-9-CM using the General Equivalence Mapping (GEM). Diagnoses are then mapped to the Clinical Classifications Software (CCS) taxonomy, with unmapped
| Statistic | MIMIC-III | MIMIC-IV |
|---|---|---|
| Patients | 1,000 | 1,000 |
| Observed visit rows | 1,308 | 1,453 |
| Mean target labels / patient | 7.745 | 6.888 |
Table 9: Final cohort statistics under a five-observed-visit cap.
and NoDx entries removed as non-informative prediction targets. From the original 285 HCUP CCS single-level categories, we retain 112 CCS single-level labels under 14 parent categories after excluding screening, residual/unclassified, selected mental-health, injury (but not poisoning), and other out-of-scope categories. The final taxonomy was determined in consensus with physician collaborators to balance clinical relevance, diagnostic specificity, and suitability for predictive modeling (mean 8.0 children per parent; median 5.5, range 2–30). The complete label space and its empirical next-visit distribution are shown in Table 10.
B.5 Sampling and Cohort Statistics
After all eligibility, trajectory, and label-space filters, we sample 1,000 patients from each dataset using subject-level stratification by age group, sex, race, and visit depth with random seed 42. A separate patient-disjoint development cohort of 500 patients was sampled from MIMIC-III with the same procedure and used only for design selection. Final cohort and target-label statistics are summarized in Table 9.
| Parent Category | Child Diagnosis Label | MIMIC-III | MIMIC-IV | ||
|---|---|---|---|---|---|
| Count | Dist. (%) | Count | Dist. (%) | ||
| Diseases of the blood and blood-forming organs | |||||
| Acute post-hemorrhagic anemia | 94 | 1.21 | 63 | 0.91 | |
| Anemia | 301 | 3.89 | 292 | 4.24 | |
| Coagulation and hemorrhagic disorders | 137 | 1.77 | 126 | 1.83 | |
| White blood cell disorders | 49 | 0.63 | 87 | 1.26 | |
| Diseases of the circulatory system | |||||
| Acute cerebrovascular disease | 46 | 0.59 | 15 | 0.22 | |
| Acute myocardial infarction | 71 | 0.92 | 58 | 0.84 | |
| Aneurysm | 35 | 0.45 | 23 | 0.33 | |
| Arterial embolism | 9 | 0.12 | 4 | 0.06 | |
| Cardiac arrest | 12 | 0.15 | 1 | 0.01 | |
| Cardiac dysrhythmia | 389 | 5.02 | 304 | 4.41 | |
| Carditis | 100 | 1.29 | 52 | 0.75 | |
| Conduction disorders | 87 | 1.12 | 93 | 1.35 | |
| Congestive heart failure; non-hypertensive | 375 | 4.84 | 253 | 3.67 | |
| Coronary atherosclerosis | 341 | 4.40 | 318 | 4.62 | |
| Heart valve disease | 147 | 1.90 | 148 | 2.15 | |
| Hypertension | 389 | 5.02 | 391 | 5.68 | |
| Hypertension complications | 188 | 2.43 | 216 | 3.14 | |
| Late effects of cerebrovascular disease | 41 | 0.53 | 27 | 0.39 | |
| Peripheral atherosclerosis | 81 | 1.05 | 92 | 1.34 | |
| Phlebitis | 107 | 1.38 | 107 | 1.55 | |
| Pre-cerebral occlusion | 15 | 0.19 | 20 | 0.29 | |
| Pulmonary heart disease | 84 | 1.08 | 83 | 1.20 | |
| Transient ischemic attack | 6 | 0.08 | 4 | 0.06 | |
| Diseases of the digestive system | |||||
| Abdominal hernia | 21 | 0.27 | 25 | 0.36 | |
| Appendicitis | 1 | 0.01 | 2 | 0.03 | |
| Biliary disease | 52 | 0.67 | 34 | 0.49 | |
| Diverticulosis | 35 | 0.45 | 26 | 0.38 | |
| Gastric and duodenal ulcer | 19 | 0.25 | 17 | 0.25 | |
| Gastroenteritis | 6 | 0.08 | 11 | 0.16 | |
| Gastrointestinal hemorrhage | 93 | 1.20 | 45 | 0.65 | |
| Intestinal infection | 64 | 0.83 | 38 | 0.55 | |
| Intestinal obstruction | 34 | 0.44 | 28 | 0.41 | |
| Pancreas disease | 25 | 0.32 | 23 | 0.33 | |
| Peritonitis | 31 | 0.40 | 24 | 0.35 | |
| Ulcerative colitis | 21 | 0.27 | 15 | 0.22 | |
| Diseases of the genitourinary system | |||||
| Acute renal failure | 257 | 3.32 | 225 | 3.27 | |
| Chronic kidney disease | 195 | 2.52 | 231 | 3.35 | |
| Nephritis | 21 | 0.27 | 31 | 0.45 | |
| Urinary stone | 12 | 0.15 | 13 | 0.19 | |
| Urinary tract infection | 193 | 2.49 | 107 | 1.55 | |
| Diseases of the musculoskeletal system and connective tissue | |||||
| Infectious arthritis | 25 | 0.32 | 38 | 0.55 | |
| Pathological fracture | 11 | 0.14 | 9 | 0.13 | |
| Rheumatoid arthritis | 23 | 0.30 | 19 | 0.28 | |
| Systemic lupus erythematosus | 8 | 0.10 | 10 | 0.15 | |
| Diseases of the nervous system and sense organs | |||||
| Coma and brain damage | 20 | 0.26 | 11 | 0.16 | |
| Encephalitis | 2 | 0.03 | 4 | 0.06 | |
| Epilepsy and convulsive disorders | 92 | 1.19 | 51 | 0.74 | |
| Meningitis | 3 | 0.04 | 2 | 0.03 | |
| Multiple sclerosis | 9 | 0.12 | 5 | 0.07 | |
| Paralysis | 22 | 0.28 | 14 | 0.20 | |
| Parkinson's disease | 11 | 0.14 | 9 | 0.13 | |
| Diseases of the respiratory system | |||||
Continued on next page
Table 10 continued
| Parent Category | Child Diagnosis Label | MIMIC-III | MIMIC-IV | ||
|---|---|---|---|---|---|
| Count | Dist. (%) | Count | Dist. (%) | ||
| Adult respiratory failure | 254 | 3.28 | 93 | 1.35 | |
| Aspiration pneumonia | 88 | 1.14 | 15 | 0.22 | |
| Asthma | 80 | 1.03 | 76 | 1.10 | |
| Chronic obstructive pulmonary disease | 195 | 2.52 | 141 | 2.05 | |
| Lung diseases due to external agents | 2 | 0.03 | 6 | 0.09 | |
| Pleurisy | 138 | 1.78 | 73 | 1.06 | |
| Pneumonia | 160 | 2.07 | 73 | 1.06 | |
| Diseases of the skin and subcutaneous tissue | |||||
| Skin infection | 43 | 0.56 | 39 | 0.57 | |
| Skin ulcer | 110 | 1.42 | 84 | 1.22 | |
| Endocrine; nutritional; and metabolic diseases and immunity disorders | |||||
| Diabetes mellitus with complications | 112 | 1.45 | 141 | 2.05 | |
| Diabetes mellitus without complications | 231 | 2.98 | 185 | 2.69 | |
| Fluid and electrolyte disorders | 352 | 4.54 | 279 | 4.05 | |
| Gout and other crystal arthropathies | 52 | 0.67 | 65 | 0.94 | |
| Hyperlipidemia | 275 | 3.55 | 380 | 5.52 | |
| Immunity disorders | 3 | 0.04 | 8 | 0.12 | |
| Nutritional deficiencies | 61 | 0.79 | 74 | 1.07 | |
| Thyroid disorders | 131 | 1.69 | 142 | 2.06 | |
| Infectious and parasitic diseases | |||||
| HIV infection | 21 | 0.27 | 13 | 0.19 | |
| Hepatitis | 79 | 1.02 | 63 | 0.91 | |
| Mycoses | 55 | 0.71 | 41 | 0.60 | |
| Septicemia | 215 | 2.78 | 85 | 1.23 | |
| Tuberculosis | 6 | 0.08 | 3 | 0.04 | |
| Viral infection | 14 | 0.18 | 23 | 0.33 | |
| Injury and poisoning | |||||
| Poisoning by non-medications | 1 | 0.01 | 0 | 0.00 | |
| Poisoning by other medications | 9 | 0.12 | 15 | 0.22 | |
| Poisoning by psychiatric medications | 3 | 0.04 | 0 | 0.00 | |
| Mental illness | |||||
| Alcohol-related disorders | 59 | 0.76 | 92 | 1.34 | |
| Delirium/dementia/amnesia/cognitive disorders | 72 | 0.93 | 58 | 0.84 | |
| Substance-related disorders | 42 | 0.54 | 40 | 0.58 | |
| Neoplasms | |||||
| Bladder cancer | 11 | 0.14 | 12 | 0.17 | |
| Bone and connective tissue cancer | 2 | 0.03 | 10 | 0.15 | |
| Brain/nervous system cancer | 13 | 0.17 | 2 | 0.03 | |
| Breast cancer | 27 | 0.35 | 35 | 0.51 | |
| Bronchus/lung cancer | 44 | 0.57 | 22 | 0.32 | |
| Cervical cancer | 3 | 0.04 | 5 | 0.07 | |
| Colon cancer | 25 | 0.32 | 19 | 0.28 | |
| Esophageal cancer | 13 | 0.17 | 5 | 0.07 | |
| Female genital cancer | 1 | 0.01 | 1 | 0.01 | |
| Gastrointestinal and peritoneal cancer | 7 | 0.09 | 8 | 0.12 | |
| Head and neck cancer | 6 | 0.08 | 8 | 0.12 | |
| Hodgkin's disease | 0 | 0.00 | 5 | 0.07 | |
| Kidney and renal cancer | 14 | 0.18 | 53 | 0.77 | |
| Leukemias | 15 | 0.19 | 55 | 0.80 | |
| Liver or inflammatory bowel disease cancer | 12 | 0.15 | 17 | 0.25 | |
| Male genital cancer | 1 | 0.01 | 1 | 0.01 | |
| Multiple myeloma | 4 | 0.05 | 31 | 0.45 | |
| Non-Hodgkin lymphoma | 18 | 0.23 | 122 | 1.77 | |
| Non-epithelial cancer | 9 | 0.12 | 34 | 0.49 | |
| Ovary cancer | 5 | 0.06 | 6 | 0.09 | |
| Pancreatic cancer | 3 | 0.04 | 1 | 0.01 | |
Continued on next page
Table 10 continued
| Parent Category | Child Diagnosis Label | MIMIC-III | MIMIC-IV | ||
|---|---|---|---|---|---|
| Count | Dist. (%) | Count | Dist. (%) | ||
| Prostate cancer | 35 | 0.45 | 28 | 0.41 | |
| Rectal or anal cancer | 7 | 0.09 | 11 | 0.16 | |
| Secondary malignancy | 75 | 0.97 | 122 | 1.77 | |
| Skin melanoma | 10 | 0.13 | 42 | 0.61 | |
| Stomach cancer | 3 | 0.04 | 4 | 0.06 | |
| Testicular cancer | 0 | 0.00 | 2 | 0.03 | |
| Thyroid cancer | 6 | 0.08 | 4 | 0.06 | |
| Urinary organ cancer | 1 | 0.01 | 4 | 0.06 | |
| Uterine cancer | 5 | 0.06 | 8 | 0.12 | |
| Symptoms; signs; and ill-defined conditions and factors influencing health status | |||||
| Gangrene | 18 | 0.23 | 24 | 0.35 | |
| Shock | 79 | 1.02 | 36 | 0.52 | |
Table 10: Complete diagnosis label space and distribution of next-visit ground-truth diagnoses in MIMIC-III and MIMIC-IV. Count denotes the number of next-visit targets containing each diagnosis, and Dist. denotes its proportion among all positive next-visit diagnosis assignments in the corresponding dataset.
C Evaluation Metrics
For patient , let and denote the reference and predicted next-visit diagnosis sets, with out-of-space predictions removed and .
Micro-F1. Counts are pooled over patients:
where , , and .
Macro-F1. For each , , , and count patients with , , and , respectively:
where terms with a zero denominator are set to 0.
Jaccard.
where a patient with contributes 0.
Transition-specific F1. Using the history-state partition of Eqs. (5)–(7) for each patient, let , , and . For , applies Eq. (13) after replacing and with and , so false positives are also attributed to a transition. New is defined operationally by the observed coding history and thus covers both newly emerging and previously uncoded diagnoses.
History depth. All metrics are recomputed within Visit 1 () and Visit 2+ (). In Visit 1, , so and Recurrent F1 is reported as -.
D Baselines
We evaluate all methods on the same observed patient histories . Rule-based heuristics use only documented diagnosis codes, whereas LLM-based methods additionally use demographics and clinical notes. We make only minimal task-specific modifications to adapt the LLM-based baselines to our task.
D.1 Rule-Based Heuristics
We consider two deterministic baselines using only observed diagnosis codes:
-
Last-Visit Carry-Forward (LVCF) predicts diagnoses from the most recent visit: .
-
Observed-History Union (OHU) predicts all previously recorded diagnoses: .
D.2 Single Prompting
- NECHOv3 (Koo, 2025b) employs a hierarchical prompting strategy that reasons through the CCS hierarchy, moving from CCS multi-level parent systems to CCS single-level child labels, while explicitly considering longitudinal diagnosis status.
D.3 Multi-Agent Systems
Specialist roles are organized around CCS multi-level parent diagnostic systems, while final predictions remain constrained to the CCS single-level child labels.
-
MedAgents (Tang et al., 2024) recruits medical specialists that independently propose diagnoses, followed by synthesis, consensus/revision, and a final reviewer.
-
MDAgents (Kim et al., 2024) adapts the collaboration strategy according to estimated task complexity. Basic cases use direct reasoning, whereas more complex cases employ specialist discussion and moderator synthesis.
-
KAMAC (Wu et al., 2025b) dynamically recruits relevant medical specialists, aggregates their analyses, and iteratively refines them through coordinator synthesis, critique, and final review.
D.4 Retrieval
All RAG baselines retrieve the top 12 chunks with bge-small-en-v1.5 (Xiao et al., 2024). EHR-
Available at https://huggingface.co/BAAI/bge-small-en-v1.5.
RAG and MASS-RAG retrieve from the patient's own observed EHR trajectory, whereas Summary-RAG and RGAR retrieve from the frozen Textbooks corpus of MedRAG (Xiong et al., 2024), comprising 18 medical textbooks from MedQA (Jin et al., 2021).
-
Summary-RAG summarizes the full patient record, uses the summary as a query to retrieve from the Textbooks corpus, and predicts next-visit diagnoses from the summary and retrieved passages, following the medical QA setting of Xiong et al. (2024).
-
RGAR (Liang et al., 2025) iteratively combines factual extraction from the patient record, conceptual retrieval from the Textbooks corpus, and query regeneration before producing the final prediction.
-
MASS-RAG (Xiao et al., 2026) employs a multi-agent system whose summarization, extraction, and reasoning agents we adapt to next-visit prediction. From the same retrieved patient evidence, they construct, in parallel, (1) a temporal summary, (2) explicit supporting and counter-evidence, and (3) diagnostic candidates, which a final synthesizer integrates into the prediction.
-
EHR-RAG (Cao et al., 2026) uses visit-aware patient chunks and two retrieval paths: a factual path and a counterfactual path, each retrieving top-6 evidence chunks. It additionally applies temporal reranking to favor recent evidence.
D.5 Memory
- Traj-CoA (Zeng et al., 2025) processes longitudinal EHRs in a visit-by-visit manner using worker agents, progressively updating a compact trajectory summary and shared long-term memory. A final manager agent synthesizes the accumulated summary and memory for prediction.
D.6 LLM Calls
Table 11 summarizes end-to-end LLM calls per patient, accounting for observed visits, specialist agents, and iterative rounds.
D.7 Inference Token Usage
Table 12 reports mean input/output token usage per patient for LONGINUS and selected baselines, computed from recorded API usage over all 1,000 patients; for retrieval–memory methods, all prediction, memory, and adjudication calls are included, and embedding and indexing costs are excluded. In total (input + output) tokens, LONGINUS uses
| Type | Method | LLM calls per patient |
|---|---|---|
| Single-Prompting | NECHOv3 | 1 |
| Multi-agent | MedAgents | 3 + E + Σr=1R Br |
| MDAgents | 3 + E + Σr=1R Br | |
| KAMAC | 4 + E + Σr=1R Br | |
| Retrieval | Summary-RAG | 2 |
| RGAR | 1 + Cextract + Cquery | |
| MASS-RAG | 4 | |
| EHR-RAG | 1 | |
| Memory | Traj-CoA | N + 1 |
| Ablation | Retrieval-view only | 1 |
| Memory-view only | 2 | |
| Ours | LONGINUS | 3 + I[|D| > 0] |
Table 11: End-to-end LLM calls per patient. N: number of observed visits; E: number of initial specialist calls; R: number of executed rounds; B<sub>r</sub>: number of calls in round r; C<sub>extract</sub>, C<sub>query</sub>: RGAR extraction and query-generation calls; D: diagnoses on which the two views disagree; I[·]: indicator function. Parallel calls are counted separately; embedding calls are excluded.
54–76% fewer tokens than the multi-agent baselines (KAMAC, MedAgents, and MDAgents) and is comparable to MASS-RAG (22% fewer to 13% more), while generating fewer output tokens than MASS-RAG in every setting. It uses 13–41% more tokens than Traj-CoA and 1.7–3.5% fewer than Union-wide, since consensus labels are not re-adjudicated.
| Method | Gemini-2.5-Flash-Lite | Gemini-3.1-Flash-Lite | GPT-OSS-120B | Llama-3.3-70B | ||||
|---|---|---|---|---|---|---|---|---|
| In | Out | In | Out | In | Out | In | Out | |
| MIMIC-III | ||||||||
| KAMAC | 49.87 | 3.35 | 50.35 | 1.52 | 61.32 | 9.22 | 62.83 | 1.46 |
| MedAgents | 40.47 | 3.95 | 45.37 | 1.48 | 46.72 | 5.74 | 44.96 | 1.75 |
| MDAgents | 65.97 | 4.09 | 71.38 | 1.18 | 67.44 | 5.10 | 73.68 | 0.55 |
| Traj-CoA | 14.33 | 2.02 | 13.38 | 0.90 | 12.39 | 3.53 | 12.76 | 0.83 |
| MASS-RAG | 18.60 | 5.40 | 14.79 | 1.50 | 14.42 | 7.31 | 14.20 | 1.56 |
| Union-wide | 18.50 | 1.19 | 18.19 | 0.77 | 17.85 | 5.42 | 17.18 | 0.64 |
| LONGINUS | 18.20 | 1.01 | 17.81 | 0.61 | 17.50 | 4.97 | 16.95 | 0.55 |
| MIMIC-IV | ||||||||
| KAMAC | 45.69 | 3.04 | 46.07 | 1.45 | 54.25 | 8.06 | 58.10 | 1.36 |
| MedAgents | 36.02 | 3.55 | 40.25 | 1.36 | 42.04 | 5.42 | 41.11 | 1.60 |
| MDAgents | 59.45 | 3.78 | 53.66 | 0.93 | 60.54 | 4.78 | 65.56 | 0.51 |
| Traj-CoA | 14.04 | 2.11 | 12.98 | 0.92 | 12.97 | 3.81 | 12.59 | 0.86 |
| MASS-RAG | 18.09 | 5.26 | 14.32 | 1.46 | 14.76 | 7.11 | 14.23 | 1.49 |
| Union-wide | 17.68 | 1.07 | 17.52 | 0.72 | 17.46 | 5.03 | 16.85 | 0.60 |
| LONGINUS | 17.40 | 0.91 | 17.15 | 0.58 | 17.08 | 4.62 | 16.63 | 0.53 |
Table 12: Mean recorded input/output LLM tokens per patient (thousands). Embedding and indexing costs are excluded.
E LONGINUS Prompt Templates
The transition-aware criteria in the adjudication prompt are conditioned on each candidate's history state (Current, Past-only, or Unseen; Section 3.1), which is observable at prediction time; no next-visit information is provided to any component.
History-State-Specific Retrieval Query Templates
Current. Recent patient-specific evidence of ongoing activity, continued treatment or monitoring, unresolved disease, improvement, resolution, completed treatment, or discontinuation for these currently coded diagnoses: {{CURRENT_LABELS}}
Past-only. Patient-specific evidence from prior episodes and recent evidence of recurrence, reactivation, exacerbation, related treatment, or continued absence for these previously coded diagnoses: {{PAST_ONLY_LABELS}}
Unseen. Recent patient-specific evidence of newly emerging or previously uncoded disease, including new or worsening symptoms, abnormal tests, active workup, new treatment, organ complications, latent comorbidities, or natural downstream conditions.
Patient-Internal Retrieval-View Prediction Prompt
System. You are an experienced critical care physician working in an Intensive Care Unit (ICU) predicting diagnoses likely to be actively coded at a patient's next hospital visit. Favor clinically supported recall and return only valid JSON.
Task. Predict the child diagnosis labels most likely to be actively documented and coded at the patient's next hospital visit.
Instructions.
You are given patient-note evidence retrieved through complementary temporal searches. Interpret all evidence chronologically.
• Include clinically plausible persistent conditions, unresolved complications, recurrent acute events, and newly relevant diagnoses when supported by the patient-specific record.
• Do not require one explicit diagnostic sentence when several consistent findings, treatments, tests, or longitudinal changes support the label.
• Actively consider comorbidity: a disease may be newly coded because it was previously latent or uncoded, emerges as a downstream condition, or is a distinct complication of an established disease.
• General medical plausibility alone is insufficient; patient-specific compatible evidence is required.
• Use only exact labels from the fixed label space.
• Exclude clearly negated, ruled-out, resolved, completed, or contradicted conditions.
• Return multiple labels when supported; do not impose a fixed prediction count.
• Do not output evidence, rationale, confidence, or commentary.
Inputs.
{{TRANSITION_EVIDENCE_JSON}} {{LABEL_SPACE_JSON}}
Output.
{ "predictions": [ {"label": "exact child label"} ] }
Longitudinal Memory Construction Prompt
System. You are an experienced critical care physician working in an Intensive Care Unit (ICU) who extracts patient-specific longitudinal clinical memory from observed hospital visits. Return only valid JSON.
Task. Given a longitudinal clinical record and a fixed diagnosis label space, construct a patient-specific memory card that preserves clinically supported signals most relevant to next-visit diagnosis prediction.
Instructions.
• Treat earlier visits as longitudinal history.
• Capture clinically plausible chronic, recurrent, acute, unresolved, treated, and monitored information when it has patient-specific support.
• Include tentative signals only when they are patient-specific and clinically relevant; avoid weakly supported, generic, or speculative associations.
• Do not discard remote chronic history solely because it is not repeated in the most recent visit.
• Do not predict the next visit.
• Do not add generic textbook associations or information unsupported by the record.
• Keep each item concise.
• Every schema field must be an array of concise strings, not objects.
Inputs.
Longitudinal clinical record: {{CLINICAL_NOTE}} Fixed diagnosis label space: {{LABEL_SPACE_JSON}}
Output.
{ "chronic_conditions": [], "recurrent_events": [], "acute_events": [], "abnormal_trends": [], "prior_treatments_or_procedures": [], "unresolved_problems": [], "risk_factors": [] }
Longitudinal Memory-View Prediction Prompt
System. You are an experienced critical care physician working in an Intensive Care Unit (ICU) predicting which diagnoses are most likely to be actively coded at the patient's next hospital visit. Return only valid JSON.
Task. Predict all clinically supported next-visit diagnoses from the fixed diagnosis label space using the structured patient memory.
Instructions
Do not impose a fixed prediction count.
- Every predicted diagnosis must be copied exactly from the fixed label space, which is treated as a closed vocabulary.
Do not output raw note phrases, abbreviations, ICD names, synonyms, subtypes, or more specific disease names unless copied exactly from the label space.
-
If a clinical concept is present but the exact label is absent, choose the closest exact label only when clearly supported; otherwise omit it.
-
Prioritize diagnoses likely to appear at the next visit rather than merely historical diagnoses.
-
Include multiple diagnoses when clinically plausible because of persistent comorbidities, unresolved complications, recurrent acute events, or discharge-related risks.
-
Use longitudinal patterns, unresolved problems, recurrent conditions, and recent acute events.
• Avoid weakly supported or speculative diagnoses.
Do not output hidden chain-of-thought.
Inputs
Patient memory:
{{PATIENT_MEMORY_JSON}}
Fixed diagnosis label space:
{{LABEL_SPACE_JSON}}
Output
{
"next_visit_diagnoses": [ ]
}
Source-Neutral Disagreement Adjudication Prompt
System. You are an experienced critical care physician adjudicating uncertain next-visit diagnosis-code candidates. Judge each candidate independently from patient evidence and return only valid JSON.
Task. Decide whether every disagreement candidate should be included or excluded from the final next-visit diagnosis set. Candidate origin is intentionally hidden. Apply the same standard to every candidate; list membership is not evidence. This is a coding-transition prediction, not a broad differential diagnosis.
Transition-Aware Criteria
-
Current: Include when the observed course supports persistence, active treatment, monitoring, unresolved activity, or likely repeat coding. Exclude when there is credible resolution, improvement with discontinuation, or non-continuation evidence.
-
Past-only: Do not exclude solely because the condition is absent from the latest visit. Include when prior repeated coding, an episodic or recurrence-prone course, persistent susceptibility, related treatment, or clinically connected activity makes repeat coding plausible. Exclude when the condition is remote and isolated or there is credible resolution, treatment completion, or sustained contradictory evidence.
-
Unseen: Include for a patient-specific emerging condition, latent or previously uncoded comorbidity, downstream complication, or distinct new event. Generic medical plausibility alone is insufficient.
Additional Rules
-
Consensus labels are fixed and are not candidates.
-
Absence from either evidence source is not by itself evidence for exclusion.
Do not invent or rename labels.
-
Return exactly one decision for every disagreement candidate.
-
Use only include or exclude.
Do not provide rationale, evidence, confidence, or commentary.
Inputs
Observed trajectory metadata:
{{TRANSITION_METADATA_JSON}}
Fixed consensus labels:
{{CONSENSUS_LABELS_JSON}}
Patient-local retrieved evidence:
{{RETRIEVED_EVIDENCE_JSON}}
Longitudinal memory card:
{{PATIENT_MEMORY_JSON}}
Source-neutral disagreement candidates:
{{DISAGREEMENT_CANDIDATES_JSON}}
Output
{
"candidate_decisions": [
{
"label": "exact candidate label",
"decision": "include | exclude"
}
}]
F Full Results
Tables 13–16 report full results. LONGINUS achieves the best transition-specific F1 among LLM-based methods in 22 of 24 full-cohort settings and in 37 of 40 depth-stratified columns, and the best Macro-F1 in 14 of 16 label-frequency columns. History-based rules nonetheless lead on MIMIC-III tail labels, suggesting that many rare next-visit diagnoses are carried over from prior visits.
| Backbone | Type | Method | MIMIC-III | MIMIC-IV | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Agg. Mic. | Dist. | Temp. | Agg. Mic. | Dist. | Temp. | |||||||||
| Mac. | Jac. | Pers. | New | Rec. | Mac. | Jac. | Pers. | New | Rec. | |||||
| - | Rule | LVCF | .558 | .510 | .397 | .719 | .000 | .000 | .582 | .479 | .439 | .732 | .000 | .000 |
| OHU | .553 | .510 | .391 | .719 | .000 | .383 | .582 | .492 | .436 | .732 | .000 | .444 | ||
| Gemini-2.5 -Flash-Lite | Single-Prompting | NECHOv3 | .473 | .404 | .319 | .693 | .172 | .391 | .500 | .440 | .353 | .726 | .193 | .484 |
| Multi-agent | MedAgents | .436 | .338 | .285 | .606 | .176 | .314 | .484 | .383 | .336 | .649 | .227 | .400 | |
| MDAgents | .470 | .368 | .314 | .657 | .206 | .315 | .509 | .415 | .352 | .696 | .246 | .418 | ||
| KAMAC | .485 | .379 | .327 | .662 | .189 | .314 | .527 | .417 | .372 | .694 | .255 | .433 | ||
| Retrieval | Summary-RAG | .468 | .387 | .311 | .674 | .218 | .384 | .496 | .384 | .345 | .717 | .258 | .466 | |
| RGAR | .475 | .390 | .311 | .674 | .203 | .351 | .513 | .424 | .347 | .701 | .261 | .444 | ||
| MASS-RAG | .528 | .490 | .363 | .718 | .209 | .393 | .564 | .496 | .398 | .739 | .277 | .464 | ||
| EHR-RAG | .529 | .446 | .372 | .707 | .165 | .322 | .566 | .454 | .416 | .732 | .234 | .437 | ||
| Memory | Traj-CoA | .485 | .399 | .329 | .699 | .210 | .402 | .525 | .436 | .368 | .741 | .264 | .495 | |
| Ours | LONGINUS | .529 | .467 | .367 | .718 | .226 | .404 | .580 | .501 | .424 | .756† | .294† | .514 | |
| Gemini-3.1 -Flash-Lite | Single-Prompting | NECHOv3 | .514 | .450 | .353 | .715 | .194 | .393 | .552 | .459 | .392 | .756 | .236 | .453 |
| Multi-agent | MedAgents | .506 | .407 | .347 | .695 | .217 | .383 | .547 | .444 | .390 | .736 | .264 | .416 | |
| MDAgents | .505 | .443 | .341 | .700 | .210 | .368 | .546 | .474 | .387 | .736 | .263 | .478 | ||
| KAMAC | .485 | .379 | .324 | .670 | .200 | .372 | .525 | .422 | .365 | .703 | .270 | .435 | ||
| Retrieval | Summary-RAG | .487 | .405 | .330 | .693 | .222 | .409 | .518 | .437 | .356 | .728 | .267 | .491 | |
| RGAR | .472 | .391 | .318 | .674 | .196 | .374 | .512 | .426 | .359 | .705 | .254 | .473 | ||
| MASS-RAG | .526 | .454 | .368 | .713 | .193 | .383 | .578 | .482 | .418 | .746 | .265 | .487 | ||
| EHR-RAG | .530 | .460 | .367 | .716 | .224 | .383 | .582 | .484 | .420 | .749 | .298 | .488 | ||
| Memory | Traj-CoA | .484 | .402 | .332 | .691 | .184 | .372 | .525 | .428 | .380 | .722 | .237 | .455 | |
| Ours | LONGINUS | .535 | .462 | .370 | .728† | .255† | .439 | .583 | .490 | .418 | .773† | .314 | .529 | |
| GPT-OSS -120B | Single-Prompting | NECHOv3 | .530 | .451 | .365 | .703 | .219 | .397 | .563 | .433 | .396 | .720 | .279 | .472 |
| Multi-agent | MedAgents | .503 | .418 | .333 | .687 | .234 | .379 | .539 | .439 | .361 | .715 | .274 | .456 | |
| MDAgents | .514 | .428 | .351 | .705 | .232 | .373 | .550 | .461 | .382 | .735 | .280 | .463 | ||
| KAMAC | .497 | .383 | .334 | .674 | .207 | .399 | .539 | .429 | .373 | .713 | .272 | .433 | ||
| Retrieval | Summary-RAG | .487 | .387 | .332 | .665 | .216 | .421 | .554 | .460 | .390 | .745 | .309 | .520 | |
| RGAR | .529 | .433 | .366 | .699 | .192 | .377 | .550 | .443 | .391 | .731 | .310 | .492 | ||
| MASS-RAG | .518 | .447 | .354 | .694 | .223 | .393 | .571 | .489 | .411 | .740 | .289 | .450 | ||
| EHR-RAG | .530 | .435 | .369 | .698 | .159 | .367 | .582 | .482 | .431 | .734 | .252 | .450 | ||
| Memory | Traj-CoA | .512 | .431 | .355 | .699 | .218 | .366 | .565 | .458 | .411 | .746 | .285 | .483 | |
| Ours | LONGINUS | .541† | .476 | .377 | .720† | .257† | .409 | .587 | .499 | .421 | .756 | .321 | .522 | |
| Llama-3.3 -70B | Single-Prompting | NECHOv3 | .510 | .405 | .354 | .686 | .021 | .297 | .548 | .405 | .401 | .719 | .067 | .406 |
| Multi-agent | MedAgents | .428 | .302 | .284 | .606 | .109 | .241 | .468 | .325 | .330 | .630 | .167 | .378 | |
| MDAgents | .449 | .328 | .303 | .632 | .105 | .248 | .487 | .352 | .348 | .656 | .170 | .344 | ||
| KAMAC | .465 | .357 | .315 | .643 | .112 | .250 | .502 | .389 | .362 | .668 | .184 | .358 | ||
| Retrieval | Summary-RAG | .390 | .293 | .261 | .557 | .127 | .268 | .484 | .378 | .342 | .676 | .226 | .436 | |
| RGAR | .463 | .358 | .321 | .642 | .056 | .196 | .491 | .372 | .370 | .657 | .127 | .269 | ||
| MASS-RAG | .518 | .434 | .360 | .694 | .102 | .360 | .562 | .455 | .415 | .723 | .195 | .450 | ||
| EHR-RAG | .508 | .437 | .357 | .683 | .082 | .160 | .556 | .446 | .425 | .717 | .134 | .350 | ||
| Memory | Traj-CoA | .457 | .362 | .313 | .632 | .139 | .345 | .502 | .396 | .364 | .663 | .220 | .453 | |
| Ours | LONGINUS | .547† | .470† | .388† | .725† | .174† | .366 | .597† | .488† | .447† | .759† | .253† | .481 | |
Table 13: Full-cohort performance on MIMIC-III and MIMIC-IV for all four backbones. Formatting and † follow Table 4.
| Backbone | Type | Method | Visit 1 | Visit 2+ | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Agg. Mic. | Dist. | Temp. | Agg. Mic. | Dist. | Temp. | ||||||||
| Mac. | Jac. | Pers. | New | Mac. | Jac. | Pers. | New | Rec. | |||||
| - | Rule | LVCF | .548 | .489 | .389 | .712 | .000 | .591 | .467 | .426 | .741 | .000 | .000 |
| OHU | .548 | .489 | .389 | .712 | .000 | .566 | .467 | .397 | .741 | .000 | .383 | ||
| Gemini-2.5 -Flash-Lite | Single-Prompting | NECHOv3 | .461 | .391 | .309 | .684 | .179 | .508 | .384 | .355 | .717 | .140 | .391 |
| Multi-agent | MedAgents | .446 | .345 | .294 | .623 | .185 | .404 | .269 | .251 | .549 | .133 | .314 | |
| MDAgents | .475 | .378 | .319 | .664 | .218 | .454 | .288 | .297 | .635 | .144 | .315 | ||
| KAMAC | .489 | .388 | .330 | .668 | .194 | .475 | .284 | .316 | .645 | .161 | .314 | ||
| Retrieval | Summary-RAG | .475 | .395 | .319 | .685 | .231 | .444 | .321 | .282 | .638 | .157 | .384 | |
| RGAR | .478 | .393 | .315 | .675 | .214 | .462 | .344 | .297 | .669 | .153 | .351 | ||
| MASS-RAG | .522 | .466 | .357 | .710 | .219 | .549 | .455 | .384 | .745 | .147 | .393 | ||
| EHR-RAG | .523 | .440 | .366 | .702 | .175 | .548 | .405 | .394 | .725 | .116 | .322 | ||
| Memory | Traj-CoA | .483 | .392 | .329 | .699 | .218 | .492 | .381 | .332 | .701 | .177 | .402 | |
| Ours | LONGINUS | .523 | .447 | .362 | .710 | .236 | .546 | .445 | .384 | .741 | .175 | .404 | |
| Gemini-3.1 -Flash-Lite | Single-Prompting | NECHOv3 | .506 | .433 | .347 | .711 | .203 | .539 | .426 | .376 | .729 | .146 | .393 |
| Multi-agent | MedAgents | .504 | .396 | .345 | .694 | .229 | .509 | .350 | .351 | .696 | .161 | .383 | |
| MDAgents | .505 | .441 | .342 | .699 | .223 | .505 | .382 | .338 | .701 | .145 | .368 | ||
| KAMAC | .487 | .380 | .327 | .673 | .214 | .479 | .327 | .316 | .662 | .135 | .372 | ||
| Retrieval | Summary-RAG | .480 | .397 | .325 | .688 | .229 | .509 | .387 | .348 | .707 | .189 | .409 | |
| RGAR | .467 | .387 | .314 | .673 | .204 | .488 | .356 | .331 | .676 | .152 | .374 | ||
| MASS-RAG | .521 | .436 | .365 | .710 | .206 | .541 | .421 | .379 | .722 | .126 | .383 | ||
| EHR-RAG | .524 | .442 | .363 | .709 | .237 | .548 | .435 | .381 | .737 | .155 | .383 | ||
| Memory | Traj-CoA | .483 | .402 | .332 | .691 | .196 | .487 | .360 | .330 | .689 | .126 | .372 | |
| Ours | LONGINUS | .529 | .438 | .365 | .723† | .266† | .553 | .448 | .387 | .741 | .199 | .439 | |
| GPT-OSS -120B | Single-Prompting | NECHOv3 | .521 | .439 | .359 | .698 | .225 | .556 | .424 | .387 | .718 | .187 | .397 |
| Multi-agent | MedAgents | .512 | .426 | .344 | .696 | .250 | .474 | .348 | .295 | .657 | .162 | .379 | |
| MDAgents | .520 | .436 | .357 | .707 | .247 | .496 | .363 | .327 | .698 | .165 | .373 | ||
| KAMAC | .497 | .382 | .335 | .676 | .218 | .497 | .330 | .329 | .669 | .155 | .399 | ||
| Retrieval | Summary-RAG | .482 | .377 | .329 | .664 | .222 | .505 | .361 | .344 | .669 | .189 | .421 | |
| RGAR | .527 | .429 | .364 | .699 | .203 | .535 | .370 | .372 | .700 | .128 | .377 | ||
| MASS-RAG | .519 | .442 | .358 | .696 | .234 | .518 | .405 | .342 | .688 | .160 | .393 | ||
| EHR-RAG | .522 | .426 | .363 | .694 | .167 | .555 | .390 | .391 | .710 | .111 | .367 | ||
| Memory | Traj-CoA | .520 | .417 | .365 | .710 | .231 | .485 | .377 | .318 | .664 | .152 | .366 | |
| Ours | LONGINUS | .537 | .460 | .375 | .714 | .268 | .553 | .433 | .386 | .738† | .199 | .409 | |
| Llama-3.3 -70B | Single-Prompting | NECHOv3 | .494 | .379 | .340 | .675 | .022 | .560 | .400 | .402 | .721 | .012 | .297 |
| Multi-agent | MedAgents | .430 | .300 | .287 | .614 | .118 | .420 | .241 | .273 | .583 | .058 | .241 | |
| MDAgents | .447 | .324 | .302 | .635 | .114 | .456 | .281 | .304 | .622 | .052 | .248 | ||
| KAMAC | .464 | .357 | .316 | .646 | .122 | .467 | .292 | .311 | .635 | .054 | .250 | ||
| Retrieval | Summary-RAG | .389 | .281 | .262 | .561 | .134 | .391 | .264 | .257 | .543 | .083 | .268 | |
| RGAR | .473 | .365 | .331 | .655 | .065 | .428 | .268 | .283 | .592 | .004 | .196 | ||
| MASS-RAG | .510 | .425 | .355 | .689 | .113 | .541 | .388 | .378 | .710 | .036 | .360 | ||
| EHR-RAG | .501 | .417 | .353 | .680 | .088 | .530 | .394 | .371 | .694 | .050 | .160 | ||
| Memory | Traj-CoA | .450 | .347 | .310 | .633 | .146 | .477 | .327 | .327 | .631 | .100 | .345 | |
| Ours | LONGINUS | .538† | .450† | .382† | .718† | .186† | .576 | .416 | .410 | .746 | .107 | .366 | |
Table 14: Performance on MIMIC-III by observed history depth. Visit 1 and Visit 2+ contain 786 and 214 patients, respectively; Recurrent is undefined for Visit 1. Formatting and † follow Table 4.
| Backbone | Type | Method | Visit 1 | Visit 2+ | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Agg. Mic. | Dist. | Temp. | Agg. Mic. | Dist. | Temp. | ||||||||
| Mac. | Jac. | Pers. | New | Mac. | Jac. | Pers. | New | Rec. | |||||
| - | Rule | LVCF | .582 | .470 | .440 | .732 | .000 | .586 | .402 | .437 | .734 | .000 | .000 |
| OHU | .582 | .470 | .440 | .732 | .000 | .582 | .455 | .426 | .734 | .000 | .444 | ||
| Gemini-2.5 -Flash-Lite | Single-Prompting | NECHOv3 | .493 | .409 | .344 | .722 | .203 | .521 | .415 | .377 | .741 | .148 | .484 |
| Multi-agent | MedAgents | .489 | .374 | .340 | .656 | .241 | .465 | .321 | .323 | .627 | .156 | .400 | |
| MDAgents | .513 | .408 | .354 | .697 | .263 | .493 | .360 | .347 | .690 | .162 | .418 | ||
| KAMAC | .527 | .398 | .373 | .693 | .264 | .526 | .383 | .368 | .696 | .212 | .433 | ||
| Retrieval | Summary-RAG | .501 | .373 | .357 | .718 | .275 | .480 | .359 | .311 | .714 | .184 | .466 | |
| RGAR | .517 | .423 | .357 | .701 | .274 | .499 | .367 | .318 | .702 | .203 | .444 | ||
| MASS-RAG | .566 | .481 | .402 | .739 | .289 | .558 | .451 | .387 | .740 | .217 | .464 | ||
| EHR-RAG | .564 | .438 | .416 | .731 | .247 | .574 | .421 | .414 | .737 | .157 | .437 | ||
| Memory | Traj-CoA | .531 | .431 | .375 | .741 | .283 | .507 | .374 | .346 | .743 | .186 | .495 | |
| Ours | LONGINUS | .578 | .477 | .424 | .756 | .304 | .589 | .461 | .424 | .757 | .245 | .514 | |
| Gemini-3.1 -Flash-Lite | Single-Prompting | NECHOv3 | .552 | .435 | .391 | .752 | .254 | .552 | .411 | .396 | .768 | .153 | .453 |
| Multi-agent | MedAgents | .552 | .426 | .397 | .736 | .279 | .532 | .388 | .372 | .734 | .195 | .416 | |
| MDAgents | .549 | .457 | .392 | .733 | .283 | .537 | .404 | .375 | .746 | .174 | .478 | ||
| KAMAC | .528 | .406 | .371 | .700 | .286 | .514 | .385 | .349 | .710 | .197 | .435 | ||
| Retrieval | Summary-RAG | .522 | .425 | .362 | .723 | .285 | .508 | .393 | .338 | .744 | .199 | .491 | |
| RGAR | .511 | .413 | .360 | .698 | .271 | .515 | .371 | .356 | .729 | .181 | .473 | ||
| MASS-RAG | .576 | .458 | .418 | .746 | .274 | .583 | .449 | .418 | .746 | .223 | .487 | ||
| EHR-RAG | .584 | .483 | .424 | .748 | .315 | .575 | .426 | .405 | .753 | .213 | .488 | ||
| Memory | Traj-CoA | .526 | .411 | .384 | .719 | .250 | .525 | .386 | .369 | .735 | .182 | .455 | |
| Ours | LONGINUS | .584 | .477 | .421 | .773 | .330 | .580 | .437 | .408 | .774 | .234 | .529 | |
| GPT-OSS -120B | Single-Prompting | NECHOv3 | .564 | .429 | .399 | .722 | .290 | .561 | .395 | .386 | .713 | .223 | .472 |
| Multi-agent | MedAgents | .551 | .440 | .383 | .727 | .290 | .498 | .357 | .298 | .673 | .196 | .456 | |
| MDAgents | .557 | .451 | .395 | .736 | .298 | .527 | .398 | .345 | .731 | .197 | .463 | ||
| KAMAC | .548 | .419 | .390 | .722 | .284 | .509 | .385 | .323 | .681 | .215 | .433 | ||
| Retrieval | Summary-RAG | .560 | .452 | .398 | .749 | .325 | .537 | .386 | .368 | .733 | .237 | .520 | |
| RGAR | .552 | .434 | .396 | .731 | .323 | .544 | .380 | .377 | .734 | .255 | .492 | ||
| MASS-RAG | .570 | .462 | .414 | .738 | .296 | .572 | .449 | .400 | .748 | .256 | .450 | ||
| EHR-RAG | .579 | .472 | .433 | .732 | .265 | .589 | .427 | .426 | .743 | .177 | .450 | ||
| Memory | Traj-CoA | .571 | .449 | .422 | .748 | .303 | .545 | .385 | .380 | .740 | .206 | .483 | |
| Ours | LONGINUS | .587 | .482 | .422 | .758 | .332 | .585 | .454 | .419 | .749 | .264 | .522 | |
| Llama-3.3 -70B | Single-Prompting | NECHOv3 | .533 | .380 | .383 | .710 | .064 | .600 | .379 | .453 | .747 | .082 | .406 |
| Multi-agent | MedAgents | .466 | .303 | .329 | .630 | .175 | .476 | .306 | .332 | .631 | .118 | .378 | |
| MDAgents | .483 | .334 | .343 | .654 | .178 | .501 | .320 | .361 | .663 | .123 | .344 | ||
| KAMAC | .500 | .367 | .358 | .666 | .195 | .510 | .348 | .372 | .678 | .122 | .358 | ||
| Retrieval | Summary-RAG | .490 | .370 | .345 | .674 | .247 | .465 | .322 | .331 | .685 | .144 | .436 | |
| RGAR | .501 | .367 | .381 | .669 | .140 | .451 | .289 | .336 | .608 | .034 | .269 | ||
| MASS-RAG | .558 | .433 | .416 | .724 | .202 | .572 | .422 | .411 | .718 | .151 | .450 | ||
| EHR-RAG | .548 | .424 | .419 | .713 | .138 | .584 | .397 | .443 | .731 | .107 | .350 | ||
| Memory | Traj-CoA | .494 | .374 | .359 | .656 | .227 | .527 | .356 | .379 | .686 | .184 | .453 | |
| Ours | LONGINUS | .592 | .463 | .444 | .757 | .262 | .613 | .437 | .456 | .764 | .197 | .481 | |
Table 15: Performance on MIMIC-IV by observed history depth. Visit 1 and Visit 2+ contain 744 and 256 patients, respectively; Recurrent is undefined for Visit 1. Formatting and † follow Table 4.
| Backbone | Type | Method | MIMIC-III | MIMIC-IV | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Head | Mid | Tail | All | Head | Mid | Tail | All | |||
| - | Rule | LVCF | .562 | .433 | .536 | .510 | .599 | .472 | .434 | .479 |
| OHU | .566 | .428 | .537 | .510 | .606 | .476 | .454 | .492 | ||
| Gemini-3.1-Flash-Lite | Single-Prompting | NECHOv3 | .511 | .383 | .465 | .450 | .574 | .430 | .428 | .459 |
| Multi-agent | MedAgents | .503 | .359 | .397 | .407 | .570 | .418 | .408 | .444 | |
| MDAgents | .514 | .379 | .453 | .443 | .574 | .438 | .454 | .474 | ||
| KAMAC | .508 | .346 | .346 | .379 | .560 | .415 | .368 | .422 | ||
| Retrieval | Summary-RAG | .470 | .368 | .401 | .405 | .539 | .421 | .403 | .437 | |
| RGAR | .431 | .356 | .395 | .391 | .513 | .401 | .405 | .426 | ||
| MASS-RAG | .508 | .388 | .472 | .454 | .587 | .457 | .454 | .482 | ||
| EHR-RAG | .545 | .392 | .466 | .460 | .617 | .465 | .440 | .484 | ||
| Memory | Traj-CoA | .431 | .364 | .413 | .402 | .515 | .410 | .402 | .428 | |
| Ours | LONGINUS | .557 | .396 | .463 | .462 | .624 | .486 | .436 | .490 | |
| Llama-3.3-70B | Single-Prompting | NECHOv3 | .519 | .341 | .397 | .405 | .547 | .381 | .361 | .405 |
| Multi-agent | MedAgents | .411 | .257 | .284 | .302 | .456 | .295 | .289 | .325 | |
| MDAgents | .443 | .287 | .306 | .328 | .476 | .338 | .308 | .352 | ||
| KAMAC | .454 | .310 | .346 | .357 | .491 | .355 | .367 | .389 | ||
| Retrieval | Summary-RAG | .361 | .233 | .301 | .293 | .446 | .348 | .368 | .378 | |
| RGAR | .454 | .303 | .351 | .358 | .469 | .323 | .362 | .372 | ||
| MASS-RAG | .510 | .379 | .435 | .434 | .548 | .428 | .433 | .455 | ||
| EHR-RAG | .495 | .366 | .458 | .437 | .555 | .414 | .420 | .446 | ||
| Memory | Traj-CoA | .433 | .291 | .375 | .362 | .459 | .374 | .384 | .396 | |
| Ours | LONGINUS | .542 | .404 | .480 | .470 | .597 | .463 | .458 | .488 | |
Table 16: Macro-F1 by label-frequency stratum on MIMIC-III and MIMIC-IV (1,000 patients each; up to five observed visits). Labels are ranked by next-visit target prevalence in each dataset: Head (top 20%; 23 labels), Mid (next 30%; 34 labels), and Tail (remaining 50%; 55 labels); All covers the full 112-label space. Per-stratum Macro-F1 averages per-label F1 within each stratum (Appendix C). Formatting follows Table 4; no significance tests are reported for frequency strata.
G Additional Precision–Recall Analysis
G.1 Overall Stage-wise Precision and Recall
Table 17 reports stage-wise micro-precision and recall. The raw candidate union contains predictions from both views, while the final output retains consensus and accepted disagreements. Adjudication increases precision from 43.2% to 49.2% with Gemini-3.1-Flash-Lite and from 52.4% to 59.7% with Llama-3.3-70B, while reducing recall from 76.4% to 71.6% and from 64.1% to 59.8%, respectively. This reflects the precision–recall trade-off of filtering disagreement candidates.
G.2 Transition-Specific Precision and Recall
Table 18 reports precision and recall by temporal transition using the history-state partition from the main evaluation. Adjudication improves precision at the cost of recall across all transitions, with the largest recall losses for Recurrent diagnoses (9.6 and 11.8 points). New recall remains low even before adjudication (46.2% and 26.7%), and New F1 improves with Gemini-3.1-Flash-Lite but slightly declines with Llama-3.3-70B.
| Scope | Stage | Gemini-3.1-Flash-Lite | Llama-3.3-70B | ||
|---|---|---|---|---|---|
| P | R | P | R | ||
| Subset | Consensus | 54.9 | 63.1 | 66.7 | 39.9 |
| Disagreement (before) | 21.6 | 13.3 | 38.8 | 24.1 | |
| Disagreement (after) | 27.8 | 8.6 | 49.2 | 19.8 | |
| Overall | Raw candidate union | 43.2 | 76.4 | 52.4 | 64.1 |
| Final prediction | 49.2 | 71.6 | 59.7 | 59.8 | |
Table 17: Stage-wise precision (P) and recall (R) on MIMIC-IV (%). All recall values use the same denominator: the total number of reference diagnosis labels. Subset recall represents each component's contribution to overall recall.
| Backbone | Transition | Precision | Recall | ||
|---|---|---|---|---|---|
| Union | Final | Union | Final | ||
| Gemini-3.1-Flash-Lite | Persistent | 62.5 | 66.8 | 95.3 | 91.7 |
| New | 22.2 | 25.8 | 46.2 | 40.0 | |
| Recurrent | 34.3 | 40.6 | 85.7 | 76.1 | |
| Llama-3.3-70B | Persistent | 66.0 | 68.1 | 88.1 | 85.8 |
| New | 26.8 | 34.3 | 26.7 | 20.0 | |
| Recurrent | 36.2 | 44.3 | 64.3 | 52.5 | |
Table 18: Precision and recall before and after adjudication by temporal transition on MIMIC-IV (%). Union denotes the raw candidate union; Final denotes LONGINUS predictions.
H Qualitative Analysis
Tables 19–22 show selected cases across four LLM backbones, illustrating key LONGINUS behaviors and a candidate-generation failure.
Patient A: MIMIC-III, Gemini-2.5-Flash-Lite; one observed visit, predicting Visit 2.
Patient summary. A male patient aged 76+ recovering from CABG, prolonged ventilation, and dialysis-requiring renal disease was admitted with fever, jaundice, biliary obstruction, and pleural effusion. ERCP was followed by pancreatitis. His observed medical history explicitly lists peripheral vascular disease and prostate cancer treated with radiotherapy, although neither appeared in the observed diagnosis-code set.
Reference diagnoses (11). Persistent (7): Adult respiratory failure; Anemia; Biliary disease; Cardiac dysrhythmia; Coronary atherosclerosis; Hypertension complications; Thyroid disorders. New (4): Fluid and electrolyte disorders; Peripheral atherosclerosis; Prostate cancer; Substance-related disorders.
| (a) Selected diagnosis predictions | ||||
|---|---|---|---|---|
| Method | Prostate cancer | Peripheral atherosclerosis | Respiratory failure | Septicemia |
| Reference | 1 | 1 | 1 | 0 |
| Retrieval | 0 | 0 | 1 | 0 |
| Memory | 1 | 1 | 0 | 1 |
| LONGINUS | 1 | 1 | 1 | 0 |
| Union-wide | 1 | 1 | 1 | 1 |
| (b) Full-set performance | ||||
|---|---|---|---|---|
| Method | TP | FP | FN | F1 |
| Retrieval | 7 | 6 | 4 | .583 |
| Memory | 7 | 7 | 4 | .560 |
| LONGINUS | 10 | 6 | 1 | .741 |
| Union-wide | 10 | 8 | 1 | .690 |
Table 19: Illustrative case of complementary Retrieval and Memory predictions. LONGINUS combines Memory-only New diagnoses with Retrieval-only Persistent diagnoses while rejecting false Memory-only Septicemia. Relative to Union-wide, it retains the same ten true positives with fewer false positives. Clinical history is paraphrased; red bold entries disagree with the reference. Full-set performance includes diagnoses not shown in panel (a).
Patient B: MIMIC-IV, Gemini-3.1-Flash-Lite; two observed visits, predicting Visit 3.
Patient summary. A male patient aged 41–60 with ulcerative colitis, prior bowel perforation, and a ventral hernia underwent staged abdominal-wall reconstruction. Approximately 69 days after the first discharge, he underwent proctectomy, ileal pouch construction, diverting ileostomy, and hernia repair. The observed notes describe recurrent C. difficile colitis, although Intestinal infection was absent from the observed coding history.
Reference diagnoses (6). Persistent (2): Hypertension; Ulcerative colitis. Recurrent (1): Abdominal hernia. New (3): Anemia; Cardiac dysrhythmia; Intestinal infection.
| (a) Selected diagnosis predictions | ||||
|---|---|---|---|---|
| Method | Ulcerative colitis | Abdominal hernia | Anemia | Intestinal infection |
| Reference | 1 | 1 | 1 | 1 |
| Retrieval | 1 | 1 | 1 | 0 |
| Memory | 1 | 1 | 0 | 1 |
| LONGINUS | 1 | 1 | 1 | 1 |
| Union-wide | 1 | 1 | 0 | 0 |
| (b) Full-set performance | ||||
|---|---|---|---|---|
| Method | TP | FP | FN | F1 |
| Retrieval | 4 | 3 | 2 | .615 |
| Memory | 4 | 5 | 2 | .533 |
| LONGINUS | 5 | 3 | 1 | .714 |
| Union-wide | 3 | 2 | 3 | .545 |
Table 20: Illustrative case of complementary New-diagnosis prediction. LONGINUS preserves the shared Persistent and Recurrent diagnoses while accepting Retrieval-only Anemia and Memory-only Intestinal infection. Union-wide removes both New diagnoses. Clinical history is paraphrased; red bold entries disagree with the reference. Full-set performance includes diagnoses not shown in panel (a).
Patient C: MIMIC-III, GPT-OSS-120B; two observed visits, predicting Visit 3.
Patient summary. A male patient aged 61–75 with lung squamous-cell carcinoma following right lower lobectomy, bronchopleural fistula/empyema, invasive aspergillosis, HIV, cardiac comorbidities, anemia, and malnutrition. The second admission involved hypoxemic respiratory failure and septic shock attributed to pneumonia, requiring prolonged ventilation, tracheostomy, and gastrostomy.
Reference diagnoses (12). Persistent (10): Adult respiratory failure; Congestive heart failure, non-hypertensive; Coronary atherosclerosis; Fluid and electrolyte disorders; HIV infection; Bronchus/lung cancer; Mycoses; Septicemia; Shock; Pleurisy. Recurrent (1): Anemia. New (1): Aspiration pneumonia.
(a) Selected diagnosis predictions
| Method | Septicemia | Pleurisy | Pulmonary heart disease | Aspiration pneumonia |
|---|---|---|---|---|
| Reference | 1 | 1 | 0 | 1 |
| Retrieval | 1 | 1 | 1 | 0 |
| Memory | 1 | 0 | 0 | 0 |
| LONGINUS | 1 | 1 | 0 | 0 |
| Union-wide | 0 | 1 | 1 | 0 |
(b) Full-set performance
| Method | TP | FP | FN | F1 |
|---|---|---|---|---|
| Retrieval | 11 | 8 | 1 | .710 |
| Memory | 10 | 5 | 2 | .741 |
| LONGINUS | 11 | 5 | 1 | .786 |
| Union-wide | 9 | 7 | 3 | .643 |
Table 21: Illustrative case of consensus preservation and disagreement adjudication. LONGINUS preserves consensus Septicemia, accepts Retrieval-only Pleurisy, and rejects false Retrieval-only Pulmonary heart disease. Neither view proposes the target Aspiration pneumonia, illustrating a candidate-generation failure. Clinical history is paraphrased; red bold entries disagree with the reference. Full-set performance includes diagnoses not shown in panel (a).
Patient D: MIMIC-IV, Llama-3.3-70B; four observed visits, predicting Visit 5.
Patient summary. A male patient aged 76+ with insulin-treated diabetes, severe peripheral vascular disease, coronary artery disease after CABG, and hypothyroidism had repeated vascular admissions. Earlier visits involved ischemic foot disease, infection, revascularization, bypass-graft infection and removal, non-healing ulcers, and bypass revision. The fourth observed admission concerned left-leg ischemia and planned bypass surgery. Gangrene was coded in Visit 3 but not Visit 4.
Reference diagnoses (6). Persistent (5): Conduction disorders; Coronary atherosclerosis; Diabetes mellitus without complications; Skin ulcer; Thyroid disorders. Recurrent (1): Gangrene. New (0).
Temporal and tail signal. Gangrene coding across observed Visits 1–4: 0, 0, 1, 0; target: 1. Gangrene is a Tail label. These states denote diagnosis coding, not necessarily clinical resolution or reactivation.
(a) Selected diagnosis predictions
| Method | Skin ulcer | Gangrene | Cardiac dysrhythmia | Hyperlipidemia |
|---|---|---|---|---|
| Reference | 1 | 1 | 0 | 0 |
| Retrieval | 1 | 0 | 0 | 1 |
| Memory | 0 | 1 | 1 | 1 |
| LONGINUS | 1 | 1 | 0 | 1 |
| Union-wide | 1 | 1 | 1 | 1 |
(b) Full-set performance
| Method | TP | FP | FN | F1 |
|---|---|---|---|---|
| Retrieval | 4 | 4 | 2 | .571 |
| Memory | 2 | 5 | 4 | .308 |
| LONGINUS | 6 | 4 | 0 | .750 |
| Union-wide | 6 | 5 | 0 | .706 |
Table 22: Illustrative long-history case involving a recurrent Tail diagnosis. LONGINUS combines Retrieval-only Persistent diagnoses with Memory-only recurrent Gangrene and rejects false Memory-only Cardiac dysrhythmia. Both LONGINUS and Union-wide recover all reference diagnoses, but LONGINUS retains one fewer false positive. Clinical history is paraphrased; red bold entries disagree with the reference. Full-set performance includes diagnoses not shown in panel (a).