Skip to Content
You are currently on the new version of our website. Access the old version .
  • Proceeding Paper
  • Open Access

10 March 2026

7 Pages

Optimizing Document Interaction Using Large Language Models by Integrating Retrieval-Augmented Generation, Facebook AI Similarity Search, and Human-like Performance Metrics †

,
,
and
Faculty of Computing and Information Technology, Tunku Abdul Rahman University of Management and Technology, Kuala Lumpur 53300, Malaysia
*
Author to whom correspondence should be addressed.
†
Presented at 2025 IEEE International Conference on Computation, Big-Data and Engineering (ICCBE), Penang, Malaysia, 27–29 June 2025.

Abstract

We developed an intelligent conversational system that enhances document interaction using advanced language models and embedding techniques. The system integrates retrieval-augmented generation, Facebook AI similarity search-based retrieval, and cosine similarity for efficient information extraction from Portable Document Format documents. It employs three embedding models, namely All-MiniLM L6 v2, All-MPNet Base v2, and Instructor Large, with three large language models including LLaMA 3.3 70B, Gemma 2-9B IT, and Mixtral 8x7B-32768. System performance is evaluated using ROUGE-1, BERTScore, and a novel human-like performance (HLP) metric, showing improved retrieval accuracy, response coherence, and efficiency for academic and enterprise applications.

1. Introduction

Large language models (LLMs) have emerged as a transformative force in natural language processing (NLP), demonstrating strong capabilities in tasks such as summarization, sentiment analysis, text generation, and question answering (QA) [1]. Models such as generative pre-trained transformer and large language model meta AI (LlaMA) have proven effective in generating coherent, contextually aware responses that closely resemble human communication [2]. As LLMs become increasingly integrated into real-world systems, the demand for applying them to unstructured document understanding, particularly for research article analysis, has grown significantly.
LLMs hold significant potential in document-level QA systems, where users require concise answers to complex queries derived from lengthy, technical texts [3]. However, existing implementations often suffer from limitations such as fixed context windows, token size constraints, and the absence of effective retrieval mechanisms that render them insufficient for handling large or multi-topic documents [4]. To address these challenges, researchers have proposed retrieval-augmented generation (RAG) frameworks, which combine the generative power of LLMs with vector-based retrieval techniques to inject relevant context into the answer generation pipeline [4].
Despite growing adoption of RAG, systematic comparative evaluations of LLMs in document QA tasks are lacking. Most existing studies rely on limited evaluation metrics such as recall-oriented understudy for gisting evaluation (ROUGE), which primarily measures surface-level lexical overlap and fails to capture the semantic relevance or human-likeness of responses [5,6]. Furthermore, there is minimal discussion around model latency or real-time performance, which is critical for practical deployment [7]. These gaps underscore the need for robust benchmarks that incorporate diverse models, retrieval strategies, and holistic evaluation metrics.
To address these gaps, we introduce an intelligent conversational system for extracting insights from academic Portable Document Format (PDF) using a RAG-based architecture. The system integrates recursive text segmentation, FAISS vector indexing, and cosine similarity for precise document chunk retrieval. Three state-of-the-art LLMs, which are LLaMA 3.3 70B, Gemma2-9B IT, and Mixtral 8x7B-32768, are employed to generate responses. Each is then evaluated in combination with three high-performing embedding models, which are all-MiniLM L6 v2, all-mpnet-base v2, and Instructor-Large.
Furthermore, system performance is evaluated using a tri-metric strategy, which includes ROUGE-1 for lexical comparison [8], bidirectional encoder representations from transformers (BERT) score for semantic similarity [9], and a novel HLP index, which assesses response fluency, relevance, and naturalness from a human-centered perspective. In addition, response latency is also measured to determine the system’s real-time usability across varying document sizes [5].
In this study, we evaluate the accuracy among the three LLMs used by utilizing evaluation metrics such as ROUGE-1, BERT Score, and HLP and response latency across model-embedding combinations for real-time deployment scenarios. By combining advanced retrieval techniques with a multi-metric evaluation approach, this article offers one of the first systematic reviews of LLM performance in intelligent document interaction. The findings provide practical insights for deploying document QA systems in academic, enterprise, and educational settings.

