Code Monkey home page Code Monkey logo

llm-rag-powered-qa-app's Introduction

End-to-End LLM-based Scalable RAG-powered QA App

This repo implements a production-ready, scalable Retrieval Augmented Generation (RAG)-powered LLM-based Open Generative (or Extractive) context-aware Question-Answering (QA) App that:

  • Takes as input a new query (or question);
  • Implements vector similarity search within the embedding space by seeking relevant contexts corresponding to the incoming query in the vector database;
  • Passes the relevant contexts as well as the input query to LLM;
  • LLM then produces the answer to the input query while being aware of the relevant contexts related to the requested query.

This project also includes Fine-tuning a 20B parameters Large Language Model (LLM) in a multi-GPU cluster environment by leveraging the distributed training paradigm. Moreover, this repo develops scalable major ML workloads for contexts (load, embed, and index the contexts in the vector database) across multiple workers with different compute resources and serves the LLM App in a highly robust and scalable manner.

The below diagram shows the architectural design of this RAG-powered LLM App:

App Architecture

Requirements

  • Python
  • Streamlit
  • PEFT (for Parameter-Efficient Fine-Tuning)
  • Accelerate
  • Ray (for distributed LLM Fine-Tuning)
  • Datasets
  • Transformers
  • PyTorch
  • Numpy
  • Scikit-Learn
  • Deta (To access Deta Vector Database)
  • LangChain
  • FastAPI (To serve production-ready LLM App)

Data

Squad dataset is used to fine-tune Eleuther AI's GPT-Neo 20B LLM model, which comprises Title, Question, Answer, and Context for each of the 98.2k dataset IDs.

LLM Training and Serving

  • The Fine-Tuning process for GPT-Neo LLM model can be found in finetune.py file.
  • The code to create RAG-powered LLM Agent for QA task can be seen in qa_agent.py file.
  • To build the agent as production-ready API for QA task, it's worth delving deep into serve.py file.
  • To seek prospects of using Streamlit to deploy the LLM app, head to streamlit.py file.
  • All hyperparameters to control fine-tuning of the model are provided in the given config.py file.

App Usage

To learn more about how to use this LLM RAG-powered QA App, consider watching the following video:

RAG-powered.LLM.App.webm

llm-rag-powered-qa-app's People

Contributors

fork123aniket avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

adeelahmad

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.