LLM-Based Section Identifiers Excel on Open Source but Stumble in Real World Applications
Saranya Krishnamoorthy Ayush Singh Shabnam Tafreshi

3D Guidance Law for Maximal Coverage and Target Enclosing with Inherent Safety
    Praveen Kumar Ranjan, Abhinav Sinha, Member, IEEE, Yongcan Cao, Senior Member, IEEE
P. K. Ranjan and Y. Cao are with the Unmanned Systems Lab, Department of Electrical and Computer Engineering, The University of Texas at San Antonio, TX- 78249 USA. Emails: praveen.ranjan@my.utsa.edu, yongcan.cao@utsa.edu.A. Sinha is with the GALACxIS Lab, Department of Aerospace Engineering and Engineering Mechanics, University of Cincinnati, OH- 45221 USA. Email: abhinav.sinha@uc.edu.

    
==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================


Electronic health records (EHR) even though a boon for healthcare practitioners, are growing convoluted and longer every day. Sifting around these lengthy EHRs is taxing and becomes a cumbersome part of physician-patient interaction. Several approaches have been proposed to help alleviate this prevalent issue either 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 healthcare. 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 methods. 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 <cit.>. 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 <cit.>. 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 movement-associated 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 Table <ref>. Even though these section types have limited cardinality, however, more often than not, physicians would fail to adhere to standards and use lexical variations generated on the fly. Moreover, practitioners not only will generate lexical variations of sections on the fly but also completely new sections altogether for valid reasons like imaging reports, etc. Apart from these variations, oftentimes there would be no headers at all, even though the information present could ideally be part of a pre-existing section in a document or a new section altogether. While studies like <cit.> utilize the Subjective, Objective, Assessment and Plan heading (SOAP) framework, real-world clinical notes often contain sections beyond these categories. This limitation is further emphasized in <cit.>, warranting further investigation and analysis.

The aforementioned factors have consequently contributed to the establishment of Section Identification (SI) as a distinct and enduring problem within the academic discourse <cit.>, 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 <cit.>, 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 <cit.>. 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 <cit.>. 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 <cit.>. 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 <cit.>, 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 <cit.> almost solved the section identification problem on the benchmark open-sourced dataset, however, on a private dataset the performance lags. Our contributions are three-fold, listed as follows:  



 
     
  * We show that GPT-4 can generate zero-shot headings of records with very high accuracy.
     
  * Contrary to the above, we find that its performance drops on internal real-world datasets.
     
  * An ontology of numerous section headers seen in real world EHR systems is shared which has much higher coverage.
     
    
  
 




§ RELATED WORK

Traditionally, SI task has been done using a pre-defined dictionary of plausible candidates. <cit.> 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 rule-based methods. <cit.> 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, <cit.> achieved very high accuracy by using conditional random fields to label scientific abstracts into Objectives, Methods, Results, and Conclusions.

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 <cit.>. <cit.> 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.
<cit.> proposes several transfer learning models based on clinical contextual embeddings for classifying clinical notes into the major SOAP sections <cit.>.
<cit.> 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 <cit.>, 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. <cit.> found a significant performance boost by asking the model to explain its chain of thought before answering the query. Further, <cit.> showed that additional performance can be gained by passing some examples as part of the prompt, they named it Few-Shot prompting. <cit.> have shown the efficacy of prompting the LLM to extract biomedical named entities from scientific articles. More recently, <cit.> 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, <cit.> first proposed a SI task as part of Informatics for Integrating Biology and the Bedside (i2b2) benchmarks. Recently, <cit.> 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 <cit.>. However, the dataset proposed by <cit.> is based on a clean source <cit.>, 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.



§ DATASETS






 §.§ i2b2 2010
 
In their study, <cit.> meticulously curated a corpus comprising 183 annotated clinical notes extracted from a selection of discharge summaries within the i2b2 2010 <cit.> dataset. This dataset was annotated by an expert and served as a valuable resource for their research. However, owing to constraints imposed by Institutional Review Boards (IRBs), our current access to the i2b2 2010 dataset is limited. As a result, we were only able to procure clinical notes for 96 out of the originally annotated 183 documents.



 §.§ MedSecID

MedSecID <cit.> is a publicly available corpus of 2,002 fully annotated medical notes from the MIMIC-III <cit.> clinical record database. Each note has been manually annotated with section boundaries and section labels (See Table <ref> for an example of a typical clinical note consisting of well-defined sections). The section labels correspond to different types of information that are typically found in clinical notes, such as history of present illness, physical exam findings, and progress notes. 



 §.§ Real-world

