Abstract
Clinical text summarization is essential for extracting value from Electronic Health Records (EHRs), yet Large Language Models (LLMs) often struggle with the verbosity, length, and domain-specific complexity of clinical notes. We introduce ConTextual, a framework that integrates a novel Context-Preserving Token Filtering (CPTF) method with domain-specific Knowledge Graphs (KG). By utilizing internal LLM attention mechanisms to prune redundant tokens and enriching the output with structured medical knowledge via Retrieval-Augmented Generation (RAG), ConTextual achieves superior clinical accuracy and a nearly 4x improvement in processing throughput compared to standard baselines.
Introduction
Electronic Health Records (EHRs) are a critical repository of patient data, but much of this information is trapped in unstructured clinical notes—narratives characterized by jargon, redundancy, and complex medical histories. While LLMs show promise in summarizing these notes, they face three primary challenges in clinical environments:
- Fidelity & Hallucinations: Models may fabricate medical details or omit critical diagnoses.
- Context Constraints: Clinical notes often exceed the context window of standard LLMs, leading to data loss during truncation.
- Computational Cost: The high token count of clinical documentation makes real-time processing slow and expensive.
ConTextual addresses these hurdles through a "compress-then-enrich" strategy that maintains clinical integrity while optimizing for speed.
Methodology
The ConTextual framework consists of three integrated components designed to balance efficiency with medical accuracy.
Context-Preserving Token Filtering (CPTF)
Rather than using simple heuristic filters, CPTF leverages the internal architecture of the LLM. It analyzes attention weights across different layers to identify tokens that are semantically and syntactically significant to the narrative. By calculating importance scores, the system dynamically removes "noise" while preserving the core clinical meaning.
Knowledge Graph (KG) Integration and RAG
To safeguard against information loss during filtering, the system incorporates a domain-specific Knowledge Graph. This KG contains structured relationships between diagnoses, medications, and treatments. During the final generation phase, the system uses Retrieval-Augmented Generation (RAG) to pull relevant facts from the KG based on patient identifiers, ensuring the LLM has access to explicit, structured medical context.
Experimental Setup
The framework was evaluated on two major clinical benchmarks:
- MIMIC-IV-Ext-BHC: Over 270,000 clinical notes paired with "Brief Hospital Course" summaries, averaging 2,200 tokens per note.
- SOAP (Subjective, Objective, Assessment, and Plan): 1,473 patient-doctor conversations annotated for structured clinical summaries.
Key Results
ConTextual consistently outperformed established models such as Longformer and BioBART, as well as larger general-purpose LLMs:
- Accuracy: On the MIMIC-BHC dataset, ConTextual achieved a BERT F1 score of 81.37, surpassing the vanilla LLaMA 3.2 baseline (80.77).
- Lexical Alignment: On the SOAP dataset, BLEU-1 scores improved significantly (11.55 vs. 4.13), indicating better alignment with human-authored summaries.
- Efficiency: The framework demonstrated a nearly 4x speedup, processing 142.87 summaries per second compared to 36.72 for the base model.
- Qualitative Performance: Using an "LLM-as-a-judge" metric, ConTextual scored higher in factual consistency and main idea retention than its competitors.
Conclusion
ConTextual demonstrates that using internal model attention as a pruning tool, paired with structured knowledge safety nets, can significantly improve the feasibility of LLMs in clinical workflows. Future work will focus on dynamic Knowledge Graph construction to ensure the system remains current with evolving medical practices and expanding entity coverage to include rarer conditions.
Summary updated