2. Methodology

Figure 1 illustrates the system flowchart, which outlines the process of extracting and analyzing content from academic articles to generate accurate responses to user queries. The process begins with the user uploading an academic article in PDF format. If the upload is successful, the text is extracted, cleaned, and divided into smaller chunks. These chunks are processed using a selected embedding model to generate numerical representations (embeddings), which are then stored in a Facebook AI similarity search-based retrieval (FAISS)-managed database for efficient similarity searches. Once this is complete, the system transitions to the query-handling phase. Here, the user inputs a query, which is preprocessed and matched against relevant text chunks retrieved from the database. These chunks are combined into a single context, and a language model is loaded to generate a response using a QA pipeline. The system outputs the user query along with the corresponding response, concluding the process. This workflow is modular, leveraging embedding models, FAISS, and a QA pipeline to enable accurate and efficient information retrieval and response generation.
Figure 1. System process.

2.1. Dataset Description

Six research articles were manually selected from reputable academic databases, including Google Scholar, the Association for Computing Machinery (ACM) Digital Library, and ResearchGate (Table 1, Table 2 and Table 3). The selected articles cover a variety of domains such as mental health, education, biology, physics, technology, and sociology, and are categorized into analytic, experimental, and argumentative/persuasive writing styles. Moreover, each article was converted to text and preprocessed for consistency. A set of three manually curated questions was also formulated for each article, resulting in a total of 18 query-answer pairs for evaluation.
Table 1. Analyzed research articles.
Table 2. Experimental research articles.
Table 3. Argumentative or persuasive research article.

2.2. Dataset Description

Text from each article was segmented into overlapping chunks using LangChain’s RecursiveCharacterTextSplitter (v1.0.0 from LangChain) to preserve the meaning of the text by maintaining the flow between sentences and paragraphs. Each chunk was then converted into a vector using one of three embedding models.
  • all-MiniLM-L6-v2 was chosen for being fast and lightweight while still providing good semantic understanding, which is useful for real-time applications.
  • all-mpnet-base-v2 was selected because it captures word order and context better than older models like BERT, and performs well on question answering tasks.
  • hkunlp/instructor-large was used for its ability to follow instructions and generate task-specific embeddings, which makes it ideal for matching user queries with relevant document content.
These vectors were stored in the FAISS index using cosine similarity. When a user asks a question, the system retrieves the top relevant text chunks based on the question before passing them to the LLM.

2.3. Question Answering with LLMs

The retrieved context is passed to a generative LLM alongside the input question. The selection of LLM models was based on a combination of their architectural strengths, public availability, and relevance to real-world applications:
  • LLaMA 3.3 70B was chosen for its strong performance in understanding complex queries and its large context window of 128,000 tokens, making it ideal for analyzing long research articles.
  • Gemma 2-9B IT offers a good balance between performance and efficiency. It handles reasoning tasks well and uses fewer resources, making it suitable for real-world chatbot use.
  • Mixtral 8x7B-32768 is a Mixture-of-Experts model that runs faster by activating only part of the model during use. It supports up to 32,768 tokens, which helps in processing full-length PDFs effectively.
All models were accessed via HuggingFace Inference Endpoints and OpenLLM interfaces, depending on availability and hardware constraints. They were integrated into a unified retrieval-then-generate pipeline, enabling controlled evaluation across all LLM and embedding model pairings.

2.4. Evaluation Metrics

The system was evaluated using four metrics. Each LLM-embedding pair was tested across all 18 queries, resulting in 135 evaluations:
  • ROUGE-1: Measures the overlap of generated responses with expected answers.
  • BERTScore: A metric for evaluating the quality of text generation based on semantic similarity.
  • HLP: A binary metric (Yes/No) for each response to assess whether the response matches a reasonable human answer.
  • Latency: Response time was recorded in seconds to assess real-time usability.

3. Result and Discussion

