Page 67 - Read Online
P. 67
Page 481 Bala et al. Art Int Surg. 2025;5:476-89 https://dx.doi.org/10.20517/ais.2025.44
Figure 1. Overview of the model utilizing instruction tuning and RAG. RAG: Retrieval-Augmented Generation. (GitHub.com, https://
github.com/InduBala-Y/RAG/blob/main/MESH_RAG.drawio.pdf)
the system to return a well-rounded set of informative and non-redundant text trunks. The retrieval process
accepts parameters such as Report ID, Report Date, and a task-specific query (e.g., extracting hernia type or
listing adverse events), and returns the most semantically aligned passages from the vector store. These
retrieved segments are then concatenated with a task-specific prompt template and passed to the generative
model, enabling it to produce structured summaries or adverse event lists grounded in the retrieved
content. As illustrated in Figure 1, this process is integrated into both the structured summarization and
adverse event extraction pipelines.
For the generative backbone, we utilized the LLaMA 2 model (13-billion parameter version) developed by
Meta AI . This open-source model was selected for its strong performance, accessibility, and ability to run
[29]
locally, ensuring that sensitive patient data remain secure. The model weights were acquired through
authorized access from Meta and Hugging Face repositories. To optimize computational efficiency, we
implemented 4-bit quantization using the BitsandBytes library, substantially reducing the computational
load while preserving generation quality.
The entire RAG pipeline - encompassing embedding, retrieval, and generation - was orchestrated using the
LangChain framework, facilitating seamless integration between components. This RAG-enhanced
approach substantially improved the fidelity and interpretability of outputs across both structured
summarization and adverse event extraction tasks, as it provided the model with direct access to relevant
patient-reported context. A detailed overview of the framework is provided in Figure 1.

