A Sliding-Window Batched Framework: Optimizing Retrieval-Augmented Generation (RAG) for Trustworthy AI under the EU AI Act
Abstract
This study introduces Sliding-Window Batched RAG (SWB-RAG), a novel framework that optimizes both efficiency and contextual accuracy in retrieval-augmented text generation for lengthy and complex documents in terms of leveraging Trustworthy AI. Building upon foundational RAG research (Lewis et al., 2020) and sliding-window techniques (Beltagy et al., 2020), we conducted a two-phase comparative evaluation. In Phase One, when processing a 144-page legal document, SWB-RAG achieved statistical equivalence to Classic Contextual RAG (CC-RAG) across all RAGAS quality metrics while reducing runtime by 92.7% and costs by 97.9%. In Phase Two, across 56 diverse documents, totaling 5,965 pages, SWB-RAG significantly outperformed Traditional RAG (T-RAG) in context of recall (p < 0.001) and context precision (p = 0.008). The framework's innovation lies in its three-component architecture: a global document summarization to capture overarching themes, a batch processing to optimize computational efficiency, and a sliding-window context enrichment to preserve local contextual richness. Our results—including a Human-in-the-Loop expert evaluation—position SWB-RAG as a scalable, cost-effective solution for especially legal, technical, and scientific document processing, effectively addressing the fundamental efficiency-quality tradeoff that has limited the practical application of RAG systems for complex documents in resource-constrained environments.
Keywords: Retrieval-Augmented Generation (RAG), Sliding-Window Batched Processing, EU AI Act Compliance, Human-in-the-Loop Evaluation, Trustworthy AI, Systems Engineering
DOI: 10.54941/ahfe1006031
Cite this paper
More from this volume
- Data-Driven Insights into Diabetes-Related Hospital Readmissions in the United States: Trends and Predictors
- A Method of Structured Standard Terminology Based on Decoupling Approach
- Convo-Based Attitude Analysis of Twitter Big Data: A Case Study on Ukraine-Russia War Dataset
- Smart Cities: are they really accessible and truly smart?
- AI Optimization of Resolution Strategy in Utility Billing and Revenue Assurance
- Behavioural Intentions of Natural Farming Farmers to Adopt Digital Platforms for Purchasing Inputs: A Structural Equation Modeling-Based Multi-Group Analysis
- AIToys: A conceptual definition and future research agenda
- FITMag: A Framework for Generating Fashion Journalism Using Multimodal LLMs, Social Media Influence, and Graph RAG
- Challenges and Opportunities in E-commerce Distribution Networks in Johannesburg.
- Revolutionizing Logistics Management with Blockchain Technology
- Interpretable AI-Generated Videos Detection using Deep Learning and Integrated Gradients
- Leveraging LLMs to emulate the design processes of different cognitive styles


AHFE Open Access