[PR #6122] [CLOSED] perf: Improve Speed of Document Insertion in Knowledge Bases #37456

Closed
opened 2026-04-25 10:55:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/6122
Author: @RobinBially
Created: 10/11/2024
Status: Closed

Base: devHead: main


📝 Commits (3)

  • e8babe6 refac
  • 0165bff Merge branch 'open-webui:main' into main
  • 57b2e62 reuse vectors when inserting file to collection

📊 Changes

4 files changed (+47 additions, -6 deletions)

View changed files

📝 backend/open_webui/apps/retrieval/main.py (+36 -4)
📝 backend/open_webui/apps/retrieval/vector/dbs/qdrant.py (+7 -1)
📝 backend/open_webui/apps/retrieval/vector/main.py (+2 -0)
📝 backend/open_webui/apps/webui/routers/auths.py (+2 -1)

📄 Description

Description

This pull request optimizes the process of inserting documents into knowledge bases by eliminating redundant embedding operations. Previously, embedding was performed twice: once for the file and again for the collection. Now, the vectors from the file embedding are reused, reducing the overall processing time. This optimization has been implemented for Qdrant at this stage.

Changelog Entry

Changed

  • Optimized document insertion process for knowledge bases
  • Reduced embedding operations from two to one by reusing file vectors
  • Implemented optimization for Qdrant

Performance

  • Improved speed of document insertion in knowledge bases

Additional Information

This change significantly enhances the efficiency of document insertion, particularly for large files or when dealing with a high volume of documents. The optimization is currently limited to Qdrant, but may be extended to other vector databases in future updates.

Checklist

  • Verified that the pull request targets the dev branch
  • Provided a concise description of the changes
  • Added a changelog entry following the Keep a Changelog format
  • Updated relevant documentation (if applicable)
  • No new dependencies added
  • Performed self-review of the code
  • Ensured adherence to the project's coding standards

Testing

  • Written and run tests to validate the changes
  • Verified improved performance with various document sizes and quantities

Additional Notes


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/6122 **Author:** [@RobinBially](https://github.com/RobinBially) **Created:** 10/11/2024 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `main` --- ### 📝 Commits (3) - [`e8babe6`](https://github.com/open-webui/open-webui/commit/e8babe62bc8e466be0367703fd062a981f5c2394) refac - [`0165bff`](https://github.com/open-webui/open-webui/commit/0165bffbb954a2f63010f2ea3bffd40dcc4283dc) Merge branch 'open-webui:main' into main - [`57b2e62`](https://github.com/open-webui/open-webui/commit/57b2e6209fc5b74a9ea3d0da9a7135d854f7cc24) reuse vectors when inserting file to collection ### 📊 Changes **4 files changed** (+47 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/apps/retrieval/main.py` (+36 -4) 📝 `backend/open_webui/apps/retrieval/vector/dbs/qdrant.py` (+7 -1) 📝 `backend/open_webui/apps/retrieval/vector/main.py` (+2 -0) 📝 `backend/open_webui/apps/webui/routers/auths.py` (+2 -1) </details> ### 📄 Description ## Description This pull request optimizes the process of inserting documents into knowledge bases by eliminating redundant embedding operations. Previously, embedding was performed twice: once for the file and again for the collection. Now, the vectors from the file embedding are reused, reducing the overall processing time. This optimization has been implemented for Qdrant at this stage. ## Changelog Entry ### Changed - Optimized document insertion process for knowledge bases - Reduced embedding operations from two to one by reusing file vectors - Implemented optimization for Qdrant ### Performance - Improved speed of document insertion in knowledge bases ## Additional Information This change significantly enhances the efficiency of document insertion, particularly for large files or when dealing with a high volume of documents. The optimization is currently limited to Qdrant, but may be extended to other vector databases in future updates. ## Checklist - [x] Verified that the pull request targets the dev branch - [x] Provided a concise description of the changes - [x] Added a changelog entry following the Keep a Changelog format - [ ] Updated relevant documentation (if applicable) - [x] No new dependencies added - [x] Performed self-review of the code - [x] Ensured adherence to the project's coding standards ## Testing - [x] Written and run tests to validate the changes - [x] Verified improved performance with various document sizes and quantities ## Additional Notes - --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 10:55:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#37456