Vaishnavi, a bright and fun-loving student, excels in Law and Business studies but faces a crisis when her exams are rescheduled, leaving her only three days to prepare notes for seven subjects. She requires a tool that can:
- Process large volumes of textbook content.
- Generate precise answers to her queries.
- Be efficient and cost-effective, overcoming limitations of free GPT tools.
This project is designed to solve Vaishnavi's problem by building a question-answering machine powered by LLMs.
This solution integrates:
- HuggingFace Models: For selecting lightweight and efficient LLMs, in this case, Llama 2.
- Fine-Tuned LLM: Optimized for high precision using the Retrieval-Augmented Generation (RAG) method.
- FastAPI: For building a backend API.
- Socket.IO: For real-time communication between the frontend and backend.
- Next.js: For creating an intuitive and responsive user interface.
- Interactive Question-Answering: Users can ask questions and get precise answers in real-time.
- Persistent Storage: Indexing and embedding using HuggingFace for efficient retrieval.
- Streamlined Workflow: Optimized for students with a time crunch.
- Future Usability: Designed for scalability and adaptability to other subjects and scenarios.
- Libraries:
- Llama Index
- HuggingFace
- Key Components:
- Embedding: HuggingFace's BAAI/bge-base-en-v1.5
- LLM: Llama 2 with RAG method
- Persistent Storage: Embedded documents stored locally for efficient query handling.
- Framework: FastAPI
- Real-Time Communication: Socket.IO
- Framework: Next.js
- Features: Responsive chat interface, real-time updates, user-friendly message display.
- Loads documents, processes embeddings, and initializes the LLM with fine-tuned settings.
- Handles user queries with streaming responses.
- Sets up the backend using FastAPI.
- Establishes a Socket.IO server for real-time communication.
- Implements the chat interface with message handling, scroll synchronization, and Socket.IO integration.
---/confirmed till here
- Clone the repository:
git clone https://github.com/nirmal15mathew/llm_hackathon cd llm_hackathon
- Install dependencies for the frontend:
cd frontend npm install
- Install dependencies for the backend:
cd backend pip install -r requirements.txt
- Start the backend server:
uvicorn main:app --reload
- Start the frontend server:
npm run dev
- Upload textbooks to the
data/
directory. - Start the backend and frontend servers.
- Access the frontend at
http://localhost:3000
. - Use the chat interface to ask questions and receive answers in real-time.
- Google Colab Limitations: GPU and RAM constraints.
- Model Access: Some HuggingFace models require approval for access.
- Fine-Tuning Time: Balancing precision with computational efficiency.
- Expand support for additional subjects and languages.
- Integrate cloud-based storage for scalable document handling.
- Add advanced analytics for tracking study progress.
This project was developed as part of a hackathon challenge to assist students under time constraints. Special thanks to the open-source community and frameworks that made this project possible.
This project is licensed under the MIT License. See the LICENSE
file for details.