Table 4 presents the performance evaluation of various LLM and embedding model combinations using ROUGE-1, BERTScore, HLP, and response time. It highlights the accuracy, semantic relevance, and efficiency of each configuration for document question answering. Table 4 provides a comparative evaluation of nine distinct model configurations formed by pairing three embedding models—all-MiniLM L6 v2, all-mpnet-base v2, and Instructor Large—with three LLMs: LLaMA-3.3-70B, Gemma2-9B IT, and Mixtral 8x7B-32768. The evaluation considers four key metrics: ROUGE-1, BERTScore, HLP, and average response time.
Table 4. Results.
Among the combinations tested, Gemma2-9B IT with all-MiniLM L6 v2 achieved perfect ROUGE-1 and the highest BERTScore within its category (1.000 and 0.443) while also delivering one of the fastest response times (0.53 s), highlighting its strong balance between accuracy and efficiency. The Mixtral 8x7B-32768 with all-mpnet-base v2 pairing reported the highest BERTScore overall (0.480), alongside a strong ROUGE-1 score (0.963), making it well-suited for high-precision retrieval tasks. In terms of HLP, LLaMA-3.3-70B consistently demonstrated top-tier fluency and relevance, particularly when combined with all-mpnet-base v2 (95% HLP). However, this came at the cost of increased latency (up to 1.50 s with all-MiniLM L6 v2). Conversely, Instructor Large embeddings generally resulted in lower latency but showed more variability in HLP and semantic accuracy. Overall, the table underscores the trade-offs between response quality and computational efficiency across different embedding-LLM configurations.

4. Conclusions

We assessed the accuracy of three state-of-the-art LLMs—LLaMA 3.3 70B, Gemma2-9B IT, and Mixtral 8x7B-32768—using ROUGE-1, BERTScore, and the proposed HLP metric and examined their response latency in combination with different embedding models for real-time deployment. The experimental results demonstrate that the Gemma2-9B IT paired with all-MiniLM L6 v2 delivers an optimal balance between accuracy and speed, achieving perfect ROUGE-1 and strong BERTScore performance with low latency. The Mixtral 8x7B-32768 model with all-mpnet-base v2 achieved the highest semantic relevance (BERTScore of 0.4800), showing promise for tasks where semantic precision is critical. Notably, LLaMA 3.3 70B, despite having the highest HLP rating (up to 95%), incurred higher latency, indicating a trade-off between response fluency and efficiency.
HLP as an evaluation metric further enriched the analysis by capturing human-centric qualities such as naturalness and contextual alignment, which are often overlooked by traditional lexical and semantic metrics. This positions HLP as a valuable complement to existing benchmarks in future LLM evaluations. Overall, the findings affirm that embedding model selection significantly influences retrieval precision, while LLM choice directly impacts the quality and naturalness of responses. The results support the deployment of adaptable, high-performing document QA systems across academic, educational, and enterprise domains. Future work will focus on domain-specific tuning, multi-document support, and optimizing real-time performance for broader scalability and robustness.

Author Contributions

Conceptualization, E.H.K.X., Z.W.T., L.H.W. and C.W.T.; methodology, E.H.K.X., Z.W.T., L.H.W. and C.W.T.; software, E.H.K.X., Z.W.T., L.H.W. and C.W.T.; validation, E.H.K.X., Z.W.T., L.H.W. and C.W.T.; formal analysis, E.H.K.X., Z.W.T., L.H.W. and C.W.T.; investigation, E.H.K.X., Z.W.T., L.H.W. and C.W.T.; resources, E.H.K.X., Z.W.T., L.H.W. and C.W.T.; data curation, E.H.K.X.; writing—original draft preparation, E.H.K.X.; writing—review and editing, Z.W.T., L.H.W. and C.W.T.; visualization, E.H.K.X., Z.W.T., L.H.W. and C.W.T.; supervision, C.W.T.; project administration, C.W.T.; funding acquisition, C.W.T. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data supporting this study were obtained entirely from previously published articles and publicly accessible online documents. All sources, including DOIs and URLs where applicable, are fully cited in the References section. No new data were created in this study.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
RAGRetrieval-Augmented Generation
FAISSFacebook AI Similarity Search
HLPHuman-like Performance
LLMLarge Language Model
QAQuestion Answering
NLPNatural Language Processing
ROUGERecall-Oriented Understudy for Gisting Evaluation

