Optimizing Retrieval-Augmented Generation: Analysis of Hyperparameter Impact on Performance and Efficiency

Ammar, Adel, Koubaa, Anis, Nacar, Omer, Boulila, Wadii

arXiv.org Artificial Intelligence 

--Large language models achieve high task performance yet often hallucinate or rely on outdated knowledge. We analyse how hyperparameters influence speed and quality in RAG systems, covering Chroma and Faiss vector stores, chunking policies, cross-encoder re-ranking, and temperature, and we evaluate six metrics: faithfulness, answer correctness, answer relevancy, context precision, context recall, and answer similarity. Chroma processes queries 13% faster, whereas Faiss yields higher retrieval precision, revealing a clear speed-accuracy trade-off. Naive fixed-length chunking with small windows and minimal overlap outperforms semantic segmentation while remaining the quickest option. Re-ranking provides modest gains in retrieval quality yet increases runtime by roughly a factor of 5, so its usefulness depends on latency constraints. These results help practitioners balance computational cost and accuracy when tuning RAG systems for transparent, up-to-date responses. Finally, we reevaluate the top configurations with a corrective RAG workflow and show that their advantages persist when the model can iteratively request additional evidence. We obtain a near-perfect context precision (99%), which demonstrates that RAG systems can achieve extremely high retrieval accuracy with the right combination of hyperparameters, with significant implications for applications where retrieval quality directly impacts downstream task performance, such as clinical decision support in healthcare. The emergence of Large Language Models (LLMs) represents a paradigm shift in artificial intelligence, demonstrating unprecedented capabilities in text generation, summarization, translation and complex reasoning. Despite training on vast corpora, LLMs remain prone to hallucinations--plausible yet incorrect outputs--and their static knowledge cutoff renders them unaware of developments beyond their training data. Moreover, the opaque nature of their reasoning hinders verification and accountability in high-stakes domains such as healthcare, robotics, legal analysis, and scientific research [1]- [5]. Retrieval-Augmented Generation (RAG) integrates external knowledge retrieval with generative models to mitigate these issues. First introduced by Lewis et al. [6], RAG systems retrieve semantically relevant document fragments prior to generation, grounding outputs in verifiable sources and enabling continuous updates. This dynamic interface improves factual accuracy, relevance and trustworthiness without sacrificing generative flexibility.

Duplicate Docs Excel Report

Title
None found

Similar Docs  Excel Report  more

TitleSimilaritySource
None found