LLM -Based Section Identifiers Excel on Open Source but Stumble in Real World Applications (2024)

Abstract: Electronic health records (EHR) even though a boon for healthcare practitioners, are grow- ing convoluted and longer every day. Sifting around these lengthy EHRs is taxing and be- comes a cumbersome part of physician-patient interaction. Several approaches have been pro- posed to help alleviate this prevalent issue ei- ther via summarization or sectioning, however, only a few approaches have truly been helpful in the past. With the rise of automated methods, machine learning (ML) has shown promise in solving the task of identifying relevant sections in EHR. However, most ML methods rely on labeled data which is difficult to get in health- care. Large language models (LLMs) on the other hand, have performed impressive feats in natural language processing (NLP), that too in a zero-shot manner, i.e. without any labeled data. To that end, we propose using LLMs to identify relevant section headers. We find that GPT-4 can effectively solve the task on both zero and few-shot settings as well as segment dramatically better than state-of-the-art meth- ods. Additionally, we also annotate a much harder real world dataset and find that GPT-4 struggles to perform well, alluding to further research and harder benchmarks.

## introduction modern day healthcare systems are increasingly moving towards large scale adoption of maintaining electronic health records (ehr) of patients @xcite . ehrs help healthcare practitioners with relevant information about a patient such as history, medications, etc. however, in recent times this practice has led to very long and convoluted ehrs @xcite . naturally, the need for better information retrieval tools emerged due to the progressively lengthy and unstructured doctor notes. one such need is the accurate identification of sections in an ehr, pertinent to a physician's inquiry. for instance, a question like "what treatments has the patient undergone in the past?" concerning prior treatments administered to a patient necessitates the swift extraction of information from the "treatments" and "past medical history" sections, while excluding sections related to "ancestral medical history". this swift extraction is vital for timely decision-making in patient care. additionally, during critical procedures such as the evaluation of medical necessity for prior authorization requests, it is customary for experienced clinicians to locate vital data within specific sections. an illustrative case entails examining the "physical exam" section to identify particular findings, such as signs of neurological disorders or movementassociated pain, indicating the need for additional diagnostic tests. the timely identification of such information is of utmost importance in ensuring the provision of appropriate care and reducing the risk of potential complications. in general, regions found in ehr would often have a section heading preceding the body of the section, as can be seen in example the aforementioned factors have consequently contributed to the establishment of section identification (si) as a distinct and enduring problem within the academic discourse @xcite , making it an indispensable component of any clinical natural language processing (nlp) pipeline. a si task entails finding regions of text that are semantically related to an aspect of a patient's medical profile. more importantly, it helps to improve pre-existing information retrieval systems by enabling them to be more targeted and specific. lastly, in light of recent findings of the negative impact of note bloat within ehrs on even the most sophisticated systems @xcite , using si to shorten or create from ehr, a sub-ehr specific to a given task would prove to be a worthwhile effort for humans and machines both. because finding sections and hence their corresponding headers involves inherent variability, machine learning (ml) methods have played an important role in this natural language processing @xcite . ml has increasingly been shown to be efficient in finding relevant sections within a document, however, a key drawback of traditional ml methods has been the dependence on labeled data @xcite . reliance on annotated data for training ml models to be able to predict the beginning and end of section headers has stalled the field from fully solving the task. the emergence of large language models (llms) in contemporary research presents a promising avenue to overcome the limitations inherent in traditional machine learning approaches, thereby expanding the scope of their applications. llms have emerged as the de-facto system for nlp in scenarios where data is scarce @xcite . the key distinction between traditional machine learning (ml) models and large language models (llms) lies in their ability to understand tasks in natural language. while traditional ml models require labeled data for training, llms can leverage pre-training on vast amounts of unstructured text data, enabling them to perform tasks with minimal task-specific fine-tuning. this makes ml possible in an unsupervised manner (no need for labeled data) and therefore opens room for applications in domains where annotated data is hard to acquire like healthcare. while llms have been evaluated on a wide array of nlp tasks in healthcare @xcite , they are yet to be evaluated on their effectiveness in segmenting a document into semantically relevant sections. in this work, we address this gap and evaluate the efficacy of our approach on a widely-known datasets in the clinical medical domain. findings show that gpt-4 (openai, 2023) almost solved the section identification problem on the benchmark open-sourced dataset, however, on a private dataset the performance lags. our contributions are threefold, listed as follows: traditionally, si task has been done using a pre-defined dictionary of plausible candidates. pomares-quimbaya et al. (2019) performed a comprehensive survey and found that rule-based methods still dominated the array of methods proposed while ml systems increasingly achieved better coverage when combined in a hybrid manner with rulebased methods. mcknight and srinivasan (2003) later on extracted bag-of-words from medline abstracts and used a support vector machine to train a classifier to categorize sentences into either introduction, method, result, or conclusion, demonstrating promising results. similarly, hirohata et al. allergies allergies: patient recorded as having no known allergies to drugs... history of present illness hpi: 61m w/ incidental l renal mass found during w/u for brachytherapy for low-grade [**last name (stitle) **], now w/ gradually worsening gross hematuria for the past several days. labs imaging pertinent results: [**2160-4-10**] 07:30am blood wbc-12.6* rbc-3.20* hgb-8.2* hct-24.5* mcv-77* mch-25.6* mchc-33.4 rdw-17.1* plt ct-438. hospital course brief hospital course: 61m w/ low-grade [**month/day/year **] awaiting brachytherapy and locallyadvanced l renal mass w/ collecting system invasion, renal vein thrombus, and likely metastases, presented w/gradually worsening gross hematuria. over time and with the inclusion of ml, the field re-framed this problem as one of span-level entity identification i.e. the system would be tasked with predicting whether each token in a sequence belongs to one of the predefined section types using the inside-outside-beginning (iob) tagging system (ramshaw and marcus, 1999). @xcite addresses the task of segmenting clinical records into distinct sections using a two-step approach. first, the section boundaries are identified. then, the sections are passed to the second step, where a classifier is used to label each token as begin, in or out of the span of a section. @xcite proposes several transfer learning models based on clinical contextual embeddings for classifying clinical notes into the major soap sections @xcite . @xcite investigates the effectiveness of continued pre-training in enhancing the transferability of clinical note section classification models. both of the above papers resemble our work, however, they restrict them to soap sections and train specific models to do so. while the techniques devised so far have shown promise, to the best of our knowledge none of the previous works have tried in an unsupervised manner. with the advent of llms @xcite , several works have shown the efficacy of llms in doing unsupervised zero-shot information extraction. the primary method for interacting with generative llms is by the use of natural language prompts. @xcite found a significant performance boost by asking the model to explain its chain of thought before answering the query. further, @xcite showed that additional performance can be gained by passing some examples as part of the prompt, they named it few-shot prompting. wang et al. (2023); bian et al. (2023) ; @xcite have shown the efficacy of prompting the llm to extract biomedical named entities from scientific articles. more recently, @xcite used gpt-4 to de-identify documents in a zero-shot manner. this hints at the immense document understanding capabilities of llms and opens doors to its application to a wide array of previously unresolved tasks such as si. apart from the advancements in the field of ml and si, to evaluate how well si systems perform, a standardization of tasks as well as datasets is required. to that end, @xcite first proposed a si task as part of informatics for integrating biology and the bedside (i2b2) benchmarks. recently, @xcite argued that the previous dataset did not fully cover the nuances in si task and proposed a dataset an order of magnitude larger as well as more comprehensive than one by @xcite . however, the dataset proposed by @xcite is based on a clean source @xcite , which oftentimes is not the case in real-world scenarios. to that end, we also annotated a real-world dataset to evaluate llms on it as well. ## annotation methods in this section, we describe the dataset and the annotation design in our study. as we described before we decided to choose section identification (si), a method to identify sections and sub-sections in ehr documents to split them into smaller text chunks and create some structure in these unstructured data. we designed a manual annotation task to identify these sections and create categorical section types. below we explain the annotation task design, the result, and the challenges. ## experimental setup our task here is to take as input a document and output all the section headers found in it. for our underlying use case, we carried out testing with various llms like gpt-4 8k (openai, 2023), llama-2 7b @xcite , and more recent mistral 7b @xcite prompting strategies foot_1 (as shown in figure 3 ) and contrasted them with a baseline experiment that used keyword search, regex, medspacy library @xcite and the best model reported by @xcite . medspacy is a clinical nlp toolkit built on the foundation of spacy, specifically designed to address the unique challenges of processing and extracting information from clinical text. this enables healthcare professionals to efficiently process and derive valuable insights from unstructured medical narratives. we did not restrict the tokens and used the entire clinical note for medsecid. we extracted the actual section header using the header span mentioned in the medsecid annotation and used it as the ground truth for our task. because of the longer length of real-world data, we used the 32k version of gpt-4 while keeping all the hyper-parameters to default such as the temperature, frequency penalty, and presence penalty to 0 and max tokens to 1000. lastly, in this study, we utilized a privately hosted instance of gpt-4 to ensure the prevention of any potential data leakage. prior to initiating the experiment, we implemented a thorough anonymization procedure to protect the dataset protected health information (phi). this involved substituting all ## results even though gpt-4 was able to perform very well on open source benchmark datasets, it was unable to reach the same level of performance on our internal corpus due to its complexity as shown in ## discussion we performed an in-depth error analysis on the subset of records that gpt-4 was unable to predict correction. our analysis found errors in the med-secid dataset itself, which is one of the reasons gpt-4 did not get a 100% performance. error analysis reveals on the rest of 2.8% missed sections of the gpt-4 finds that 18% of the above stated 2.8% belong to the "findings" section label and 13% belong to the "image-type" category. most of the documents did not have those section headers explicitly mentioned and were hidden as part of the text. even though the precision was 100% in i2b2 2010 dataset, the granularity of the subsections, the surprisingly, we found that gpt-4 was even able to extract sub-sections that were missed in the human annotations in medsecid. this raises the question of whether gpt-4's superior performance on these datasets can be attributed to its prior exposure to them? we found out that medsecid is derived from mimic dataset which forbids being used for llm training, therefore, it is highly unlikely it was used during model training. further analysis of our internal dataset revealed that high variation in the structure of the document is the root cause of such a wide gap between benchmark and our internal datasets. the original version of our data is in the form of images and pdf files. while gpt was resilient to most ocr errors it did contribute to some misspelled sections. we acknowledge the difference in gpt's and the gold standard's approach to section title extraction. while the gold standard highlights literal text, gpt summarizes the content, potentially providing a more concise and informative overview. example gpt output patient information and visit details encompasses multiple headers like chief complaint, history of present illness, and patient information. gpt also extracted irrelevant titles as section headers provider information and signature, page footer, etc. we aim to work on addressing these issues by incorporating context awareness into the title-generation process. the major challenge in performance drop on internal dataset is due to the nature of our data itself. more specifically, there is neither standard structure nor format. the situation exacerbates with the document being an out of an ocr system which introduces numerous morphological errors. consequently, gpt-4's responses on our dataset are more creative and semantically similar which is something an exact match evaluation is unable to measure. as zero-shot was performing extremely well on public corpus and the improvement with other prompting techniques gave only minor improvements, we conducted only zero shot on our internal datasets. apart from conducting experiments on the state of art llms like gpt-4 (openai, 2023), we also wanted to experiment with smaller open-source models that offer flexibility. we experimented with two of the best-performing models llama-2 @xcite and mistral @xcite . however, in reality, both the open source models found it hard to follow the prompts and the outputs are not consistent. the challenges were further exacerbated when the models were required to generate results in a uniform format. sometimes, both llama-2 and mistral would just output the summarization of the text. llama-2 demonstrated a significantly superior performance than mistral on both i2b2 and medsecid. further, each section name is categorised to either its top-header section or a category is selected by human to represent the topic of the section. this annotation is done manually by two annotators where one selected a course-grained category list and other selected a fine-grained one. the one we show in ## conclusion in this work, we evaluated llms capabilities in segmenting a clinical document into individual sections. more specifically, we show that an unsupervised gpt-4 can nearly solve the section identification task. even though gpt-4 has a very high accuracy on the benchmark datasets, however, its performance on a real-world dataset has a significant lag. we further analyze the reasons for such a wide gap and find that the source dataset has cleanly defined section headers which is not the case with its real-world counterpart. to show how diverse the real-world dataset is, we further derived an ontology using another set of annotators that we share with the community at large. to that end, we create a harder benchmark, one that is derived from real-world data generating process. moreover, we conducted an annotation study with five annotators to create the final dataset and found high ambiguity in the identification of headers on the newly introduced benchmark. as a take-away, we suggest that if the source dataset or ehr is clean, then there is no need anymore to train specific supervised models to detect sections as an unsupervised llm can perform that task.