Skip to main content
Ophthalmology Science logoLink to Ophthalmology Science
. 2026 Jun 1;6(8):101265. doi: 10.1016/j.xops.2026.101265

Automated Review of Patient Records

Privacy-Preserving Large Language Models for Identifying Incident Nonarteritic Anterior Ischemic Optic Neuropathy at Scale

Tuyet Thao Nguyen 1,2, Kelvin Zhenghao Li 2,3,4, Pareena Chaitanuwong 5,6, Heather Elspeth Moss 2,7,∗
PMCID: PMC13355692  PMID: 42437116

Abstract

Purpose

Retrospective identification of acute nonarteritic anterior ischemic optic neuropathy (NAION) cases is critical for research on risk factors. However, reliance on International Classification of Diseases (ICD) 10th edition coding for case identification has limited accuracy, and manual review of longitudinal electronic health records is time-intensive. The purpose of this study is to evaluate automated methods for retrospective identification of acute NAION cases using large language models (LLMs) that preserve patient privacy.

Design

Retrospective cross-sectional study.

Subjects

165 patients with ≥1 ICD-10 code for ischemic optic neuropathy (H47.01∗) in the electronic health record at an academic medical center.

Methods

Five locally deployed LLM models (Mistral Small 3.1, Magistral Small, Gemma3, MedGemma, GPT-OSS 20B) were used to implement 4 approaches for acute NAION diagnostic classification using unstructured ophthalmology records (basic prompting, retrieval-augmented generation [RAG], 2-step agentic workflow, and 3-step agentic workflow). Ten percent of subjects were used for prompt refinement. Large language model/approach diagnostic classifications were compared against expert neuro-ophthalmologist diagnoses based on chart review.

Main Outcome Measures

Positive predictive value (PPV) of LLM approaches for acute NAION case identification with expert chart review diagnosis serving as gold standard. Secondary outcomes included negative predictive value, sensitivity, specificity, accuracy, F1 score, and distribution of LLM/approach classifications.

Results

7/17 prompt refinement subjects and 58/148 testing subjects had acute NAION by expert chart review corresponding to PPV of 0.39 for ≥1 ICD code. Large language model approaches accurately identified 20 ± 12 (mean, standard deviation) acute NAION cases in the test set with PPV of 0.78 ± 0.16 and accuracy of 0.69 ± 0.06. The Mistral model using a 3-step agentic approach had the best-balanced performance (39 cases identified, 0.85 PPV, 0.82 accuracy, 0.75 F1 score).

Conclusions

Privacy-preserving agentic LLM approaches can achieve high PPV for acute NAION case identification using unstructured ophthalmology longitudinal electronic health records. These results exceed the performance of using structured ICD codes to identify cases, offering a scalable, efficient method for case identification in retrospective research while maintaining patient confidentiality and local data control. This method has application for enhancing research efficiency and accuracy for studies on NAION risk factors, with potential applicability to other conditions requiring complex diagnostic review.

Financial Disclosure(s)

Proprietary or commercial disclosure may be found in the Footnotes and Disclosures at the end of this article.

Keywords: Chart review, Electronic health records, Large language models, Natural language processing, Nonarteritic anterior ischemic optic neuropathy


Nonarteritic anterior ischemic optic neuropathy (NAION) is a leading cause of acute, painless vision loss in older adults.1,2 For patient care, accurate diagnosis depends entirely on clinical observations and exclusion of other diagnoses, as no definitive diagnostic test exists. Specifically, clinicians rely on the recognition of characteristic features such as relative afferent pupillary defect, optic disc edema, and sudden onset of vision loss in patients with typical demographics for the disease.1 Clinicians document their diagnosis in 2 ways: the details (history, physical examination findings, ancillary testing results, and diagnostic reasoning) are captured in the clinician’s notes, which are part of the unstructured medical record. They also select 1 or more diagnostic codes, typically using the International Classification of Diseases 10th edition (ICD-10), which becomes part of the structured medical record. However, the accuracy of ICD-10 codes varies based on specificity and clinician coding practices. In the case of NAION, the closest ICD-10 code (H47.01∗) lacks specificity regarding anterior location, acuity, and etiology (i.e., arteritic vs, nonarteritic).