In an increasingly digital world, one would be inclined to assume healthcare data also lives digitally. Surprisingly, that is not the case almost 75% of the healthcare dataset still lives in faxes <cit.> (see figure <ref> for a sample handwritten and faxed clinical notes). Whereas all preexisting SI datasets are digitally derived from clean EHR systems, which even though offer us some insight into the performance of state of art, however, fail to paint the full picture. Therefore, we use an internal dataset of prior authorization requests derived from faxed-in images being transcribed to text via an optical character recognition system (OCR). These requests contain EHR of patients in the form of doctors' notes, submitted in both PDF and image formats. These documents lack a standardized structure, with segments and titles that can vary significantly in length. Although it's possible to group these titles into clusters of similar meaning, the language and number of titles differ across documents. Additionally, OCR inaccuracies arise from unclear text, spelling errors, complex table structures, and handwritten content, resulting in highly noisy input for any SI system to process.



§ 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.



 §.§ Annotation Design


We randomly selected 100 records from a pool of one million records we have in our corpus. These records are in two forms, PDF or fax images which doctors submit to insurance companies, and hence, can arrive from any arbitrary format. We refer to these records as documents in the span of this manuscript. These documents have no standard structures and sometimes they contain multiple patients information at the same time. Six annotators with higher education and non-native speakers of English carry the annotation task. Each annotates an equal amount and random selection of these documents.

