Rag Based Chatbot for PDF Question Answering: An Intelligent Document Interaction System Using Retrieval-Augmented Generation
DOI:
https://doi.org/10.63282/3050-9246.IJETCSIT-V7I2P131Keywords:
Retrieval-Augmented Generation (RAG), Large Language Models (LLM), FAISS, Vector Embeddings, PDF Question Answering, NLP, Langchain, Flask, Chatbot, Semantic SearchAbstract
With the rapid growth of digital data, vast amounts of information are stored in the form of PDF documents across academic, professional, and research domains. Extracting relevant information from these documents manually is time-consuming, inefficient, and often challenging. Traditional chatbots and search systems fail to provide accurate answers as they lack the ability to understand the context of document-specific content. To overcome these limitations, this paper presents a Retrieval-Augmented Generation (RAG) based chatbot for PDF question answering. The system allows users to upload PDF documents and interact with them using natural language queries. It integrates information retrieval techniques with advanced large language models (LLMs) to generate accurate and context-aware responses. In this approach, the uploaded PDF is processed by extracting text and dividing it into smaller semantic chunks. These chunks are then converted into vector embeddings using OpenAI embedding models and stored in a FAISS (Facebook AI Similarity Search) vector database. When a user submits a query, the system retrieves the most relevant document sections using similarity search and passes them to a language model to generate precise answers. The system is developed using Python, Flask, LangChain, and the OpenAI API. The proposed system significantly improves answer accuracy, reduces irrelevant responses, and enhances user experience. It is particularly useful for students, researchers, and professionals who need quick access to information from large documents. Experimental results demonstrate high retrieval accuracy, fast response time, and reliable performance across diverse document types. Overall, this project demonstrates the effectiveness of combining retrieval mechanisms with generative AI for intelligent document interaction.
Downloads
References
[1] P. Lewis et al., "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks," Advances in Neural Information Processing Systems (NeurIPS), 2020.
[2] A. Vaswani et al., "Attention Is All You Need," Advances in Neural Information Processing Systems (NeurIPS), 2017.
[3] J. Devlin et al., "BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding," NAACL-HLT, 2019.
[4] J. Johnson et al., "Billion-scale Similarity Search with GPUs (FAISS)," IEEE Transactions on Big Data, 2019.
[5] S. Robertson and H. Zaragoza, "The Probabilistic Relevance Framework: BM25 and Beyond," Foundations and Trends in Information Retrieval, 2009.
[6] D. Jurafsky and J. H. Martin, Speech and Language Processing (3rd ed. draft), Stanford University, 2023. Available: https://web.stanford.edu/~jurafsky/slp3/
[7] S. Russell and P. Norvig, Artificial Intelligence: A Modern Approach, 4th ed., Pearson, 2021.
[8] LangChain Documentation, "LangChain: Building applications with LLMs through composability," Available: https://docs.langchain.com
