{"id":15061724,"url":"https://github.com/bayesianinstitute/decentralized-rag","last_synced_at":"2026-02-04T08:01:54.392Z","repository":{"id":254615025,"uuid":"834285058","full_name":"bayesianinstitute/Decentralized-RAG","owner":"bayesianinstitute","description":"Decentralized RAG with Blockchain ","archived":false,"fork":false,"pushed_at":"2025-01-06T04:25:51.000Z","size":9253,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-24T08:21:21.645Z","etag":null,"topics":["blockchain","ipfs","llm","rag"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/bayesianinstitute.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-07-26T21:04:03.000Z","updated_at":"2025-03-18T07:19:40.000Z","dependencies_parsed_at":"2024-08-24T19:32:35.230Z","dependency_job_id":"24177b94-cec3-44b7-93cc-411df0358d22","html_url":"https://github.com/bayesianinstitute/Decentralized-RAG","commit_stats":null,"previous_names":["bayesianinstitute/decentralized-rag"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayesianinstitute%2FDecentralized-RAG","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayesianinstitute%2FDecentralized-RAG/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayesianinstitute%2FDecentralized-RAG/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayesianinstitute%2FDecentralized-RAG/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bayesianinstitute","download_url":"https://codeload.github.com/bayesianinstitute/Decentralized-RAG/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248191082,"owners_count":21062419,"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":["blockchain","ipfs","llm","rag"],"created_at":"2024-09-24T23:24:13.700Z","updated_at":"2026-02-04T08:01:49.329Z","avatar_url":"https://github.com/bayesianinstitute.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Decentralized Retrieval-Augmented Generation (DRAG)\n\n![DRAG](./doc/drags.JPG)\nThis repository presents a decentralized extension of Retrieval-Augmented Generation (RAG), addressing privacy, scalability, and security issues of traditional RAG systems using IPFS, MQTT, and blockchain. DRAG enables users to interact with local knowledge bases and contribute to a global, shared database, promoting knowledge democratization and incentivizing participation.\n\n## DRAG Overview\n\nDRAG improves RAG by decentralizing storage, communication, and processing, ensuring:\n\n- **Privacy**: Secure, decentralized data storage with IPFS.\n- **Scalability**: Global knowledge contributions without central authority.\n- **Security**: Blockchain for transparency and safe record-keeping, with rewards for contributors.\n- **Collaborative Learning**: Continuous improvement from distributed nodes.\n\n### Key Technologies:\n- **IPFS** for decentralized storage.\n- **MQTT** for low-latency communication.\n- **Blockchain** for secure record-keeping.\n- **Qdrant** for vector database storage and retrieval.\n\n\n\n## Traditional RAG vs. DRAG\n\nThe main difference between traditional RAG and DRAG is the decentralization. In DRAG, multiple nodes contribute knowledge, while traditional RAG relies on a centralized approach. Below is a visual comparison:\n\n![Traditional RAG](./doc/rag.png)\n*Traditional RAG: Centralized architecture with a single knowledge base.*\n\n![DRAG](./doc/drags.JPG)\n*DRAG: Decentralized architecture with multiple nodes contributing to a global knowledge base.*\n\n## Architecture\n\nThe system consists of two types of nodes:\n\n1. **Data Nodes**: Provide domain-specific knowledge to the global vector database.\n2. **Evaluator Nodes**: Verify contributions and ensure the integrity of the global database.\n\nThe framework incorporates a **blockchain-based reward system** that incentivizes nodes for their contributions, improving both system accuracy and knowledge sharing.\n\n## Setup and Installation\n\n### Clone and Build\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/bayesianinstitute/Decentralized-RAG\n   cd Decentralized-RAG \n   ```\n\n2. Build the package:\n   ```bash\n   python setup.py sdist bdist_wheel\n   pip install .\n   ```\n\n### Running in Docker Container\n\nRun all services:\n```bash\ndocker compose up -d\n```\n\nDownload the model and start the application:\n```bash\nbash run.sh\n```\n\n### Setting up Qdrant (Vector Database)\n\n1. **Download Qdrant Image**:\n   ```bash\n   docker pull qdrant/qdrant\n   ```\n\n2. **Run Qdrant**:\n   ```bash\n   docker run -d -p 6333:6333 -p 6334:6334 \\\n       -v ./qdrant_data:/qdrant/storage \\\n       qdrant/qdrant\n   ```\n   For Windows:\n   ```bash\n   docker run -d --name qdrant_container -p 6333:6333 -p 6334:6334 \\\n       -v C:/path/to/qdrant_data:/qdrant/storage \\\n       qdrant/qdrant:latest\n   ```\n\n### Setting up Dependencies\n\n1. **Ollama**: Install Ollama by following the instructions on [Ollama's website](https://ollama.ai/).\n\n2. **Language Model**: Pull a language model from the Ollama library:\n   ```bash\n   ollama pull llama3:8b\n   ```\n\n3. **Text Embedding Model**:\n   ```bash\n   ollama pull nomic-embed-text:latest\n   ```\n\n4. Install required Python libraries (e.g., `qdrant-client`).\n\n### Running the Application\n\n1. **Configure Node Type**:  \n   Edit `main.py` to specify the node type:\n   - `admin`: Institute Node (manages the global embedding)\n   - `data`: Data Node (contributes specialized knowledge)\n\n2. **Start the Application**:\n   ```bash\n   python main.py --data-dir data --nodetype admin\n   ```\n\n   Replace `data` with the desired data directory. Set `--nodetype` to either `admin` or `data`.\n\n### IPFS Installation\n\nTo set up IPFS for decentralized storage, follow the installation instructions from [IPFS Documentation](https://docs.ipfs.tech/install/command-line/#system-requirements) or use the following commands for Windows:\n\n```bash\nwget https://dist.ipfs.tech/kubo/v0.23.0/kubo_v0.23.0_windows-amd64.zip -Outfile kubo_v0.23.0.zip\nExpand-Archive -Path kubo_v0.23.0.zip -DestinationPath .\\kubo\ncd .\\kubo\n.\\install.bat\n```\n\n## Conclusion\n\nThis framework showcases the potential of decentralized systems in enhancing RAG applications by reducing retrieval errors, preserving privacy, and fostering continuous, collaborative learning. By leveraging blockchain technology, it ensures secure and transparent record-keeping, while rewarding participants for their contributions. For a complete implementation, visit our GitHub repository: [Decentralized RAG GitHub](https://github.com/bayesianinstitute/Decentralized-RAG).\n\n## References\n\n- Ollama Docker Hub: [https://hub.docker.com/r/ollama/ollama](https://hub.docker.com/r/ollama/ollama)\n- IPFS Documentation: [https://docs.ipfs.tech](https://docs.ipfs.tech)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayesianinstitute%2Fdecentralized-rag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbayesianinstitute%2Fdecentralized-rag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayesianinstitute%2Fdecentralized-rag/lists"}