Accurate diagnostic classification is important for research. Prospective studies can employ multimodal diagnostic criteria to ensure accuracy, but retrospective studies typically rely on (ICD) codes, especially when using large data sets.3,4 For NAION, the positive predictive value (PPV) of the H47.01 ICD-10 code has been reported at 74.5% (95% confidence interval, 67.2%–80.7%). This increased to 86.8% when obtained from those who had visited neuro-ophthalmologists (95% confidence interval, 79.2%–91.9%).3 Notably, this study did not distinguish acute from historical (chronic) cases, with the implication that the PPV of the ischemic optic neuropathy (ION) ICD-10 code for acute cases is lower than reported for all cases. Thus, classification using ICD-10 codes results in misclassification of NAION, which can bias research results. Manual chart review is widely used in neuro-ophthalmological research as a corrective method, but it is resource-intensive, limited by interrater variability, and difficult to scale.5 The need for better strategies to accurately identify acute NAION cases from medical records has become especially urgent with recent concerns about medication-associated events.6

Large language models (LLMs) have recently emerged as promising tools for automating the extraction of information from clinical text,7,8 and they have shown encouraging results in clinical decision support, administrative tasks such as coding9, 10, 11 and retrospective research7,12, 13, 14, 15, 16 including for optic neuropathies such as glaucoma.17 However, current literature highlights meaningful limitations when LLMs are used for chart review for research purposes. Challenges include difficulty maintaining temporal and contextual consistency across records, variation in accuracy depending on the complexity of diagnostic reasoning, and concerns around privacy and safety.18, 19, 20 Privacy concerns may necessitate smaller, locally deployed models rather than large cloud-based systems, and these smaller models typically perform worse on complex reasoning tasks.21,22 Several techniques have been developed to address these limitations. Retrieval-augmented generation (RAG), which uses external knowledge bases to enrich, and ground model outputs, has demonstrated improved performance in certain medical applications.23,24 Additionally, agentic approaches, which decompose complex tasks into structured and sequential decision-making steps, have shown early promise by better aligning LLM function with human clinical reasoning.25

Given the diagnostic specificity and temporal integration required for identifying cases of acute NAION, the condition provides a rigorous test case for automated chart review. This study developed and evaluated automated LLM-based approaches for longitudinal unstructured patient record review. The performance of basic prompting, RAG, and agentic approaches was assessed against expert chart review, with the goal of determining whether privacy-preserving systems can achieve useful performance for research purposes.

Methods

The target population was patients with possible NAION. These were retrospectively identified from a single academic medical center using the STAnford Research Repository (STARR) tool with the search criteria being those with 1 or more ICD-10 codes for ION (H47.01, H47.011, H47.012, H47.013, H47.019) given by any provider, in any setting, from January 1 to December 31, 2018. All subjects were consecutively selected based on ICD-10 code presence, with no additional eligibility criteria applied. The sample comprised 165 individuals, and no participants were excluded after selection. Approval was obtained from the Stanford Institutional Review Board by expedited review with a waiver of documentation of informed consent. The described research adhered to the tenets of the Declaration of Helsinki.

There was no data preprocessing; all electronic health record (EHR) data were used as-is. The gold standard clinical diagnosis was determined through manual record review by an experienced neuro-ophthalmologist who labeled each subject as acute NAION, historical (chronic) NAION, diagnosis other than NAION (i.e., not NAION), diagnostic uncertainty (which included possible NAION and unknown cases), or insufficient documentation based on all available information. A second fellowship-trained neuro-ophthalmologist confirmed labels of acute NAION and not-NAION cases through chart review. In the single case for which the 2 labelers disagreed, a third fellowship-trained neuro-ophthalmologist adjudicated the classification. For evaluation of the primary LLM task, these expert labels were mapped to a binary reference standard in which acute NAION was considered positive, and all other categories were considered negative (i.e., not acute NAION). In addition, the following information was manually abstracted for each subject to characterize the cohort: demographics, clinical features (sudden onset of vision loss, ocular pain, afferent pupillary defect [APD], and optic disc edema), and laboratory results (erythrocyte sedimentation rate and C-reactive protein). No additional annotation beyond the expert reference standard was performed.

LLM classification approaches used clinical notes from ophthalmology outpatient visits at Byers Eye Institute at Stanford, which were extracted from the EHR using the STARR. The exports are text data strings comprised of textual information in the clinical note, including that entered by the clinical teams in unstructured and structured fields per their practices. These were saved in .csv format as unstructured data. Clinical notes were anonymized by removing direct identifiers and applying temporal shifting of event dates while preserving relative chronological order.

All experiments were conducted locally using the llama.cpp inference library on an NVIDIA RTX 4090 GPU with a maximum input length of 8192 tokens, in order to keep video RAM usage within limits of most readily available consumer hardware. The primary model deployed was Mistral Small 3.1 24B, due to strong performance of Mistral models in other similar studies.22,26,27 In order to ensure findings are generalizable and to test the effect of reasoning and domain fine-tuning on accuracy, 4 other models were tested: Magistral Small 2509, the reasoning variant of Mistral Small 3.1;28 Gemma3 27B, a generalist model from Google;29 MedGemma 27B, the medical-domain fine-tuned variant of Gemma3;30 and GPT-OSS 20b, an open-source generalist model from OpenAI.31 Models were used in September and October 2025, and no LLM fine-tuning or postdeployment updating was conducted.