References

  1. Ren, M. Advancements and Applications of Large Language Models in Natural Language Processing: A Comprehensive Review. Appl. Comput. Eng. 2024, 97, 55–63. [Google Scholar] [CrossRef] [Scilit]
  2. Minaee, S.; Kalchbrenner, N.; Cambria, E.; Nikzad, N.; Chenaghlu, M.; Gao, J. Large Language Models: A Survey. arXiv 2024. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  3. Kaddour, J.; Harris, J.; Mozes, M.; Bradley, H.; Raileanu, R.; McHardy, R. Challenges and Applications of Large Language Models. arXiv 2023. [Google Scholar] [CrossRef] [Scilit]
  4. Lewis, P.; Perez, E.; Piktus, A.; Petroni, F.; Karpukhin, V.; Goyal, N.; Küttler, H.; Lewis, M.; Yih, W.T.; Rocktäschel, T. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. arXiv 2021. [Google Scholar] [CrossRef] [Scilit]
  5. Yu, H.; Gan, A.; Zhang, K.; Tong, S.; Liu, Q.; Liu, Z. Evaluation of Retrieval-Augmented Generation: A Survey. arXiv 2024. [Google Scholar] [CrossRef] [Scilit]
  6. Li, M.; Zhan, Z.; Yang, H.; Xiao, Y.; Huang, J.; Zhang, R. Benchmarking Retrieval-Augmented Large Language Models in Biomedical NLP: Application, Robustness, and Self-Awareness. arXiv 2024. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  7. Zhang, Z.; Tsiakas, K.; Schneegass, C. Explaining the Wait: How Justifying Chatbot Response Delays Impact User Trust. In Proceedings of the 6th ACM Conference on Conversational User Interfaces, Luxembourg, 8–10 July 2024; Volume 27, pp. 1–16. [Google Scholar] [CrossRef] [Scilit]
  8. Lin, C.-Y. ROUGE: A Package for Automatic Evaluation of Summaries. In Proceedings of the Workshop on Text Summarization Branches Out, Barcelona, Spain, 25–26 July 2004; Available online: https://aclanthology.org/W04-1013.pdf (accessed on 1 February 2025).
  9. Zhang, T.; Kishore, V.; Wu, F.; Weinberger, K.Q.; Artzi, Y. BERTScore: Evaluating Text Generation with BERT. arXiv 2020. [Google Scholar] [CrossRef] [Scilit]
  10. dBraghieri, L.; Levy, R.; Makarin, A. Social Media and Mental Health. Am. Econ. Rev. 2022, 112, 3660–3693. [Google Scholar] [CrossRef] [Scilit]
  11. Hatch, K.E. Determining the Effects of Technology on Children. Senior Honors Projects, University of Rhode Island, Kingston, RI, USA, Article 260. Available online: https://digitalcommons.uri.edu/cgi/viewcontent.cgi?article=1212&context=srhonorsprog (accessed on 1 February 2025).
  12. Khursheed, T.; Ansari, M.; Shahab, D. Studies on the Effect of Caffeine on Growth and Yield Parameters in Helianthus annuus L. Variety Modern. Biol. Med. 2009, 1, 56–60. [Google Scholar] [CrossRef]
  13. Kiviranta, L.; Lindfors, E.; Ronkko, M.-L.; Luukka, E. Outdoor Learning in Early Childhood Education: Exploring Benefits and Challenges. Educ. Res. 2023, 66, 102–119. [Google Scholar] [CrossRef] [Scilit]
  14. Thomai, D. Death Penalty: What Keeps It Alive and Why It Should Be Abolished. Theory and Practice of Human Rights, University of Essex, Colchester, UK, 2019. Available online: https://repository.essex.ac.uk/26917/1/1805630_Dissertation.pdf (accessed on 1 February 2025).
  15. Yunos, A.M.; Omar, G.; Salim, M.A.; Masripan, N.A.; Ahmed Al-Mola, M.H. The Effect of Temperature on the Electrical Conductivity and Microstructure Behaviour of Silver Particles. Int. J. Nanoelectron. Mater. 2020, 13, 431–438. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.