{"id":19316731,"url":"https://github.com/vubacktracking/bert-faiss-qa-system","last_synced_at":"2025-04-22T17:30:28.765Z","repository":{"id":235083952,"uuid":"784024662","full_name":"VuBacktracking/bert-faiss-qa-system","owner":"VuBacktracking","description":"Q\u0026A System using BERT and Faiss Vector Database","archived":false,"fork":false,"pushed_at":"2024-05-21T08:33:19.000Z","size":921,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T02:01:59.978Z","etag":null,"topics":["bert","distilbert","faiss","faiss-vector-database","qa-system","vector-database"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VuBacktracking.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-09T03:13:31.000Z","updated_at":"2025-03-13T03:48:50.000Z","dependencies_parsed_at":"2024-11-10T01:12:34.110Z","dependency_job_id":"5b8a8846-12f8-42c9-b2fc-9a414f48c0a6","html_url":"https://github.com/VuBacktracking/bert-faiss-qa-system","commit_stats":null,"previous_names":["vubacktracking/bert-faiss-qa-system"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VuBacktracking%2Fbert-faiss-qa-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VuBacktracking%2Fbert-faiss-qa-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VuBacktracking%2Fbert-faiss-qa-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VuBacktracking%2Fbert-faiss-qa-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VuBacktracking","download_url":"https://codeload.github.com/VuBacktracking/bert-faiss-qa-system/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250287337,"owners_count":21405588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bert","distilbert","faiss","faiss-vector-database","qa-system","vector-database"],"created_at":"2024-11-10T01:12:26.536Z","updated_at":"2025-04-22T17:30:28.332Z","avatar_url":"https://github.com/VuBacktracking.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Q\u0026A System using BERT and Faiss Vector Database\n\n---\n\n### Table of Contents\n\n- [Q\\\u0026A System using BERT and Faiss Vector Database](#qa-system-using-bert-and-faiss-vector-database)\n    - [Table of Contents](#table-of-contents)\n  - [Overview](#overview)\n  - [Features](#features)\n  - [Installation](#installation)\n    - [Requirements](#requirements)\n    - [Setup](#setup)\n  - [Usage](#usage)\n    - [Streamlit Web App Interface](#streamlit-web-app-interface)\n  - [How it Works](#how-it-works)\n  - [Demo](#demo)\n    - [Extractive Q\\\u0026A](#extractive-qa)\n    - [Closed Generative Q\\\u0026A](#closed-generative-qa)\n  - [Acknowledgments](#acknowledgments)\n\n---\n\n## Overview\n\nThis project is a Question \u0026 Answer system implemented using DistilBERT for text representation and Faiss (Facebook AI Similarity Search) for efficient similarity search in a vector database. The system is designed to provide accurate and relevant answers to user queries by searching through a large collection of documents.\n\n\u003cp align = \"center\"\u003e\n    \u003cimg src=\"assets/faiss-index.png\" alt=\"workflow\" width=\"70%\"\u003e\n\u003c/p\u003e\n\n## Features\n\n- **DistilBERT-based Text Representation**: Utilizes the DistilBERT model to convert questions and documents into dense vector representations.\n  \n- **Faiss Vector Database**: Stores the vector representations of the documents for fast similarity search.\n\n- **Efficient Retrieval**: Finds the most relevant documents to a given question by performing efficient similarity searches in the Faiss vector database.\n\n---\n\n## Installation\n\n### Requirements\n\n- Python 3.x\n- PyTorch\n- Transformers\n- Faiss\n- Streamlit (for the web-based interface)\n\n### Setup\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/VuBacktracking/bert-faiss-qa-sytem.git\n```\n\n2. Clone the repository:\n\n```bash\npip install -r requirements.txt\n```\n\n3. Train and Download the DistilBERT model:\n\n```bash\npython3 trainer.py\n```\n**Note**: \nYou can check my model in the link: https://huggingface.co/vubacktracking/distilbert-base-uncased-finetuned-squad2\n\n4. Build the Faiss vector database:\n\n```bash\npython3 faiss_index.py\n```\n\u003cp align = \"center\"\u003e\n    \u003cimg src=\"assets/faiss_index_file.png\" alt=\"workflow\" width=\"70%\"\u003e\n\u003c/p\u003e\n\n---\n\n## Usage\n\n### Streamlit Web App Interface\n\n```bash\nstreamlit run app.py\n```\n\n---\n\nOpen your web browser and navigate to `http://localhost:8501/` to use the web-based Q\u0026A system.\n\n## How it Works\n  \n1. **BERT Embeddings**: \n   - The preprocessed text is converted into vector embeddings using the DistilBERT model.\n\n2. **Faiss Indexing**: \n   - The DistilBERT embeddings of the documents are indexed in the Faiss vector database.\n\n3. **Query Processing**: \n   - When a user inputs a question, the question is converted into a DistilBERT embedding.\n   - Faiss is used to find the most similar embeddings (i.e., the most relevant documents) to the question embedding.\n  \n4. **Answer Extraction**: \n   - The relevant documents are ranked, and the most relevant answer passages are extracted and presented to the user.\n\n---\n\n## Demo\n\n### Extractive Q\u0026A\n\u003cp align = \"center\"\u003e\n    \u003cimg src=\"assets/demo2.png\" alt=\"workflow\" width=\"70%\"\u003e\n\u003c/p\u003e\n\n### Closed Generative Q\u0026A\n\u003cp align = \"center\"\u003e\n    \u003cimg src=\"assets/demo1.png\" alt=\"workflow\" width=\"70%\"\u003e\n\u003c/p\u003e\n\n---\n\n## Acknowledgments\n\n- [Hugging Face Transformers](https://github.com/huggingface/transformers)\n- [Facebook AI Similarity Search (Faiss)](https://github.com/facebookresearch/faiss)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvubacktracking%2Fbert-faiss-qa-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvubacktracking%2Fbert-faiss-qa-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvubacktracking%2Fbert-faiss-qa-system/lists"}