Four automated LLM-based approaches were compared (Fig. 1). In the simple prompting approach, the concatenated ophthalmology clinical notes for a subject were presented to the model with direct queries. In the retrieval-augmented generation (RAG) approach, all ophthalmology clinical notes for a subject were segmented using LangChain and indexed in a Chroma vector database, which enabled retrieval of semantically relevant passages for queries. Two agentic approaches were also evaluated, each designed to mimic sequential clinical reasoning across records. Both of these evaluated ophthalmology clinical notes 1 at a time in chronological order with a query to identify the oldest relevant note. In the 2-step method, the segmented and indexed clinical note was then used for subsequent queries. In the 3-step method, an intermediate query was added to summarize relevant passages in order to focus the final queries on the most relevant information.

Figure 1.

Figure 1

Flow diagrams for the LLM approaches (simple, RAG, 2-step agentic, 3-step agentic). Bolded text represents the question to be answered by the LLM and the question’s choices. Patient records and clinical notes are outpatient ophthalmology clinical notes in unstructured text format. LLM = large language model; RAG = retrieval-augmented generation.

In all approaches, the final output was unstructured text with “Yes” or “No” wrapped in “<answer>” tags. If the output did not match this format, then the answer was classified as “No.” In intermediate steps in agentic approaches, the intermediate outputs were “Yes” or “No.” If the intermediate output did not match this format, then the approach proceeded as if the answer were “No.”

For simple, RAG, 2-step agentic and 3-step agentic approaches, the LLM models were used to directly answer the question, “does this patient have acute NAION?” In addition, the best performing model/approach was used to classify presence of each acute NAION feature (APD, optic disc edema, sudden onset) by embedding a question (Table S1, available at www.ophthalmologyscience.org) about each feature in a prompt (Table S2, available at www.ophthalmologyscience.org). Positive classifications were combined using logical expressions to classify acute NAION diagnosis or not for each case (for example, IF [(feature_1 = yes) AND (feature_2 = yes)] THEN DIAGNOSIS = acute NAION, ELSE DIAGNOSIS = not acute NAION). On an exploratory basis, performance of acute NAION classification algorithms using different combinations of LLM classified features was compared.

Prompt refinement was performed using a subset comprising 10 percent of the cohort (n = 17). Prompts (Table S2) consisted of scaffolding instructions to the LLM to guide it in answering a question (Table S1). Prompts were specific for each approach and included what text to consider, what output to provide and the format of the output. These were refined for each approach to improve accuracy of the output. The questions embedded in each prompt were consistent across approaches. Classification using each of the 4 approaches (basic prompting, RAG, 2-step agentic, and 3-step agentic) for explicit acute NAION diagnosis and for feature based acute NAION diagnosis was conducted on the test cohort of 148 subjects.

For each LLM approach diagnosis, each subject was classified as true positive, true negative, false positive, or false negative relative to the neuro-ophthalmologist chart review reference standard. Performance for each LLM approach was assessed using accuracy, F1 score, positive predictive value, negative predictive value, sensitivity, and specificity. No imputation was performed, and no class imbalance was addressed.

Given broadly utilized ICD-based algorithms for identifying cases, performance metrics for 1, ≥2, and ≥3 codes were calculated. Given that cohort inclusion required at least 1 ICD-10 code for ischemic optic neuropathy (ION), there are no true or false negatives for 1 ICD code within the selected sample (i.e., no ICD code and acute NAION [false negative] or not acute NAION [true negative]). To assess the magnitude of false negative cases using a single ICD code algorithm patients were retrospectively identified from our academic medical center using the STARR tool with the search criteria including at least 1 ophthalmology encounter between January and December, 2018, absence of ICD-10 codes for ION (H47.01, H47.011, H47.012, H47.013, H47.019), and presence of “NAION” or “anterior ischemic optic neuropathy” or “non-arteritic anterior ischemic optic neuropathy” in EHR notes. This query surfaced 134 individuals among 24 575 people with ophthalmology encounters during that period. A random 10% sample was labeled as acute NAION or not by manual chart review by a fellowship-trained neuro-ophthalmologist.

Results

Among 165 subjects with at least 1 ICD-10 ION code (mean age 65.0 ± 13.9 years; 61.8% male), chart review identified acute NAION in 65 (39.4%). Common findings included APD, optic disc edema, and visual field defects; sudden onset was frequent, whereas pain was uncommon (Table 1). Of the 17 patients who were used for prompt refinement, 7 had acute NAION (41.2%), leaving 58 with acute NAION in the test set of 148 subjects. None of the reviewed patients without an ION code had acute NAION.