We used Label Studio[https://labelstud.io/], an open source data labeling platform. PDF or image file of each record is uploaded to label studio and the task was to mark the section and sub-section in each file and manually enter the corresponding text of these sections and sub-sections. To instruct the annotators, we provided written instructions as well as held a video discussion session and explained the task to the annotators. 




 §.§ Annotation Result


We aggregate the sections per document to form the final section and sub-section list. A total of 912 sections and subsections are identified which makes 14 sections and sub-sections on average per document. Then one annotator, different from the ones who have annotated the documents, categorized these sections and sub-sections into more general categories based on the Consolidated Clinical Document Architecture (C-CDA) implementation guide[C-CDA contains a library of CDA templates, incorporating and harmonizing previous efforts from Health Level Seven (HL7), Integrating the Healthcare Enterprise (IHE), and Health Information Technology Standards Panel (HITSP). https://www.hl7.org/ccdasearch/]. In other words, the diverse categories are mapped to a category to unify them. This allows us to calculate IAA and be able to use the text semantic similarity method to find these sections in the unannotated documents.  A total of 464 categories are coded of which 394 of these categories have a frequency of 1 and 70 categories have a frequency of 2 or more. We provide a small sample of the most frequent categories in Table <ref> and Figure <ref>. 

24 documents have been randomly selected and on each of these documents, a second annotator annotated the document. Further, we calculated the Jaccard similarity to report Inter-Annotator Agreement (IAA), The Jaccard similarity is a measure of the similarity between two sets of data. We obtained a Jaccard distance of 0.40, which is a fair agreement and an indication that the annotation task is challenging. The most diverse section and sub-section lists that each normalized into one section name are shown in table <ref>. Notably, the diversity of these two general categories indicates the challenge involved in structuring and identifying these sections in these documents. In some cases, categories such as Order Report or Medication Reconciliation can be both a section and sub-section according to the annotation results. This characteristic does not enforce the decision to select the general category for these types. 










§ 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 <cit.>, LLaMa-2 7B <cit.>, and more recent Mistral 7B <cit.> prompting strategies[CoT A<ref>, One Shot A<ref> and Close Ended A<ref> prompting strategies are elaborated in appendix <ref>.] (as shown in figure <ref>) and contrasted them with a baseline experiment that used keyword search, regex, MedSpacy library <cit.> and the best model reported by <cit.>. 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 personal identifiers, such as names, identification numbers, and ages, with fictitious entities.

Apart from the basic prompts, we also experiment with combining them with Few-Shot <cit.> and CoT Prompting <cit.> where we ask the LLM to think step-by-step along with providing an example of the clinical note and a list of headings. We keep the prompts same across all the datasets. Lastly, the evaluation metric used here is the exact match (EM) accuracy as well as precision (P), recall (R), and F1-score calculated by comparing GPT-4's output to that of ground truth in the Inside-Outside-Beginning (IOB) scheme <cit.> as used in work by <cit.>.
Similar GPT-4 experiments were conducted on i2b2 2010 dataset but as the context length of i2b2 was smaller, in all the experiments we use GPT-4 8K. Lastly, because of cost constraints, we chose the best-performing model on above mentioned benchmarks to be evaluated against our internal real-world dataset.




§ 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 table <ref>. Experiments showed that GPT-4 was able to achieve an accuracy of only 37% in contrast to that of 96% on MedSecId corpus. LLaMa-2 and MedSpacy performed equally well, in that, former achieved higher recall than latter. This can be attributed to the global knowledge encoded in the LLMs, which is not the case with MedSpacy, while on the other hand MedSpacy would be much faster to run with less overhead.
Results in table <ref> and <ref> show that one-shot GPT-4 <cit.> performed the best and achieved a new state of the art on MedSecId outperforming previous models by a significant margin. This unsupervised methodology beats all the supervised models on the MedSecId corpus <cit.>. Similarly, one-shot also had a state-of-the-art performance on i2b2 2010 dataset. On the other hand, LLaMa-2 did not perform as well as GPT-4, but nevertheless had on par performance with regex. Additionally, LLaMa-2 <cit.> performance on i2b2 dataset came very close to that of GPT-4 itself. This disparity in performance of LLaMa-2 as well as its variation in results across the experiments leads to inconclusive results. Lastly, Mistral <cit.> performance was sub-optimal, exhibiting only a marginal improvement than a naive keyword based approach.







§ 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 MedSecId 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 presence of ambiguous language, or the lack of clear markers for section boundaries could be the contributors to the slight dip in recall of the section headers. We leave fixing the issues in the dataset and advanced prompting for future work. 

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 <cit.>, we also wanted to experiment with smaller open-source models that offer flexibility. We experimented with two of the best-performing models LLaMa-2 <cit.> and Mistral <cit.>. 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 table <ref> is the coarse-grained category list, along with the number of sections in each category, frequency, and frequency percentage. 25 categories are created by the annotator to represent the coarse-grained categories. There are some section names that both annotators are unable to assess or select a category. These sections are categorized as UNKNOWN. If we consider that the top nodes in an ontology network, on average each node will have 26 child nodes in this ontology. 



§ 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 takeaway, 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. 



§ FUTURE WORK

After realizing the close-to-perfect performance and poor performance on the internal real world dataset of an unsupervised LLM in this study, we believe currently released datasets do not paint a clear picture of how the techniques proposed so far would perform in real world scenarios. Using our own internal dataset, we would like to fine-tune the LLM to see whether it can improve performance in a way that is comparable to open-source. Lastly, because sharing sensitive patient data is not possible, we plan to work on de-identifying and training an LLM to generate synthetic but realistic datasets which could lead to better real world benchmarks.



§ LIMITATIONS

One of the self-evident limitations of our approach is the reliance on GPT-4 to perform SI task. Using GPT-4 incurs both high overhead costs and significant data leakage risks if not set up properly. Therefore, the technique itself cannot be run in an isolated environment as it depends on an external API. Another drawback common with ML systems is if tomorrow new sections emerge and GPT-4 is not updated, the if will fail to capture the new section types.



§ ETHICS


The datasets used in the study involved sensitive patient data. Therefore, we decided not to disclose the internal data. Additionally, even for the data based on MIMIC <cit.>, we used a privately hosted instance of GPT-4 that sits in a HIPAA compliant environment. Separately, the annotators were provided fully de-identified data, and the identification of the annotators themselves was anonymized during the annotation process. We have released the taxonomy at our github[<https://github.com/inQbator-eviCore/LLM_section_identifiers>] and kindly request the community to report any further advancements to us via email.







§ APPENDIX


Figure <ref> illustrates an example of "One Shot" prompt method. It contains the segmentations and the seed list of heading found in MedSecId. In the end we present the entire patient notes received from the doctors. Figure <ref> shows an example of "CoT" prompt. We observe that in this method the prompt should instruct the LLMs to think rationally and ask them to extract the section headers from the patient notes. Lastly, figure <ref> shows an example of "Close Ended" prompt method. This method restricts the responses to be one of the 50 class labels that is obtained from MedSecId annotation.

Table <ref> demonstrates the top 50 populated section names that we observed in our corpus. The numbers are extracted from the aggregated annotation results. We observe that "Allergies", "Family History", and "Social History" are top 3 populated sections in the corpus. The full list is published in our GitHub which is provided in section <ref>. 

Figure <ref> shows the sections categories. The annotation is done by two annotators. One annotator chooses course-grained categories and the other chooses more fine-grained categories. These categories are selected based on observation of top-header sections in the corpus and human judgment to associate these section names to their topic or category of representations. Our findings show that "Assessment & Plan" is the most populated category with 958 sections and "Return Visit" us the least populated one with only 1 section. The sections are extracted from the aggregated annotation result of our study. Statistics such as number of sections per category, frequency, and frequency percentage is shown in Table <ref>.












