Skip to main content
QUICK REVIEW

[Paper Review] Developing Retrieval Augmented Generation (RAG) based LLM Systems from PDFs: An Experience Report

Ayub Khan, Md. Toufique Hasan|arXiv (Cornell University)|Oct 21, 2024
Digital Rights Management and SecurityComputer Science5 citations
TL;DR

This experience report documents building RAG systems that use PDF documents as the knowledge base, detailing end-to-end workflow, challenges, and practical solutions across OpenAI and Llama implementations.

ABSTRACT

This paper presents an experience report on the development of Retrieval Augmented Generation (RAG) systems using PDF documents as the primary data source. The RAG architecture combines generative capabilities of Large Language Models (LLMs) with the precision of information retrieval. This approach has the potential to redefine how we interact with and augment both structured and unstructured knowledge in generative models to enhance transparency, accuracy, and contextuality of responses. The paper details the end-to-end pipeline, from data collection, preprocessing, to retrieval indexing and response generation, highlighting technical challenges and practical solutions. We aim to offer insights to researchers and practitioners developing similar systems using two distinct approaches: OpenAI's Assistant API with GPT Series and Llama's open-source models. The practical implications of this research lie in enhancing the reliability of generative AI systems in various sectors where domain-specific knowledge and real-time information retrieval is important. The Python code used in this work is also available at: https://github.com/GPT-Laboratory/RAG-LLM-Development-Guidebook-from-PDFs.

Motivation & Objective

  • Demonstrate an end-to-end RAG pipeline that uses PDFs as the primary knowledge source.
  • Highlight design choices, data preprocessing, and retrieval-augmented generation to improve accuracy and transparency.
  • Compare two RAG implementation pathways: using OpenAI's GPT series via Assistant API and an open-source Llama model.
  • Identify technical challenges in PDF handling and propose practical solutions for reliable deployment.
  • Provide guidance for practitioners on selecting strategies based on data, resources, and security considerations.

Proposed method

  • Describe the RAG architecture and workflow from data collection to final response generation.
  • Detail preprocessing and chunking strategies for PDFs to enable effective retrieval.
  • Explain vector embedding creation and storage in a vector store for fast similarity search.
  • Present two implementation paths: OpenAI Assistant API with GPT series and open-source Llama with customization options.
  • Outline pilot evaluations and workshop feedback to refine retrieval and generation integration.
  • Offer step-by-step setup guidance and code-oriented practices for deploying RAG systems.

Experimental results

Research questions

  • RQ1How can PDFs be effectively processed and chunked to support retrieval-augmented generation?
  • RQ2What are the practical trade-offs between using OpenAI GPT-based RAG versus an open-source Llama-based approach?
  • RQ3What design considerations improve transparency, accuracy, and latency in PDF-driven RAG systems?
  • RQ4What workflow and tooling are most effective for deploying RAG with PDFs in real-world domains?

Key findings

  • PDF-based RAG systems can ground generated responses in current, domain-specific information by retrieving relevant passages from a vector store.
  • Two deployment paths are viable: OpenAI's Assistant API offers ease of use and strong general capabilities, while Llama provides greater customization and control.
  • PDF processing challenges include complex layouts and OCR errors, which require careful preprocessing, chunking, and metadata utilization.
  • A vector store enables fast, semantically-meaningful retrieval that augments the LLM context with precise sources.
  • Workflow decisions, such as data ingestion, embedding creation, and retrieval augmentation, significantly influence accuracy and transparency of outputs.
  • Security and data handling considerations differ between proprietary APIs and open-source deployments, affecting privacy and control.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.