Table 1.

Clinical Features of Subjects with ≥1 ICD-10 Code for ION (H47.01∗) Based on Manual Review of Electronic Medical Records

Variable Classification No. (%)
(n = 165)
Age Continuous in years (mean ± SD) 65.0 ± 13.9
Gender Male 102 (61.8)
Clinical features Relative afferent pupillary defect 108 (65.5)
Optic disc edema 70 (42.4)
Visual field defect 138 (83.6)
Sudden onset 82 (49.7)
Pain 19 (11.5)
Expert diagnosis Acute NAION 65 (39.4)
Historical NAION 33 (20.0)
Possible NAION 17 (10.3)
Diagnosis other than NAION (i.e., not NAION) 42 (25.5)
Unknown diagnosis 3 (1.8)
Insufficient records 5 (3.0)

ICD = International Classification of Diseases; ION = ischemic optic neuropathy; NAION = nonarteritic anterior ischemic optic neuropathy; SD = standard deviation.

Figure 2 summarizes the classification of test subjects across LLMs and approaches compared to neuro-ophthalmologist chart review as reference standard. No model/approach combination correctly identified all acute NAION cases. The model/approach with the most true positives (Gemma3 - simple) also had the most false positives. The corresponding performance indices varied widely (accuracy 0.69 ± 0.05; PPV 0.79 ± 0.15; negative predictive value [NPV] 0.69 ± 0.06) with PPVs for all LLM approaches exceeding the proportion of acute NAION cases in the test sample (0.39), which corresponds to the PPV for acute NAION based on ION ICD-10 code in our sample.

Figure 2.

Figure 2

Distribution of classification for acute NAION across LLMs and approaches against expert chart review as reference standard. Magistral, MedGemma, GPT OSS 20b, Gemma3, and Mistral are the LLM models used. Two-step (agentic), 3-step (agentic), RAG (retrieval-augmented generation), and simple are approaches used with each model. Horizontal bars represent distribution of diagnostic classifications for each model-approach with number of positive (acute NAION) classifications indicated by solid shading and number of negative (not acute NAION) classifications indicated by negative shading. Bars to the right of the vertical line (black solid [TP true positive] or black pattern [FN false negative]) correspond to acute NAION cases by expert chart review and those to the left of the vertical line (gray solid (FP false positive) or gray pattern (TN true negative) are not acute NAION by expert chart review. LLM = large language model; NAION = nonarteritic anterior ischemic optic neuropathy.

Overall, the Mistral model with 3-step agentic approach had the best balance of true positives while minimizing false positives. Table 2 provides performance indices for the Mistral model across different approaches compared against manual chart review (reference standard), and ION ICD code-based approaches (≥1, ≥2, ≥3 code instances), with the 3-step agentic approach having accuracy, PPV, and NPV all exceeding 0.80 and the highest F1 score of any approach (0.75). Table S3 (available at www.ophthalmologyscience.org) contains performance metrics for all model-algorithm combinations studied. Figure 3 shows the breakdown for Mistral model 3-step agentic binary approach classification against the manual chart review labels. Table S4 (available at www.ophthalmologyscience.org) shows the breakdown for all approaches using the Mistral model. False positive rates were low, and the majority of false positives were for historical (chronic) diagnoses of NAION, indicating that errors largely reflect misclassification of acute versus historical (chronic) rather than confusion with non-NAION conditions.

Table 2.

Performance of Approaches for Classification of Acute NAION against a Reference Standard of Expert Chart Review among 148∗ Subjects with ≥1 ICD-10 Code for ION

Approach True Positive Accuracy PPV (Precision) NPV Sensitivity (Recall) Specificity F1 Score
Expert chart review (reference standard) 58 1.0 1.0 1.0 1.0 1.0 1.0
ICD-10 code (≥1)
(cohort inclusion criterion)
58 0.39 0.39 N/A 1.0 0 0.56
ICD-10 code (≥2) 58 0.48 0.43 1.00 1.00 0.14 0.60
ICD-10 code (≥3) 33 0.66 0.57 0.72 0.57 0.72 0.57
LLM-Simple† 22 0.74 0.92 0.71 0.38 0.98 0.54
LLM-RAG† 22 0.72 0.79 0.70 0.38 0.93 0.51
LLM-2-Step Agentic† 27 0.76 0.82 0.74 0.48 0.93 0.61
LLM-3-Step Agentic† 39 0.82 0.85 0.81 0.67 0.92 0.75

ICD-10 = International Classification of Diseases 10th edition; ION = ischemic optic neuropathy; LLM = large language model; N/A = not applicable; NAION nonarteritic anterior ischemic optic neuropathy; PPV = positive predictive value; NPV = negative predictive value; RAG = retrieval-augmented generation.

∗

Subjects used for prompt refinement excluded (n = 17).

†

Values for LLM approaches utilized a Mistral model with explicit queries, see Table S3 for performance metrics of utilizing other LLM models.

Figure 3.

Figure 3

Distribution of LLM binary classification of acute NAION using Mistral model 3-step agentic approach according to expert diagnostic labels based on chart review. White shading indicates accurate classifications, whereas gray shading indicates inaccurate classifications. Numbers in parentheses are number of cases (148 total). LLM = large language model; NAION = nonarteritic anterior ischemic optic neuropathy.

Figure 4 summarizes the classification of test subjects across different combinations of LLM classified (Mistral LLM 3-step agentic approach) features associated with NAION (disc edema, APD, sudden onset). In general, requiring more features to confirm a diagnosis of NAION reduced true positive yield. Performance was variable with accuracy 0.76 ± 0.10 and PPV 0.81 ± 0.16 (all exceeding the proportion of acute NAION cases in the sample). Analysis of individual and combined features revealed that optic disc edema alone had the best performance with 51 true positives, accuracy 0.91, F1 score 0.89, PPV 0.89, and NPV 0.92, exceeding the performance of ICD code and explicit LLM approaches for classification of acute NAION.

Figure 4.

Figure 4

Distribution of classification for acute NAION using LLM classification of features. Results shown for Mistral LLM, 3-step agentic approach. Horizontal bars represent distribution of acute NAION diagnostic classifications for each feature combination with number of positive (acute NAION) classifications indicated by solid shading and number of negative (not acute NAION) classifications indicated by negative shading. Bars to the right of the vertical line (black solid [TP true positive] or black pattern [FN false negative]) correspond to acute NAION cases by expert chart review, and those to the left of the vertical line (gray solid [FP false positive] or gray pattern [TN true negative] are not acute NAION by expert chart review. LLM = large language model; NAION = nonarteritic anterior ischemic optic neuropathy.

Discussion

Accurate case identification is critically important in retrospective clinical research to avoid misclassification and selection bias. Structured data (e.g., ICD-10 code) approaches are prone to error due to exclusion of codes or use of inaccurate codes by providers, administrative error, and limitations in the code set. This is a particular challenge in NAION because the most appropriate ICD code lacks specificity for acuity, location (anterior) and etiology (nonarteritic). In this study, we developed LLM approaches for unstructured EHR review and applied them to classify acute cases of NAION among subjects with ICD codes for ION. We found that LLM approaches achieved performance exceeding ICD-10 code-based classification with some approaches achieving performance approaching that of expert classification based on chart review, even when utilizing a relatively small local model to maintain necessary patient data privacy and confidentiality when reviewing unstructured patient records.

Across the board, the LLM approaches developed in the current study achieved improved accuracy and PPV (49.1%–100%) compared to ICD code-based identification in this and other studies (PPV 39%–57%) (3), in some cases approaching, but not matching the reference standard of expert chart review, which, by definition, has PPV and accuracy of 100%. The observed accuracy rates for our LLM approaches compare favorably to established benchmarks for medical chart review accuracy of other diseases by nonexperts across different levels of clinical training. Previous studies have reported chart review accuracy of 0.69 for medical students, 0.75 for interns, 0.77 for residents, and 0.77 for attending physicians.32 Our LLMs’ performance is particularly significant given the resource-intensive nature of manual chart review and the growing need for scalable approaches to identify acute NAION cases in large datasets. This scalability extends beyond technical considerations to clinical workflow integration.

Most false positives (i.e., incorrectly classified as acute NAION) in our LLM approaches corresponded to expert labeled historical (chronic) NAION cases. It was extremely rare that the LLM approaches falsely identified a confirmed non-NAION diagnosis as acute NAION, which suggests that further gains in LLM performance might be achieved by improving recognition of the acute disease state through prompt engineering. Additional insight into patterns of LLM errors, such as a study analyzing association between input data features and LLM performance, could guide such efforts. This parallels the trend seen with ICD code algorithms with reports of higher PPV of an ION ICD code for identification of acute or historical (chronic) NAION cases (74%) (3) than our study found for acute cases (39%). Although the gains from using an LLM approach and unstructured data are significant for identification of acute cases, an ICD code approach may be acceptable for a study of acute or historical (chronic) NAION.

The differences in performance of different models and approaches reveal tradeoffs. Gains in PPV were generally at the expense of NPV. This may be an acceptable tradeoff when trying to identify disease cases (i.e., include), which is a particular challenge in clinical research of low prevalence, rare diseases such as NAION. Negative predictive value is a more important concern for identification of healthy controls (i.e., excluding cases), which is less of a challenge for identification of rare disease cases such as NAION due to low prevalence in the general population. There was also variation in the number of cases identified with no LLM model identifying all cases of acute NAION in the cohort. Some models with good performance metrics identified less than half of cases, which could negatively impact power of studies due to reduced sample size. Interestingly, the approaches did not perform uniformly across LLM’s, highlighting that the models, particularly the smaller ones used in this study to facilitate local implementation, are not interchangeable.

The differences in performance of different approaches reveal important insights about the nature of information synthesis for identification of acute NAION cases. Although RAG approaches have demonstrated effectiveness in other clinical information extraction scenarios, they are limited by fragmentation of clinical narratives resulting from vector-based retrieval systems, which disrupts the temporal and contextual relationships essential for accurate medical diagnosis.33 In contrast, agentic approaches considered larger data chunks in a temporal sequence (oldest to newest), which potentially could be leveraged to identify time of onset for acute NAION cases in a future study. Because agentic approaches were developed to simulate human reasoning, their approach may be more relatable, facilitating acceptance and trust among healthcare providers and researchers.34,35

Several important limitations must be acknowledged. This study utilized retrospective data from a single academic medical center, potentially limiting generalizability across different healthcare settings and patient populations. Additional validation should be performed prior to utilization for case identification in a different cohort due to differences in clinical documentation and data ingestion. The focus of this study was identification of acute NAION cases for retrospective research which is particularly relevant for epidemiologic study of risk factors. The results of approaches may not be generalizable to or even relevant to other conditions. For example, there are other conditions with more nuanced ICD coding which may have better case identification performance using structured data alone. The evaluated workflows are designed for clinical researchers/data analysts and operation requires routine Python tooling familiarity to run the pipeline and review outputs, and clinical domain expertise is required to adjudicate cases used for validation.

Future opportunities for investigation should evaluate the generalizability of agentic longitudinal EHR across multiple institutions, different clinical conditions, and diverse patient populations. Future work could also evaluate the accuracy of LLM-based approaches in identifying the timing of acute NAION onset, including the first documentation of symptoms suggestive of acute NAION and the point at which the diagnosis is first established, which is particularly relevant for identification of incident cases and risk factor research. Exploration of hybrid human-machine workflows could provide additional quality assurance mechanisms while preserving the efficiency gains of automated approaches. Evaluation of deployment for research investigations would further advance the practical utility of these approaches.

In conclusion, the demonstrated ability of agentic LLM approaches to achieve meaningful accuracy in tasks involving reviewing entire patient records represents an important advancement in medical artificial intelligence applications. By structurally decomposing tasks into steps that simulate clinician reasoning patterns, these approaches preserved essential temporal context and achieved reliable extraction of diagnostic criteria. The successful implementation using local, privacy-preserving infrastructure further enhances the practical applicability of these approaches in clinical research settings. These findings support the potential role of agentic LLM systems in enabling scalable, consistent, and accurate chart review in clinical research, with implications extending well beyond neuro-ophthalmology to encompass broader applications in medical informatics and clinical decision support.

Manuscript no. XOPS-D-26-00002R2.

Footnotes

Supplemental material available at www.ophthalmologyscience.org.

Disclosure(s):

All authors have completed and submitted the ICMJE disclosures form.

The author(s) have made the following disclosure(s):

H.M.: Grants – NIH, Research to Prevent Blindness; Consulting – Verana Health, Legal firms; Payment or honoraria – American Academy of Neurology, Academic institutions (grand rounds); Leadership or fiduciary role – North American Neuro-ophthalmology Society; Receipt of equipment – MachineMD.

K.Z.L.: Grants – Healthcare Manpower Development Award, National Healthcare Group, Ministry of Health, Singapore.

The other authors have no proprietary or commercial interest in any materials discussed in this article.

Data availability: Raw EHR data contain protected health information and cannot be shared. We will release deidentified aggregate results, prompt templates, and evaluation configurations. Reproducible code will be available on reasonable request.

Supported by NIH P30 026877, and an unrestricted grant from Research to Prevent Blindness. The funders had no role in study design, data collection/analysis, decision to publish, or manuscript preparation.

It is being paid by the Department of Ophthalmology, Stanford University

HUMAN SUBJECTS: Human subjects were included in this study. Institutional review board approval was obtained from the Stanford IRB by expedited review with a waiver of documentation of informed consent. The described research adhered to the tenets of the Declaration of Helsinki.

No animal subjects were included in this study.

Author Contributions.

Conception and design: Nguyen, Li, Moss

Data collection: Nguyen, Li, Chaitanuwong

Analysis and interpretation: Nguyen, Li, Moss

Obtained funding: Moss

Overall responsibility: Nguyen, Li, Chaitanuwong, Moss

Supplementary Data

Table S1
mmc1.pdf (14.3KB, pdf)
Table S2
mmc2.pdf (24.3KB, pdf)
Table S3
mmc3.pdf (63.1KB, pdf)
Table S4
mmc4.pdf (38.1KB, pdf)

References

  • 1.Biousse V., Newman N.J. Ischemic optic neuropathies. N Engl J Med. 2015;372:2428–2436. doi: 10.1056/NEJMra1413352. [DOI] [PubMed] [Google Scholar]
  • 2.Miller N.R., Arnold A.C. Current concepts in the diagnosis, pathogenesis and management of nonarteritic anterior ischaemic optic neuropathy. Eye. 2015;29:65–79. doi: 10.1038/eye.2014.144. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3.Hamedani A.G., Kim D.S., Chaitanuwong P., et al. Validity of administrative coding for nonarteritic ischemic optic neuropathy. J Neuroophthalmol. 2024;44:342–345. doi: 10.1097/WNO.0000000000002163. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Hamedani A.G., De Lott L.B., Deveney T., Moss H.E. Validity of International Classification of Diseases codes for identifying neuro-ophthalmic disease in large data sets: a systematic review. J Neuroophthalmol. 2020;40:514–519. doi: 10.1097/WNO.0000000000000971. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Straub L., Gagne J.J., Maro J.C., et al. Evaluation of use of technologies to facilitate medical chart review. Drug Saf. 2019;42:1071–1080. doi: 10.1007/s40264-019-00838-x. [DOI] [PubMed] [Google Scholar]
  • 6.Cai C.X., Hribar M., Baxter S., et al. Semaglutide and nonarteritic anterior ischemic optic neuropathy. JAMA Ophthalmol. 2025;143:304. doi: 10.1001/jamaophthalmol.2024.6555. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7.Gu B., Shao V., Liao Z., et al. Scalable information extraction from free text electronic health records using large language models. BMC Med Res Methodol. 2025;25:23. doi: 10.1186/s12874-025-02470-z. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Xie Q., Chen Q., Chen A., et al. Medical foundation large language models for comprehensive text analysis and beyond. Npj Digit Med. 2025;8:141. doi: 10.1038/s41746-025-01533-1. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Mustafa A., Naseem U., Rahimi Azghadi M. Large language models vs human for classifying clinical documents. Int J Med Inf. 2025;195 doi: 10.1016/j.ijmedinf.2025.105800. [DOI] [PubMed] [Google Scholar]
  • 10.Li S., Zheng C., Wu J., et al. Verification is all you need: prompting large language models for zero-shot clinical coding. IEEE J Biomed Health Inform. 2025;29:8536–8549. doi: 10.1109/JBHI.2025.3593028. [DOI] [PubMed] [Google Scholar]
  • 11.Yoo Y., Kim S. How to leverage large language models for automatic ICD coding. Comput Biol Med. 2025;189 doi: 10.1016/j.compbiomed.2025.109971. [DOI] [PubMed] [Google Scholar]
  • 12.Shool S., Adimi S., Saboori Amleshi R., et al. A systematic review of large language model (LLM) evaluations in clinical medicine. BMC Med Inform Decis Mak. 2025;25:117. doi: 10.1186/s12911-025-02954-4. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13.Bedi S., Liu Y., Orr-Ewing L., et al. Testing and evaluation of health care applications of large language models: a systematic review. JAMA. 2025;333:319. doi: 10.1001/jama.2024.21700. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14.Gao H., Wang K., Yuan Y., et al. A large language model based pipeline for extracting information from patient complaint and anamnesis in clinical notes for severity assessment. Sci Rep. 2025;15 doi: 10.1038/s41598-025-07649-4. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Adam H., Lin J., Lin J., et al. Clinical information extraction with large language models: a case study on organ procurement. AMIA Annu Symp Proc. 2024;2024:115–123. [PMC free article] [PubMed] [Google Scholar]
  • 16.Munzir S.I., Hier D.B., Oommen C., Carrithers M.D. A large language model outperforms other computational approaches to the high-throughput phenotyping of physician notes. AMIA Annu Symp Proc. 2024;2024:838–846. [PMC free article] [PubMed] [Google Scholar]
  • 17.Bhatnagar A., Scherer R., Samico G.A., et al. Identification of risk factors for glaucoma progression in free-text clinical notes using a local large language model. Transl Vis Sci Technol, 2026;15 doi: 10.1101/2025.09.26.25336746. 2025.09.26.25336746. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Choi I., Long Q., Getzen E. Filling the gaps: leveraging large language models for temporal harmonization of clinical text across multiple medical visits for clinical prediction [internet] medRxiv. 2024 doi: 10.1101/2024.05.06.24306959. [DOI] [Google Scholar]
  • 19.Moura L., Jones D.T., Sheikh I.S., et al. Implications of large language models for quality and efficiency of neurologic care: emerging issues in neurology. Neurology. 2024;102 doi: 10.1212/WNL.0000000000209497. [DOI] [PubMed] [Google Scholar]
  • 20.Park Y.J., Pillai A., Deng J., et al. Assessing the research landscape and clinical utility of large language models: a scoping review. BMC Med Inform Decis Mak. 2024;24:72. doi: 10.1186/s12911-024-02459-6. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Bolton E., Xiong B., Muralidharan V., et al. Assessing the potential of mid-sized language models for clinical QA [Internet] arXiv. 2024 doi: 10.48550/arXiv.2404.15894. 15894v1 15894v1. [DOI] [Google Scholar]
  • 22.Workum J.D., Volkers B.W.S., Van De Sande D., et al. Comparative evaluation and performance of large language models on expert level critical care questions: a benchmark study. Crit Care. 2025;29:72. doi: 10.1186/s13054-025-05302-0. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 23.Gargari O.K., Habibi G. Enhancing medical AI with retrieval-augmented generation: a mini narrative review. Digit Health. 2025;11 doi: 10.1177/20552076251337177. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 24.Liu S., McCoy A.B., Wright A. Improving large language model applications in biomedicine with retrieval-augmented generation: a systematic review, meta-analysis, and clinical development guidelines. J Am Med Inform Assoc. 2025;32:605–615. doi: 10.1093/jamia/ocaf008. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 25.Lee Y.C. Rethinking artificial intelligence in medicine: from tools to agents. Clin Exp Emerg Med. 2025;12:101–103. doi: 10.15441/ceem.25.125. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 26.Wu C., Qiu P., Liu J., Gu H., Li N., Zhang Y., et al. Towards evaluating and building versatile large language models for medicine. Npj Digit Med. 2025;8:58. doi: 10.1038/s41746-024-01390-4. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27.Wang P., Liu Z., Li Y., et al. Fine-tuning open-source large language models to improve their performance on radiation oncology tasks: a feasibility study to investigate their potential clinical applications in radiation oncology. Med Phys. 2025;52 doi: 10.1002/mp.17985. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 28.Mistral-AI. Rastogi A., Jiang A.Q., et al. Magistral [internet] arXiv. 2025 doi: 10.48550/arXiv.2506.10910. [DOI] [Google Scholar]
  • 29.Kamath A., Ferret J., Pathak S., et al. Gemma 3 technical report [internet] arXiv. 2025 doi: 10.48550/arXiv.2503.19786. [DOI] [Google Scholar]
  • 30.Sellergren A., Kazemzadeh S., Jaroensri T., et al. MedGemma technical report [internet] arXiv. 2025 doi: 10.48550/arXiv.2507.05201. [DOI] [Google Scholar]
  • 31.Agarwal S., Ahmad L., Ai J., et al. gpt-oss-120b & gpt-oss-20b Model Card [internet] arXiv. 2025 doi: 10.48550/arXiv.2508.10925. [DOI] [Google Scholar]
  • 32.Sun V.H., Heemelaar J.C., Hadzic I., et al. Detection of immune-related adverse events among hospitalized patients using large language models. J Clin Oncol. 2024;42(suppl 16) [Google Scholar]
  • 33.Luo K., Liu Z., Zhang P., et al. Does RAG really perform bad for long-context processing? [internet] arXiv. 2025 doi: 10.48550/arXiv.2502.11444. [DOI] [Google Scholar]
  • 34.Xu H., Wang Y., Xun Y., et al. Artificial intelligence for clinical reasoning: the reliability challenge and path to evidence-based practice. QJM Mon J Assoc Physicians. 2025;118:802–804. doi: 10.1093/qjmed/hcaf114. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 35.Pierce R.L., Van Biesen W., Van Cauwenberge D., et al. Explainability in medicine in an era of AI-based clinical decision support systems. Front Genet. 2022;13 doi: 10.3389/fgene.2022.903600. [DOI] [PMC free article] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

Table S1
mmc1.pdf (14.3KB, pdf)
Table S2
mmc2.pdf (24.3KB, pdf)
Table S3
mmc3.pdf (63.1KB, pdf)
Table S4
mmc4.pdf (38.1KB, pdf)

Articles from Ophthalmology Science are provided here courtesy of Elsevier

RESOURCES